Nimble as imported package: handling "no visible binding for global variable"

12 views
Skip to first unread message

PierGianLuca

unread,
Jun 24, 2026, 8:47:16 AMJun 24
to nimble-users
Dear Nimble developers,

I have finally submitted to CRAN the Bayesian-nonparametrics package that uses Nimble for its Monte Carlo computations (https://pglpm.github.io/prova/).

One Note I get from 'R CMD check' is the following:

"no visible binding for global variable..."

for several variables that are used within Nimble code. It is not an error, I think this happens because of how Nimble works.

Do you happen to have any recommendations, considering other packages that import Nimble, on how to avoid this Note? A web search suggests (https://github.com/r-lib/zeallot/issues/57#issuecomment-1276918875) to put these variables in `globalVariables()`, but I wanted to have your opinion before proceeding this way.

Thank you so much!
Kind regards,
Luca

Chris Paciorek

unread,
Jun 24, 2026, 3:35:12 PMJun 24
to PierGianLuca, nimble-users
hi Luca,

Yes, I think the use of `globalVariables()` is generally a good approach. If you can point me more specifically to what variables you are using I might be able to be more concrete/definitive. 

-chris

--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/nimble-users/29f5c0ad-7a11-4935-b12f-19bdf23ba9e6%40magnaspesmeretrix.org.

PierGianLuca

unread,
Jun 26, 2026, 11:11:25 AMJun 26
to nimble-users
Dear Nimble devs,

Regarding the "no visible binding..." problem, the following solution seems to work: at the beginning of the function(s) containing the unbound variables or functions, I added

if(FALSE){A <- B <- C <- NULL}

where A, B, C, etc. are the unbound objects. This seems to "fool" the automated CRAN code checker without altering the code execution in any way.

Package is submitted now, fingers crossed!

Kind regards,
Luca
Reply all
Reply to author
Forward
0 new messages