Build & Reload in RStudio on Windows: devtools::document() says devtools not found

前端 未结 4 734
清酒与你
清酒与你 2021-02-07 12:17

When I click \"Build & Reload\" on the Build tab within RStudio, I get the following error:

==> devtools::document(roclets=c(\'rd\', \'collate\', \'namesp         


        
相关标签:
4条回答
  • 2021-02-07 12:21

    I encounter the same issue, what I solve in the latest version of Rstudio is :

    Build -> Configure Build Tools -> Build Tools -> Press Configure Button -> Uncheck "Source and binary package builds"

    0 讨论(0)
  • 2021-02-07 12:28

    I encountered this problem multiple times and also with other packages related to devtools (e.g. knitr in the devtools::check()). As it was getting on my nerves, I tried to install devtools in other location of .libPaths(), i.e. in the first standard one (in my case it was /usr/local/lib/R/site-library/). It was telling me that I needed sudo rights. I gave them (as I was utterly annoyed by this) but still, it is needed a large number of dependencies. Therefore, my practical solution was to sudo-copy my "special" R library folder into the standard one. The following code fixed all my problems:

    sudo cp -rf /home/myname/R/x86_64-pc-linux-gnu-library/3.4/* /usr/local/lib/R/site-library/
    

    I would like to point out that this is the only effective solution I found. Even so, it lacks elegance and I would definitely prefer if the guys from Rstudio provide a way to link Rstudio to a personally-defined library. It was already my case on startup and I had to add my personal lib to .libPaths() in the file Rprofile.site which is run every time on R startup, but this did not solve the above problem anyhow.

    0 讨论(0)
  • 2021-02-07 12:31

    I had to uncheck "Build & Reload" under "Automatically reoxygenize when running:" in the Build Tools -> Roxygen Configure menu. Installing devtools in the program files/r/3.2.3/lib helped, but it still wanted all the dependencies there as well. Using packrat didn't seem to help either..

    0 讨论(0)
  • 2021-02-07 12:42

    Here's a convenient solution based on mathematical.coffee's comment:

    Just run this from Rstudio:

    writeLines("install.packages('devtools', repos = 'https://cran.rstudio.com/')", "inst.R")
    system("Rscript --vanilla inst.R")
    
    0 讨论(0)
提交回复
热议问题