selectVariables {DASplusR}R Documentation

DASData - Select Variables

Description

The function `{em selectVariables/}' writes the attribute `{em selectedVariables/}' to a data set of class `{em DASData/}'.

The function `{em deselectVariables/}' removes the entries of the attribute `{em selectedVariables/}' of the data set.

Usage

selectVariables(dat, datname, vars)
deselectVariables()

Arguments

dat a data object of class '{em data.frame/}' and '{em DASData/}', which attribute '{em selectedVariables}' will be altered.
datname name of data object
vars a vector of integers, specifying the numeric variables which names will be written to the attribute '{em selectedVariables/}', or a vector of variable names, e.g. column names as given in colnames(dat). Specifying vars=c(0,...) causes the reset of the attribute to an empty list (list()), where it does not matter what follows 0. (Same as deselectVariables().

Details

The function adds or alters an attribute named '{em selectedVariables/}' to the data set '{em dat/}'. Certain functions will use this specification of a restricted data set.

If you want to select all variables you can either use the button 'All Variables' under the task bar button 'Select' or use the function call 'selectVariables(dat,datname,Numeric())'.

The order of selection may be crucial and is kept in memory.

The function 'deselectVariables()' deletes all entries of the attribute 'selectedVariables'.

Value

The function returns TRUE or FALSE reguarding the success of the workflow. The new data object is copied to the working environment and is visible there.

Note

There are no missing values allowed.

Author(s)

Stefan Schnabl, stefan.schnabl@gmail.com, Katharina Fabi, kathi_fabi@yahoo.de, Barbara Lugschitz, barbara_lugschitz@gmx.at

See Also

'makeDASData', 'attributes', 'attr'

Examples

## example data object
dat <- KOLA95_C2MM

## select variables by integer
selectVariables(dat,"dat",c(1,3,4))

## select variables by name
selectVariables(dat,"dat",c("Ag","As","B"))

## select all variables
selectVariables(dat,"dat",Numeric())

## deselect all variables
deselectVariables()

[Package DASplusR version 0.0-2 Index]