[R] accessing function arguments as text, macro style

Ed L Cashin ecashin at uga.edu
Tue May 25 20:22:22 CEST 2004


Gabor Grothendieck <ggrothendieck at myway.com> 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:
  ecashin at uga.edu        |   http://noserose.net/e/pgp/




More information about the R-help mailing list