Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing R commands in Bash script?

Tags:

linux

bash

r

From a bash script would I like to execute these R commands

install.packages('knitr', dependencies = TRUE)
install.packages("xlsx", dependencies="Depends")
install.packages("xtable")

One way would be to put them in a R file, then execute that, but I would prefer not to do that.

Can these commands be executed directly from a Bash script?

like image 345
Jasmine Lognnes Avatar asked Sep 21 '26 05:09

Jasmine Lognnes


1 Answers

apt-get -y install littler

echo 'install.packages("knitr", dependencies = TRUE, repos="http://cran.rstudio.com/")' | r

R -e can also be used.

like image 161
d2xdt2 Avatar answered Sep 23 '26 21:09

d2xdt2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!