unlister {rube}R Documentation

A convenience function to facilitate use of ragged arrays for WinBUGS.

Description

A named list that contains an element named "unlist" is altered by applying unlist to elements listed in the "unlist" vector (possibly renaming them).

Usage

unlister(data)

Arguments

data

A named list (of data).

Details

If one of the elements of "data" is a string vector named "unlist", then the strings are ta

Value

A new named vector with no "unlist" element and with designated elements unlisted.

Author(s)

Howard J. Seltman <hseltman@stat.cmu.edu>

References

http://www.stat.cmu.edu/~hseltman/rube

See Also

rube

Examples

## This example returns a list of three vector elements: age, id, and female
## where age a vector matched to id.  Note that "ages" is originally a ragged
## list, that its name is changed, and that the result does not have an "unlist"
## element.
lens <- sample(5:7, 10, rep=TRUE)
temp <- list(ages=lapply(lens, function(x) sample(20:70,x,rep=TRUE)),
             id=rep(1:10, each=lens),
             female=rbinom(10,1,0.5),
             unlist=list(age="ages"))
unlister(temp)

[Package rube version 0.3-11 Index]