How to Install R Package from Github

I am using the plumberDeploy package in R to set up an API endpoints on DO to a droplet I have running now. I have a package that is on a public github that I need to install.

I’m trying to figure out how to use this function:

analogsea::install_github_r_package(mydrop, "PACERStuff",  repo = "")

Which does not work. If I were doing this in the R console it would be

devtools::install_github("myname/Blog", subdir='packagename')

Which does indeed install the package locally. Does anyone else have experience or knowledge on how to install an R package to a droplet from github, specifically using these same functions from plumberDeploy?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
May 12, 2023

Hi there,

Indeed, the documentation is not very clear, maybe it’s worth raising an issue to report this!

But as far as I can see in their tests, they don’t specify the full GitHub URL:

Example test:

  z <- install_github_r_package(x, "pachamaltese/eflm")
  expect_equal(z$status, "active")

So this indicates that the problem you are facing might be related to the specification of the GitHub repository in your call to analogsea::install_github_r_package(). The repo argument should be in the form “username/repo”, not a full URL (at least judging by their tests). Also, the subdir argument should be used to specify the subdirectory if the package is not in the root of the repository.

Here is how you might use the function:

analogsea::install_github_r_package(mydrop, "myname/Blog", subdir = "packagename")

This function should install the package located in the “packagename” subdirectory of the “myname/Blog” repository on your droplet named mydrop.



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel