Re: [R] finding global variables in a function containing formulae

2012-11-03 Thread William Dunlap
> -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

Re: [R] finding global variables in a function containing formulae

2012-11-03 Thread William Dunlap
---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

Re: [R] finding global variables in a function containing formulae

2012-11-03 Thread Gabor Grothendieck
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

Re: [R] finding global variables in a function containing formulae

2012-11-02 Thread Hafen, Ryan P
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

Re: [R] finding global variables in a function containing formulae

2012-11-01 Thread Bert Gunter
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