Select a subset of a LSD results matrix (by variable attributes)

Share:

Description

This function select a subset of a LSD results matrix (as produced by read.raw.lsd) by the variable attributes, considering the LSD object position and the time span.

Usage

1
2
select.colattrs.lsd(dataSet, info, col.names = NA, posit = NULL,
                    init.value = NA, init.time = NA, end.time = NA)

Arguments

dataSet

matrix produced by the invocation of read.raw.lsd, read.single.lsd, read.multi.lsd or read.list.lsd (a single matrix a time) functions.

info

data frame produced by info.details.lsd for the same results file from where 'dataSet' was extracted.

col.names

a vector of optional names for the variables to select from. The default is to select from all variables.

posit

a string, a vector of strings or an integer vector describing the LSD object position of the variable(s) to select. If a string or an integer vector, it should define the position of a SINGLE LSD object. If a vector of strings, each element of the vector should define a different LSD object, so the returning matrix will contain variables from more than one object.

init.value

initial value attributed to the variable(s) to select.

init.time

initial time attributed to the variable(s) to select.

end.time

end time attributed to the variable(s) to select.

Details

Selection restriction parameters can be provided as needed; when not specified, each selection dimension include all available cases.

Value

Returns a single matrix containing the selected variables' time series contained in the original data set.

Note

If only variable names selection is needed, select.colnames.lsd is more efficient because information pre-processing (info.details.lsd) is not required.

Author(s)

Marcelo C. Pereira

See Also

info.details.lsd, select.colnames.lsd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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")

# build the info table
info <- info.details.lsd("Sim1_1.res")

# read some instances of a set of variables named '_A1p' and '_growth1'
abFirst2 <- select.colattrs.lsd(bigTable, info, c("_A1p", "_growth1"), posit = c("1_2", "1_5"))

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

# reads instances of variable '_A1p' that start at time step t = 1
a50 <- select.colattrs.lsd(bigTable, info, make.names("_A1p"), init.time = 1)
#View(a50)

# Restore working directory
setwd(currWD)