Friday 15 March 2013

Accessing dynamically named tables using a new object in R -



Accessing dynamically named tables using a new object in R -

this question has reply here:

r: how phone call object character variable of same name 1 reply

i have sequentially labeled info frames i.e frame_1 frame_2 e.t.c... access them in sequential manner perchance using loop

one way makes sense me assign name of info frame want access object, pass object function i.e

varname<-paste("frame_",1,_sep="")

then phone call function

function(varname)

but r appears phone call function on string varname, , not object same name varname.

is there way can want?

thanks.

i found out can parse string r command using combination of eval , parse, instance :

function( eval( parse(text=paste0("name_",1))) )

in loop:

for( in 1:length(holder)){ function(eval( parse(text=paste0("frame_",i))) ) }

r

No comments:

Post a Comment