> -Original Message-
> From: William Dunlap
> Sent: Saturday, November 03, 2012 11:23 AM
> To: 'Hafen, Ryan P'; Bert Gunter
> Cc: r-help@r-project.org
> Subject: RE: [R] finding global variables in a function containing formulae
>
> findGlobals must b
---Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Hafen, Ryan P
> Sent: Friday, November 02, 2012 4:28 PM
> To: Bert Gunter
> Cc: r-help@r-project.org
> Subject: Re: [R] finding global variables in a function
On Thu, Nov 1, 2012 at 2:04 PM, Hafen, Ryan P wrote:
> I need to find all global variables being used in a function and
> findGlobals() in the codetools package works quite nicely. However, I am not
> able to find variables that are used in formulae. Simply avoiding formulae
> in functions is
Thanks. That works if I a have the formula expression handy. But suppose
I want a function, findGlobalVars() that takes a function as an argument
and finds globals in it, where I have absolutely no idea what is in the
supplied function:
findGlobalVars <- function(f) {
require(codetools)
fi
Does
?all.vars
##as in
> all.vars(y~x)
[1] "y" "x"
help?
-- Bert
On Thu, Nov 1, 2012 at 11:04 AM, Hafen, Ryan P wrote:
> I need to find all global variables being used in a function and
> findGlobals() in the codetools package works quite nicely. However, I am not
> able to find variables t
5 matches
Mail list logo