Hi, I have a function A which calls a function B. B accepts an argument 'FUN' (a function). Depending on the choice of package, A constructs FUN and passes it on to B:
A <- function(x, pkg = c("pkg1", "pkg2", "pkg3"), ...) { pkg <- match.arg(pkg) FUN <- switch(pkg, "pkg1" = { function(x, arg1, arg2) { } }, "pkg2" = { function(x, arg3, arg4, arg5) { } }, "pkg3" = { function(x, arg6) { } }, stop("Wrong 'pkg'")) B(x, pkg = pkg, FUN = FUN, ...) } Since different packages require a different structure of FUN, 'R CMD check' shows: * checking R code for possible problems ... NOTE A: multiple local function definitions for ‘FUN’ with different formal arguments I can avoid the note by using three different names for FUN and then another switch once B is called... ... but is there a more elegant solution? Also, is this a 'critical' note for package submission to CRAN? Cheers, M ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel