[R] Getting DataFrame Name from Text String

Bert Jacobs b.jacobs at pandora.be
Mon Dec 11 15:27:19 CET 2006


Hi,

I have the following simple function

Testfunc = function(x)
{
Test = subset(x, var1 <= 1000)
}

Suppose I have a dataframe «dat1» then the command Testfunc(dat1) gives a
correct result.

The problem is that the name of dataframe to be used in the function can be
found in a vector (Dfname). The value of the vector can change in eg.

Dfname = « dat1 »
Or
Dfname = « dat2 »
Or
...

How can I pass this string into the function so that the correct database is
used. Thx for helping me out.

Bert




More information about the R-help mailing list