[R] style question: returning multiple arguments - structure orlist
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Sun Jul 29 00:07:54 CEST 2001
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list