[R] How to use the paste function to create an already used variable

Sharpie chuck at sharpsteen.net
Thu Mar 25 16:02:28 CET 2010



"Biedermann, Jürgen" wrote:
> 
> Perfekt!
> 
> So, the code below does, what I want it does.
> 
> for (m in 1:AnzRat) {
>     Daten_akt <- eval(parse(text=paste("Daten",m,"_akt",sep="")))
>     ...
>     ...
>     assign(paste("Daten",m,"_akt",sep=""),Daten_akt)
> }
> 

You may want to consider replacing eval(parse()) with a call to get(). 
eval(parse()) does the job- but it's like using a sledgehammer when you have
a tack hammer available that will work just fine.

-Charlie

-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://n4.nabble.com/How-to-use-the-paste-function-to-create-an-already-used-variable-tp1680508p1690769.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list