Working with Spark on R Studio
The instructions are related to RStudio on Databricks.
1# connect to Databricks on this server
2
3library(SparkR)
4SparkR::sparkR.session()
5
6library(sparklyr)
7sc <- spark_connect(method = "databricks")
8
9library(dplyr)
List table in mydb database:
Read a table from mydb database:
1spark_df <- spark_read_table(sc, "mytable") # read as Spark DataFrame
2r_df <- collect(spark_df) # convert to R DataFrame
Save R DataFrame as Spark table:

Have feedback or questions? Feel free to email me.