Skip to content
Prev 42974 / 63421 Next

CRAN policies

Most of that stuff is already in codetools, at least when it is checking functions
with checkUsage().  E.g., arguments of ~ are not checked.  The  expr argument
to with() will not be checked if you add  skipWith=FALSE to the call to checkUsage.

  > library(codetools)

  > checkUsage(function(dataFrame) with(dataFrame, {Num/Den ; Resp ~ Pred}))
  <anonymous>: no visible binding for global variable 'Num' (:1)
  <anonymous>: no visible binding for global variable 'Den' (:1)

  > checkUsage(function(dataFrame) with(dataFrame, {Num/Den ; Resp ~ Pred}), skipWith=TRUE)

  > checkUsage(function(dataFrame) with(DataFrame, {Num/Den ; Resp ~ Pred}), skipWith=TRUE)
  <anonymous>: no visible binding for global variable 'DataFrame'

The only part that I don't see is the mechanism to add code-walker functions to
the environment in codetools that has the standard list of them for functions with
nonstandard evaluation:
  > objects(codetools:::collectUsageHandlers, all=TRUE)
   [1] "$"             "$<-"           ".Internal"    
   [4] "::"            ":::"           "@"            
   [7] "@<-"           "{"             "~"            
  [10] "<-"            "<<-"           "="            
  [13] "assign"        "binomial"      "bquote"       
  [16] "data"          "detach"        "expression"   
  [19] "for"           "function"      "Gamma"        
  [22] "gaussian"      "if"            "library"      
  [25] "local"         "poisson"       "quasi"        
  [28] "quasibinomial" "quasipoisson"  "quote"        
  [31] "Quote"         "require"       "substitute"   
  [34] "with"         

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com