If I understand what you are looking to do, this might be the most efficient:
y < - apply(x,1,function(y,ns) procState(y,ns), colnames(x))
y <- as.xts(do.call(rbind, y))
merge(x, y)
But you might benefit from looking at zoo::rollapplyr() rather than
apply -- I think the result will be an xts (or
Hi,
I have an xts starting with a number of columns (currency pairs see below),
then I add new ones which are derived from existing ones (like adding the
moving average of a column) by merging the new columns one by one. These
get the name of the column they are calculated from concatenated with "
2 matches
Mail list logo