1

I discovered today the very (very) cool packrat R package to make your project reproducible.

However, when I use packrat for my project by using packrat::resolve() in Rstudio, the packages that need Rtools trigger a pop-up window asking me to install Rtools (while it is already install in "C:\rtools40"). On the other hand, Rstudio is installed in "C:\Program Files\RStudio".

I tried to build this project on an other laptop and this problem doesn't appear (Rtools is installed the same and Rstudio is installed directly in C:\RStudio).

This means that Rstudio doesn't find the rtools path on the first laptop.

Is it a common problem? Could it be linked to the Rstudio path?

For info:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.0.2   bookdown_0.20    rsconnect_0.8.16 htmltools_0.5.0  tools_4.0.2      yaml_2.2.1       rmarkdown_2.5   
 [8] knitr_1.30       xfun_0.18        digest_0.6.27    rlang_0.4.8      evaluate_0.14

Cheers!

EDIT

It turns out that using the new alternative to packrat (renv) solves this problem.

FrsLry
  • 348
  • 4
  • 19
  • 2
    FYI, the packrat package has now been retired and replaced by the package renv. I would turn to renv instead if I were you. – Phil Dec 28 '20 at 19:23

1 Answers1

1

You need to add RTools40 to your PATH. You can do this either using the UI (search for "Environmental variables" on Windows search) or using

library(devtools)
Sys.setenv(PATH = paste("C:/Rtools40/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools40/mingw_$(WIN)/bin/")
mhovd
  • 3,724
  • 2
  • 21
  • 47