Read LSD results file and clean variables names

Share:

Description

This function reads all the data series in a LSD results file (.res).

Usage

1
read.raw.lsd(file, nrows = -1, skip = 0)

Arguments

file

the name of the LSD results 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(). This can be a compressed file (see file) and must include the appropriated extension (usually .res or .res.gz).

nrows

integer: the maximum number of time steps (rows) to read in. Negative and other invalid values are ignored. The default is to read all rows.

skip

integer: the number of time steps (rows) of the results file to skip before beginning to read data. The default is to read from the first time step (t = 1).

Value

Returns a single matrix containing all variables' time series contained in the results file.

Note

The returned matrix may be potentially very wide. For extracting data in a more selective way, see read.single.lsd and read.multi.lsd. To use multiple results files simultaneously, see read.list.lsd and read.3d.lsd. Variable names are never "cleaned", even for single instanced variables.

Author(s)

Marcelo C. Pereira

See Also

read.single.lsd, read.multi.lsd, read.list.lsd, read.3d.lsd, read.4d.lsd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Save current work directory and change to the examples directory
currWD <- getwd()
setwd(system.file("extdata", package = "LSDinterface"))

# reads all instances of all variables
bigTable <- read.raw.lsd("Sim1_1.res")

# See matrix in the data viewer (require package 'utils')
#View(bigTable)

## reads all instances of all variables, skipping the initial 20 time steps
## and keeping up to 50 time steps (from t = 21 up to t = 70)
all21_70 <- read.raw.lsd("Sim1_2.res.gz", skip = 20, nrows = 50)
#View(all21_70)