Re: [R] vector of Vectors

2009-09-09 Thread Giovanni Petris
The code below seems to contradict your claim that vectors cannot contain vectors. zz - vector(mode = list, length = 3) zz [[1]] NULL [[2]] NULL [[3]] NULL Best, Giovanni Date: Tue, 08 Sep 2009 23:00:54 -0500 (CDT) From: sclar...@illinois.edu Sender: r-help-boun...@r-project.org

[R] vector of Vectors

2009-09-08 Thread sclarke3
I just learned that vectors can't contain vectors, which frankly simply confuses me (can you imagine arrays or lists in any other language not being able to contain arrays or lists?). At any rate, I need to create a data structure (size to be determined at runtime) which I will instantiate and

Re: [R] vector of Vectors

2009-09-08 Thread Schalk Heunis
You want to use list: a = list() a[[1]] = c(1,2,3) a[[2]] = c(1,2,3) Note the [[..]] operator - check the An Introduction to R manual for more details Schalk Heunis On Wed, Sep 9, 2009 at 6:00 AM, sclar...@illinois.edu wrote: I just learned that vectors can't contain vectors, which frankly

[R] Vector of Vectors

2009-04-01 Thread Shawn Garbett
I have a matrix of data. I need to scan the matrix and find every sequence from maxima to maxima across a row. I can write a loop to do this easily. Problem is, I can't figure out how to store the results. Each result is a vector of widely varying lengths. Ideally I'd like a vector of

Re: [R] Vector of Vectors

2009-04-01 Thread jim holtman
This may help in understanding how to access the list: notice that I am using numeric indices and using the '[[' operator # generate a list with a varying number of values myList - list() # initialize for (i in 1:10) myList[[i]] - seq(i) myList [[1]] [1] 1 [[2]] [1] 1 2 [[3]] [1] 1 2 3