Skip to content
Back to formatted view

Raw Message

Message-ID: <x2d76kogg5.fsf@blueberry.kubism.ku.dk>
Date: 2001-07-28T22:07:54Z
From: Peter Dalgaard
Subject: style question: returning multiple arguments - structure  orlist
In-Reply-To: Thomas Lumley's message of "Sat, 28 Jul 2001 14:43:25 -0700 (PDT)"

Thomas Lumley <tlumley at u.washington.edu> writes:

> I think you'll find that the first argument of an assignment function has
> to exist already -- the function is passed the evaluated first argument.
> 
> This means it isn't quite true that
>   a<-"foo<-"(a,value)
> is the same as
>   foo(a)<-value
> 
> eg
> > "foo<-"<-function(x,value){list(substitute(x),value)}
> > foo(a)<-4
> Error: Object "a" not found
> > "foo<-"(a,1)
> [[1]]
> a
> 
> [[2]]
> [1] 1
> > a<-1
> > foo(a)<-4
> > a
> [[1]]
> *tmp*
> 
> [[2]]
> [1] 4
> 
> 
> If this is correct, then you can't really write "list<-"

Dang! You're right...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._