[R] accessing function arguments as text, macro style

2004-05-25 Thread Ed L Cashin
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

Re: [R] accessing function arguments as text, macro style

2004-05-25 Thread Gabor Grothendieck
Ed L Cashin ecashin at uga.edu writes: 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 R f - function(x) paste(as.character(substitute(x)),x) R z - 3 R f(z) [1]

Re: [R] accessing function arguments as text, macro style

2004-05-25 Thread Ed L Cashin
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/

Re: [R] accessing function arguments as text, macro style

2004-05-25 Thread Berton Gunter
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