Read time series from Comma Separated Values (.csv) file
Reads tis
(Time Indexed Series) from a csv file,
returning the series in a list, and optionally storing them in an environment.
tisFromCsv(csvFile, dateCol = "date", dateFormat = "%Y%m%d", tz = "", tif = NULL, defaultTif = "business", save = F, envir = parent.frame(), naNumber = NULL, chopNAs = TRUE, tolerance = sqrt(.Machine$double.eps), ...)
csvFile |
A file name, connection, or URL acceptable to
|
dateCol |
name of the column holding dates. This column must be present in the file. |
dateFormat |
format of the dates in |
tz |
the time zone to be used by |
tif |
time index frequency of the data. If this is |
defaultTif |
If the frequency can't be inferred from the dates in
the |
save |
If true, save the individual series in the enviroment
given by the |
envir |
if |
naNumber |
if non- |
chopNAs |
if |
tolerance |
Used to determine whether or not numbers in the file
are close enough to |
... |
Additional arguments passed along to the underlying
|
File Requirements: The csv file must have column names
across the top, and everything but the first row should be numeric.
There must be as many column names (enclosed in quotes) as there are
columns, and the column named by dateCol
must have dates in the
format indicated by dateFormat
. The dateCol
column must be present.
Missing (NA) values: Missing and NA values are the same thing.
The underlying read.csv
has "," as its default separator and
"NA" as its default na.string, so the rows
20051231,,13,,42,NA, 20060131,NA,14,,43,,NA
indicate NA
values for both the Dec 2005 and Jan 2006
observations of the first, third, fifth and sixth series.
The values in the file are read into a single large tis
series,
with a tif
(Time Index Frequency) inferred from the first six
dates in the ymd column. The first date is converted to a ti
(Time Index) of that frequency and becomes the start
of the
series. If chopNAs
is TRUE
, each individual column is
then windowed via naWindow
to strip off leading and trailing
NA
values, and the resulting series are put into a list with
names given by lower-casing the column names from the csv file. If
save
is TRUE
, the series are also stored in envir
using those same names.
A list of tis
time series, one per column of the csv file.
The list is returned invisibly if save
is TRUE
.
ti
, tis
, read.csv
,
read.table
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.