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,
>>
>>
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
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
3 matches
Mail list logo