Hello,

how can I return the name of a variable, say "a$b", from a function?

fun <- function(x){
  return(substitute(x));
}
a  <- data.frame(b=1:10);
fun(a$b)

... returns a$b, but this is a type language, thus I can't use it as a character string, can I? How?

Thanks for help,

Sören

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to