Skip to content

Instantly share code, notes, and snippets.

@tomz
Forked from shivaram/rstudo-sparkr.R
Last active August 29, 2015 14:25
Show Gist options
  • Save tomz/5b98f3f9f74131edafe6 to your computer and use it in GitHub Desktop.
Save tomz/5b98f3f9f74131edafe6 to your computer and use it in GitHub Desktop.
Rstudio local setup
Sys.setenv(SPARK_HOME="/Users/shivaram/spark-1.4.1")
.libPaths(c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib"), .libPaths()))
library(SparkR)
sc <- sparkR.init(master="local")
sqlContext <- sparkRSQL.init(sc)
df <- createDataFrame(sqlContext, faithful)
# Select one column
head(select(df, df$eruptions))
# Filter out rows
head(filter(df, df$waiting < 50))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment