[R] accessing function arguments as text, macro style

About this list Date view Thread view Subject view Author view Attachment view

From: Ed L Cashin (ecashin@uga.edu)
Date: Wed 26 May 2004 - 03:55:31 EST


Message-id: <87d64sl7cc.fsf@uga.edu>

Hi. In a case like this, I can get strip headings that have the name
"c" and the value for c.

  d <- data.frame(a=1:5,b=6:10,c=11:15)
> xyplot(a ~ b | paste("c", c), data=d)
>

For more complicated examples, instead of using paste repeatedly I
would like to use a function. It seems like what I really want is a
macro, though. I'm not quite familiar enough with R's treatment of
function parameters to know how to do something like this (ficticious
example):

  f <- function(x) { paste(identifier(x), value(x)) }
> rambo <- "brave"
> f(rambo)
  "rambo brave"

I've checked ?function, ?args, ?eval, and some others, but I think
I'm barking up the wrong tree. Any pointers would be most
appreciated.
  

-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/

______________________________________________ R-help@stat.math.ethz.ch 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


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:12 EST