Install R Packages on Shiny Server Pro

If you’ve installed Shiny Server Pro as a user other than shiny, you might have experienced difficulty adding R packages. This is because Shiny Server Pro runs R as the shiny user, and running R -e “install.packages(‘foo’)” will install packages to the local user’s files only.

The solution to this is to su to the shiny user:

su - shiny

And run

R -e "install.packages('foo', repos='')"

Alternatively, this script will parse an R file looking for require statements and install the necessary packages. It isn’t very smart, so be careful.

Install R Packages on Shiny Server Pro

2 thoughts on “Install R Packages on Shiny Server Pro

  1. vishal says:

    When I type su – shiny it asks me for a password. What is the default password for the shiny account?
    [-ec2-user-~] : su – shiny

    su: Authentication failure
    [-ec2-user-~] :

Leave a Reply