How to Initialize and Stop Spark Session in R ?


To Initialize Spark Session in R

  • Set up spark home
  • Load the spark library
  • Initialize the spark context
  • Now write the desired coding
  • Stop the spark session

#Set up spark home
.libPaths(c(file.path(Sys.getenv(“SPARK_HOME”), “R”, “lib”), .libPaths()))
#Load the library
#Initialize the Spark Context
#To run spark in a local node give master=”local”
sc #Start the SparkSQL Context
sqlContext #To stop the spark session

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit