Displaying 3 results from an estimated 3 matches for "checkusagepackage".
2003 Jul 28
0
codetools
I've put together a package codetools with some tools for examining R
source code. It is available at
http://www.stat.uiowa.edu/~luke/R/codetools/codetools.tar.gz
It requires a reasonably current version of R-devel.
The main user functions are:
checkUsage, checkUsageEnv, checkUsagePackage: Examine closure,
closures in an environment, closures in a package, and report
information on possible problems
findGlobals: Finds global functions and variables used by a function.
showTree: Prints Lisp-style representation of expression; useful for
understanding...
2024 Feb 06
1
[EXTERNAL] Re: NOTE: multiple local function definitions for ?fun? with different formal arguments
Here's a dummy example that I think illustrates the problem:
toto <- function() {
if (runif(1) < 0.5)
function(a) a
else
function(a,b) a+b
}
> fcn <- toto()
> fcn(1,2)
[1] 3
> fcn <- toto()
> fcn(1,2)
[1] 3
> fcn <- toto()
> fcn(1,2)
Error in fcn(1, 2) : unused argument (2)
How can you use the returned function, if you get different arguments?
2024 Feb 07
1
[EXTERNAL] Re: NOTE: multiple local function definitions for ?fun? with different formal arguments
...com> wrote:
>>>
>>> I went looking and found this in codetools, where it's been for 20 years
>>>
>>> https://gitlab.com/luke-tierney/codetools/-/blame/master/R/codetools.R?ref_type=heads#L951
>>>
>>> I think the call stack in codetools is checkUsagePackage -> checkUsageEnv -> checkUsage, and these are similarly established. The call from the tools package https://github.com/wch/r-source/blame/95146f0f366a36899e4277a6a722964a51b93603/src/library/tools/R/QC.R#L4585 is also quite old.
>>>
>>> I'm not sure this had been said e...