[R-SIG-Finance] re-indexing data under the zoo package

Arun.stat arun.kumar.saha at gmail.com
Mon Feb 28 18:49:39 CET 2011


Hi Aiden, is this what you wanted?


library(zoo)
dat <- as.matrix(zooreg(matrix(rnorm(18), 6), start=as.Date("2011-01-01"),
frequency=1))
colnames(dat) <- paste("column", 1:3, sep="")
dat
dat1 <- t(apply(dat, 1, function(x) return(x/dat[1,]*100)))
dat1

Thanks,

-- 
View this message in context: http://r.789695.n4.nabble.com/re-indexing-data-under-the-zoo-package-tp3328376p3328397.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list