readSeries | R Documentation |
Reads a file in table format and creates a "timeSeries"
object
from it. The first column of the table must hold the timestamps.
readSeries(file, header = TRUE, sep = ";", zone = "",
FinCenter = "", format, ...)
file |
the filename of a spreadsheet dataset from which to import the data records. |
header |
a logical value indicating whether the file contains the names of the variables as its first line. If missing, the value is determined from the file format: 'header' is set to 'TRUE' if and only if the first row contains one fewer fields than the number of columns. |
sep |
the field seperator used in the spreadsheet file to separate
columns, by default |
zone |
the time zone or financial center where the data were recorded. By
default |
FinCenter |
a character with the the location of the financial center named as "continent/city". |
format |
a character string with the format in POSIX notation specifying the timestamp format. The format has not to be specified if the first column in the file has the timestamp format specifier, e.g. "%Y-%m-%d" for the short ISO 8601 format. |
... |
Additional arguments passed to |
The file is imported with read.table
. Note the different
default for argument "sep"
.
The first column of the table must hold the timestamps. Format of the
timestamps can be either specified in the header of the first column
or by the format
argument.
an object of class "timeSeries"
as.timeSeries
,
timeSeries
,
dummyMonthlySeries
,
dummyDailySeries
## full path to an example file
fn <- system.file("extdata/msft.csv", package = "timeSeries")
## first few lines of the file
readLines(fn, n = 5)
## import the file
msft <- readSeries(fn)
head(msft)
## is msft the same as the data object MSFT?
all.equal(msft, MSFT)
## ... almost, except for slot 'documentation'
c(msft@documentation, MSFT@documentation)
## actually, all.equal() says 'attribute', not slot. this is ok too:
c(attr(MSFT, "documentation"), attr(msft, "documentation"))
## make 'documentation' equal, here "", and compare again:
msft@documentation <- ""
all.equal(msft, MSFT) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.