[R] Variable Names

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Feb 17 18:32:43 CET 1999


Konstantinos Euripides Vorloou <K.E.Vorloou at durham.ac.uk> writes:

> Dear R users,
> 
> That's probably a silly question even for a newbie but :
> 
> Is it possible to assign variable prices as variable names ?
> For instance, would something like the following work :
> 
> for (i in 1:4)
> {
>  error.i <- some_calculation
> }
> 
> so "error.i" variables would be created for i=1,2,3,4
> i.e.  error.1 error.2 error.3 etc. etc.

Yes. Look at the help page for assign(). Whether it is ever better
than using arrays or lists is questionable, though.

-- 
   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