Last data update: 2014.03.03

R: Select a subset of a LSD results matrix (by column/variable...
select.colnames.lsdR Documentation

Select a subset of a LSD results matrix (by column/variable names)

Description

This function select a subset of a LSD results matrix (as produced by read.raw.lsd) by the column (variable) names, considering only the name part of the column labels.

Usage

select.colnames.lsd(dataSet, col.names, instance = 0)

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.

col.names

a vector of optional names for the variables. The default is to read all variables. The names must to be in R format.

instance

integer: the instance of the variable to be read, for variables that exist in more than one object. This number is based on the position (column) of the variable in the results file. The default (0) is to read all instances.

Value

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

Note

The variable/column names must be valid R column names (e.g., names do not start with a underscore). Use make.names if required.

Author(s)

Marcelo C. Pereira

See Also

select.colattrs.lsd, make.names

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)

# extract all instances of a set of variables named '_A1p' and '_growth1'
abTable <- select.colnames.lsd(bigTable, make.names(c("_A1p", "_growth1")))
#View(abTable)

# Restore working directory
setwd(currWD)

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/select.colnames.lsd.Rd_%03d_medium.png", width=480, height=480)
> ### Name: select.colnames.lsd
> ### Title: Select a subset of a LSD results matrix (by column/variable
> ###   names)
> ### Aliases: select.colnames.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)
> 
> # extract all instances of a set of variables named '_A1p' and '_growth1'
> abTable <- select.colnames.lsd(bigTable, make.names(c("_A1p", "_growth1")))
> #View(abTable)
> 
> # Restore working directory
> setwd(currWD)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>