[R] alist()

Christos Hatzis christos at nuverabio.com
Mon Nov 6 22:00:35 CET 2006


You need to start by first allocating the list.  The problem is that you
cannot reference a list member that does not exist yet (as in x$two):

x <- vector("list", 10)
x

List x has 10 NULL elements by default.  You can then assign values to these
as needed.

-Christos 

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Glen Herrmannsfeldt
Sent: Monday, November 06, 2006 3:37 PM
To: r-help at stat.math.ethz.ch
Subject: [R] alist()

In trying to get NULL members into a list, I found out about alist().

x<-alist()

x$one<-1
x$two<-NULL

but x$two doesn't exist.

It seems, though, that an alist is just a list.

How can one put NULL members into a list?

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list