R: using ddply in a loop over data frame columns

后端 未结 1 705
南旧
南旧 2021-01-26 20:20

I need to calculate and add to a data frame multiple new columns based on the values in each column in a subset of columns in the data frame. These columns all hold time series

相关标签:
1条回答
  • 2021-01-26 20:55

    In your loop, since myxts is not part of the data frame, it is not split up in the ddply statement along with everything else. Change it to:

    mydf$myxts <- xts(mydf[, newcolnames[i]], order.by = mydf$mydate)
    

    I don't know of any way to use dynamically generated names with transform.

    0 讨论(0)
提交回复
热议问题