What is the most direct way to calculate object returns (nxm) xts?
When I pass the (nxm) xts mxts mxts to the quantmod dailyReturn function, the return value is a (nx 1) vector representing the return of the first column. I am looking for a way to create an (nxm) xts object containing the corresponding return vector for each mxts column.
I tried to work with some of the applicable functions, such as
lapply(mxts,dailyReturn)
but the return values ββalways had the wrong type and lost their mark ( dailyReturn changes the value of the vector colnames to "daily.returns").
Is there a simple, non-hacker way to achieve this? Perhaps I am using the wrong function for this problem?
source share