Guest User

Untitled

a guest
Jan 19th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. x <- xts(matrix(rnorm(500*8),ncol=8),Sys.Date()-500:1)
  2. x.m <- split(x,'months')
  3.  
  4. ff <- function(xts.obj){xts.obj[,c(1:4)]}
  5.  
  6. g <- lapply(x.m, ff)
  7.  
  8. > args(xts:::`[.xts`)
  9. function (x, i, j, drop = FALSE, which.i = FALSE, ...)
  10. NULL
  11.  
  12. lapply(x.m, '[', , c(1:4))
  13. lapply(x.m, '[', j=c(1:4))
  14.  
  15. g <- lapply(x.m, FUN = function(x){x[, c(1:4]}
Add Comment
Please, Sign In to add comment