R: Read LSD results file and clean variables names
read.raw.lsd
R Documentation
Read LSD results file and clean variables names
Description
This function reads all the data series in a LSD results file (.res).
Usage
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.
# 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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(LSDinterface)
Loading required package: abind
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LSDinterface/read.raw.lsd.Rd_%03d_medium.png", width=480, height=480)
> ### Name: read.raw.lsd
> ### Title: Read LSD results file and clean variables names
> ### Aliases: read.raw.lsd
> ### Keywords: ~kwd1 ~kwd2
>
> ### ** Examples
>
> # 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)
>
>
>
>
>
> dev.off()
null device
1
>