From af484f177fba87a7d405771ee6fd559f0d63d20b Mon Sep 17 00:00:00 2001 From: Katherine Heal Date: Fri, 5 Jul 2024 17:29:49 -0700 Subject: [PATCH 1/2] Simplify R dependencies to fix #50 --- .renvignore | 3 +- libraries.R | 7 + renv.lock | 578 ++++++++++++++++++++++-------------------------- renv/activate.R | 80 +++++-- 4 files changed, 333 insertions(+), 335 deletions(-) create mode 100644 libraries.R diff --git a/.renvignore b/.renvignore index 9bc9e6c3..1f60c155 100644 --- a/.renvignore +++ b/.renvignore @@ -1 +1,2 @@ -*.ipynb \ No newline at end of file +*.ipynb +venv/* \ No newline at end of file diff --git a/libraries.R b/libraries.R new file mode 100644 index 00000000..af4121c4 --- /dev/null +++ b/libraries.R @@ -0,0 +1,7 @@ +library(jsonlite) +library(dplyr) +library(tidyr) +library(ggplot2) +library(forcats) +library(lubridate) +library(GGally) \ No newline at end of file diff --git a/renv.lock b/renv.lock index 2e237fc0..5c71c2e6 100644 --- a/renv.lock +++ b/renv.lock @@ -11,32 +11,32 @@ "Packages": { "GGally": { "Package": "GGally", - "Version": "2.1.2", + "Version": "2.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "RColorBrewer", "dplyr", - "forcats", "ggplot2", + "ggstats", "grDevices", "grid", "gtable", "lifecycle", + "magrittr", "plyr", "progress", - "reshape", "rlang", "scales", "tidyr", "utils" ], - "Hash": "022f78c8698724b326f1838b1a98cafa" + "Hash": "b11ac45c916608b7d1374ff87da053d5" }, "MASS": { "Package": "MASS", - "Version": "7.3-60", + "Version": "7.3-60.0.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -47,15 +47,16 @@ "stats", "utils" ], - "Hash": "a56a6365b3fa73293ea8d084be0d9bb0" + "Hash": "b765b28387acc8ec9e9c1530713cb19c" }, "Matrix": { "Package": "Matrix", - "Version": "1.5-4.1", + "Version": "1.6-5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", + "grDevices", "graphics", "grid", "lattice", @@ -63,7 +64,7 @@ "stats", "utils" ], - "Hash": "38082d362d317745fb932e13956dccbb" + "Hash": "8c7115cd3a0e048bda2a7cd110549f7a" }, "R6": { "Package": "R6", @@ -87,66 +88,110 @@ }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.11", + "Version": "1.0.12", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "methods", "utils" ], - "Hash": "ae6cbbe1492f4de79c45fce06f967ce8" + "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" }, - "base64enc": { - "Package": "base64enc", - "Version": "0.1-3", + "backports": { + "Package": "backports", + "Version": "1.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "e1e1b9d75c37401117b636b7ae50827a" + }, + "bit": { + "Package": "bit", + "Version": "4.0.5", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "R" ], - "Hash": "543776ae6848fde2f48ff3816d0628bc" + "Hash": "d242abec29412ce988848d0294b208fd" }, - "bslib": { - "Package": "bslib", - "Version": "0.5.1", + "bit64": { + "Package": "bit64", + "Version": "4.0.5", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "R", - "base64enc", - "cachem", - "grDevices", - "htmltools", - "jquerylib", - "jsonlite", - "memoise", - "mime", + "bit", + "methods", + "stats", + "utils" + ], + "Hash": "9fe98599ca456d6552421db0d6772d8f" + }, + "broom": { + "Package": "broom", + "Version": "1.0.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "backports", + "dplyr", + "generics", + "glue", + "lifecycle", + "purrr", "rlang", - "sass" + "stringr", + "tibble", + "tidyr" ], - "Hash": "283015ddfbb9d7bf15ea9f0b5698f0d9" + "Hash": "a4652c36d1f8abfc3ddf4774f768c934" }, - "cachem": { - "Package": "cachem", - "Version": "1.0.8", + "broom.helpers": { + "Package": "broom.helpers", + "Version": "1.15.0", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ - "fastmap", - "rlang" + "R", + "broom", + "cli", + "dplyr", + "labelled", + "lifecycle", + "purrr", + "rlang", + "stats", + "stringr", + "tibble", + "tidyr" ], - "Hash": "c35768291560ce302c0a6589f92e837d" + "Hash": "768cae43c3da698d6b11763777301e43" }, "cli": { "Package": "cli", - "Version": "3.6.1", + "Version": "3.6.3", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "89e6d8219950eac806ae0c489052048a" + "Hash": "b21916dd77a27642b447374a5d30ecf3" + }, + "clipr": { + "Package": "clipr", + "Version": "0.8.0", + "Source": "Repository", + "Repository": "RSPM", + "Requirements": [ + "utils" + ], + "Hash": "3f038e5ac7f41d4ac41ce658c85e3042" }, "colorspace": { "Package": "colorspace", @@ -164,40 +209,29 @@ }, "cpp11": { "Package": "cpp11", - "Version": "0.4.6", + "Version": "0.4.7", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "R" ], - "Hash": "707fae4bbf73697ec8d85f9d7076c061" + "Hash": "5a295d7d963cc5035284dcdbaf334f4e" }, "crayon": { "Package": "crayon", - "Version": "1.5.2", + "Version": "1.5.3", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "grDevices", "methods", "utils" ], - "Hash": "e8a1e41acf02548751f45c718d55aa6a" - }, - "digest": { - "Package": "digest", - "Version": "0.6.33", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "utils" - ], - "Hash": "b18a9cf3c003977b0cc49d5e76ebe48d" + "Hash": "859d96e65ef198fd43e82b9628d593ef" }, "dplyr": { "Package": "dplyr", - "Version": "1.1.3", + "Version": "1.1.4", "Source": "Repository", "Repository": "RSPM", "Requirements": [ @@ -216,33 +250,11 @@ "utils", "vctrs" ], - "Hash": "e85ffbebaad5f70e1a2e2ef4302b4949" - }, - "ellipsis": { - "Package": "ellipsis", - "Version": "0.3.2", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "rlang" - ], - "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077" - }, - "evaluate": { - "Package": "evaluate", - "Version": "0.22", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "methods" - ], - "Hash": "66f39c7a21e03c4dcb2c2d21d738d603" + "Hash": "fedd9d00c2944ff00a0e2696ccf048ec" }, "fansi": { "Package": "fansi", - "Version": "1.0.5", + "Version": "1.0.6", "Source": "Repository", "Repository": "RSPM", "Requirements": [ @@ -250,33 +262,14 @@ "grDevices", "utils" ], - "Hash": "3e8583a60163b4bc1a80016e63b9959e" + "Hash": "962174cf2aeb5b9eea581522286a911f" }, "farver": { "Package": "farver", - "Version": "2.1.1", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "8106d78941f34855c440ddb946b8f7a5" - }, - "fastmap": { - "Package": "fastmap", - "Version": "1.1.1", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "f7736a18de97dea803bde0a2daaafb27" - }, - "fontawesome": { - "Package": "fontawesome", - "Version": "0.5.2", + "Version": "2.1.2", "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "htmltools", - "rlang" - ], - "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" + "Repository": "CRAN", + "Hash": "680887028577f3fa2a81e410ed0d6e42" }, "forcats": { "Package": "forcats", @@ -294,17 +287,6 @@ ], "Hash": "1a0a9a3d5083d0d573c4214576f1e690" }, - "fs": { - "Package": "fs", - "Version": "1.6.3", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "methods" - ], - "Hash": "47b5f30c720c23999b913a1a635cf0bb" - }, "generics": { "Package": "generics", "Version": "0.1.3", @@ -318,9 +300,9 @@ }, "ggplot2": { "Package": "ggplot2", - "Version": "3.4.4", + "Version": "3.5.1", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "MASS", "R", @@ -339,24 +321,47 @@ "vctrs", "withr" ], - "Hash": "313d31eff2274ecf4c1d3581db7241f9" + "Hash": "44c6a2f8202d5b7e878ea274b1092426" + }, + "ggstats": { + "Package": "ggstats", + "Version": "0.6.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "broom.helpers", + "cli", + "dplyr", + "forcats", + "ggplot2", + "lifecycle", + "magrittr", + "patchwork", + "purrr", + "rlang", + "scales", + "stats", + "stringr", + "tidyr" + ], + "Hash": "02cdab34154e9e70dac279afbb20d34b" }, "glue": { "Package": "glue", - "Version": "1.6.2", + "Version": "1.7.0", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "R", "methods" ], - "Hash": "4f2596dfb05dac67b9dc558e5c6fba2e" + "Hash": "e0b3a53876554bd45879e596cdb10a52" }, "gtable": { "Package": "gtable", - "Version": "0.3.4", + "Version": "0.3.5", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "R", "cli", @@ -365,18 +370,28 @@ "lifecycle", "rlang" ], - "Hash": "b29cf3031f49b04ab9c852c912547eef" + "Hash": "e18861963cbc65a27736e02b3cd3c4a0" }, - "highr": { - "Package": "highr", - "Version": "0.10", + "haven": { + "Package": "haven", + "Version": "2.5.4", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "R", - "xfun" + "cli", + "cpp11", + "forcats", + "hms", + "lifecycle", + "methods", + "readr", + "rlang", + "tibble", + "tidyselect", + "vctrs" ], - "Hash": "06230136b2d2b9ba5805e1963fa6e890" + "Hash": "9171f898db9d9c4c1b2c745adc2c1ef1" }, "hms": { "Package": "hms", @@ -392,23 +407,6 @@ ], "Hash": "b59377caa7ed00fa41808342002138f9" }, - "htmltools": { - "Package": "htmltools", - "Version": "0.5.6.1", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "base64enc", - "digest", - "ellipsis", - "fastmap", - "grDevices", - "rlang", - "utils" - ], - "Hash": "1e12fe667316a76508898839ecfb2d00" - }, "isoband": { "Package": "isoband", "Version": "0.2.7", @@ -420,41 +418,15 @@ ], "Hash": "0080607b4a1a7b28979aecef976d8bc2" }, - "jquerylib": { - "Package": "jquerylib", - "Version": "0.1.4", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "htmltools" - ], - "Hash": "5aab57a3bd297eee1c1d862735972182" - }, "jsonlite": { "Package": "jsonlite", - "Version": "1.8.7", + "Version": "1.8.8", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "methods" ], - "Hash": "266a20443ca13c65688b2116d5220f76" - }, - "knitr": { - "Package": "knitr", - "Version": "1.45", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "evaluate", - "highr", - "methods", - "tools", - "xfun", - "yaml" - ], - "Hash": "1ec462871063897135c1bcbe0fc8f07d" + "Hash": "e1b9c55281c5adc4dd113652d9e26768" }, "labeling": { "Package": "labeling", @@ -467,9 +439,27 @@ ], "Hash": "b64ec208ac5bc1852b285f665d6368b3" }, + "labelled": { + "Package": "labelled", + "Version": "2.13.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "dplyr", + "haven", + "lifecycle", + "rlang", + "stringr", + "tidyr", + "tidyselect", + "vctrs" + ], + "Hash": "ad4b6d757624221aec6220b8c78defeb" + }, "lattice": { "Package": "lattice", - "Version": "0.21-8", + "Version": "0.22-6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -480,11 +470,11 @@ "stats", "utils" ], - "Hash": "0b8a6d63c8770f02a8b5635f3c431e6b" + "Hash": "cc5ac1ba4c238c7ca9fa6a87ca11a7e2" }, "lifecycle": { "Package": "lifecycle", - "Version": "1.0.3", + "Version": "1.0.4", "Source": "Repository", "Repository": "RSPM", "Requirements": [ @@ -493,7 +483,7 @@ "glue", "rlang" ], - "Hash": "001cecbeac1cff9301bdc3775ee46a86" + "Hash": "b8552d117e1b808b09a832f589b79035" }, "lubridate": { "Package": "lubridate", @@ -518,32 +508,9 @@ ], "Hash": "7ce2733a9826b3aeb1775d56fd305472" }, - "maps": { - "Package": "maps", - "Version": "3.4.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "graphics", - "utils" - ], - "Hash": "49575d57c53981f0f033a84239d75085" - }, - "memoise": { - "Package": "memoise", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "cachem", - "rlang" - ], - "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c" - }, "mgcv": { "Package": "mgcv", - "Version": "1.8-42", + "Version": "1.9-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -556,32 +523,22 @@ "stats", "utils" ], - "Hash": "3460beba7ccc8946249ba35327ba902a" - }, - "mime": { - "Package": "mime", - "Version": "0.12", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "tools" - ], - "Hash": "18e9c28c1d3ca1560ce30658b22ce104" + "Hash": "110ee9d83b496279960e162ac97764ce" }, "munsell": { "Package": "munsell", - "Version": "0.5.0", + "Version": "0.5.1", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "colorspace", "methods" ], - "Hash": "6dfe8bf774944bd5595785e3229d8771" + "Hash": "4fd8900853b746af55b81fda99da7695" }, "nlme": { "Package": "nlme", - "Version": "3.1-162", + "Version": "3.1-165", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -591,7 +548,25 @@ "stats", "utils" ], - "Hash": "0984ce8da8da9ead8643c5cbbb60f83e" + "Hash": "2769a88be217841b1f33ed469675c3cc" + }, + "patchwork": { + "Package": "patchwork", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "cli", + "ggplot2", + "grDevices", + "graphics", + "grid", + "gtable", + "rlang", + "stats", + "utils" + ], + "Hash": "9c8ab14c00ac07e9e04d1664c0b74486" }, "pillar": { "Package": "pillar", @@ -643,16 +618,17 @@ }, "progress": { "Package": "progress", - "Version": "1.2.2", + "Version": "1.2.3", "Source": "Repository", "Repository": "RSPM", "Requirements": [ + "R", "R6", "crayon", "hms", "prettyunits" ], - "Hash": "14dc9f7a3c91ebb14ec5bb9208a07061" + "Hash": "f4625e061cb2865f111b47ff163a5ca6" }, "purrr": { "Package": "purrr", @@ -669,120 +645,86 @@ ], "Hash": "1cba04a4e9414bdefc9dcaa99649a8dc" }, - "rappdirs": { - "Package": "rappdirs", - "Version": "0.3.3", + "readr": { + "Package": "readr", + "Version": "2.1.5", "Source": "Repository", "Repository": "RSPM", "Requirements": [ - "R" + "R", + "R6", + "cli", + "clipr", + "cpp11", + "crayon", + "hms", + "lifecycle", + "methods", + "rlang", + "tibble", + "tzdb", + "utils", + "vroom" ], - "Hash": "5e3c5dc0b071b21fa128676560dbe94d" + "Hash": "9de96463d2117f6ac49980577939dfb3" }, "renv": { "Package": "renv", - "Version": "1.0.3", + "Version": "1.0.7", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "utils" ], - "Hash": "41b847654f567341725473431dd0d5ab" - }, - "reshape": { - "Package": "reshape", - "Version": "0.8.9", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "plyr" - ], - "Hash": "603d56041d7d4fa3ceb1864b3f6ee6b1" + "Hash": "397b7b2a265bc5a7a06852524dabae20" }, "rlang": { "Package": "rlang", - "Version": "1.1.1", + "Version": "1.1.4", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "a85c767b55f0bf9b7ad16c6d7baee5bb" - }, - "rmarkdown": { - "Package": "rmarkdown", - "Version": "2.25", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "bslib", - "evaluate", - "fontawesome", - "htmltools", - "jquerylib", - "jsonlite", - "knitr", - "methods", - "stringr", - "tinytex", - "tools", - "utils", - "xfun", - "yaml" - ], - "Hash": "d65e35823c817f09f4de424fcdfa812a" - }, - "sass": { - "Package": "sass", - "Version": "0.4.7", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R6", - "fs", - "htmltools", - "rappdirs", - "rlang" - ], - "Hash": "6bd4d33b50ff927191ec9acbf52fd056" + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" }, "scales": { "Package": "scales", - "Version": "1.2.1", + "Version": "1.3.0", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "R", "R6", "RColorBrewer", + "cli", "farver", + "glue", "labeling", "lifecycle", "munsell", "rlang", "viridisLite" ], - "Hash": "906cb23d2f1c5680b8ce439b44c6fa63" + "Hash": "c19df082ba346b0ffa6f833e92de34d1" }, "stringi": { "Package": "stringi", - "Version": "1.7.12", + "Version": "1.8.4", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "R", "stats", "tools", "utils" ], - "Hash": "ca8bd84263c77310739d2cf64d84d7c9" + "Hash": "39e1144fd75428983dc3f63aa53dfa91" }, "stringr": { "Package": "stringr", - "Version": "1.5.0", + "Version": "1.5.1", "Source": "Repository", "Repository": "RSPM", "Requirements": [ @@ -795,7 +737,7 @@ "stringi", "vctrs" ], - "Hash": "671a4d384ae9d32fc47a14e98bfa3dc8" + "Hash": "960e2ae9e09656611e0b8214ad543207" }, "tibble": { "Package": "tibble", @@ -818,7 +760,7 @@ }, "tidyr": { "Package": "tidyr", - "Version": "1.3.0", + "Version": "1.3.1", "Source": "Repository", "Repository": "RSPM", "Requirements": [ @@ -837,11 +779,11 @@ "utils", "vctrs" ], - "Hash": "e47debdc7ce599b070c8e78e8ac0cfcf" + "Hash": "915fb7ce036c22a6a33b5a8adb712eb1" }, "tidyselect": { "Package": "tidyselect", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "RSPM", "Requirements": [ @@ -853,28 +795,29 @@ "vctrs", "withr" ], - "Hash": "79540e5fcd9e0435af547d885f184fd5" + "Hash": "829f27b9c4919c16b593794a6344d6c0" }, "timechange": { "Package": "timechange", - "Version": "0.2.0", + "Version": "0.3.0", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "R", "cpp11" ], - "Hash": "8548b44f79a35ba1791308b61e6012d7" + "Hash": "c5f3c201b931cd6474d17d8700ccb1c8" }, - "tinytex": { - "Package": "tinytex", - "Version": "0.48", + "tzdb": { + "Package": "tzdb", + "Version": "0.4.0", "Source": "Repository", "Repository": "RSPM", "Requirements": [ - "xfun" + "R", + "cpp11" ], - "Hash": "8f96d229b7311beb32b94cf413b13f84" + "Hash": "f561504ec2897f4d46f0c7657e488ae1" }, "utf8": { "Package": "utf8", @@ -888,7 +831,7 @@ }, "vctrs": { "Package": "vctrs", - "Version": "0.6.4", + "Version": "0.6.5", "Source": "Repository", "Repository": "RSPM", "Requirements": [ @@ -898,7 +841,7 @@ "lifecycle", "rlang" ], - "Hash": "266c1ca411266ba8f365fcc726444b87" + "Hash": "c03fa420630029418f7e6da3667aac4a" }, "viridisLite": { "Package": "viridisLite", @@ -910,36 +853,43 @@ ], "Hash": "c826c7c4241b6fc89ff55aaea3fa7491" }, - "withr": { - "Package": "withr", - "Version": "2.5.2", + "vroom": { + "Package": "vroom", + "Version": "1.6.5", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "R", - "grDevices", - "graphics", - "stats" + "bit64", + "cli", + "cpp11", + "crayon", + "glue", + "hms", + "lifecycle", + "methods", + "progress", + "rlang", + "stats", + "tibble", + "tidyselect", + "tzdb", + "vctrs", + "withr" ], - "Hash": "4b25e70111b7d644322e9513f403a272" + "Hash": "390f9315bc0025be03012054103d227c" }, - "xfun": { - "Package": "xfun", - "Version": "0.40", + "withr": { + "Package": "withr", + "Version": "3.0.0", "Source": "Repository", "Repository": "RSPM", "Requirements": [ - "stats", - "tools" + "R", + "grDevices", + "graphics" ], - "Hash": "be07d23211245fc7d4209f54c4e4ffc8" - }, - "yaml": { - "Package": "yaml", - "Version": "2.3.7", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "0d0056cc5383fbc240ccd0cb584bf436" + "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" } } } diff --git a/renv/activate.R b/renv/activate.R index cb5401f9..d13f9932 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,11 +2,13 @@ local({ # the requested version of renv - version <- "1.0.3" + version <- "1.0.7" attr(version, "sha") <- NULL # the project directory - project <- getwd() + project <- Sys.getenv("RENV_PROJECT") + if (!nzchar(project)) + project <- getwd() # use start-up diagnostics if enabled diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") @@ -31,6 +33,14 @@ local({ if (!is.null(override)) return(override) + # if we're being run in a context where R_LIBS is already set, + # don't load -- presumably we're being run as a sub-process and + # the parent process has already set up library paths for us + rcmd <- Sys.getenv("R_CMD", unset = NA) + rlibs <- Sys.getenv("R_LIBS", unset = NA) + if (!is.na(rlibs) && !is.na(rcmd)) + return(FALSE) + # next, check environment variables # TODO: prefer using the configuration one in the future envvars <- c( @@ -50,9 +60,22 @@ local({ }) - if (!enabled) + # bail if we're not enabled + if (!enabled) { + + # if we're not enabled, we might still need to manually load + # the user profile here + profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") + if (file.exists(profile)) { + cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") + if (tolower(cfg) %in% c("true", "t", "1")) + sys.source(profile, envir = globalenv()) + } + return(FALSE) + } + # avoid recursion if (identical(getOption("renv.autoloader.running"), TRUE)) { warning("ignoring recursive attempt to run renv autoloader") @@ -108,6 +131,21 @@ local({ } + heredoc <- function(text, leave = 0) { + + # remove leading, trailing whitespace + trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text) + + # split into lines + lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]] + + # compute common indent + indent <- regexpr("[^[:space:]]", lines) + common <- min(setdiff(indent, -1L)) - leave + paste(substring(lines, common), collapse = "\n") + + } + startswith <- function(string, prefix) { substring(string, 1, nchar(prefix)) == prefix } @@ -610,6 +648,9 @@ local({ # if the user has requested an automatic prefix, generate it auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) + if (is.na(auto) && getRversion() >= "4.4.0") + auto <- "TRUE" + if (auto %in% c("TRUE", "True", "true", "1")) return(renv_bootstrap_platform_prefix_auto()) @@ -801,24 +842,23 @@ local({ # the loaded version of renv doesn't match the requested version; # give the user instructions on how to proceed - remote <- if (!is.null(description[["RemoteSha"]])) { + dev <- identical(description[["RemoteType"]], "github") + remote <- if (dev) paste("rstudio/renv", description[["RemoteSha"]], sep = "@") - } else { + else paste("renv", description[["Version"]], sep = "@") - } # display both loaded version + sha if available friendly <- renv_bootstrap_version_friendly( version = description[["Version"]], - sha = description[["RemoteSha"]] + sha = if (dev) description[["RemoteSha"]] ) - fmt <- paste( - "renv %1$s was loaded from project library, but this project is configured to use renv %2$s.", - "- Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.", - "- Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", - sep = "\n" - ) + fmt <- heredoc(" + renv %1$s was loaded from project library, but this project is configured to use renv %2$s. + - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile. + - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library. + ") catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) FALSE @@ -1041,7 +1081,7 @@ local({ # if jsonlite is loaded, use that instead if ("jsonlite" %in% loadedNamespaces()) { - json <- catch(renv_json_read_jsonlite(file, text)) + json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) if (!inherits(json, "error")) return(json) @@ -1050,7 +1090,7 @@ local({ } # otherwise, fall back to the default JSON reader - json <- catch(renv_json_read_default(file, text)) + json <- tryCatch(renv_json_read_default(file, text), error = identity) if (!inherits(json, "error")) return(json) @@ -1063,14 +1103,14 @@ local({ } renv_json_read_jsonlite <- function(file = NULL, text = NULL) { - text <- paste(text %||% read(file), collapse = "\n") + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") jsonlite::fromJSON(txt = text, simplifyVector = FALSE) } renv_json_read_default <- function(file = NULL, text = NULL) { # find strings in the JSON - text <- paste(text %||% read(file), collapse = "\n") + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' locs <- gregexpr(pattern, text, perl = TRUE)[[1]] @@ -1118,14 +1158,14 @@ local({ map <- as.list(map) # remap strings in object - remapped <- renv_json_remap(json, map) + remapped <- renv_json_read_remap(json, map) # evaluate eval(remapped, envir = baseenv()) } - renv_json_remap <- function(json, map) { + renv_json_read_remap <- function(json, map) { # fix names if (!is.null(names(json))) { @@ -1152,7 +1192,7 @@ local({ # recurse if (is.recursive(json)) { for (i in seq_along(json)) { - json[i] <- list(renv_json_remap(json[[i]], map)) + json[i] <- list(renv_json_read_remap(json[[i]], map)) } } From 47df1f20790326fe208df7c4c4fd838b3499d5c3 Mon Sep 17 00:00:00 2001 From: Katherine Heal Date: Fri, 5 Jul 2024 17:40:36 -0700 Subject: [PATCH 2/2] Add libraries.R and update contributing guide for R dependency management. --- .github/CONTRIBUTING.md | 19 ++++++++++++++++--- libraries.R | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 840d59af..c831c4b9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -93,13 +93,26 @@ _or_ ### R -This project uses `renv` for package management. After cloning the github repository, open the R project and run `renv::restore()` to make sure your packages match. To learn more about how renv works, [see this resource](https://rstudio.github.io/renv/articles/renv.html). +This project uses `renv` for package management. We maintain a libraries.R mini script that calls the necessary packages for the project for local development because renv does not track library calls withing .ipynb files (only.R or .Rmd files). + +#### To install the R dependencies: + +1. Clone the github repository +2. Open the R project +3. Run `renv::restore()` to make sure your packages match. To learn more about how renv works, [see this resource](https://rstudio.github.io/renv/articles/renv.html). + +#### To add new R dependencie: + +1. Install the library with `renv::install("package_name")`. +2. Add the package to the libraries.R file so that `renv` can track it (e.g. `library("package_name")`. +3. Run `renv::snapshot()` to update the lockfile. +4. Commit changes and push to github. ### Python This project uses pip paired with venv to manage dependencies. Note that requirements_dev.txt should be used and updated for local development dependencies, and requirements.txt should be used for production/binder dependencies (updated manually and with discretion). -#### To install the dependencies: +#### To install the python dependencies: 1. Clone the github repository 2. create a virtual environment: @@ -111,7 +124,7 @@ This project uses pip paired with venv to manage dependencies. Note that require **Note** to update your package installations: `pip install -U -r requirements_dev.txt` -#### To add new packages: +#### To add new python dependencies: 1. Activate the virtual environment: `source venv/bin/activate` diff --git a/libraries.R b/libraries.R index af4121c4..56ded3df 100644 --- a/libraries.R +++ b/libraries.R @@ -1,3 +1,5 @@ +# This file contains the libraries that are used in the R juptyer notebooks to facilitate reproducibility using the renv package. + library(jsonlite) library(dplyr) library(tidyr)