Let'say we have a dataframe mydata with column v1. If mydata$v1 is passed
to a function, is there way, then, to extract the name of the dataframe?
What I now do is passing the name of the dataframe to the funcion, so
passing two parameters. Maybe with mydata$v1 it is not possible, but with
Will this work for you:
myFunc - function(var){
+ # get the dataframe name
+ charName - deparse(substitute(var))
+ # parse out data.frame
+ dataFrame - sub(\\$.*, , charName)
+ cat(input:, charName, data.frame:, dataFrame, \n)
+ }
myFunc(mydata$V1)
input: mydata$V1
On Feb 17, 2013, at 5:51 AM, Frans Marcelissen wrote:
Let'say we have a dataframe mydata with column v1. If mydata$v1 is passed
to a function, is there way, then, to extract the name of the dataframe?
What I now do is passing the name of the dataframe to the funcion, so
passing two
3 matches
Mail list logo