From p.dalgaard@kubism.ku.dk  Fri Apr 25 00:36:23 1997
From: p.dalgaard@kubism.ku.dk (Peter Dalgaard BSA)
Date: 25 Apr 1997 01:36:23 +0200
Subject: R-alpha: list assignment
Message-ID: <x2afmo803s.fsf@bush.kubism.ku.dk>

This works in Splus:

> x<-list()
> x[["f"]]<-1
> zz<-"g"
> x[[zz]]<-2 
> x
$f:
[1] 1

$g:
[1] 2

In R both variants fail unless the name is already on the list. The
first one can be replaced by x$f, but there's seems to be no
substitute for the other one (oh yes I found one, but it's not fit to
print!). This comes up if you e.g. want to create a variable in a data
frame with a name given by a character string.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: list assignment
Peter Dalgaard BSA