Initializing like this is generally recommended only when the object
sizes get very big. Otherwise it's ok to grow your object as you go
(i.e., append to it on each iteration).
When I want to initialize a list, I do this:
array <- list()
length(array) <- n
## then,
for (i in 1:n) {
On Jul 5, 2009, at 2:43 PM, Martin Morgan wrote:
Hi ZRL,
zrl wrote:
Dear list,
I have a question regarding how to allocate or initialize the
proper type of
the arrays or lists.
I have a for loop, each iteration, I want it to assign a subset of
a data
frame to an element of an array or
Hi ZRL,
zrl wrote:
> Dear list,
>
> I have a question regarding how to allocate or initialize the proper type of
> the arrays or lists.
>
> I have a for loop, each iteration, I want it to assign a subset of a data
> frame to an element of an array or list.
> However, I am wondering how I should
Try
mylist <- NULL
and then just assign the subsets to each element of the list
mylist[[1]] <- data1[,1]
as an example
--- On Sun, 7/5/09, zrl wrote:
> From: zrl
> Subject: [R] allocation/initialization of arrays/lists
> To: r-h...@stat.math.ethz.ch
> Received: Sunday, July 5, 2009, 1:58 P
4 matches
Mail list logo