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
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, wrote:
> I just learned that vectors can't contain vectors, which frankly simply
> confuses m
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 t
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
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 these
5 matches
Mail list logo