[R] alist()

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Nov 6 22:02:52 CET 2006


Glen Herrmannsfeldt <gah4 at u.washington.edu> writes:

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

(that is the same as x <- list(). I don't think alist() is relevant.)
 
> 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?


Like this:

> x["two"] <- list(NULL)
> x
$two
NULL

or just put it there with x <- list(two=NULL)


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list