O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting ready

There are different ways of installing Apache Spark with R:

  • Install directly from a GitHub repository:
if (!require('devtools')) install.packages('devtools') devtools::install_github('apache/spark@v2.1.1', subdir='R/pkg')
  • Install from a downloaded binary Apache Spark package: R library is in an R/lib/SparkR subdirectory. It can be used to install SparkR directly using the following commands:
$ export SPARK_HOME=/path/to/spark/directory$ cd $SPARK_HOME/R/lib/SparkR/$ R -e "devtools::install('.')"
  • Load the library SparkR:
> library(SparkR)> Sys.setenv(SPARK_HOME='/path/to/spark/directory') .libPaths(c(file.path(Sys.getenv('SPARK_HOME'), 'R', 'lib'), .libPaths()))

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required