CredibilityLab / groundhog

Reproducible R Scripts Via Date Controlled Installing & Loading of CRAN & Git Packages
https://groundhogr.com/
GNU General Public License v3.0
78 stars 4 forks source link

issues with loading grid? #70

Closed HedvigS closed 3 years ago

HedvigS commented 3 years ago

Hi again!

So, normally I load 'grid' but that doesn't work with groundhog.library()

> groundhog.library('grid', '2021-03-14')

groundhog says: FAILED to load 'grid_0.7-1'

I am able to load ggplot2 and gridExtra though, but that doesn't load grid.

I'm probably just missing something obvious. Any ideas :)?

urisohn commented 3 years ago

'grid' is now part of base R and cannot be modified (https://cran.r-project.org/web/packages/grid/index.html)

It was last revised in 2002 as a stand-alone package: groundhog::toc('grid')

Will put in the to-do list to include a more informative error for this situation, something like what you would get with this: install.packages('grid')

HedvigS commented 3 years ago

Thanks for the response

I'm aware that grid is now part of base, I'm just having issues with running a script which utilises grid functions unless I explicitly load grid. It's a bit odd, I'll admit and I'm trying different options. Previously I used pacman for package loading, and I explicitly loaded grid and everything worked fine. It's just breaking now as I'm having to exclude loading grid from the groundhog.library() set up.

urisohn commented 3 years ago

Ah, interesting. ok. Right, you want to attach a package that is a base package, that's a scenario I had not considered.

For base packages one cannot do version control beyond sticking to the same version of R, which is something groundhog nudges people into doing with warnings. But right, you may want to attach those packages

For the next release of groundhog I will make it so that if a base package is requested it is loaded locally (whichever version is available, with a warning if there is a mismatch).

In the meantime, if you want to use groundhog, to work with base packages you can either 1) Use :: to explicitly call on the package (e.g., grid::convertX() ) 2) Use library(grid) to attach it.

Until groundhog incorporates this scenario, 1 or 2 will produce the same results and thus, even after groundhog is updated, the code will remain reproducible.

Does this make sense?

HedvigS commented 3 years ago

It does make sense :)! Thank you.

I think for now I'll just do run of the mill loading with library() for this, seems easiest after all.

Thank you for the help, this is a very nice package and it's great that you're also very responsive here :)