Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packagage Mangement? #6

Open
leirbagflow opened this issue Jun 26, 2020 · 2 comments
Open

Packagage Mangement? #6

leirbagflow opened this issue Jun 26, 2020 · 2 comments

Comments

@leirbagflow
Copy link

leirbagflow commented Jun 26, 2020

Just tried to run global.R and need to install a few packages first. I recommend updating to something like the following for ease of use:

If a package is installed, it will be loaded. If any
are not, the missing package(s) will be installed
from CRAN and then loaded.

First specify the packages of interest
packages = c("tidyverse", "geomorph",
"phytools", "viridis")

Now load or install&load all

package.check <- lapply(
packages,
FUN = function(x) {
if (!require(x, character.only = TRUE)) {
install.packages(x, dependencies = TRUE)
library(x, character.only = TRUE)
}
}
)

https://vbaliga.github.io/verify-that-r-packages-are-installed-and-loaded/

@DaveParr
Copy link
Contributor

DaveParr commented Jun 27, 2020

This could be done via renv?

Additionally, potentially this should be a package itself?

Is it possible to get the original researchers to set up renve from their machines. This should give us the explicit package versions in use. Also we should have a note of the version of R this was originally designed to run against for full reproducibility.

@DaveParr
Copy link
Contributor

DaveParr commented Jun 29, 2020

I've started on this this morning, on a branch of my fork: https://github.com/DaveParr/CalCAT/tree/set-up-package

You can see the exact steps from the commits, but generally:

  • Ran renv and made an renv.lock file
  • Made a NAMESPACE and a DESCRIPTION
  • run sinew to put boilerplate roxygen comments in all the functions
  • took the liberty of adding myself as a contributor (as well as the listed original authors) in the description.

Let me know if this is useful/ if you would like a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants