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 that will ring a bell on the following code 
> (saying "line 4 : 'pp' undefine in function 'power' ")
> 
> 1. pp <- 3
> 2. power <- function(x){
> 3.    p <- 2
> 4.    return(2^pp)
> 5. }

You can use R CMD check if you've got your code in a package.

That code won't generate a warning, because pp is visible from within 
power.  If you had left the pp assignment off, the codetools tests would 
flag it.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to