R - How to set the path of install.packages() for shiny server ? - Ubuntu

后端 未结 2 865
無奈伤痛
無奈伤痛 2021-01-03 02:13

For my system: Ubuntu 12.04 and R 3.03, whenever I install a custom package in R via

>install.packages(         


        
2条回答
  •  生来不讨喜
    2021-01-03 02:51

    I would propose a different approach.

    The problem is that shiny-server cannot find the packages that you install because it runs them as a different user which is called shiny. This user is created upon installation of shiny-server

    The easiest (and safest IMHO) way to solve this is to just install the packages as the shiny user, using the following steps.

    1. Set a password for the user using sudo passwd shiny, now enter and confirm a password of your choosing.
    2. Switch to the shiny account using: su - shiny
    3. Call up R using $ R (without sudo)
    4. Install the required packages, in this case: `install.packages("shinydashboard")

    Note that if you have rstudio-server installed on the same machine then you can perform steps 2-4 using that interface. Simply go the same domain/ip and use :8787 for the rstudio-server interface instead of :3838 for shiny-server.

    Adapted from my answer here

提交回复
热议问题