Skip to content

Instantly share code, notes, and snippets.

@akiatoji
Last active August 29, 2015 14:24
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 akiatoji/5b516a25ab3af6b3f5c8 to your computer and use it in GitHub Desktop.
Save akiatoji/5b516a25ab3af6b3f5c8 to your computer and use it in GitHub Desktop.
Loading and using SparkR, OSX Homebrew Spark 1.4
# SparkR RULES!
#Load libraries
library("rJava")
library(SparkR, lib.loc="/usr/local/Cellar/apache-spark/1.4.0/libexec/R/lib")
sc <- sparkR.init(sparkHome = "/usr/local/Cellar/apache-spark/1.4.0/libexec")
sqc <- sparkRSQL.init(sc)
# Create SparkR dataframe from R dataframe
df <- createDataFrame(sqc, faithful)
head(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment