I'm using devtools in an rmarkdown script to load packages from a specific folder. The folder lives in my C:/Users/myname/Documents
folder, my home folder for tilde expansion.
The chunk below used to work but now throws an error:
> file.exists("~/R/GHmaster-library")
[1] TRUE
> if(file.exists( "~/R/GHmaster-library")){
devtools::dev_mode(on=T, path = "~/R/GHmaster-library")}
Error: [ENOENT] Failed to realize 'C:/Users/Martina Morris/R/GHmaster-library': no such file or directory
So the ~ expansion works for the file.exists
-- but not for the devtools
expansion -- it's missing the Documents
at the end of the expansion.
But forcing the right expansion with fs
also doesn't work, and throws a different error:
> fs::path_expand_r("~/R/GHmaster-library")
C:/Users/Martina Morris/Documents/R/GHmaster-library
> file.exists(fs::path_expand_r("~/R/GHmaster-library"))
[1] TRUE
> if(file.exists( "~/R/GHmaster-library")){
devtools::dev_mode(on=T, path = fs::path_expand_r("~/R/GHmaster-library"))}
Error in match.arg(type, names(directory_entry_types), several.ok = TRUE) : 'arg' should be one of “any”, “unknown”, “file”, “directory”, “symlink”, “FIFO”, “socket”, “character_device”, “block_device”
Googling that error doesn't bring up anything helpful So I'm hoping someone here might have some insight. Thx!
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rmarkdown_2.7 knitr_1.33
loaded via a namespace (and not attached):
[1] pillar_1.6.0 compiler_4.0.5 prettyunits_1.1.1 remotes_2.3.0 tools_4.0.5
[6] testthat_3.0.2 digest_0.6.27 pkgbuild_1.2.0 pkgload_1.2.1 evaluate_0.14
[11] memoise_2.0.0 lifecycle_1.0.0 tibble_3.1.1 pkgconfig_2.0.3 rlang_0.4.11
[16] cli_2.5.0 rstudioapi_0.13 xfun_0.22 fastmap_1.1.0 withr_2.4.2
[21] desc_1.3.0 fs_1.5.0 vctrs_0.3.8 devtools_2.4.0 rprojroot_2.0.2
[26] glue_1.4.2 R6_2.5.0 processx_3.5.2 fansi_0.4.2 sessioninfo_1.1.1
[31] purrr_0.3.4 callr_3.7.0 magrittr_2.0.1 ps_1.6.0 ellipsis_0.3.2
[36] htmltools_0.5.1.1 usethis_2.0.1 utf8_1.2.1 cachem_1.0.4 crayon_1.4.1