Read zoo Series via read.table
read.zoo is a convenience function for reading
"zoo" series from text files.
read.zoo(file, format = "", tz = "", FUN = NULL, ...)
- character giving the name of the file which the data
are to be read from. See
read.tablefor more information.
- date format argument passed to
- time zone argument passed to
- a function for computing the index from the first column of the data. See details.
- further arguments passed to
read.zoo is a convenience function which should make it easier
to read data from a text file and turn it into a
read.zoo reads the data file via
The first column of the resulting data is interpreted to be the index, the
remaining columns the corresponding data. (If the file only has only column
then that is assumed to be the data column and
1, 2, ... are used
for the index.) To assign the appropriate class
to the index,
FUN can be specified and is applied to the first column.
as.Date(as.character(x), format = format) if
as.POSIXct(as.character(x), tz = tz) if
is specified; otherwise it tries to guess between
If the resulting series has an underlying regularity, it is coerced to
- An object of class
## turn *numeric* first column into yearmon index z <- read.zoo("foo.csv", sep = ",", FUN = as.yearmon) ## turn *character* first column into Date index z <- read.zoo("foo.tab", format = "%m/%d/%Y")