Read LSD results file and clean variables names
This function reads all the data series in a LSD results file (.res).
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).
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.
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).
Returns a single matrix containing all variables' time series contained in the results file.
The returned matrix may be potentially very wide.
For extracting data in a more selective way, see
read.multi.lsd. To use multiple results files simultaneously, see
Variable names are never "cleaned", even for single instanced variables.
Marcelo C. Pereira
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)