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
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:
myxts
ddply
mydf$myxts <- xts(mydf[, newcolnames[i]], order.by = mydf$mydate)
I don't know of any way to use dynamically generated names with transform.
transform