Re: [R] problem deparsing argument

2011-08-18 Thread Bert Gunter
The problem is scope -- the environment in which substitute() looks for x. Try: foo <- function(x){ deparse(substitute(x,env=parent.frame()))} a<-1 foo(a) bar <- function(x)foo(x) bar(a) -- Bert 2011/8/18 David Winsemius : > > On Aug 18, 2011, at 5:11 PM, Ernest Adrogué wrote: > >> Hi, >> >>

Re: [R] problem deparsing argument

2011-08-18 Thread David Winsemius
On Aug 18, 2011, at 5:11 PM, Ernest Adrogué wrote: Hi, I don't know much about R's deparsing "magic", I simply use the deparse(substitute(arg)) trick to get the names of the variables passed as arguments to the function in order to set labels, etc. The problem is that this doesn't work with n

[R] problem deparsing argument

2011-08-18 Thread Ernest Adrogué
Hi, I don't know much about R's deparsing "magic", I simply use the deparse(substitute(arg)) trick to get the names of the variables passed as arguments to the function in order to set labels, etc. The problem is that this doesn't work with nested functions. For example, > foo <- function(x) pr