How to create a vector of lists in R?

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2010-04-12T19:28:45Z Indexed on 2010/04/12 19:33 UTC
Read the original article Hit count: 421

Filed under:

Hi,

I have a list (tmpList), which looks like this:

$op
[1] "empty"

$termset
$termset$field
[1] "entry"

$termset[[2]]
$termset[[2]]$explode
[1] "Y"

This is a list with a list inside. If I add this list to a vector

theOneVector = c(theOneVector, tmpList)

Now the resulting vector is of the length 2, because the first entry ("op") of the list is separated from the tmpList. Is it possible to append the complete tmpList into this vector?
I already tried it with

theOneVector = c(theOneVector, list(tmpList))

which gives a vector with the length of 1, but it is very cumbersome to access the elements of the list with this extra list around the list. (Too much list in one sentence I think.)

Any help would be appreciated,
Martin

© Stack Overflow or respective owner

Related posts about r