Hello everyone, How does one write a function to return the name of an input object (that is assumed to be a data frame) as a character string? I tired using the get(), but this does not work as I had hoped. For example: myfn<-function(x){ output<-data.frame(Attribute="Data Set Name",Value=as.character(get(x))) print(output) } Thank you! Dan [[alternative HTML version deleted]]
On 05/05/11 11:16, Dan Abner wrote:> Hello everyone, > > How does one write a function to return the name of an input object (that is > assumed to be a data frame) as a character string? I tired using the get(), > but this does not work as I had hoped. For example: > > myfn<-function(x){ > > output<-data.frame(Attribute="Data Set Name",Value=as.character(get(x))) > > print(output) > > }foo <- function(x) { deparse(substitute(x)) } cheers, Rolf Turner