[R] still need read.zoo command help
Gabor Grothendieck
ggrothendieck at gmail.com
Sat Feb 18 05:53:07 CET 2012
On Fri, Feb 17, 2012 at 8:16 PM, Hasan Diwan <hasan.diwan at gmail.com> wrote:
> Henry,
> You're reading a CSV with read.zoo. This is not likely to work. The
> way I'd do this is:
> data <- read.csv('/tmp/Kevin-0-comma-ITPower.txt', header=FALSE)
> z <- zoo(data[,2], order.by=as.POSIXct(data[,1], format='%d/%m/%y
> %H:%M:%S') # or whatever your format actually is...
>
If you wanted to read in the csv data with a first column in the
format shown by the poster, no header and a POSIXct index then it
would be done like this where Lines and fmt are defined in my last
post:
read.zoo(text = Lines, format = fmt, tz = "", sep = ",")
however, note that the poster intends subsequent use of chron, not
POSIXct. Also see R News 4/1 regarding choosing index classes.
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list