R環境の構築メモ(2019/09)

R環境を作る時によく忘れるのでメモ

メモを作成したOS環境は、GCEのUbuntu 18.04 LTS Minimal。

Rprofile

メッセージを英語にするため、~/.Rprofileに「Sys.setenv(LANGUAGE = "en")」を記載。r4dsの1.6 Getting help and learning moreを参考。

https://r4ds.had.co.nz/introduction.html 

RStudioのServer

Webブラウザ経由での操作が可能になる。

https://www.rstudio.com/products/rstudio/download-server/

Rのライブラリ

  • tidyverse
  • lubridate
  • caret
  • doParallel
  • randomForest
  • broom
  • forecast
  • gridExtra
  • jsonlite
  • knitr
  • scales
  • sweep
  • timetk
  • vars
  • ggthemes
  • ggmosaic
  • fastDummies
  • lightgbm
  • tictoc
  • MLmetrics
  • moments
  • rattle
  • rsample
  • keras
  • glmnet

tidyverseの時には、OSソフトのインストールが必要になる。

sudo apt install libssl-dev libxml2-dev libcurl4-openssl-dev

lightgbmはR3.6.1だとinstall.packagesで入れられなかった。

https://github.com/microsoft/LightGBM/tree/master/R-package

より、コマンドラインでインストール

sudo apt install cmake

git clone --recursive https://github.com/microsoft/LightGBM

cd LightGBM

Rscript build_r.R

 Rmarkdown

renderコマンドで生成する場合はpandocが必要.

sudo apt install pandoc