[R] checkUsage from codetools shows errors when function uses functions from loaded packages

R. Michael Weylandt michael.weylandt at gmail.com
Wed Apr 10 18:23:09 CEST 2013


On Wed, Apr 10, 2013 at 4:47 AM, Jannis <bt_jannis at yahoo.de> wrote:
> Well, its mentioned in the function itself by library(xxx) or require(xxx).
> Well, most probably codetools is more aimed towards checking packages in
> whcih case such information is in the depends section of the package
> declaration.

Yes -- it's written as a static analyzer so it doesn't execute the
function in question; hence it won't experience the side effects of
package loading.

For example:

f <- function(x){print("Hello World!"); x + 3}

checkUsage(f) # Doesn't print anything

Similarly, library() in f won't have any effect until f is executed.

MW



More information about the R-help mailing list