Do packages installed from Github need Rtools?

Viewed 478

I am creating my first package, which shall be installed through Github. I thought that Rtools was needed only for the person creating it. However, people that tried to install it using Github were asked to update Rtools. Is this really necessary?

Doing some research, I found this: https://community.rstudio.com/t/missing-rtools-should-i-be-worried/27817

One of the answers says the following:

"This means that if you are going to install packages that need compilation, you also have to install Rtools in your system. "

This is the repo with the package: https://github.com/datazoompuc/PNAD_Covid/tree/master/R/datazoom_pnad_covid

What does this actually mean? How do I know that my package needs compilation?

2 Answers

Your package "needs compilation" — i.e. needs Rtools to install from source (on Windows) — if it contains C or Fortran components, i.e. if you have anything in the src/ directory of your package ...

If you, the package author, don't know if you have C or Fortran code as part of your package, then you almost certainly don't.

It's quite possible that devtools is being overzealous, i.e. detecting that users have a not-most-current Rtools and suggesting (requiring??) that they update it, even though it's not needed for this installation.

I thought that Rtools was needed only for the person creating it.

Yes, if and only if you distribute it as a binary. Then the creator uses Rtools to compile and link, and the user just installs, and enjoys.

That is how CRAN works as CRAN compiles for Windows users.

GitHub, however, is foremost a source repository so the installation from GitHub is using a source mode ... and every user will need to compile, and hence have Rtools. (Unless the package and all its depedencies are R-code only.)

You can also have a package repository on GitHub using e.g. the drat package to create it, but that is getting us a little further from the original question.

Related