devtools::install_github... in R to install a repository and also installed the repository by using
git clone in terminal. What’s the difference between these two routes? So far, I understand that I can then use
library(package) in R and will load the package in, whereas when I’ve cloned the GitHub repository, I don’t think the package is immediately available. Can anyone explain the difference between these two methods?
git clone is a general way to check out a local copy of any git repository. It doesn’t know about R at all or how R packages work. The
devtools::install_github() (which is really just
remotes::install_github()) checks out a copy of a repository and then does the extra work of actually building and installing the package so R can use it. Also it removes the local copy of the raw source files after it installs. If you just want to run/use the package, use
remotes::install_github(). If you want to edit/contribute to the source code for a package, then use
git clone to get the code.
Answered By – MrFlick