Skip to content

Instantly share code, notes, and snippets.

@R3DDY97
Forked from pachadotdev/r_ubuntu_17_10.sh
Last active November 3, 2017 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save R3DDY97/502dc11de75b023ff4f4237dd2268c6a to your computer and use it in GitHub Desktop.
Save R3DDY97/502dc11de75b023ff4f4237dd2268c6a to your computer and use it in GitHub Desktop.
Install R on Ubuntu 17.10
#!/bin/bash
# Install R
sudo apt-get update
sudo apt-get install libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base -y
# create local library folder and update path
mkdir -p ~/R/x86_64-pc-linux-gnu-library/3.4
echo ".libPaths("~/R/x86_64-pc-linux-gnu-library/3.4")" > ~/.Rprofile
# Install RStudio
cd Downloads
wget -c https://download1.rstudio.org/rstudio-xenial-1.1.383-amd64.deb
sudo dpkg -i rstudio-xenial-1.1.383-amd64.deb
printf '\nexport QT_STYLE_OVERRIDE=gtk\n' | sudo tee -a ~/.profile
R --vanilla << EOF
# install common packages
install.packages(c("tidyverse","data.table","dtplyr","devtools","roxygen2","bit64"), repos = "https://cran.rstudio.com/")
#Export to HTML/Excel
install.packages(c("htmlTable","openxlsx"), repos = "https://cran.rstudio.com/")
# Blog tools
install.packages(c("knitr","rmarkdown"), repos='http://cran.us.r-project.org')
# stats packages
install.packages(c("xlsxjars","xlsx", "stargazer", "foreign"), repos='http://cran.us.r-project.org')
q()
EOF
sudo apt-get install python3-pip -y
sudo -H pip3 install -U markdown rpy2 pelican
# PDF extraction tools
sudo apt-get install libpoppler-cpp-dev default-jre default-jdk r-cran-rjava -y
sudo R CMD javareconf
R --vanilla << EOF
library(devtools)
sudo install.packages("pdftools", repos = "https://cran.rstudio.com/")
install_github("ropensci/tabulizer")
q()
EOF
# TTF/OTF fonts usage
sudo apt-get install libfreetype6-dev -y
R --vanilla << EOF
install.packages("showtext", repos = "https://cran.rstudio.com/")
q()
EOF
# Cairo for graphic devices
sudo apt-get install libgtk2.0-dev libxt-dev libcairo2-dev -y
R --vanilla << EOF
install.packages("Cairo", repos = "https://cran.rstudio.com/")
q()
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment