Why apply() returns a transposed xts matrix?
I want to run a function on all periods of an xts matrix. apply() is very fast but the returned matrix has transposed dimensions compared to the original object: > dim(myxts) [1] 7429 48 > myxts.2 = apply(myxts, 1 , function(x) { return(x) }) > dim(myxts.2) [1] 48 7429 > str(myxts) An 'xts' object from 2012-01-03 09:30:00 to 2012-01-30 16:00:00 containing: Data: num [1:7429, 1:48] 4092500 4098500 4091500 4090300 4095200 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr [1:48] "Open" "High" "Low" "Close" ... Indexed by objects of class: [POSIXlt,POSIXt] TZ: xts Attributes: NULL > str