This solution may not quite work as you intend. I believe that the preferred solution is: f <- function(x) paste(deparse(substitute(x)),x)
This would give the same result with the z<-3 example below, but try it for both versions with the call: f(sin(3)) The subtlety is that substitute returns the parse TREE of its (expression)argument, which you probably want deparsed rather than cast by as.character(). Cheers, Bert Ed L Cashin wrote: > Gabor Grothendieck <[EMAIL PROTECTED]> writes: > > ... > > R> f <- function(x) paste(as.character(substitute(x)),x) > > R> z <- 3 > > R> f(z) > > [1] "z 3" > > Fantastic. Works like a charm. > > -- > --Ed L Cashin | PGP public key: > [EMAIL PROTECTED] | http://noserose.net/e/pgp/ > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Bert Gunter Non-Clinical Biostatistics Genentech MS: 240B Phone: 650-467-7374 "The business of the statistician is to catalyze the scientific learning process." -- George E.P. Box ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html