0

I'm composing a package in R 3.1.2, with RStudio, using the devtools package. When I check() the package, there is one persistent note to the effect that there is "no visible binding for global variable"...

I have read several threads that suggest assigning my offending variables to NULL, to using globalVariables(), and that pronounce anathema on globalVariables(). Nothing is working for me, unhappily. I'm happy to do anything that works, including submitting my package with the NOTE I'm getting, and keeping my fingers crossed.

But before I submit as is, can anyone enlighten me as to why one should try to avoid a the situation that generates the NOTE? Should I care?

Details: I am initializing an object in .onAttach() and assign()ing it into the global environment. I understand this may be bad practice.

Ken
  • 41
  • 1
  • 8
  • With no code, this reads more like a rant than a question. – IRTFM Jan 15 '15 at 18:56
  • Not intended that way. I really don't know what the issue is, and would like to. – Ken Jan 15 '15 at 19:29
  • I was just trying give you a heads up. I'm unlikely to know the answer but it seemed that you could have constructed the question along the lines of : with version x.x.x of R, I did X with `` code and I got Y (in printed output). – IRTFM Jan 15 '15 at 19:37
  • 1
    You're not going to get your package on CRAN if you're modifying the global environment as it is explicityly against [CRAN Policy](http://cran.r-project.org/web/packages/policies.html) (search for global) – GSee Jan 15 '15 at 20:10
  • Thanks. I was not aware of that-- had only seen that it was frowned upon. – Ken Jan 15 '15 at 20:32
  • OK, I switched my code to avoid doing the bad thing, but I still don't understand why it's bad, in case anyone signs in. – Ken Jan 15 '15 at 23:34
  • This [thread](http://r.789695.n4.nabble.com/what-is-the-preferred-method-to-create-a-package-local-variable-td923040.html) might be helpful. Also, welcome to SO! – tonytonov Jan 16 '15 at 08:26

0 Answers0