How to Install an R Package from the Source Tarball on Windows

How do I install an R package from the source tarball on windows?

I know this is an old question but it came up first in my Google search for this same question, even though I knew the answer I just wanted something to copy and paste. Which makes it worth improving the answer for future reference. So here is what works for me:

Install rtools, then:

install.packages(path_to_file, repos = NULL, type="source")

Installing package from source R

After spending about an hour, thanks to @user20650 and @GWD I was able to solve my problem as follows:

  • I previously had R 3.5.3, I upgraded to the latest version 3.6.2
  • Steps to upgrade R if you already have it: tutorial 1 and tutorial 2
  • After having R 3.6.2, I used RGui rather that RStudio to install Hmisc
  • I typed in the GUI console: install.packages("Hmisc"); it prompts you for a message about compilation, I clicked on NO

Install R package from source, without changing PATH (Windows)

Since you have to set the PATH, but you're hesitant to do so because you're afraid you may hose something up, you can do it temporarily in your R session via:

pathRtools <- paste(c("c:\\Rtools\\bin",
"c:\\Rtools\\MinGW\\bin",
"c:\\MiKTeX\\miktex\\bin",
"c:\\R\\bin\\i386",
"c:\\windows",
"c:\\windows\\system32"), collapse=";")
Sys.setenv(PATH=paste(pathRtools,Sys.getenv("PATH"),sep=";"))

R: make not found when installing a R-package from local tar.gz

what do you need is to update the Rtool, here is the link I had the same issue before once you update it will work.



Related Topics



Leave a reply



Submit