Re: [R] indexing into a list

About this list Date view Thread view Subject view Author view Attachment view

From: Uwe Ligges (ligges@statistik.uni-dortmund.de)
Date: Thu 12 Jun 2003 - 17:20:04 EST


Message-id: <3EE829A4.7020706@statistik.uni-dortmund.de>

Anna H. Pryor wrote:

> I am trying to make an array of lists. I don't think that I am doing it right
> however because I cannot access the individual elements of the lists once I
> have created the array of lists. Can someone help?
>
>
> for(i in 1:3){
> y[[i]] = list(name[((i-1)*index+1):(i*index)])
> }
>
> Anna

Certainly you are not going to create an array of lists, but you are
going to create "just" a list. See the manuals for details.

If "name" is an atomic vector, you won't need a list, but to stay within
  your example:

  y[[i]] <- name[((i-1)*index+1):(i*index)]

to write the assignment's right hand side to the i-th element of list y.

Uwe Ligges

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:53 EST