Re: [R] clean programming

2007-12-18 Thread cgenolin
Gabor Grothendieck <[EMAIL PROTECTED]> a écrit : > Its a FAQ Oups... Sorry for that. Just to close the topic : cleanProg <- function(name,tolerance){ if(length(findGlobals(get(name),FALSE)$variables) > tolerance){ cat("More than",tolerance,"global variable(s) in ",name,"\a\n") } } cleanProg

Re: [R] clean programming

2007-12-16 Thread Duncan Murdoch
On 16/12/2007 9:25 AM, [EMAIL PROTECTED] wrote: > Hello the list, > > I am trying to write a "cleanProgramming" function to test the > procedure I use. For example, I want to be sure that I am not using > globals variables. The function "findGlobals" detect that. > > To list the globals used in

Re: [R] clean programming

2007-12-16 Thread Gabor Grothendieck
Its a FAQ http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f On Dec 16, 2007 9:25 AM, <[EMAIL PROTECTED]> wrote: > Hello the list, > > I am trying to write a "cleanProgramming" function to test the > procedure I use. For example, I want to be sure that I am

[R] clean programming

2007-12-16 Thread cgenolin
Hello the list, I am trying to write a "cleanProgramming" function to test the procedure I use. For example, I want to be sure that I am not using globals variables. The function "findGlobals" detect that. To list the globals used in function "fun", the syntax is : "findGlobals(fun,FALSE)$vari

Re: [R] Clean programming with R

2007-11-26 Thread Prof Brian Ripley
It is part of recent versions of R (a recommended package), so if Mr Waller follows the advice of the posting guide, he will find it already installed. On Mon, 26 Nov 2007, Gabor Csardi wrote: > Try some other mirror, or the main site: > http://cran.r-project.org/src/contrib/Descriptions/codeto

Re: [R] Clean programming with R

2007-11-26 Thread Gabor Csardi
Try some other mirror, or the main site: http://cran.r-project.org/src/contrib/Descriptions/codetools.html You can easily install it via install.packages("codetools") and then selecting an appropriate mirror. Gabor On Mon, Nov 26, 2007 at 08:19:39PM +, Martin Waller wrote: > Hmm - I looked

Re: [R] Clean programming with R

2007-11-26 Thread Martin Waller
Hmm - I looked for the codetools package on the UK(London) cran site and couldn't find it - where can I find it please? Martin [EMAIL PROTECTED] wrote: >>> library(codetools) >>> findGlobals(power) > > Thanks for your answer. > In addition, findGlobals(power,FALSE) gives the list of the globals

Re: [R] Clean programming with R

2007-11-25 Thread cgenolin
>> library(codetools) >> findGlobals(power) Thanks for your answer. In addition, findGlobals(power,FALSE) gives the list of the globals variables alone : > findGlobals(power,F) $functions [1] "^" "{" "<-" "return" $variables [1] "pp" -

Re: [R] Clean programming with R

2007-11-22 Thread Gabor Grothendieck
See the codetools package: > library(codetools) > checkUsage(power) : local variable 'p' assigned but may not be used > findGlobals(power) [1] "^" "{" "<-" "pp" "return" On Nov 22, 2007 5:12 PM, Christophe Genolini <[EMAIL PROTECTED]> wrote: > Hi all > > Is there any compiler f

Re: [R] Clean programming with R

2007-11-22 Thread Duncan Murdoch
On 22/11/2007 5:12 PM, Christophe Genolini wrote: > Hi all > > Is there any compiler for R ? By compiler, I mean something that check > the cleanliness of the code : if we declare all the variables we use, if > we don't use external variable from a function and so on... > For exemple, something

[R] Clean programming with R

2007-11-22 Thread Christophe Genolini
Hi all Is there any compiler for R ? By compiler, I mean something that check the cleanliness of the code : if we declare all the variables we use, if we don't use external variable from a function and so on... For exemple, something that will ring a bell on the following code (saying "line 4 :