Monday, February 04, 2008

R package: codetools

Since the release of R_2.6.0, R package developers were advised to use the ``codetools" package to check potential bugs. However, as I am not familiar with computer language, I found the warning messages a bit confusing. For example:

> checkUsage(
: no visible binding for global variable ‘n’

I don't understand what it really means. Apparently, `n' was not globally defined but was used inside the Nonetheless, this is really not a bug.

I found checkUsage() and checkUsagePacakge() are useful in finding redundant code. For example:

bar <- function(x){ <- mean(x)   
  mu <- mean(x, na.rm=TRUE)   

> checkUsage(bar)
: local variable ‘’ assigned but may not be use

No comments: