splitbyname {rv}R Documentation

Split a vector based on the names of the components

Description

splitbyname splits the given vector based on the names of the components and returns a named list of arrays and vectors.

Usage

  splitbyname(x)

Arguments

x a vector with the name attributes set

Details

The names are supposed to be of the format 'name[indexes]', for example 'alpha[1,1]', 'beta[1]', etc.

A name without brackets is equivalent to a name with '[1]'.

Dimension will not be set in case of vectors.

Note. Will not work for rv objects if rvcompatibility()==1.

Value

A list of arrays and vectors. Missing entries in the arrays and vectors are filled in with NAs.

Author(s)

Jouni Kerman kerman@stat.columbia.edu http://www.stat.columbia.edu/~kerman

Examples

  x <- structure(rvnorm(2), names=c("x[1,1]", "x[3,3]"))
  splitbyname(x) # yields a list containing a 3*3 random matrix

[Package rv version 0.949 Index]