In this brief set of exercises, you will try some simple solutions
for dependency management in R
. For this, you should
continue working with the R
script you have created and
pushed to your GitHub repository in the previous sessions.
R
you
are using as well as the names and versions of the R
packages you have loaded in your current R
session. Add a
comment containing the version of R
you are using to the
R
script you have created and edited in the previous
sessions.
R
version and the packages via the GUI of RStudio (e.g., in the
Console and the Packages tab). However, you should should use
base R
functions to get this information.
# Only information about your R version
R.version.string
## [1] "R version 4.3.2 (2023-10-31 ucrt)"
# Detailed information about your current R session
sessionInfo()
## R version 4.3.2 (2023-10-31 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19044)
##
## Matrix products: default
##
##
## locale:
## [1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8
## [4] LC_NUMERIC=C LC_TIME=German_Germany.utf8
##
## time zone: Europe/Berlin
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] vctrs_0.6.3 cli_3.6.1 knitr_1.44 rlang_1.1.1 xfun_0.40
## [6] stringi_1.7.12 assertthat_0.2.1 jsonlite_1.8.7 woRkshoptools_0.1.0 glue_1.6.2
## [11] htmltools_0.5.6.1 sass_0.4.7 unilur_0.4.0.9100 fansi_1.0.5 rmarkdown_2.25
## [16] klippy_0.0.0.9500 evaluate_0.22 jquerylib_0.1.4 tibble_3.2.1 fontawesome_0.5.2
## [21] fastmap_1.1.1 yaml_2.3.7 lifecycle_1.0.3 stringr_1.5.0 compiler_4.3.2
## [26] pkgconfig_2.0.3 rstudioapi_0.15.0 digest_0.6.33 R6_2.5.1 utf8_1.2.3
## [31] pillar_1.9.0 magrittr_2.0.3 bslib_0.5.1 tools_4.3.2 cachem_1.0.8
groundhog
package to load the packages you use
in your script.
library(groundhog)
# adapt the package names to include the ones you use in your script
pkgs <- c("dplyr", "ggplot2", "scales", "correlation", "sjPlot")
groundhog.library(pkgs, date = "2023-11-17")
If you are done with these exercises very quickly or if they are too
easy for you, feel free to change some of the arguments for the
groundhog.library()
function and see what happens. You can
also try to use the groundhog
package to install a package
that is not available on CRAN anymore. Or read some of the detailed
documentation on the groundhog
package
website.