Learn R Programming

splusTimeDate (version 2.5.0-137)

groupVecColumn: groupVec Class - Data Access

Description

Accesses the columns of a groupVec object.

Usage

groupVecColumn(object, col.name)

Arguments

object
the object to access.
col.name
the name of columns to access.

Value

returns the data in the given columns.
  • If only one column is supplied, the result is the column
  • If more than one name is supplied, the result is a list of columns.

Details

The function finds the given column by comparing col.name to the names slot of object, and then extracts the corresponding vectors from the list in the columns slot of object.

You can use this function on the left side of an assignment to replace the given columns with new values.

  • If you replace one column, supply the value as a vector.
  • If you replace multiple columns, supply the values in a list.

The new data is coerced to the columns class using as before the replacement, and the column lengths are checked.

See Also

groupVecData, groupVecNames, groupVecClasses, groupVec class.

Examples

Run this code
obj <- new("groupVec") 
groupVecNames(obj) <- "colname1" 
groupVecColumn(obj, "colname1") <- c(1, 2, 3) 
groupVecColumn(obj, "colname1") 
#[1] 1 2 3

Run the code above in your browser using DataLab