简体   繁体   中英

Executing R commands in Bash script?

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?

apt-get -y install littler

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

R -e can also be used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM