[R] creating a sequence of object names

John cyracules at yahoo.co.uk
Sun Nov 28 22:26:24 CET 2004


Thank you, Uwe. I've found a way to do the job by
reading the FAQ 7.21 although it is not giving a
precise explanation to a novice or casual user at
first reading. For example, if you type the first two
lines in the FAQ, you get an error as you do not have
the variable, a, initially.

I am sure that more and more people get interested in
and serious about using R if advanced users are kind
enough to answer simple and silly questions as well
which are already explained in basic documentations.
Or is this community for highly motivated and advanced
R users only?

Regards,

John


 --- Uwe Ligges <ligges at statistik.uni-dortmund.de>
wrote: 
> John wrote:
> 
> > Hello R-users,
> > 
> > I wanted to generate objects named 'my.ftn1',
> > 'my.ftn2', ... , 'my.ftn10', and tried the
> following
> > code without success. How can I do this?
> > 
> > 
> >>for ( i in 1:10 ) {
> > 
> > + sub(" ", "", paste("my.ftn", i)) <- NULL
> > + }
> > Error: Target of assignment expands to
> non-language
> > object
> > 
> > 
> > Many thanks.
> > 
> > John
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> 
> Please do as suggested above, read the posting
> guide!
> It suggests to read the FAQs. FAQ 7.21 is what you
> are looking for: "How 
> can I turn a string into a variable?".
> 
> Uwe Ligges
>




More information about the R-help mailing list