[R] Names

Jan Goebel jgoebel at diw.de
Wed Dec 20 03:10:48 CET 2000


Hello David,

maybe this helps you:

> assign(paste("myvar","1",sep="."),1:10)
> ls()
[1] "myvar.1"
> myvar.1
 [1]  1  2  3  4  5  6  7  8  9 10

Greetings

jan

On Wed, 20 Dec 2000, David Scott wrote:

> 
> I am trying to create a set of vectors which have similar names. They have
> a common part and an extra unique part. I am sure I have seen questions on
> this before but I have been unable to find it in the archive. There are
> examples of sets of names for columns of a data frame, but not for
> individual vectors.
> 
> Suppose I want vectors named myvar.1 myvar.2 etc.
> 
> I tried:
> > as.name(paste("myvar","1",sep="."))<-1:10
> Error: Target of assignment expands to non-language object
> 
> But:
> > is.language(as.name(paste("myvar","1",sep=".")))
> [1] TRUE
> 
> Any suggestions as to how to do this?
> 
> David Scott 
> 
> _________________________________________________________________
> David Scott     Department of Statistics
>                 The University of Auckland, PB 92019
>                 Auckland        NEW ZEALAND
> Phone: +64 9 373 7599 ext 6830     Fax: +64 9 373 7018            
> Email:  d.scott at Auckland.ac.nz
> 
> President, New Zealand Statistical Association
> Head, Department of Statistics, University of Auckland
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
+-----------------------------------
 Jan Goebel (mailto:jgoebel at diw.de)

 DIW Berlin 
 Longitudinal Data and Microanalysis
 Königin-Luise-Str. 5
 D-14195 Berlin -- Germany --
 phone: 49 30 89789-377
+-----------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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