Imports a formatted, tab-delimited file to a data frame.
importRDB(file.name = "", date.format = NULL, tz = "",
convert.type = TRUE)
a character string specifying the name of the relational database (RDB) file containing the data to be imported.
a character string specifying the format of all date
columns. Required for columns that contain date and time. The default value,
NULL
, will read any valid date (not date and time) format. The special
formats "none," which suppresses date conversion; and "varies," which can be
used when the date data included time data sometimes and sometimes not.
For the latter special format, the date and time data must be in POSIX format
(YYYY-mm-dd HH:MM) with optional seconds. For dates that are missing time data, the time
will be set to midnight in the specified or local time zone.
the time zone information of the data.
logical TRUE
or FALSE
, convert data according
to the format line? Setting convert.type
to FALSE
forces all data
to be imported as character.
A data frame with one column for each data column in the RDB file.
All of the dates in a date column must have the same format as the first
non-blank date in the column. Any date with a format different from that of
the first non-blank date in the column will be imported as NA
(missing
value). By default, dates are imported as class "Date" using a 4-digit year,
2-digit month, and 2-digit day with the period (.), hyphen (-), slash (/), or
no separator.
If a valid date.format
is supplied, then the data are imported using
as.POSIXct
, and time information can be included in the data. If
date.format
is "none," then conversion of the date information is
suppressed and the data are retained as character strings.
The value for tz
should be a valid "Olson" format consisting typically
of a continent and city. See timezone
for a description of
time zones. For the United States, use these time-zone specifications where
daylight savings time is used:
Eastern | "America/New_York" |
Central | "America/Chicago" |
Mountain | "America/Denver" |
Pacific | "America/Los_Angeles" |
Alaska | "America/Anchorage" |
Hawii | "America/Honolulu" |
Use these time specifications where daylight savings time is not used: #'
Eastern | "America/Jamaica" |
Central | "America/Managua" |
Mountain | "America/Phoenix" |
Pacific | "America/Metlakatla" |
Added from smwrBase.
# NOT RUN {
## This dataset is available in smwrData as a text file
TestDir <- system.file("misc", package="smwrData")
TestFull <- importRDB(file.path(TestDir, "TestFull.rdb"))
# }
Run the code above in your browser using DataLab