[Rd] R CMD check issue
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Mon Apr 6 21:25:21 CEST 2026
This might not be compatible with your need for speed, but you can do
env$var
to access a variable in the specified environment. Something similar
would work with a list instead of an eime nvironment, but then changes
to var would not be saved to the original list, and name completion
could hide errors (i.e. env$v doesn't find anything if the variable is
named "var", but lst$v would find "var").
In the usual case where you only work with a few variables at a time you
would probably save some time with code like
var <- env$var
# work with it. Changes would need to be explicitly saved!
Duncan Murdoch
On 2026-04-06 2:40 p.m., Therneau, Terry M., Ph.D. via R-devel wrote:
> I'm doing something less usual in a package (with some help from others). The big
> picture: I'm solving a particular varianct of hidden Markov models, which involves a
> zillion calls for a matrix exponential and its derivative, and I've been doing everything
> I can think of to speed it up. The secondary picture is that I don't like to work with
> source code files that go on for page after page, I have a terrible time
> editing/managing/whatever such.
>
> The issue: I end up using an envionment trick to pass along a long list of parameters
> (about 34 vectors or lists), or I should say to make them findable without having to send
> them down the call chain as arguments. R CMD check flags the pair of function at the end
> of the chain, which actually use them, as each having 34 "no visible binding for global
> variable xyz" messages. In the short term I can just live with it, but if I ever want
> to submit to CRAN I'll need something more formal. I'm happy to give more details to
> whomever might want to pitch in.
>
> PS. The first pass had about 40 such warnings, i.e, these 'spurious' ones along with a
> half dozen misspelled variable names -- I overall like what the check does for me, it's
> just overzealous in this case.
>
> Terry T.
>
More information about the R-devel
mailing list