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

uncertain about error message #103

Closed HedvigS closed 7 months ago

HedvigS commented 12 months ago

I'm going through and setting up groundhog for some of my projects. I have a vector of packages to install, and i'm running groundhog::groundhog.library() over them. I got this error:

Error: package or namespace load failed for ‘tidyverse’:
 .onAttach failed in attachNamespace() for 'tidyverse', details:
  call: value[[3L]](cond)
  error: Package ‘purrr’ version 1.0.2 cannot be unloaded:
 Error in unloadNamespace(package) : namespace ‘purrr’ is imported by ‘profvis’, ‘usethis’, ‘tidyr’ so cannot be unloaded

and I'm uncertain of how to act now. I think I understand what's happened, but I don't know what I am meant to do instead. Full code below


#packages

#groundhogr set-up

groundhog_date = "2023-07-17"

if(!("groundhog" %in% rownames(installed.packages()))){

  install.packages("groundhog")
  library(groundhog)

}else{  

  library(groundhog)

}

groundhog_dir <- paste0("groundhog_libraries_", groundhog_date)

if(!dir.exists(groundhog_dir)){
  dir.create(groundhog_dir)
}

groundhog::set.groundhog.folder(groundhog_dir)

pkgs = c(
  "tidyverse",
  "reshape2",
  "jsonlite",
  "modEvA",
  "MuMIn",
  "rsq",
  "viridis",
  "rlang",
  "readODS",
  "devtools",
  "MASS", 
  "colorspace",
  "wesanderson",
  "ggalt",
  "randomcoloR",
  "RColorBrewer",
  "ggplot2",
  "readxl",
  "ggrepel",
  "psych",
  "ggthemes",
  "readxl",
  "broom", 
  "ggpubr",
  "lemon",
  "data.table",
  "naniar", 
  "fields",
  "scales",
  "devtools",
  "xtable",
  "broom", 
  "nFactors",
  "sp", 
  "raster")

groundhog.library(pkgs, groundhog_date)
HedvigS commented 12 months ago

a clean environment and restart of R session solved this... haha but I don't know why ^^