Cyrus' New Completely Useless Blog

Ugh... more R

(pieced together from some random twitter comments I made)

So... R 3.6 has this new staged install mechanism that doesn't like my use of rprojroot and its makefixfile. I can get around the problem by installing with --no-staged-install but this makes me think I'm just sweeping the problem under the rug.

This makes me think maybe I should redo the way my packages load/process/provide data in the first place. I'm not a huge fan of the R package installation mechanism, but I get that it's there and that I should use it. How do folks deal with loading non-R data from packages?

One thing I see from @hadleywickham, e.g., is the use of the data-raw directory and some hand-run scripts that generate the .Rdata files. I guess this can work, but seems like a bit of a hack to me.

There are a couple of distinct issues here. One is finding data at runtime. It seems like rprojroot hasn't been updated in a while and isn't designed to deal with staged installs. The "here" package that @JennyBryan raved about a while back seems to have disappeared.

The second is the time at which very pieces of code are run (in this case to do the processing of the "external" data and the generation of .Rdata files and/or various exported variables with "canned/processed" data in them.

Anyone have good suggestions for managing both of these issues in the face of staged installs?

So far the cleanest thing I've got is to setup global variables, use .onLoad to populate them, and to, e.g., from my vignettes, use requireNamespace(...) to load the namespace and (implicitly) call my .onLoad function.