[R-SIG-Finance] Need some help on zoo object

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jun 7 22:00:06 CEST 2011


On Tue, Jun 7, 2011 at 3:45 PM, Bogaso Christofer
<bogaso.christofer at gmail.com> wrote:
> Dear all, I have some problem with zoo object. So it will really be very
> helpful if somebody helps me to fix that. Here I have created a zoo object:
>
>
>
> library(zoo)
>
> MyData <- zooreg(1:20, start = as.Date("2010-02-03"))
>
>
>
> This is vector, so I want to convert it a matrix with number of columns as

Try this:

library(zoo)
z <- zooreg(matrix(1:20, nc = 1), start = as.Date("2010-02-03"))

or

MyData <- zooreg(1:20, start = as.Date("2010-02-03"))
dim(MyData) <- c(length(MyData), 1)


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-SIG-Finance mailing list