Skip to content
Prev 245692 / 398506 Next

Writing a single output file

On Thu, Dec 23, 2010 at 8:07 AM, Amy Milano <milano_amy at yahoo.com> wrote:
In the development version of zoo you can do all this in basically one
read.zoo command producing the required zoo series:

# chron's default date format is the same as in the output*.csv files
library(chron)

# pull in development version of read.zoo
library(zoo)
source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/zoo/R/read.zoo.R?revision=813&root=zoo")

# this does it
z <- read.zoo(Sys.glob("output*.csv"), header = TRUE, FUN = as.chron)

as.data.frame(z) or data.frame(Time = time(z), coredata(z)) can be
used to convert z to a data frame with times as row names or a data
frame with times in column respectively (although you may wish to just
leave it as a zoo object so you can take advantage of zoo's other
facilities too).