diff --git a/.Rprofile b/.Rprofile new file mode 100644 index 00000000..81b960f5 --- /dev/null +++ b/.Rprofile @@ -0,0 +1 @@ +source("renv/activate.R") diff --git a/renv.lock b/renv.lock deleted file mode 100644 index 79618ea5..00000000 --- a/renv.lock +++ /dev/null @@ -1,1407 +0,0 @@ -{ - "R": { - "Version": "4.1.0", - "Repositories": [ - { - "Name": "CRAN", - "URL": "https://cran.rstudio.com" - } - ] - }, - "Packages": { - "BH": { - "Package": "BH", - "Version": "1.75.0-0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "e4c04affc2cac20c8fec18385cd14691", - "Requirements": [] - }, - "MASS": { - "Package": "MASS", - "Version": "7.3-54", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "0e59129db205112e3963904db67fd0dc", - "Requirements": [] - }, - "Matrix": { - "Package": "Matrix", - "Version": "1.3-3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "df57c82e79600601287edfdcef92c2d6", - "Requirements": [ - "lattice" - ] - }, - "R6": { - "Package": "R6", - "Version": "2.5.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "470851b6d5d0ac559e9d01bb352b4021", - "Requirements": [] - }, - "RColorBrewer": { - "Package": "RColorBrewer", - "Version": "1.1-2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "e031418365a7f7a766181ab5a41a5716", - "Requirements": [] - }, - "XML": { - "Package": "XML", - "Version": "3.99-0.6", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "59b7d0a3d18303ae30ba1246e77faa83", - "Requirements": [] - }, - "askpass": { - "Package": "askpass", - "Version": "1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "e8a22846fff485f0be3770c2da758713", - "Requirements": [ - "sys" - ] - }, - "assertthat": { - "Package": "assertthat", - "Version": "0.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "50c838a310445e954bc13f26f26a6ecf", - "Requirements": [] - }, - "backports": { - "Package": "backports", - "Version": "1.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "644043219fc24e190c2f620c1a380a69", - "Requirements": [] - }, - "base64enc": { - "Package": "base64enc", - "Version": "0.1-3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "543776ae6848fde2f48ff3816d0628bc", - "Requirements": [] - }, - "base64url": { - "Package": "base64url", - "Version": "1.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "0c54cf3a08cc0e550fbd64ad33166143", - "Requirements": [ - "backports" - ] - }, - "brew": { - "Package": "brew", - "Version": "1.0-6", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "92a5f887f9ae3035ac7afde22ba73ee9", - "Requirements": [] - }, - "brio": { - "Package": "brio", - "Version": "1.1.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "2f01e16ff9571fe70381c7b9ae560dc4", - "Requirements": [] - }, - "bslib": { - "Package": "bslib", - "Version": "0.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "56ae7e1987b340186a8a5a157c2ec358", - "Requirements": [ - "htmltools", - "jquerylib", - "jsonlite", - "rlang", - "sass" - ] - }, - "cachem": { - "Package": "cachem", - "Version": "1.0.5", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "5346f76a33eb7417812c270b04a5581b", - "Requirements": [ - "fastmap", - "rlang" - ] - }, - "callr": { - "Package": "callr", - "Version": "3.7.3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "9b2191ede20fa29828139b9900922e51", - "Requirements": [ - "R6", - "processx" - ] - }, - "cli": { - "Package": "cli", - "Version": "3.6.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "3177a5a16c243adc199ba33117bd9657", - "Requirements": [] - }, - "clipr": { - "Package": "clipr", - "Version": "0.7.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "ebaa97ac99cc2daf04e77eecc7b781d7", - "Requirements": [] - }, - "colorspace": { - "Package": "colorspace", - "Version": "2.0-1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "6cab523af06ac301e7a40c5529d45882", - "Requirements": [] - }, - "commonmark": { - "Package": "commonmark", - "Version": "1.7", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "0f22be39ec1d141fd03683c06f3a6e67", - "Requirements": [] - }, - "cpp11": { - "Package": "cpp11", - "Version": "0.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "40ba3fd26c8f61d8d14d334bc7761df9", - "Requirements": [] - }, - "crayon": { - "Package": "crayon", - "Version": "1.5.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "e8a1e41acf02548751f45c718d55aa6a", - "Requirements": [] - }, - "credentials": { - "Package": "credentials", - "Version": "1.3.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "a96728288c75a814c900af9da84387be", - "Requirements": [ - "askpass", - "curl", - "jsonlite", - "openssl", - "sys" - ] - }, - "curl": { - "Package": "curl", - "Version": "5.0.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "511bacbfa153a15251166b463b4da4f9", - "Requirements": [] - }, - "data.table": { - "Package": "data.table", - "Version": "1.14.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "d1b8b1a821ee564a3515fa6c6d5c52dc", - "Requirements": [] - }, - "desc": { - "Package": "desc", - "Version": "1.3.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "b6963166f7f10b970af1006c462ce6cd", - "Requirements": [ - "R6", - "crayon", - "rprojroot" - ] - }, - "devtools": { - "Package": "devtools", - "Version": "2.4.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "048d0b914d2cea61f440d35dd3cbddac", - "Requirements": [ - "callr", - "cli", - "desc", - "ellipsis", - "fs", - "httr", - "lifecycle", - "memoise", - "pkgbuild", - "pkgload", - "rcmdcheck", - "remotes", - "rlang", - "roxygen2", - "rstudioapi", - "rversions", - "sessioninfo", - "testthat", - "usethis", - "withr" - ] - }, - "diffobj": { - "Package": "diffobj", - "Version": "0.3.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "feb5b7455eba422a2c110bb89852e6a3", - "Requirements": [ - "crayon" - ] - }, - "digest": { - "Package": "digest", - "Version": "0.6.31", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "8b708f296afd9ae69f450f9640be8990", - "Requirements": [] - }, - "downlit": { - "Package": "downlit", - "Version": "0.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "ba63dc9ab5a31f3209892437e40c5f60", - "Requirements": [ - "brio", - "desc", - "digest", - "evaluate", - "fansi", - "memoise", - "rlang", - "vctrs", - "yaml" - ] - }, - "dplyr": { - "Package": "dplyr", - "Version": "1.0.6", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "19e84500b64bc7e589cb1e2550e25832", - "Requirements": [ - "R6", - "ellipsis", - "generics", - "glue", - "lifecycle", - "magrittr", - "pillar", - "rlang", - "tibble", - "tidyselect", - "vctrs" - ] - }, - "drake": { - "Package": "drake", - "Version": "7.13.3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "0c7f735ec457ec8d499be5c1ea5a647d", - "Requirements": [ - "base64url", - "digest", - "igraph", - "rlang", - "storr", - "tidyselect", - "txtq", - "vctrs" - ] - }, - "ellipsis": { - "Package": "ellipsis", - "Version": "0.3.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077", - "Requirements": [ - "rlang" - ] - }, - "evaluate": { - "Package": "evaluate", - "Version": "0.20", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "4b68aa51edd89a0e044a66e75ae3cc6c", - "Requirements": [] - }, - "fansi": { - "Package": "fansi", - "Version": "0.4.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "fea074fb67fe4c25d47ad09087da847d", - "Requirements": [] - }, - "farver": { - "Package": "farver", - "Version": "2.1.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "c98eb5133d9cb9e1622b8691487f11bb", - "Requirements": [] - }, - "fastmap": { - "Package": "fastmap", - "Version": "1.1.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "77bd60a6157420d4ffa93b27cf6a58b8", - "Requirements": [] - }, - "filelock": { - "Package": "filelock", - "Version": "1.0.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "38ec653c2613bed60052ba3787bd8a2c", - "Requirements": [] - }, - "fs": { - "Package": "fs", - "Version": "1.5.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "44594a07a42e5f91fac9f93fda6d0109", - "Requirements": [] - }, - "generics": { - "Package": "generics", - "Version": "0.1.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "4d243a9c10b00589889fe32314ffd902", - "Requirements": [] - }, - "gert": { - "Package": "gert", - "Version": "1.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "8612346a70ca2b2bebb0ef008d5c0e30", - "Requirements": [ - "askpass", - "credentials", - "openssl", - "rstudioapi", - "sys", - "zip" - ] - }, - "ggplot2": { - "Package": "ggplot2", - "Version": "3.3.5", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "d7566c471c7b17e095dd023b9ef155ad", - "Requirements": [ - "MASS", - "digest", - "glue", - "gtable", - "isoband", - "mgcv", - "rlang", - "scales", - "tibble", - "withr" - ] - }, - "gh": { - "Package": "gh", - "Version": "1.3.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "38c2580abbda249bd6afeec00d14f531", - "Requirements": [ - "cli", - "gitcreds", - "httr", - "ini", - "jsonlite" - ] - }, - "gitcreds": { - "Package": "gitcreds", - "Version": "0.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "f3aefccc1cc50de6338146b62f115de8", - "Requirements": [] - }, - "glue": { - "Package": "glue", - "Version": "1.4.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "6efd734b14c6471cfe443345f3e35e29", - "Requirements": [] - }, - "gtable": { - "Package": "gtable", - "Version": "0.3.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "ac5c6baf7822ce8732b343f14c072c4d", - "Requirements": [] - }, - "highr": { - "Package": "highr", - "Version": "0.9", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "8eb36c8125038e648e5d111c0d7b2ed4", - "Requirements": [ - "xfun" - ] - }, - "hms": { - "Package": "hms", - "Version": "1.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "5b8a2dd0fdbe2ab4f6081e6c7be6dfca", - "Requirements": [ - "ellipsis", - "lifecycle", - "pkgconfig", - "rlang", - "vctrs" - ] - }, - "htmltools": { - "Package": "htmltools", - "Version": "0.5.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "526c484233f42522278ab06fb185cb26", - "Requirements": [ - "base64enc", - "digest", - "fastmap", - "rlang" - ] - }, - "httr": { - "Package": "httr", - "Version": "1.4.7", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "ac107251d9d9fd72f0ca8049988f1d7f", - "Requirements": [ - "R6", - "curl", - "jsonlite", - "mime", - "openssl" - ] - }, - "igraph": { - "Package": "igraph", - "Version": "1.2.11", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "1d10cd31c2979f9c819ffe4d16b9dc2b", - "Requirements": [ - "Matrix", - "magrittr", - "pkgconfig" - ] - }, - "ini": { - "Package": "ini", - "Version": "0.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "6154ec2223172bce8162d4153cda21f7", - "Requirements": [] - }, - "isoband": { - "Package": "isoband", - "Version": "0.2.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "b2008df40fb297e3fef135c7e8eeec1a", - "Requirements": [] - }, - "jquerylib": { - "Package": "jquerylib", - "Version": "0.1.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "5aab57a3bd297eee1c1d862735972182", - "Requirements": [ - "htmltools" - ] - }, - "jsonlite": { - "Package": "jsonlite", - "Version": "1.8.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "a4269a09a9b865579b2635c77e572374", - "Requirements": [] - }, - "kableExtra": { - "Package": "kableExtra", - "Version": "1.3.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "49b625e6aabe4c5f091f5850aba8ff78", - "Requirements": [ - "digest", - "glue", - "htmltools", - "knitr", - "magrittr", - "rmarkdown", - "rstudioapi", - "rvest", - "scales", - "stringr", - "svglite", - "viridisLite", - "webshot", - "xml2" - ] - }, - "knitr": { - "Package": "knitr", - "Version": "1.42", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "8329a9bcc82943c8069104d4be3ee22d", - "Requirements": [ - "evaluate", - "highr", - "xfun", - "yaml" - ] - }, - "labeling": { - "Package": "labeling", - "Version": "0.4.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "3d5108641f47470611a32d0bdf357a72", - "Requirements": [] - }, - "lattice": { - "Package": "lattice", - "Version": "0.20-44", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "f36bf1a849d9106dc2af72e501f9de41", - "Requirements": [] - }, - "lifecycle": { - "Package": "lifecycle", - "Version": "1.0.3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "001cecbeac1cff9301bdc3775ee46a86", - "Requirements": [ - "cli", - "glue", - "rlang" - ] - }, - "magrittr": { - "Package": "magrittr", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "41287f1ac7d28a92f0a286ed507928d3", - "Requirements": [] - }, - "memoise": { - "Package": "memoise", - "Version": "2.0.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "a0bc51650201a56d00a4798523cc91b3", - "Requirements": [ - "cachem", - "rlang" - ] - }, - "mgcv": { - "Package": "mgcv", - "Version": "1.8-35", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "89fd8b2ad4a6cb4979b78cf2a77ab503", - "Requirements": [ - "Matrix", - "nlme" - ] - }, - "mime": { - "Package": "mime", - "Version": "0.12", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "18e9c28c1d3ca1560ce30658b22ce104", - "Requirements": [] - }, - "mockr": { - "Package": "mockr", - "Version": "0.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "94fb0fbd659d4f439dafa71213cbeca1", - "Requirements": [ - "rlang", - "withr" - ] - }, - "munsell": { - "Package": "munsell", - "Version": "0.5.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "6dfe8bf774944bd5595785e3229d8771", - "Requirements": [ - "colorspace" - ] - }, - "nlme": { - "Package": "nlme", - "Version": "3.1-152", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "35de1ce639f20b5e10f7f46260730c65", - "Requirements": [ - "lattice" - ] - }, - "openssl": { - "Package": "openssl", - "Version": "2.0.6", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "0f7cd2962e3044bb940cca4f4b5cecbe", - "Requirements": [ - "askpass" - ] - }, - "pillar": { - "Package": "pillar", - "Version": "1.7.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "51dfc97e1b7069e9f7e6f83f3589c22e", - "Requirements": [ - "cli", - "crayon", - "ellipsis", - "fansi", - "glue", - "lifecycle", - "rlang", - "utf8", - "vctrs" - ] - }, - "pkgbuild": { - "Package": "pkgbuild", - "Version": "1.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "725fcc30222d4d11ec68efb8ff11a9af", - "Requirements": [ - "R6", - "callr", - "cli", - "crayon", - "desc", - "prettyunits", - "rprojroot", - "withr" - ] - }, - "pkgconfig": { - "Package": "pkgconfig", - "Version": "2.0.3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "01f28d4278f15c76cddbea05899c5d6f", - "Requirements": [] - }, - "pkgdown": { - "Package": "pkgdown", - "Version": "2.0.7", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "16fa15449c930bf3a7761d3c68f8abf9", - "Requirements": [ - "bslib", - "callr", - "cli", - "desc", - "digest", - "downlit", - "fs", - "httr", - "jsonlite", - "magrittr", - "memoise", - "purrr", - "ragg", - "rlang", - "rmarkdown", - "tibble", - "whisker", - "withr", - "xml2", - "yaml" - ] - }, - "pkgload": { - "Package": "pkgload", - "Version": "1.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "463642747f81879e6752485aefb831cf", - "Requirements": [ - "cli", - "crayon", - "desc", - "rlang", - "rprojroot", - "rstudioapi", - "withr" - ] - }, - "praise": { - "Package": "praise", - "Version": "1.0.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "a555924add98c99d2f411e37e7d25e9f", - "Requirements": [] - }, - "prettyunits": { - "Package": "prettyunits", - "Version": "1.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "95ef9167b75dde9d2ccc3c7528393e7e", - "Requirements": [] - }, - "processx": { - "Package": "processx", - "Version": "3.8.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "3efbd8ac1be0296a46c55387aeace0f3", - "Requirements": [ - "R6", - "ps" - ] - }, - "ps": { - "Package": "ps", - "Version": "1.6.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "32620e2001c1dce1af49c49dccbb9420", - "Requirements": [] - }, - "purrr": { - "Package": "purrr", - "Version": "0.3.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "97def703420c8ab10d8f0e6c72101e02", - "Requirements": [ - "magrittr", - "rlang" - ] - }, - "ragg": { - "Package": "ragg", - "Version": "1.2.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "14932bb6f2739c771ca4ceaba6b4248e", - "Requirements": [ - "systemfonts", - "textshaping" - ] - }, - "rappdirs": { - "Package": "rappdirs", - "Version": "0.3.3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "5e3c5dc0b071b21fa128676560dbe94d", - "Requirements": [] - }, - "rcmdcheck": { - "Package": "rcmdcheck", - "Version": "1.3.3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "ed95895886dab6d2a584da45503555da", - "Requirements": [ - "R6", - "callr", - "cli", - "crayon", - "desc", - "digest", - "pkgbuild", - "prettyunits", - "rprojroot", - "sessioninfo", - "withr", - "xopen" - ] - }, - "readr": { - "Package": "readr", - "Version": "1.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "2639976851f71f330264a9c9c3d43a61", - "Requirements": [ - "BH", - "R6", - "cli", - "clipr", - "cpp11", - "crayon", - "hms", - "lifecycle", - "rlang", - "tibble" - ] - }, - "rematch2": { - "Package": "rematch2", - "Version": "2.1.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "76c9e04c712a05848ae7a23d2f170a40", - "Requirements": [ - "tibble" - ] - }, - "remotes": { - "Package": "remotes", - "Version": "2.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "a85ebb35721573b196317b49ddd2dfe4", - "Requirements": [] - }, - "renv": { - "Package": "renv", - "Version": "0.16.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "c9e8442ab69bc21c9697ecf856c1e6c7", - "Requirements": [] - }, - "rlang": { - "Package": "rlang", - "Version": "1.0.6", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "4ed1f8336c8d52c3e750adcdc57228a7", - "Requirements": [] - }, - "rmarkdown": { - "Package": "rmarkdown", - "Version": "2.14", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "31b60a882fabfabf6785b8599ffeb8ba", - "Requirements": [ - "bslib", - "evaluate", - "htmltools", - "jquerylib", - "jsonlite", - "knitr", - "stringr", - "tinytex", - "xfun", - "yaml" - ] - }, - "roxygen2": { - "Package": "roxygen2", - "Version": "7.2.3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "7b153c746193b143c14baa072bae4e27", - "Requirements": [ - "R6", - "brew", - "cli", - "commonmark", - "cpp11", - "desc", - "knitr", - "pkgload", - "purrr", - "rlang", - "stringi", - "stringr", - "withr", - "xml2" - ] - }, - "rprojroot": { - "Package": "rprojroot", - "Version": "2.0.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "249d8cd1e74a8f6a26194a91b47f21d1", - "Requirements": [] - }, - "rstudioapi": { - "Package": "rstudioapi", - "Version": "0.13", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "06c85365a03fdaf699966cc1d3cf53ea", - "Requirements": [] - }, - "rversions": { - "Package": "rversions", - "Version": "2.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "f88fab00907b312f8b23ec13e2d437cb", - "Requirements": [ - "curl", - "xml2" - ] - }, - "rvest": { - "Package": "rvest", - "Version": "1.0.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "74b905b0076e1de6e27f540c95ba68d5", - "Requirements": [ - "httr", - "lifecycle", - "magrittr", - "rlang", - "selectr", - "tibble", - "xml2" - ] - }, - "sass": { - "Package": "sass", - "Version": "0.4.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "f37c0028d720bab3c513fd65d28c7234", - "Requirements": [ - "R6", - "fs", - "htmltools", - "rappdirs", - "rlang" - ] - }, - "scales": { - "Package": "scales", - "Version": "1.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "6f76f71042411426ec8df6c54f34e6dd", - "Requirements": [ - "R6", - "RColorBrewer", - "farver", - "labeling", - "lifecycle", - "munsell", - "viridisLite" - ] - }, - "selectr": { - "Package": "selectr", - "Version": "0.4-2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "3838071b66e0c566d55cc26bd6e27bf4", - "Requirements": [ - "R6", - "stringr" - ] - }, - "sessioninfo": { - "Package": "sessioninfo", - "Version": "1.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "308013098befe37484df72c39cf90d6e", - "Requirements": [ - "cli", - "withr" - ] - }, - "storr": { - "Package": "storr", - "Version": "1.2.5", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "96034207276a46a44dc81b8d43397602", - "Requirements": [ - "R6", - "digest" - ] - }, - "stringi": { - "Package": "stringi", - "Version": "1.6.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "3b9a9c9454b864b08713715396689b9e", - "Requirements": [] - }, - "stringr": { - "Package": "stringr", - "Version": "1.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "0759e6b6c0957edb1311028a49a35e76", - "Requirements": [ - "glue", - "magrittr", - "stringi" - ] - }, - "svglite": { - "Package": "svglite", - "Version": "2.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "29442899581643411facb66f4add846a", - "Requirements": [ - "cpp11", - "systemfonts" - ] - }, - "sys": { - "Package": "sys", - "Version": "3.4.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "34c16f1ef796057bfa06d3f4ff818a5d", - "Requirements": [] - }, - "systemfonts": { - "Package": "systemfonts", - "Version": "1.0.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "90b28393209827327de889f49935140a", - "Requirements": [ - "cpp11" - ] - }, - "testthat": { - "Package": "testthat", - "Version": "3.0.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "575216c9946ca70016c3ffb9c31709ba", - "Requirements": [ - "R6", - "brio", - "callr", - "cli", - "crayon", - "desc", - "digest", - "ellipsis", - "evaluate", - "jsonlite", - "lifecycle", - "magrittr", - "pkgload", - "praise", - "processx", - "ps", - "rlang", - "waldo", - "withr" - ] - }, - "textshaping": { - "Package": "textshaping", - "Version": "0.3.6", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "1ab6223d3670fac7143202cb6a2d43d5", - "Requirements": [ - "cpp11", - "systemfonts" - ] - }, - "tibble": { - "Package": "tibble", - "Version": "3.1.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "349b40a9f144516d537c875e786ec8b8", - "Requirements": [ - "ellipsis", - "fansi", - "lifecycle", - "magrittr", - "pillar", - "pkgconfig", - "rlang", - "vctrs" - ] - }, - "tidyr": { - "Package": "tidyr", - "Version": "1.1.3", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "450d7dfaedde58e28586b854eeece4fa", - "Requirements": [ - "cpp11", - "dplyr", - "ellipsis", - "glue", - "lifecycle", - "magrittr", - "purrr", - "rlang", - "tibble", - "tidyselect", - "vctrs" - ] - }, - "tidyselect": { - "Package": "tidyselect", - "Version": "1.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "7243004a708d06d4716717fa1ff5b2fe", - "Requirements": [ - "ellipsis", - "glue", - "purrr", - "rlang", - "vctrs" - ] - }, - "tinytex": { - "Package": "tinytex", - "Version": "0.31", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "25b572f764f3c19fef9aac33b5724f3d", - "Requirements": [ - "xfun" - ] - }, - "txtq": { - "Package": "txtq", - "Version": "0.2.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "47bc241ac3efaa6b75109c00ad708448", - "Requirements": [ - "R6", - "base64url", - "filelock" - ] - }, - "usethis": { - "Package": "usethis", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "360e904f9e623286e1a0c6ca0a98c5f6", - "Requirements": [ - "cli", - "clipr", - "crayon", - "curl", - "desc", - "fs", - "gert", - "gh", - "glue", - "jsonlite", - "lifecycle", - "purrr", - "rappdirs", - "rlang", - "rprojroot", - "rstudioapi", - "whisker", - "withr", - "yaml" - ] - }, - "utf8": { - "Package": "utf8", - "Version": "1.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "c3ad47dc6da0751f18ed53c4613e3ac7", - "Requirements": [] - }, - "vctrs": { - "Package": "vctrs", - "Version": "0.3.8", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "ecf749a1b39ea72bd9b51b76292261f1", - "Requirements": [ - "ellipsis", - "glue", - "rlang" - ] - }, - "viridisLite": { - "Package": "viridisLite", - "Version": "0.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "55e157e2aa88161bdb0754218470d204", - "Requirements": [] - }, - "waldo": { - "Package": "waldo", - "Version": "0.2.5", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "20c45f1d511a3f730b7b469f4d11e104", - "Requirements": [ - "cli", - "diffobj", - "fansi", - "glue", - "rematch2", - "rlang", - "tibble" - ] - }, - "webshot": { - "Package": "webshot", - "Version": "0.5.5", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "16858ee1aba97f902d24049d4a44ef16", - "Requirements": [ - "callr", - "jsonlite", - "magrittr" - ] - }, - "whisker": { - "Package": "whisker", - "Version": "0.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "ca970b96d894e90397ed20637a0c1bbe", - "Requirements": [] - }, - "withr": { - "Package": "withr", - "Version": "2.5.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "c0e49a9760983e81e55cdd9be92e7182", - "Requirements": [] - }, - "xfun": { - "Package": "xfun", - "Version": "0.39", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "8f56e9acb54fb525e66464d57ab58bcb", - "Requirements": [] - }, - "xml2": { - "Package": "xml2", - "Version": "1.3.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "d4d71a75dd3ea9eb5fa28cc21f9585e2", - "Requirements": [] - }, - "xopen": { - "Package": "xopen", - "Version": "1.0.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "6c85f015dee9cc7710ddd20f86881f58", - "Requirements": [ - "processx" - ] - }, - "yaml": { - "Package": "yaml", - "Version": "2.3.7", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "0d0056cc5383fbc240ccd0cb584bf436", - "Requirements": [] - }, - "zip": { - "Package": "zip", - "Version": "2.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "c7eef2996ac270a18c2715c997a727c5", - "Requirements": [] - } - } -} diff --git a/renv/activate.R b/renv/activate.R index 019b5a66..ff7e6550 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,50 +2,18 @@ local({ # the requested version of renv - version <- "0.16.0" + version <- "0.12.0" # the project directory project <- getwd() - # figure out whether the autoloader is enabled - enabled <- local({ - - # first, check config option - override <- getOption("renv.config.autoloader.enabled") - if (!is.null(override)) - return(override) - - # next, check environment variables - # TODO: prefer using the configuration one in the future - envvars <- c( - "RENV_CONFIG_AUTOLOADER_ENABLED", - "RENV_AUTOLOADER_ENABLED", - "RENV_ACTIVATE_PROJECT" - ) - - for (envvar in envvars) { - envval <- Sys.getenv(envvar, unset = NA) - if (!is.na(envval)) - return(tolower(envval) %in% c("true", "t", "1")) - } - - # enable by default - TRUE - - }) - - if (!enabled) - return(FALSE) - # avoid recursion - if (identical(getOption("renv.autoloader.running"), TRUE)) { - warning("ignoring recursive attempt to run renv autoloader") + if (!is.na(Sys.getenv("RENV_R_INITIALIZING", unset = NA))) return(invisible(TRUE)) - } # signal that we're loading renv during R startup - options(renv.autoloader.running = TRUE) - on.exit(options(renv.autoloader.running = NULL), add = TRUE) + Sys.setenv("RENV_R_INITIALIZING" = "true") + on.exit(Sys.unsetenv("RENV_R_INITIALIZING"), add = TRUE) # signal that we've consented to use renv options(renv.consent = TRUE) @@ -54,17 +22,33 @@ local({ # mask 'utils' packages, will come first on the search path library(utils, lib.loc = .Library) - # unload renv if it's already been loaded - if ("renv" %in% loadedNamespaces()) + # check to see if renv has already been loaded + if ("renv" %in% loadedNamespaces()) { + + # if renv has already been loaded, and it's the requested version of renv, + # nothing to do + spec <- .getNamespaceInfo(.getNamespace("renv"), "spec") + if (identical(spec[["version"]], version)) + return(invisible(TRUE)) + + # otherwise, unload and attempt to load the correct version of renv unloadNamespace("renv") - # load bootstrap tools - `%||%` <- function(x, y) { - if (is.environment(x) || length(x)) x else y } - + + # load bootstrap tools bootstrap <- function(version, library) { + # read repos (respecting override if set) + repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) + if (is.na(repos)) + repos <- getOption("repos") + + # fix up repos + on.exit(options(repos = repos), add = TRUE) + repos[repos == "@CRAN@"] <- "https://cloud.r-project.org" + options(repos = repos) + # attempt to download renv tarball <- tryCatch(renv_bootstrap_download(version), error = identity) if (inherits(tarball, "error")) @@ -77,102 +61,6 @@ local({ } - renv_bootstrap_tests_running <- function() { - getOption("renv.tests.running", default = FALSE) - } - - renv_bootstrap_repos <- function() { - - # check for repos override - repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) - if (!is.na(repos)) - return(repos) - - # check for lockfile repositories - repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity) - if (!inherits(repos, "error") && length(repos)) - return(repos) - - # if we're testing, re-use the test repositories - if (renv_bootstrap_tests_running()) - return(getOption("renv.tests.repos")) - - # retrieve current repos - repos <- getOption("repos") - - # ensure @CRAN@ entries are resolved - repos[repos == "@CRAN@"] <- getOption( - "renv.repos.cran", - "https://cloud.r-project.org" - ) - - # add in renv.bootstrap.repos if set - default <- c(FALLBACK = "https://cloud.r-project.org") - extra <- getOption("renv.bootstrap.repos", default = default) - repos <- c(repos, extra) - - # remove duplicates that might've snuck in - dupes <- duplicated(repos) | duplicated(names(repos)) - repos[!dupes] - - } - - renv_bootstrap_repos_lockfile <- function() { - - lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock") - if (!file.exists(lockpath)) - return(NULL) - - lockfile <- tryCatch(renv_json_read(lockpath), error = identity) - if (inherits(lockfile, "error")) { - warning(lockfile) - return(NULL) - } - - repos <- lockfile$R$Repositories - if (length(repos) == 0) - return(NULL) - - keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1)) - vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1)) - names(vals) <- keys - - return(vals) - - } - - renv_bootstrap_download <- function(version) { - - # if the renv version number has 4 components, assume it must - # be retrieved via github - nv <- numeric_version(version) - components <- unclass(nv)[[1]] - - # if this appears to be a development version of 'renv', we'll - # try to restore from github - dev <- length(components) == 4L - - # begin collecting different methods for finding renv - methods <- c( - renv_bootstrap_download_tarball, - if (dev) - renv_bootstrap_download_github - else c( - renv_bootstrap_download_cran_latest, - renv_bootstrap_download_cran_archive - ) - ) - - for (method in methods) { - path <- tryCatch(method(version), error = identity) - if (is.character(path) && file.exists(path)) - return(path) - } - - stop("failed to download renv ", version) - - } - renv_bootstrap_download_impl <- function(url, destfile) { mode <- "wb" @@ -185,136 +73,69 @@ local({ if (fixup) mode <- "w+b" - args <- list( + download.file( url = url, destfile = destfile, mode = mode, quiet = TRUE ) - if ("headers" %in% names(formals(utils::download.file))) - args$headers <- renv_bootstrap_download_custom_headers(url) - - do.call(utils::download.file, args) - } - renv_bootstrap_download_custom_headers <- function(url) { - - headers <- getOption("renv.download.headers") - if (is.null(headers)) - return(character()) - - if (!is.function(headers)) - stopf("'renv.download.headers' is not a function") - - headers <- headers(url) - if (length(headers) == 0L) - return(character()) - - if (is.list(headers)) - headers <- unlist(headers, recursive = FALSE, use.names = TRUE) + renv_bootstrap_download <- function(version) { - ok <- - is.character(headers) && - is.character(names(headers)) && - all(nzchar(names(headers))) + methods <- list( + renv_bootstrap_download_cran_latest, + renv_bootstrap_download_cran_archive, + renv_bootstrap_download_github + ) - if (!ok) - stop("invocation of 'renv.download.headers' did not return a named character vector") + for (method in methods) { + path <- tryCatch(method(version), error = identity) + if (is.character(path) && file.exists(path)) + return(path) + } - headers + stop("failed to download renv ", version) } renv_bootstrap_download_cran_latest <- function(version) { - spec <- renv_bootstrap_download_cran_latest_find(version) - type <- spec$type - repos <- spec$repos + # check for renv on CRAN matching this version + db <- as.data.frame(available.packages(), stringsAsFactors = FALSE) - message("* Downloading renv ", version, " ... ", appendLF = FALSE) + entry <- db[db$Package %in% "renv" & db$Version %in% version, ] + if (nrow(entry) == 0) { + fmt <- "renv %s is not available from your declared package repositories" + stop(sprintf(fmt, version)) + } - baseurl <- utils::contrib.url(repos = repos, type = type) - ext <- if (identical(type, "source")) - ".tar.gz" - else if (Sys.info()[["sysname"]] == "Windows") - ".zip" - else - ".tgz" - name <- sprintf("renv_%s%s", version, ext) - url <- paste(baseurl, name, sep = "/") + message("* Downloading renv ", version, " from CRAN ... ", appendLF = FALSE) - destfile <- file.path(tempdir(), name) - status <- tryCatch( - renv_bootstrap_download_impl(url, destfile), + info <- tryCatch( + download.packages("renv", destdir = tempdir()), condition = identity ) - if (inherits(status, "condition")) { + if (inherits(info, "condition")) { message("FAILED") return(FALSE) } - # report success and return - message("OK (downloaded ", type, ")") - destfile - - } - - renv_bootstrap_download_cran_latest_find <- function(version) { - - # check whether binaries are supported on this system - binary <- - getOption("renv.bootstrap.binary", default = TRUE) && - !identical(.Platform$pkgType, "source") && - !identical(getOption("pkgType"), "source") && - Sys.info()[["sysname"]] %in% c("Darwin", "Windows") - - types <- c(if (binary) "binary", "source") - - # iterate over types + repositories - for (type in types) { - for (repos in renv_bootstrap_repos()) { - - # retrieve package database - db <- tryCatch( - as.data.frame( - utils::available.packages(type = type, repos = repos), - stringsAsFactors = FALSE - ), - error = identity - ) - - if (inherits(db, "error")) - next - - # check for compatible entry - entry <- db[db$Package %in% "renv" & db$Version %in% version, ] - if (nrow(entry) == 0) - next - - # found it; return spec to caller - spec <- list(entry = entry, type = type, repos = repos) - return(spec) - - } - } - - # if we got here, we failed to find renv - fmt <- "renv %s is not available from your declared package repositories" - stop(sprintf(fmt, version)) + message("OK") + info[1, 2] } renv_bootstrap_download_cran_archive <- function(version) { name <- sprintf("renv_%s.tar.gz", version) - repos <- renv_bootstrap_repos() + repos <- getOption("repos") urls <- file.path(repos, "src/contrib/Archive/renv", name) destfile <- file.path(tempdir(), name) - message("* Downloading renv ", version, " ... ", appendLF = FALSE) + message("* Downloading renv ", version, " from CRAN archive ... ", appendLF = FALSE) for (url in urls) { @@ -335,42 +156,6 @@ local({ } - renv_bootstrap_download_tarball <- function(version) { - - # if the user has provided the path to a tarball via - # an environment variable, then use it - tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA) - if (is.na(tarball)) - return() - - # allow directories - info <- file.info(tarball, extra_cols = FALSE) - if (identical(info$isdir, TRUE)) { - name <- sprintf("renv_%s.tar.gz", version) - tarball <- file.path(tarball, name) - } - - # bail if it doesn't exist - if (!file.exists(tarball)) { - - # let the user know we weren't able to honour their request - fmt <- "* RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." - msg <- sprintf(fmt, tarball) - warning(msg) - - # bail - return() - - } - - fmt <- "* Bootstrapping with tarball at path '%s'." - msg <- sprintf(fmt, tarball) - message(msg) - - tarball - - } - renv_bootstrap_download_github <- function(version) { enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") @@ -409,7 +194,7 @@ local({ return(FALSE) } - message("OK") + message("Done!") return(destfile) } @@ -424,13 +209,7 @@ local({ bin <- R.home("bin") exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" r <- file.path(bin, exe) - - args <- c( - "--vanilla", "CMD", "INSTALL", "--no-multiarch", - "-l", shQuote(path.expand(library)), - shQuote(path.expand(tarball)) - ) - + args <- c("--vanilla", "CMD", "INSTALL", "-l", shQuote(library), shQuote(tarball)) output <- system2(r, args, stdout = TRUE, stderr = TRUE) message("Done!") @@ -447,7 +226,7 @@ local({ } - renv_bootstrap_platform_prefix <- function() { + renv_bootstrap_prefix <- function() { # construct version prefix version <- paste(R.version$major, R.version$minor, sep = ".") @@ -466,8 +245,8 @@ local({ components <- c(prefix, R.version$platform) # include prefix if provided by user - prefix <- renv_bootstrap_platform_prefix_impl() - if (!is.na(prefix) && nzchar(prefix)) + prefix <- Sys.getenv("RENV_PATHS_PREFIX") + if (nzchar(prefix)) components <- c(prefix, components) # build prefix @@ -475,181 +254,17 @@ local({ } - renv_bootstrap_platform_prefix_impl <- function() { - - # if an explicit prefix has been supplied, use it - prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) - if (!is.na(prefix)) - return(prefix) - - # if the user has requested an automatic prefix, generate it - auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) - if (auto %in% c("TRUE", "True", "true", "1")) - return(renv_bootstrap_platform_prefix_auto()) - - # empty string on failure - "" - - } - - renv_bootstrap_platform_prefix_auto <- function() { - - prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) - if (inherits(prefix, "error") || prefix %in% "unknown") { - - msg <- paste( - "failed to infer current operating system", - "please file a bug report at https://github.com/rstudio/renv/issues", - sep = "; " - ) - - warning(msg) - - } - - prefix - - } - - renv_bootstrap_platform_os <- function() { - - sysinfo <- Sys.info() - sysname <- sysinfo[["sysname"]] - - # handle Windows + macOS up front - if (sysname == "Windows") - return("windows") - else if (sysname == "Darwin") - return("macos") - - # check for os-release files - for (file in c("/etc/os-release", "/usr/lib/os-release")) - if (file.exists(file)) - return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) - - # check for redhat-release files - if (file.exists("/etc/redhat-release")) - return(renv_bootstrap_platform_os_via_redhat_release()) - - "unknown" - - } - - renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { - - # read /etc/os-release - release <- utils::read.table( - file = file, - sep = "=", - quote = c("\"", "'"), - col.names = c("Key", "Value"), - comment.char = "#", - stringsAsFactors = FALSE - ) - - vars <- as.list(release$Value) - names(vars) <- release$Key - - # get os name - os <- tolower(sysinfo[["sysname"]]) - - # read id - id <- "unknown" - for (field in c("ID", "ID_LIKE")) { - if (field %in% names(vars) && nzchar(vars[[field]])) { - id <- vars[[field]] - break - } - } - - # read version - version <- "unknown" - for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { - if (field %in% names(vars) && nzchar(vars[[field]])) { - version <- vars[[field]] - break - } - } - - # join together - paste(c(os, id, version), collapse = "-") - - } - - renv_bootstrap_platform_os_via_redhat_release <- function() { - - # read /etc/redhat-release - contents <- readLines("/etc/redhat-release", warn = FALSE) - - # infer id - id <- if (grepl("centos", contents, ignore.case = TRUE)) - "centos" - else if (grepl("redhat", contents, ignore.case = TRUE)) - "redhat" - else - "unknown" - - # try to find a version component (very hacky) - version <- "unknown" - - parts <- strsplit(contents, "[[:space:]]")[[1L]] - for (part in parts) { - - nv <- tryCatch(numeric_version(part), error = identity) - if (inherits(nv, "error")) - next - - version <- nv[1, 1] - break - - } - - paste(c("linux", id, version), collapse = "-") - - } - - renv_bootstrap_library_root_name <- function(project) { - - # use project name as-is if requested - asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") - if (asis) - return(basename(project)) - - # otherwise, disambiguate based on project's path - id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) - paste(basename(project), id, sep = "-") - - } - renv_bootstrap_library_root <- function(project) { - prefix <- renv_bootstrap_profile_prefix() - path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) if (!is.na(path)) - return(paste(c(path, prefix), collapse = "/")) + return(path) - path <- renv_bootstrap_library_root_impl(project) - if (!is.null(path)) { - name <- renv_bootstrap_library_root_name(project) - return(paste(c(path, prefix, name), collapse = "/")) - } - - renv_bootstrap_paths_renv("library", project = project) - - } - - renv_bootstrap_library_root_impl <- function(project) { - - root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) - if (!is.na(root)) - return(root) + path <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) + if (!is.na(path)) + return(file.path(path, basename(project))) - type <- renv_bootstrap_project_type(project) - if (identical(type, "package")) { - userdir <- renv_bootstrap_user_dir() - return(file.path(userdir, "library")) - } + file.path(project, "renv/library") } @@ -668,8 +283,8 @@ local({ paste("renv", loadedversion, sep = "@") 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.", + "renv %1$s was loaded from project library, but renv %2$s is recorded in lockfile.", + "Use `renv::record(\"%3$s\")` to record this version in the lockfile.", "Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", sep = "\n" ) @@ -681,16 +296,6 @@ local({ } - renv_bootstrap_hash_text <- function(text) { - - hashfile <- tempfile("renv-hash-") - on.exit(unlink(hashfile), add = TRUE) - - writeLines(text, con = hashfile) - tools::md5sum(hashfile) - - } - renv_bootstrap_load <- function(project, libpath, version) { # try to load renv from the project library @@ -706,256 +311,12 @@ local({ TRUE } - - renv_bootstrap_profile_load <- function(project) { - - # if RENV_PROFILE is already set, just use that - profile <- Sys.getenv("RENV_PROFILE", unset = NA) - if (!is.na(profile) && nzchar(profile)) - return(profile) - - # check for a profile file (nothing to do if it doesn't exist) - path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project) - if (!file.exists(path)) - return(NULL) - - # read the profile, and set it if it exists - contents <- readLines(path, warn = FALSE) - if (length(contents) == 0L) - return(NULL) - - # set RENV_PROFILE - profile <- contents[[1L]] - if (!profile %in% c("", "default")) - Sys.setenv(RENV_PROFILE = profile) - - profile - - } - - renv_bootstrap_profile_prefix <- function() { - profile <- renv_bootstrap_profile_get() - if (!is.null(profile)) - return(file.path("profiles", profile, "renv")) - } - - renv_bootstrap_profile_get <- function() { - profile <- Sys.getenv("RENV_PROFILE", unset = "") - renv_bootstrap_profile_normalize(profile) - } - - renv_bootstrap_profile_set <- function(profile) { - profile <- renv_bootstrap_profile_normalize(profile) - if (is.null(profile)) - Sys.unsetenv("RENV_PROFILE") - else - Sys.setenv(RENV_PROFILE = profile) - } - - renv_bootstrap_profile_normalize <- function(profile) { - - if (is.null(profile) || profile %in% c("", "default")) - return(NULL) - - profile - - } - - renv_bootstrap_path_absolute <- function(path) { - - substr(path, 1L, 1L) %in% c("~", "/", "\\") || ( - substr(path, 1L, 1L) %in% c(letters, LETTERS) && - substr(path, 2L, 3L) %in% c(":/", ":\\") - ) - - } - - renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) { - renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv") - root <- if (renv_bootstrap_path_absolute(renv)) NULL else project - prefix <- if (profile) renv_bootstrap_profile_prefix() - components <- c(root, renv, prefix, ...) - paste(components, collapse = "/") - } - - renv_bootstrap_project_type <- function(path) { - - descpath <- file.path(path, "DESCRIPTION") - if (!file.exists(descpath)) - return("unknown") - - desc <- tryCatch( - read.dcf(descpath, all = TRUE), - error = identity - ) - - if (inherits(desc, "error")) - return("unknown") - - type <- desc$Type - if (!is.null(type)) - return(tolower(type)) - - package <- desc$Package - if (!is.null(package)) - return("package") - - "unknown" - - } - - renv_bootstrap_user_dir <- function() { - dir <- renv_bootstrap_user_dir_impl() - path.expand(chartr("\\", "/", dir)) - } - - renv_bootstrap_user_dir_impl <- function() { - - # use local override if set - override <- getOption("renv.userdir.override") - if (!is.null(override)) - return(override) - - # use R_user_dir if available - tools <- asNamespace("tools") - if (is.function(tools$R_user_dir)) - return(tools$R_user_dir("renv", "cache")) - - # try using our own backfill for older versions of R - envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME") - for (envvar in envvars) { - root <- Sys.getenv(envvar, unset = NA) - if (!is.na(root)) - return(file.path(root, "R/renv")) - } - - # use platform-specific default fallbacks - if (Sys.info()[["sysname"]] == "Windows") - file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv") - else if (Sys.info()[["sysname"]] == "Darwin") - "~/Library/Caches/org.R-project.R/R/renv" - else - "~/.cache/R/renv" - - } - - - renv_json_read <- function(file = NULL, text = NULL) { - - # if jsonlite is loaded, use that instead - if ("jsonlite" %in% loadedNamespaces()) - renv_json_read_jsonlite(file, text) - else - renv_json_read_default(file, text) - - } - - renv_json_read_jsonlite <- function(file = NULL, text = NULL) { - text <- paste(text %||% read(file), 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") - pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - locs <- gregexpr(pattern, text, perl = TRUE)[[1]] - - # if any are found, replace them with placeholders - replaced <- text - strings <- character() - replacements <- character() - - if (!identical(c(locs), -1L)) { - - # get the string values - starts <- locs - ends <- locs + attr(locs, "match.length") - 1L - strings <- substring(text, starts, ends) - - # only keep those requiring escaping - strings <- grep("[[\\]{}:]", strings, perl = TRUE, value = TRUE) - - # compute replacements - replacements <- sprintf('"\032%i\032"', seq_along(strings)) - - # replace the strings - mapply(function(string, replacement) { - replaced <<- sub(string, replacement, replaced, fixed = TRUE) - }, strings, replacements) - - } - - # transform the JSON into something the R parser understands - transformed <- replaced - transformed <- gsub("{}", "`names<-`(list(), character())", transformed, fixed = TRUE) - transformed <- gsub("[[{]", "list(", transformed, perl = TRUE) - transformed <- gsub("[]}]", ")", transformed, perl = TRUE) - transformed <- gsub(":", "=", transformed, fixed = TRUE) - text <- paste(transformed, collapse = "\n") - - # parse it - json <- parse(text = text, keep.source = FALSE, srcfile = NULL)[[1L]] - - # construct map between source strings, replaced strings - map <- as.character(parse(text = strings)) - names(map) <- as.character(parse(text = replacements)) - - # convert to list - map <- as.list(map) - - # remap strings in object - remapped <- renv_json_remap(json, map) - - # evaluate - eval(remapped, envir = baseenv()) - - } - - renv_json_remap <- function(json, map) { - - # fix names - if (!is.null(names(json))) { - lhs <- match(names(json), names(map), nomatch = 0L) - rhs <- match(names(map), names(json), nomatch = 0L) - names(json)[rhs] <- map[lhs] - } - - # fix values - if (is.character(json)) - return(map[[json]] %||% json) - - # handle true, false, null - if (is.name(json)) { - text <- as.character(json) - if (text == "true") - return(TRUE) - else if (text == "false") - return(FALSE) - else if (text == "null") - return(NULL) - } - - # recurse - if (is.recursive(json)) { - for (i in seq_along(json)) { - json[i] <- list(renv_json_remap(json[[i]], map)) - } - } - - json - - } - - # load the renv profile, if any - renv_bootstrap_profile_load(project) # construct path to library root root <- renv_bootstrap_library_root(project) # construct library prefix for platform - prefix <- renv_bootstrap_platform_prefix() + prefix <- renv_bootstrap_prefix() # construct full libpath libpath <- file.path(root, prefix) @@ -964,13 +325,7 @@ local({ if (renv_bootstrap_load(project, libpath, version)) return(TRUE) - # load failed; inform user we're about to bootstrap - prefix <- paste("# Bootstrapping renv", version) - postfix <- paste(rep.int("-", 77L - nchar(prefix)), collapse = "") - header <- paste(prefix, postfix) - message(header) - - # perform bootstrap + # load failed; attempt to bootstrap bootstrap(version, libpath) # exit early if we're just testing bootstrap @@ -979,7 +334,7 @@ local({ # try again to load if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { - message("* Successfully installed and loaded renv ", version, ".") + message("Successfully installed and loaded renv ", version, ".") return(renv::load()) } diff --git a/renv/settings.dcf b/renv/settings.dcf index 169d82f1..11a53eaf 100644 --- a/renv/settings.dcf +++ b/renv/settings.dcf @@ -1,10 +1,6 @@ -bioconductor.version: external.libraries: ignored.packages: package.dependency.fields: Imports, Depends, LinkingTo -r.version: snapshot.type: implicit use.cache: TRUE -vcs.ignore.cellar: TRUE vcs.ignore.library: TRUE -vcs.ignore.local: TRUE