I ran a single line of code to make a Spark DataFrame. I installed SparkR and used library(SparkR) before I ran the following:
spark_df <- as.DataFrame(data)
However I get the following error message
Error in getSparkSession() : SparkSession not initialized
What do I need to do?



This is for Databricks using R notebooks. Make sure you load the library. This loads the diamonds dataset which if famous for linear regression.
Refer to docs for details. https://docs.databricks.com/sparkr/overview.html
There is code to create a spark data frame also.