diff --git a/.github/workflows/deploy_bookdown.yml b/.github/workflows/deploy_bookdown.yml index ffba5389..efabe9d7 100644 --- a/.github/workflows/deploy_bookdown.yml +++ b/.github/workflows/deploy_bookdown.yml @@ -15,7 +15,7 @@ jobs: lfs: True - uses: r-lib/actions/setup-r@v2 with: - r-version: '4.3.1' + r-version: '4.4.0' use-public-rspm: true - uses: r-lib/actions/setup-pandoc@v2 - name: Set RENV_PATHS_ROOT diff --git a/.gitignore b/.gitignore index e16691b7..b177cd34 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # don't push local rendered files in master branch _book/ _bookdown_files/ +bookdown_files/ bookdown_cache/ libs/ *.log diff --git a/04-set-up.Rmd b/04-set-up.Rmd index b572f981..f62a12e1 100644 --- a/04-set-up.Rmd +++ b/04-set-up.Rmd @@ -180,7 +180,6 @@ Detailed information for these variables can be found in the [CPS data dictionar ```{r} #| label: setup-anes-cps-get #| message: false -#| cache: TRUE cps_state_in <- getCensus(name = "cps/basic/mar", vintage = 2020, diff --git a/13-ncvs-vignette.Rmd b/13-ncvs-vignette.Rmd index 18a5f839..5ae54d59 100644 --- a/13-ncvs-vignette.Rmd +++ b/13-ncvs-vignette.Rmd @@ -122,7 +122,7 @@ We want to create four variables to indicate if an incident is a series crime. ```{r} #| label: ncvs-vign-incfile #| message: false -#| cache: TRUE + inc_series <- ncvs_2021_incident %>% mutate( series = case_when(V4017 %in% c(1, 8) ~ 1, @@ -310,7 +310,6 @@ where $w_{ijk}$ is the person weight (`WGTPERCY`) for personal crimes or the hou ```{r} #| label: ncvs-vign-merge-inc-sum -#| cache: TRUE hh_z_list <- rep(0, ncol(inc_hh_sums) - 3) %>% as.list() %>% setNames(names(inc_hh_sums)[-(1:3)]) diff --git a/index.Rmd b/index.Rmd index a0712681..a5dddaca 100644 --- a/index.Rmd +++ b/index.Rmd @@ -22,6 +22,8 @@ header-includes: ```{r setup} #| include: false + +library(styler) options( htmltools.dir.version = FALSE, formatR.indent = 2, digits = 4 ) diff --git a/renv.lock b/renv.lock index 12609307..e5ffce5e 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.3.1", + "Version": "4.4.0", "Repositories": [ { "Name": "CRAN", @@ -11,24 +11,24 @@ "Packages": { "DBI": { "Package": "DBI", - "Version": "1.1.3", + "Version": "1.2.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "b2866e62bab9378c3cc9476a1954226b" + "Hash": "164809cd72e1d5160b4cb3aa57f510fe" }, "DiagrammeR": { "Package": "DiagrammeR", - "Version": "1.0.10", + "Version": "1.0.11", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "RColorBrewer", - "downloader", + "cli", "dplyr", "glue", "htmltools", @@ -43,10 +43,10 @@ "stringr", "tibble", "tidyr", - "viridis", + "viridisLite", "visNetwork" ], - "Hash": "f3de4a4878163a4629a528bbcc6e655d" + "Hash": "584c1e1cbb6f9b6c3b0f4ef0ad960966" }, "KernSmooth": { "Package": "KernSmooth", @@ -61,7 +61,7 @@ }, "MASS": { "Package": "MASS", - "Version": "7.3-60", + "Version": "7.3-60.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -72,11 +72,11 @@ "stats", "utils" ], - "Hash": "a56a6365b3fa73293ea8d084be0d9bb0" + "Hash": "2f342c46163b0b54d7b64d1f798e2c78" }, "Matrix": { "Package": "Matrix", - "Version": "1.6-1", + "Version": "1.7-0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -89,7 +89,61 @@ "stats", "utils" ], - "Hash": "cb6855ac711958ca734b75e631b2035d" + "Hash": "1920b2f11133b12350024297d8a4ff4a" + }, + "R.cache": { + "Package": "R.cache", + "Version": "0.16.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R.methodsS3", + "R.oo", + "R.utils", + "digest", + "utils" + ], + "Hash": "fe539ca3f8efb7410c3ae2cf5fe6c0f8" + }, + "R.methodsS3": { + "Package": "R.methodsS3", + "Version": "1.8.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "278c286fd6e9e75d0c2e8f731ea445c8" + }, + "R.oo": { + "Package": "R.oo", + "Version": "1.26.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R.methodsS3", + "methods", + "utils" + ], + "Hash": "4fed809e53ddb5407b3da3d0f572e591" + }, + "R.utils": { + "Package": "R.utils", + "Version": "2.12.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R.methodsS3", + "R.oo", + "methods", + "tools", + "utils" + ], + "Hash": "3dc2829b790254bfba21e60965787651" }, "R6": { "Package": "R6", @@ -113,14 +167,28 @@ }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.11", + "Version": "1.0.12", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods", "utils" ], - "Hash": "ae6cbbe1492f4de79c45fce06f967ce8" + "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" + }, + "RcppArmadillo": { + "Package": "RcppArmadillo", + "Version": "0.12.8.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "methods", + "stats", + "utils" + ], + "Hash": "d5448fb24fb114c4da1275a37a571f37" }, "UpSetR": { "Package": "UpSetR", @@ -142,7 +210,7 @@ }, "V8": { "Package": "V8", - "Version": "4.3.0", + "Version": "4.4.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -151,17 +219,17 @@ "jsonlite", "utils" ], - "Hash": "d1fa8fae6a47e88bb46d5152312bd8bd" + "Hash": "ca98390ad1cef2a5a609597b49d3d042" }, "askpass": { "Package": "askpass", - "Version": "1.1", + "Version": "1.2.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "sys" ], - "Hash": "e8a22846fff485f0be3770c2da758713" + "Hash": "cad6cf7f1d5f6e906700b9d3e718c796" }, "backports": { "Package": "backports", @@ -248,7 +316,7 @@ }, "bookdown": { "Package": "bookdown", - "Version": "0.34", + "Version": "0.39", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -261,7 +329,7 @@ "xfun", "yaml" ], - "Hash": "25e3e995e30c235ea6fcc76677efbe27" + "Hash": "cb4f7066855b6f936e8d25edc9a9cff9" }, "broom": { "Package": "broom", @@ -286,7 +354,7 @@ }, "broom.helpers": { "Package": "broom.helpers", - "Version": "1.13.0", + "Version": "1.15.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -303,27 +371,29 @@ "tibble", "tidyr" ], - "Hash": "2e94ff50e1846787f4e3e829f50a6336" + "Hash": "768cae43c3da698d6b11763777301e43" }, "bslib": { "Package": "bslib", - "Version": "0.5.0", + "Version": "0.7.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "base64enc", "cachem", + "fastmap", "grDevices", "htmltools", "jquerylib", "jsonlite", + "lifecycle", "memoise", "mime", "rlang", "sass" ], - "Hash": "1b117970533deb6d4e992c1b34e9d905" + "Hash": "8644cc53f43828f19133548195d7e59e" }, "cachem": { "Package": "cachem", @@ -338,7 +408,7 @@ }, "callr": { "Package": "callr", - "Version": "3.7.3", + "Version": "3.7.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -347,7 +417,7 @@ "processx", "utils" ], - "Hash": "9b2191ede20fa29828139b9900922e51" + "Hash": "d7e13f49c19103ece9e58ad2d83a7354" }, "cellranger": { "Package": "cellranger", @@ -363,22 +433,21 @@ }, "censusapi": { "Package": "censusapi", - "Version": "0.8.0", + "Version": "0.9.0.9000", "Source": "GitHub", "RemoteType": "github", "RemoteHost": "api.github.com", - "RemoteRepo": "censusapi", "RemoteUsername": "hrecht", - "RemotePkgRef": "https://github.com/hrecht/censusapi/pull/88", - "RemotePull": "88", - "RemoteSha": "15b2b0277193da160e5feaabe1298cc854503fe3", + "RemoteRepo": "censusapi", + "RemoteRef": "main", + "RemoteSha": "74334d4d180ff79477456a777235afdde164f2cd", "Requirements": [ "R", "httr", "jsonlite", - "utils" + "rlang" ], - "Hash": "cf6b5031008658c8d8e1f0dbbd9a62bd" + "Hash": "aabb2a086e3fac2ca41ebe67abcd11a1" }, "class": { "Package": "class", @@ -395,7 +464,7 @@ }, "classInt": { "Package": "classInt", - "Version": "0.4-9", + "Version": "0.4-10", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -407,7 +476,7 @@ "graphics", "stats" ], - "Hash": "bee651a42a89633eccb36dca9d9ab413" + "Hash": "f5a40793b1ae463a7ffb3902a95bf864" }, "cli": { "Package": "cli", @@ -432,13 +501,13 @@ }, "codetools": { "Package": "codetools", - "Version": "0.2-19", + "Version": "0.2-20", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "c089a619a7fae175d149d89164f8c7d8" + "Hash": "61e097f35917d342622f21cdc79c256e" }, "colorspace": { "Package": "colorspace", @@ -456,10 +525,10 @@ }, "commonmark": { "Package": "commonmark", - "Version": "1.9.0", + "Version": "1.9.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "d691c61bff84bd63c383874d2d0c3307" + "Hash": "5d8225445acb167abf7797de48b2ee3c" }, "conflicted": { "Package": "conflicted", @@ -498,7 +567,7 @@ }, "crul": { "Package": "crul", - "Version": "1.4.0", + "Version": "1.4.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -509,32 +578,32 @@ "mime", "urltools" ], - "Hash": "1eb00a531331c91d970f3af74b75321f" + "Hash": "5685d2603020d0f879a147ba23d51292" }, "curl": { "Package": "curl", - "Version": "5.1.0", + "Version": "5.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "9123f3ef96a2c1a93927d828b2fe7d4c" + "Hash": "411ca2c03b1ce5f548345d2fc2685f7a" }, "data.table": { "Package": "data.table", - "Version": "1.14.8", + "Version": "1.15.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "b4c06e554f33344e044ccd7fdca750a9" + "Hash": "8ee9ac56ef633d0c7cab8b2ca87d683e" }, "dbplyr": { "Package": "dbplyr", - "Version": "2.3.2", + "Version": "2.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -558,29 +627,18 @@ "vctrs", "withr" ], - "Hash": "d24305b92db333726aed162a2c23a147" + "Hash": "39b2e002522bfd258039ee4e889e0fd1" }, "digest": { "Package": "digest", - "Version": "0.6.31", + "Version": "0.6.35", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "8b708f296afd9ae69f450f9640be8990" - }, - "downloader": { - "Package": "downloader", - "Version": "0.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "digest", - "utils" - ], - "Hash": "f4f2a915e0dedbdf016a83b63477349f" + "Hash": "698ece7ba5a4fa4559e3d537e7ec3d31" }, "dplyr": { "Package": "dplyr", @@ -626,7 +684,7 @@ }, "e1071": { "Package": "e1071", - "Version": "1.7-13", + "Version": "1.7-14", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -638,7 +696,7 @@ "stats", "utils" ], - "Hash": "1046cb48d06cb40c2900d8878f03a0fe" + "Hash": "4ef372b716824753719a8a38b258442d" }, "ellipsis": { "Package": "ellipsis", @@ -653,14 +711,14 @@ }, "evaluate": { "Package": "evaluate", - "Version": "0.21", + "Version": "0.23", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "d59f3b464e8da1aef82dc04b588b8dfb" + "Hash": "daf4a1246be12c1fa8c7705a0935c1a0" }, "fansi": { "Package": "fansi", @@ -690,7 +748,7 @@ }, "fontawesome": { "Package": "fontawesome", - "Version": "0.5.1", + "Version": "0.5.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -698,7 +756,7 @@ "htmltools", "rlang" ], - "Hash": "1e22b8cabbad1eae951a75e9f8b52378" + "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" }, "forcats": { "Package": "forcats", @@ -718,18 +776,18 @@ }, "fs": { "Package": "fs", - "Version": "1.6.2", + "Version": "1.6.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "94af08e0aa9675a16fadbb3aaaa90d2a" + "Hash": "15aeb8c27f5ea5161f9f6a641fafd93a" }, "gargle": { "Package": "gargle", - "Version": "1.5.0", + "Version": "1.5.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -747,7 +805,7 @@ "utils", "withr" ], - "Hash": "c64c926cdc1a2796e609f99b53017be2" + "Hash": "fc0b272e5847c58cd5da9b20eedbd026" }, "generics": { "Package": "generics", @@ -777,7 +835,7 @@ }, "ggplot2": { "Package": "ggplot2", - "Version": "3.4.2", + "Version": "3.5.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -798,18 +856,18 @@ "vctrs", "withr" ], - "Hash": "3a147ee02e85a8941aad9909f1b43b7b" + "Hash": "44c6a2f8202d5b7e878ea274b1092426" }, "glue": { "Package": "glue", - "Version": "1.6.2", + "Version": "1.7.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "4f2596dfb05dac67b9dc558e5c6fba2e" + "Hash": "e0b3a53876554bd45879e596cdb10a52" }, "googledrive": { "Package": "googledrive", @@ -880,7 +938,7 @@ }, "gridpattern": { "Package": "gridpattern", - "Version": "1.0.2", + "Version": "1.1.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -894,11 +952,11 @@ "sf", "utils" ], - "Hash": "511a541015f9b9960a088fb7402c3877" + "Hash": "287aa77a9ecd9dea234fe490e0b398fd" }, "gt": { "Package": "gt", - "Version": "0.9.0", + "Version": "0.10.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -920,15 +978,15 @@ "rlang", "sass", "scales", - "tibble", "tidyselect", + "vctrs", "xml2" ], - "Hash": "d55233a737e43e44987724e57dfec302" + "Hash": "03009c105dfae79460b8eb9d8cf791e4" }, "gtable": { "Package": "gtable", - "Version": "0.3.3", + "Version": "0.3.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -939,11 +997,11 @@ "lifecycle", "rlang" ], - "Hash": "b44addadb528a0d227794121c00572a0" + "Hash": "e18861963cbc65a27736e02b3cd3c4a0" }, "gtsummary": { "Package": "gtsummary", - "Version": "1.7.1", + "Version": "1.7.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -964,11 +1022,11 @@ "tidyr", "vctrs" ], - "Hash": "dadd93bb879b3e0245bb43d990e93219" + "Hash": "08df7405a102e3f0bdf7a13a29e8c6ab" }, "haven": { "Package": "haven", - "Version": "2.5.2", + "Version": "2.5.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -985,7 +1043,7 @@ "tidyselect", "vctrs" ], - "Hash": "8b331e659e67d757db0fcc28e689c501" + "Hash": "9171f898db9d9c4c1b2c745adc2c1ef1" }, "here": { "Package": "here", @@ -1041,24 +1099,23 @@ }, "htmltools": { "Package": "htmltools", - "Version": "0.5.5", + "Version": "0.5.8.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "base64enc", "digest", - "ellipsis", "fastmap", "grDevices", "rlang", "utils" ], - "Hash": "ba0240784ad50a62165058a27459304a" + "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" }, "htmlwidgets": { "Package": "htmlwidgets", - "Version": "1.6.2", + "Version": "1.6.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1069,7 +1126,7 @@ "rmarkdown", "yaml" ], - "Hash": "a865aa85bcb2697f47505bfd70422471" + "Hash": "04291cc45198225444a397606810ac37" }, "httpcode": { "Package": "httpcode", @@ -1080,7 +1137,7 @@ }, "httr": { "Package": "httr", - "Version": "1.4.6", + "Version": "1.4.7", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1091,11 +1148,11 @@ "mime", "openssl" ], - "Hash": "7e5e3cbd2a7bc07880c94e22348fb661" + "Hash": "ac107251d9d9fd72f0ca8049988f1d7f" }, "httr2": { "Package": "httr2", - "Version": "1.0.0", + "Version": "1.0.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1112,7 +1169,7 @@ "vctrs", "withr" ], - "Hash": "e2b30f1fc039a0bab047dd52bb20ef71" + "Hash": "03d741c92fda96d98c3a3f22494e3b4a" }, "ids": { "Package": "ids", @@ -1127,7 +1184,7 @@ }, "igraph": { "Package": "igraph", - "Version": "1.5.0", + "Version": "2.0.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1137,14 +1194,16 @@ "cpp11", "grDevices", "graphics", + "lifecycle", "magrittr", "methods", "pkgconfig", "rlang", "stats", - "utils" + "utils", + "vctrs" ], - "Hash": "84818361421d5fc3ff0bf4e669524217" + "Hash": "c3b7d801d722e26e4cd888e042bf9af5" }, "isoband": { "Package": "isoband", @@ -1191,13 +1250,13 @@ }, "jsonlite": { "Package": "jsonlite", - "Version": "1.8.5", + "Version": "1.8.8", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods" ], - "Hash": "3ee4d9899e4db3e976fc82b98d24a31a" + "Hash": "e1b9c55281c5adc4dd113652d9e26768" }, "juicyjuice": { "Package": "juicyjuice", @@ -1211,13 +1270,12 @@ }, "kableExtra": { "Package": "kableExtra", - "Version": "1.3.4", + "Version": "1.4.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "digest", - "glue", "grDevices", "graphics", "htmltools", @@ -1225,21 +1283,19 @@ "magrittr", "rmarkdown", "rstudioapi", - "rvest", "scales", "stats", "stringr", "svglite", "tools", "viridisLite", - "webshot", "xml2" ], - "Hash": "49b625e6aabe4c5f091f5850aba8ff78" + "Hash": "532d16304274c23c8563f94b79351c86" }, "knitr": { "Package": "knitr", - "Version": "1.43", + "Version": "1.46", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1251,22 +1307,22 @@ "xfun", "yaml" ], - "Hash": "9775eb076713f627c07ce41d8199d8f6" + "Hash": "6e008ab1d696a5283c79765fa7b56b47" }, "labeling": { "Package": "labeling", - "Version": "0.4.2", + "Version": "0.4.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "graphics", "stats" ], - "Hash": "3d5108641f47470611a32d0bdf357a72" + "Hash": "b64ec208ac5bc1852b285f665d6368b3" }, "labelled": { "Package": "labelled", - "Version": "2.12.0", + "Version": "2.13.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1277,13 +1333,14 @@ "rlang", "stringr", "tidyr", + "tidyselect", "vctrs" ], - "Hash": "1ec27c624ece6c20431e9249bd232797" + "Hash": "ad4b6d757624221aec6220b8c78defeb" }, "lattice": { "Package": "lattice", - "Version": "0.21-8", + "Version": "0.22-6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1294,7 +1351,7 @@ "stats", "utils" ], - "Hash": "0b8a6d63c8770f02a8b5635f3c431e6b" + "Hash": "cc5ac1ba4c238c7ca9fa6a87ca11a7e2" }, "lifecycle": { "Package": "lifecycle", @@ -1311,7 +1368,7 @@ }, "lubridate": { "Package": "lubridate", - "Version": "1.9.2", + "Version": "1.9.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1320,7 +1377,7 @@ "methods", "timechange" ], - "Hash": "e25f18436e3efd42c7c590a1c4c15390" + "Hash": "680ad542fbcf801442c83a6ac5a2126c" }, "magrittr": { "Package": "magrittr", @@ -1334,7 +1391,7 @@ }, "markdown": { "Package": "markdown", - "Version": "1.7", + "Version": "1.12", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1343,7 +1400,7 @@ "utils", "xfun" ], - "Hash": "0ffaea87c070a56d140ce00b0727b278" + "Hash": "765cf53992401b3b6c297b69e1edb8bd" }, "memoise": { "Package": "memoise", @@ -1358,7 +1415,7 @@ }, "mgcv": { "Package": "mgcv", - "Version": "1.9-0", + "Version": "1.9-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1371,7 +1428,7 @@ "stats", "utils" ], - "Hash": "086028ca0460d0c368028d3bda58f31b" + "Hash": "110ee9d83b496279960e162ac97764ce" }, "mime": { "Package": "mime", @@ -1425,18 +1482,18 @@ }, "munsell": { "Package": "munsell", - "Version": "0.5.0", + "Version": "0.5.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "colorspace", "methods" ], - "Hash": "6dfe8bf774944bd5595785e3229d8771" + "Hash": "4fd8900853b746af55b81fda99da7695" }, "naniar": { "Package": "naniar", - "Version": "1.0.0", + "Version": "1.1.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1447,6 +1504,7 @@ "forcats", "ggplot2", "glue", + "lifecycle", "magrittr", "norm", "purrr", @@ -1458,7 +1516,7 @@ "viridis", "visdat" ], - "Hash": "3a684e715cebd023880a6171e35cd02c" + "Hash": "74d1b68ee4d1e076dee034a9ef3acd41" }, "nlme": { "Package": "nlme", @@ -1496,13 +1554,13 @@ }, "openssl": { "Package": "openssl", - "Version": "2.0.6", + "Version": "2.1.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "askpass" ], - "Hash": "0f7cd2962e3044bb940cca4f4b5cecbe" + "Hash": "ea2475b073243d9d338aa8f086ce973e" }, "osfr": { "Package": "osfr", @@ -1552,14 +1610,14 @@ }, "plyr": { "Package": "plyr", - "Version": "1.8.8", + "Version": "1.8.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "Rcpp" ], - "Hash": "d744387aef9047b0b48be2933d78e862" + "Hash": "6b8177fd19982f0020743fadbfdbd933" }, "png": { "Package": "png", @@ -1583,7 +1641,7 @@ }, "processx": { "Package": "processx", - "Version": "3.8.1", + "Version": "3.8.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1592,20 +1650,21 @@ "ps", "utils" ], - "Hash": "d75b4059d781336efba24021915902b4" + "Hash": "0c90a7d71988856bad2a2a45dd871bb9" }, "progress": { "Package": "progress", - "Version": "1.2.2", + "Version": "1.2.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "R", "R6", "crayon", "hms", "prettyunits" ], - "Hash": "14dc9f7a3c91ebb14ec5bb9208a07061" + "Hash": "f4625e061cb2865f111b47ff163a5ca6" }, "proxy": { "Package": "proxy", @@ -1621,14 +1680,14 @@ }, "ps": { "Package": "ps", - "Version": "1.7.5", + "Version": "1.7.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "709d852d33178db54b17c722e5b1e594" + "Hash": "dd2b9319ee0656c8acf45c7f40c59de7" }, "purrr": { "Package": "purrr", @@ -1647,14 +1706,14 @@ }, "ragg": { "Package": "ragg", - "Version": "1.2.5", + "Version": "1.3.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "systemfonts", "textshaping" ], - "Hash": "690bc058ea2b1b8a407d3cfe3dce3ef9" + "Hash": "082e1a198e3329d571f4448ef0ede4bc" }, "rappdirs": { "Package": "rappdirs", @@ -1668,13 +1727,13 @@ }, "reactR": { "Package": "reactR", - "Version": "0.4.4", + "Version": "0.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "htmltools" ], - "Hash": "75389c8091eb14ee21c6bc87a88b3809" + "Hash": "c9014fd1a435b2d790dd506589cb24e5" }, "reactable": { "Package": "reactable", @@ -1693,7 +1752,7 @@ }, "readr": { "Package": "readr", - "Version": "2.1.4", + "Version": "2.1.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1712,11 +1771,11 @@ "utils", "vroom" ], - "Hash": "b5047343b3825f37ad9d3b5d89aa1078" + "Hash": "9de96463d2117f6ac49980577939dfb3" }, "readxl": { "Package": "readxl", - "Version": "1.4.2", + "Version": "1.4.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1727,14 +1786,14 @@ "tibble", "utils" ], - "Hash": "2e6020b1399d95f947ed867045e9ca17" + "Hash": "8cf9c239b96df1bbb133b74aef77ad0a" }, "rematch": { "Package": "rematch", - "Version": "1.0.1", + "Version": "2.0.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "c66b930d20bb6d858cd18e1cebcfae5c" + "Hash": "cbff1b666c6fa6d21202f07e2318d4f1" }, "rematch2": { "Package": "rematch2", @@ -1748,17 +1807,17 @@ }, "renv": { "Package": "renv", - "Version": "1.0.0", + "Version": "1.0.7", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "utils" ], - "Hash": "c321cd99d56443dbffd1c9e673c0c1a2" + "Hash": "397b7b2a265bc5a7a06852524dabae20" }, "reprex": { "Package": "reprex", - "Version": "2.0.2", + "Version": "2.1.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1776,22 +1835,22 @@ "utils", "withr" ], - "Hash": "d66fe009d4c20b7ab1927eb405db9ee2" + "Hash": "1425f91b4d5d9a8f25352c44a3d914ed" }, "rlang": { "Package": "rlang", - "Version": "1.1.2", + "Version": "1.1.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "50a6dbdc522936ca35afc5e2082ea91b" + "Hash": "42548638fae05fd9a9b5f3f437fbbbe2" }, "rmarkdown": { "Package": "rmarkdown", - "Version": "2.23", + "Version": "2.26", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1804,18 +1863,17 @@ "jsonlite", "knitr", "methods", - "stringr", "tinytex", "tools", "utils", "xfun", "yaml" ], - "Hash": "79f14e53725f28900d936f692bfdd69f" + "Hash": "9b148e7f95d33aac01f31282d49e4f44" }, "rnaturalearth": { "Package": "rnaturalearth", - "Version": "0.3.3", + "Version": "1.0.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1823,22 +1881,20 @@ "httr", "jsonlite", "sf", - "sp", "terra", "utils" ], - "Hash": "86411a59f5fc9534d8ea0c270d70cfa5" + "Hash": "741166cab0fe76d8a5670d3ee459a2a4" }, "rnaturalearthdata": { "Package": "rnaturalearthdata", - "Version": "0.1.0", + "Version": "1.0.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ - "R", - "sp" + "R" ], - "Hash": "0d34b89b43e900467e60f5449226f3e3" + "Hash": "650339de24d9574c0079a4a13baa623d" }, "rprojroot": { "Package": "rprojroot", @@ -1852,14 +1908,14 @@ }, "rstudioapi": { "Package": "rstudioapi", - "Version": "0.14", + "Version": "0.16.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "690bd2acc42a9166ce34845884459320" + "Hash": "96710351d642b70e8f02ddeb237c46a7" }, "rvest": { "Package": "rvest", - "Version": "1.0.3", + "Version": "1.0.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1872,14 +1928,13 @@ "rlang", "selectr", "tibble", - "withr", "xml2" ], - "Hash": "a4a5ac819a467808c60e36e92ddf195e" + "Hash": "0bcf0c6f274e90ea314b812a6d19a519" }, "s2": { "Package": "s2", - "Version": "1.1.4", + "Version": "1.1.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1887,11 +1942,11 @@ "Rcpp", "wk" ], - "Hash": "f1cbe03bb3346f8e817518ffa20f9f5a" + "Hash": "32f7b1a15bb01ae809022960abad5363" }, "sass": { "Package": "sass", - "Version": "0.4.6", + "Version": "0.4.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1901,25 +1956,37 @@ "rappdirs", "rlang" ], - "Hash": "cc3ec7dd33982ef56570229b62d6388e" + "Hash": "d53dbfddf695303ea4ad66f86e99b95d" }, "scales": { "Package": "scales", - "Version": "1.2.1", + "Version": "1.3.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "R6", "RColorBrewer", + "cli", "farver", + "glue", "labeling", "lifecycle", "munsell", "rlang", "viridisLite" ], - "Hash": "906cb23d2f1c5680b8ce439b44c6fa63" + "Hash": "c19df082ba346b0ffa6f833e92de34d1" + }, + "secretbase": { + "Package": "secretbase", + "Version": "0.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "c476c18b22b21849c9f4d29b3cd720a5" }, "selectr": { "Package": "selectr", @@ -1949,7 +2016,7 @@ }, "sf": { "Package": "sf", - "Version": "1.0-14", + "Version": "1.0-16", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1968,7 +2035,7 @@ "units", "utils" ], - "Hash": "e2111252a76984ca50bf8d6314348681" + "Hash": "ad57b543f7c3fca05213ba78ff63df9b" }, "snakecase": { "Package": "snakecase", @@ -1982,23 +2049,6 @@ ], "Hash": "58767e44739b76965332e8a4fe3f91f1" }, - "sp": { - "Package": "sp", - "Version": "1.6-1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "grDevices", - "graphics", - "grid", - "lattice", - "methods", - "stats", - "utils" - ], - "Hash": "ca27b2643e3593b7688244d035f2cd92" - }, "srvyr": { "Package": "srvyr", "Version": "1.2.0", @@ -2068,14 +2118,35 @@ ], "Hash": "960e2ae9e09656611e0b8214ad543207" }, + "styler": { + "Package": "styler", + "Version": "1.10.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R.cache", + "cli", + "magrittr", + "purrr", + "rlang", + "rprojroot", + "tools", + "vctrs", + "withr" + ], + "Hash": "93a2b1beac2437bdcc4724f8bf867e2c" + }, "survey": { "Package": "survey", - "Version": "4.2-1", + "Version": "4.4-2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "Matrix", "R", + "Rcpp", + "RcppArmadillo", "graphics", "grid", "lattice", @@ -2087,11 +2158,11 @@ "stats", "survival" ], - "Hash": "03195177db81a992f22361f8f54852f4" + "Hash": "b29af45d3afe5f718e387688d43d71e6" }, "survival": { "Package": "survival", - "Version": "3.5-7", + "Version": "3.6-4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2103,11 +2174,11 @@ "stats", "utils" ], - "Hash": "b8e943d262c3da0b0febd3e04517c197" + "Hash": "e6e3071f471513e4b85f98ca041303c7" }, "svglite": { "Package": "svglite", - "Version": "2.1.1", + "Version": "2.1.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2115,7 +2186,7 @@ "cpp11", "systemfonts" ], - "Hash": "29442899581643411facb66f4add846a" + "Hash": "124a41fdfa23e8691cb744c762f10516" }, "sys": { "Package": "sys", @@ -2126,18 +2197,18 @@ }, "systemfonts": { "Package": "systemfonts", - "Version": "1.0.4", + "Version": "1.0.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "cpp11" ], - "Hash": "90b28393209827327de889f49935140a" + "Hash": "6d538cff441f0f1f36db2209ac7495ac" }, "targets": { "Package": "targets", - "Version": "1.4.1", + "Version": "1.7.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2148,10 +2219,11 @@ "cli", "codetools", "data.table", - "digest", "igraph", "knitr", + "ps", "rlang", + "secretbase", "stats", "tibble", "tidyselect", @@ -2160,11 +2232,11 @@ "vctrs", "yaml" ], - "Hash": "760c8dcdf3a21b7131c181f02705101c" + "Hash": "27ee47827a89430be0d38b78c0cb8fb7" }, "terra": { "Package": "terra", - "Version": "1.7-39", + "Version": "1.7-71", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2172,11 +2244,11 @@ "Rcpp", "methods" ], - "Hash": "6037d18193ca3f16900646e773937094" + "Hash": "e8611881ab70a4fb7a1f629b31e6fcff" }, "textshaping": { "Package": "textshaping", - "Version": "0.3.6", + "Version": "0.3.7", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2184,7 +2256,7 @@ "cpp11", "systemfonts" ], - "Hash": "1ab6223d3670fac7143202cb6a2d43d5" + "Hash": "997aac9ad649e0ef3b97f96cddd5622b" }, "tibble": { "Package": "tibble", @@ -2207,7 +2279,7 @@ }, "tidycensus": { "Package": "tidycensus", - "Version": "1.6.2", + "Version": "1.6.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2230,11 +2302,11 @@ "utils", "xml2" ], - "Hash": "f9071f073dc63ff313d311d5c14a613b" + "Hash": "c77c57b67d43addfe568dba21ef4b811" }, "tidyr": { "Package": "tidyr", - "Version": "1.3.0", + "Version": "1.3.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2253,11 +2325,11 @@ "utils", "vctrs" ], - "Hash": "e47debdc7ce599b070c8e78e8ac0cfcf" + "Hash": "915fb7ce036c22a6a33b5a8adb712eb1" }, "tidyselect": { "Package": "tidyselect", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2269,7 +2341,7 @@ "vctrs", "withr" ], - "Hash": "79540e5fcd9e0435af547d885f184fd5" + "Hash": "829f27b9c4919c16b593794a6344d6c0" }, "tidyverse": { "Package": "tidyverse", @@ -2332,24 +2404,24 @@ }, "timechange": { "Package": "timechange", - "Version": "0.2.0", + "Version": "0.3.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "cpp11" ], - "Hash": "8548b44f79a35ba1791308b61e6012d7" + "Hash": "c5f3c201b931cd6474d17d8700ccb1c8" }, "tinytex": { "Package": "tinytex", - "Version": "0.45", + "Version": "0.50", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "xfun" ], - "Hash": "e4e357f28c2edff493936b6cb30c3d65" + "Hash": "be7a76845222ad20adb761f462eed3ea" }, "triebeard": { "Package": "triebeard", @@ -2374,14 +2446,14 @@ }, "units": { "Package": "units", - "Version": "0.8-2", + "Version": "0.8-5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "Rcpp" ], - "Hash": "422376fe53419adcde4710d43acbcdd0" + "Hash": "119d19da480e873f72241ff6962ffd83" }, "urltools": { "Package": "urltools", @@ -2408,13 +2480,13 @@ }, "uuid": { "Package": "uuid", - "Version": "1.1-0", + "Version": "1.2-0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "f1cb46c157d080b729159d407be83496" + "Hash": "303c19bfd970bece872f93a824e323d9" }, "vctrs": { "Package": "vctrs", @@ -2432,7 +2504,7 @@ }, "viridis": { "Package": "viridis", - "Version": "0.6.3", + "Version": "0.6.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2441,7 +2513,7 @@ "gridExtra", "viridisLite" ], - "Hash": "0d774f552202add033efc43a30293b3f" + "Hash": "acd96d9fa70adeea4a5a1150609b9745" }, "viridisLite": { "Package": "viridisLite", @@ -2495,7 +2567,7 @@ }, "vroom": { "Package": "vroom", - "Version": "1.6.3", + "Version": "1.6.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -2517,72 +2589,61 @@ "vctrs", "withr" ], - "Hash": "8318e64ffb3a70e652494017ec455561" - }, - "webshot": { - "Package": "webshot", - "Version": "0.5.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "callr", - "jsonlite", - "magrittr" - ], - "Hash": "16858ee1aba97f902d24049d4a44ef16" + "Hash": "390f9315bc0025be03012054103d227c" }, "withr": { "Package": "withr", - "Version": "2.5.2", + "Version": "3.0.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "grDevices", - "graphics", - "stats" + "graphics" ], - "Hash": "4b25e70111b7d644322e9513f403a272" + "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" }, "wk": { "Package": "wk", - "Version": "0.7.3", + "Version": "0.9.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "68a7ab6ec1afb5f076172b983c069313" + "Hash": "5d4545e140e36476f35f20d0ca87963e" }, "xfun": { "Package": "xfun", - "Version": "0.39", + "Version": "0.43", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "grDevices", "stats", "tools" ], - "Hash": "8f56e9acb54fb525e66464d57ab58bcb" + "Hash": "ab6371d8653ce5f2f9290f4ec7b42a8e" }, "xml2": { "Package": "xml2", - "Version": "1.3.4", + "Version": "1.3.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", - "methods" + "cli", + "methods", + "rlang" ], - "Hash": "7dc765ac9b909487326a7d471fdd3821" + "Hash": "1d0336142f4cd25d8d23cd3ba7a8fb61" }, "yaml": { "Package": "yaml", - "Version": "2.3.7", + "Version": "2.3.8", "Source": "Repository", "Repository": "CRAN", - "Hash": "0d0056cc5383fbc240ccd0cb584bf436" + "Hash": "29240487a071f535f5e5d5a323b7afbd" } } } diff --git a/renv/activate.R b/renv/activate.R index cc742fc9..d13f9932 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,11 +2,28 @@ local({ # the requested version of renv - version <- "1.0.0" + 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") + if (diagnostics) { + start <- Sys.time() + profile <- tempfile("renv-startup-", fileext = ".Rprof") + utils::Rprof(profile) + on.exit({ + utils::Rprof(NULL) + elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L) + writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed))) + writeLines(sprintf("- Profile: %s", profile)) + print(utils::summaryRprof(profile)) + }, add = TRUE) + } # figure out whether the autoloader is enabled enabled <- local({ @@ -16,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( @@ -35,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") @@ -93,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 } @@ -504,7 +557,7 @@ local({ # open the bundle for reading # We use gzcon for everything because (from ?gzcon) - # > Reading from a connection which does not supply a ‘gzip’ magic + # > Reading from a connection which does not supply a 'gzip' magic # > header is equivalent to reading from the original connection conn <- gzcon(file(bundle, open = "rb", raw = TRUE)) on.exit(close(conn)) @@ -595,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()) @@ -767,10 +823,12 @@ local({ renv_bootstrap_validate_version <- function(version, description = NULL) { # resolve description file - description <- description %||% { - path <- getNamespaceInfo("renv", "path") - packageDescription("renv", lib.loc = dirname(path)) - } + # + # avoid passing lib.loc to `packageDescription()` below, since R will + # use the loaded version of the package by default anyhow. note that + # this function should only be called after 'renv' is loaded + # https://github.com/rstudio/renv/issues/1625 + description <- description %||% packageDescription("renv") # check whether requested version 'version' matches loaded version of renv sha <- attr(version, "sha", exact = TRUE) @@ -784,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 @@ -841,7 +898,7 @@ local({ hooks <- getHook("renv::autoload") for (hook in hooks) if (is.function(hook)) - tryCatch(hook(), error = warning) + tryCatch(hook(), error = warnify) # load the project renv::load(project) @@ -982,10 +1039,15 @@ local({ } - renv_bootstrap_version_friendly <- function(version, sha = NULL) { + renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) { sha <- sha %||% attr(version, "sha", exact = TRUE) - parts <- c(version, sprintf("[sha: %s]", substring(sha, 1L, 7L))) - paste(parts, collapse = " ") + parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L))) + paste(parts, collapse = "") + } + + renv_bootstrap_exec <- function(project, libpath, version) { + if (!renv_bootstrap_load(project, libpath, version)) + renv_bootstrap_run(version, libpath) } renv_bootstrap_run <- function(version, libpath) { @@ -1012,11 +1074,6 @@ local({ } - - renv_bootstrap_in_rstudio <- function() { - commandArgs()[[1]] == "RStudio" - } - renv_json_read <- function(file = NULL, text = NULL) { jlerr <- NULL @@ -1024,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) @@ -1033,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) @@ -1046,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]] @@ -1101,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))) { @@ -1135,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)) } } @@ -1155,26 +1212,8 @@ local({ # construct full libpath libpath <- file.path(root, prefix) - # attempt to load - if (renv_bootstrap_load(project, libpath, version)) - return(TRUE) - - if (renv_bootstrap_in_rstudio()) { - setHook("rstudio.sessionInit", function(...) { - renv_bootstrap_run(version, libpath) - - # Work around buglet in RStudio if hook uses readline - tryCatch( - { - tools <- as.environment("tools:rstudio") - tools$.rs.api.sendToConsole("", echo = FALSE, focus = FALSE) - }, - error = function(cnd) {} - ) - }) - } else { - renv_bootstrap_run(version, libpath) - } + # run bootstrap code + renv_bootstrap_exec(project, libpath, version) invisible()