read.toa5: Read TOA5 file

Description Usage Arguments Details Value Examples

View source: R/read.toa5.R

Description

This function reads CSV-alike TOA5 file. It assumes that TIMESTAMP column and those ending with _TMx and _TMn contain time stamps in "YYYY-MM-DD HH:MM:SS" format.

Usage

1
read.toa5(file, fileEncoding = "")

Arguments

file

the name of the file which the data are to be read from. If it does not contain an absolute path, the file name is relative to the current working directory, getwd(). Tilde-expansion is performed where supported. This can be a compressed file (see file).

Alternatively, file can be a readable text-mode connection (which will be opened for reading if necessary, and if so closed (and hence destroyed) at the end of the function call). (If stdin() is used, the prompts for lines may be somewhat confusing. Terminate input with a blank line or an EOF signal, Ctrl-D on Unix and Ctrl-Z on Windows. Any pushback on stdin() will be cleared before return.)

file can also be a complete URL. (For the supported URL schemes, see the 'URLs' section of the help for url.)

fileEncoding

character string: if non-empty declares the encoding used on a file (not a connection) so the character data can be re-encoded. See read.table for more details.

Details

It relies heavily on as.POSIXct for time stamp recognition as used internally by read.table. Therefore it is important to make sure correct time zone is set so you won't get unexpected conversions. One approach is to use Sys.setenv(TZ='GMT') in the code. Use something like this if you chose to stick to local time zone but decided to neglect DST switch.

No column name sanitation is performed. As a result, column names are likely not syntactically valid if arrays were used in CR Basic. To reference such columns, use backquote marks, e.g., obj@data$`Air(1)`.

"NAN" is treated as NA.

Value

an S4 class csdf

Examples

1
2
3
Sys.setenv(TZ='GMT')
fpath <- system.file("extdata", "Station_Daily.dat", package="csdf")
obj <- read.toa5(fpath)

mlt/csdf documentation built on May 23, 2019, 4:06 a.m.

Related to read.toa5 in mlt/csdf...