loadActions: Load a tsv file (repository actions).

Description Usage Arguments Value Errors Examples

Description

Essentially this just reads any tab-separated value (tsv) file with headers into a data frame. The file must be formatted correctly to read in, but no other content is checked - that is the role of validateActions().

Usage

1

Arguments

file

The file to load.

Must be a tab-separated file with headers. Headers may be transformed by replacing spaces, etc. with . to allow them to be R variables. Blank lines and lines beginning with # are ignored. Any string containing a literal tab must be escaped inside "double quotes". Use NA for missing values.

Value

Returns a data frame corresponding to the file read.

Errors

The following errors can occur:

No such file to load: "fileName" The given file name can not be found. Try an absolute path or check permissions.
Reading file "fileName" failed with the following error: There was an error reported by read.delim while reading and parsing the specified tsv file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Create a temporary file to read in.
file.tsv <- tempfile()
file.create(file.tsv)
content <- c("col_a\tcol_b\tcol_c", "one\t1\tTRUE",
             "two\t2\tFALSE", "# COMMENT")
writeLines( content, file.tsv )

# Read in a tsv file
if (file.exists(file.tsv)) {
   df <- loadActions( file.tsv )
}
df

# Cleanup.
file.remove(file.tsv)

jefferys/DataRepo documentation built on May 19, 2019, 3:58 a.m.