I am not sure what the general rule you are looking for is. Using
deparse(substitute()) gets you the print-value of the expression (in your
case a name) for the actual argument. But if you want to go back
generations of calls, then just when do you stop?
What you can do is write fun2 to use s
I think the usual thing would be to pass substitute(x) or
deparse(substitute(x)) from the original function (fun2 in your
example).
But if you really want to, you can do
fun <- function(x) eval.parent(call("substitute", substitute(x)))
On 10/22/07, Steve Powell <[EMAIL PROTECTED]> wrote:
> Dear
Dear list members,
I am writing some functions to help with printing graphs.
If I want to return the name of a variable within a function, for instance
to print the label for a graph, I know that I can use substitute:
fun=function(x) substitute(x) #plus of course some other processing
var=1:3
fu
3 matches
Mail list logo