search for: checkusageenv

Displaying 4 results from an estimated 4 matches for "checkusageenv".

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...
2009 Jul 02
2
Warning when trying to access a variable out of scope?
Hi, I was wondering if I could get R to warn me, or give me a rude awakening somehow, if I'm accessing a variable that is out of my function's scope. For example, often times I'm creating a function as I'm testing it in the REPL, copying and pasting between both. As a simple example, I might end up with a function like: f <- function(a, b) { a + b.test } Where
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
...gt; >>> 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 explicitly, but perha...