I am using rpy2 to wrap R in Python. I used R for plotting the CONSORT diagram with packages installed with devtools::install_github(“tgerke/ggconsort”). How can I put this in the packages.txt for deployment?
Hi @ruby9455
I’ve created a tutorial showing how to install R packages in a Streamlit app by specifying that in the packages.txt
file. Please see the GitHub repo GitHub - dataprofessor/R-Python-app
Here’s a companion tutorial video https://www.youtube.com/watch?v=xTfaJsn2PN0
Demo app: https://dataprofessor-r-streamlit-app-ocl159.streamlit.app/
Hope this helps!
Hi,
I’ve watched the tutorial which is pretty useful. I am able to specify those cran packages, however, I could not specify those packages that are installed from github. The packages that I am struggling on is that installed with devtools::install_github(“tgerke/ggconsort”).
Currently, my packages.txt
looks like this
r-base
r-cran-ggplot2
r-cran-remotes
r-cran-dplyr
r-crab-glue
Hi @ruby9455
Conceptually, putting R package names into packages.txt file is like installing these R packages like so:
sudo apt install r-base r-cran-ggplot2
As for installing R packages via devtools, this would need to be run inside an R environment.
Please see the following tutorial on installing R dependencies:
which can also be placed inside the packages.txt file. However, when running devtools you’ll probably need to run this from within an R environment as mentioned above. Since this would not be practical, the workaround is to run the command from the shell/terminal.
Thus, I’d recommend exploring the following commands:
R -e
Rscript -e
R CMD BATCH
to run the devtools::install_github(“tgerke/ggconsort”)
as you had intended.
Hope this helps!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.