[R] still need read.zoo command help

Gabor Grothendieck ggrothendieck at gmail.com
Sat Feb 18 05:27:29 CET 2012


On Fri, Feb 17, 2012 at 7:54 PM, Henry <hccoles at lbl.gov> wrote:
> The problem now is it looks like my read.zoo isn't working.
> Sorry for sort of double posting.
> Someone please assist if you have time with my read.zoo command line.
> my data is as just below this line, a time stamp and a real number with a
> comma sep.
>
> 10/11/2011 23:00:06,432.12
>
>
> z=read.zoo("Kevin-0-comma-ITPower.txt",
>                       format="%m/%d/%Y %H:%M:%S",
>                        tz="",
>                        FUN=NULL,
>                        regular=FALSE,
>                        header=FALSE,
>                        sep=",",
>                        index.column=1)
>
> library(zoo)
> library(chron)

The read.zoo statement should come AFTER the library statements, not
before, and the read.zoo should be specified like this where fmt was
also defined in my response to your prior post:

Lines <- "10/11/2011 23:00:06,432.12
10/11/2011 23:02:09,432.42
10/11/2011 23:05:00,432.42"

library(zoo)
library(chron)
fmt <- "%m/%d/%Y %H:%M:%S"
z <- read.zoo(text = Lines, FUN = as.chron, format = fmt, sep = ",")

Also regarding the comment by the other poster, read.zoo reads csv data fine.

Be sure you have read and assimilated ?read.zoo and also
vignette("zoo-read") which is a document entirely devoted to read.zoo
examples.

-- 
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