[R] Names
Thomas Lumley
thomas at biostat.washington.edu
Wed Dec 20 01:31:07 CET 2000
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
The problem is that there isn't an "as.name<-" function so you can't use
as.name on the left-hand side of an assignment.
You probably mean
assign(paste("myvar","1",sep="."),1:10)
but your life might well be easier if you just had a list called myvar and
had vectors myvar[[1]], myvar[[2]], and so on.
-thomas
Thomas Lumley Asst. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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