1 Setup

1.1 Install the latest rtemis version from GitHub


You can run the install_github command as often as you like: it will only work if there is an update available on GitHub. It will install rtemis with a minimal set of dependencies. A dependency check is run each time a function is called and will tell you if a package is missing. Install the following packages to begin with a reasonable lightweight setup:

packages <- c("e1071", "gbm", "glmnet", "pbapply", "plyr", "ranger", "rpart")

1.2 RStudio

You can run rtemis in the command line or using the IDE of your choice. RStudio is the preferred environment and can be downloaded here

1.3 macOS

1.3.1 Prerequisites

If you are installing on macOS, make sure you have installed:

Note on R + Java on macOS: In order to run some R packages that use rJava, like bartMachine, you may need to add a link to libjvm.dylib inside your R lib folder as explained here

1.3.2 Using Apple’s BLAS

You can speed up matrix operations by using Apple’s Basic Linear Algebra Subprograms (BLAS) instead of the default R BLAS. At the MacOS terminal:

cd /Library/Frameworks/R.framework/Resources/lib
ln -sf /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib libRblas.dylib

Restart R and check the version of BLAS in use:

R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.0.0   magrittr_1.5     bookdown_0.19    htmltools_0.4.0 
 [5] tools_4.0.0      yaml_2.2.1       Rcpp_1.0.4.6     fansi_0.4.1     
 [9] codetools_0.2-16 stringi_1.4.6    rmarkdown_2.3    knitr_1.28      
[13] stringr_1.4.0    digest_0.6.25    xfun_0.14        rlang_0.4.6     
[17] evaluate_0.14   

Benchmarks suggest substantial speed gains for some operations.

1.4 External frameworks

The following are all optional - install as needed.

1.4.1 MXNet

To use MXNet (s.MXN), you need to install the MXNet system libraries first and then the R package. Follow instructions on the MXNet website.
This will first require installation of more system dependencies, which can be installed using Brew

1.4.2 H2O

To use H2O (d.H2OGLRM, s.H2ODL.R, s.H2OGBM.R, s.H2ORF, u.H2OKMEANS), you will need to install H2O first. Follow instructions on the H2O website.

1.4.3 Spark

To use Spark’s ML framework (s.MLGBM, s.MLMP, s.MLRF), installation can be performed within R:


1.4.4 Keras + TensorFlow

You can easily install Keras for R and the TensorFlow library:


Learn more on the RStudio website

1.5 Load rtemis

  .:rtemis 0.8.0: Welcome, egenn
  [x86_64-apple-darwin17.0 (64-bit): Defaulting to 4/4 available cores]
  Documentation & vignettes: https://rtemis.netlify.com

1.6 Setup project directories

rtemis includes a function and RStudio addin to initialize a simple directory structure under the working directory for your data analysis projects with the following:

  • ./R/
    Directory to save your project .R code files
  • ./Data/
    Directory to save your project data files, e.g. .rds, .csv, etc
  • ./Results/
    Directory to save your output, e.g. rtemis supervised learning output directories (define using outdir, e.g. outdir = "./Results/Dataset_Algorithm")
  • ./rtInit.log
    Log file with R session info

Call the function directly or use RStudio’s Addins drop down menu:

[2020-06-23 08:14:07 rtInitProjectDir] rtemis: Initializing project directory... 
   Working in /Users/egenn/Library/Mobile Documents/com~apple~CloudDocs/Projects/rtemis/rtemisWeb_0.8.0...
  Creating 'R' folder... Already present
  Creating 'Data' folder... Already present
  Creating 'Results' folder... Already present
  All done

rtemis RStudio addin

Figure 1.1: rtemis RStudio addin

1.7 Notes on this bookdown website format

Graphviz-based graphics, used to plot decision trees and MXNet graphs, appear a little off on this html output. The text is slightly oversized for the given box size - will hopefully be solved in the near future.

rtemis running in RStudio with the (recommended) dark theme

Figure 1.2: rtemis running in RStudio with the (recommended) dark theme