title: How to convert Spark R dataframe into R list
body: <p>This is my first time to try Spark R to do the same work I did with RStudio, on Databricks Cloud Community Edition. But met some weird problems.</p>
  
  <p>It seems that Spark R do support packages like ggplot2, plyr, but the data has to be in R list format. I could generate this type of list in R Studio when I am using <code>train &lt;- read.csv("R_basics_train.csv")</code>, variable <code>train</code> here is a list when you use <code>typeof(train)</code>.</p>
  
  <p>However, in Spark R, when I am reading the same csv data as "train", it will be converted into dataframe, and this is not the Spark Python DataFrame we have used before, since I cannot use <code>collect()</code> function to convert it into list.... When you use <code>typeof(train)</code>, it shows the type is <code>"S4"</code>, but in fact the type is dataframe....</p>
  
  <p>So, is there anyway in Spark R that I can convert dataframe into R list so that I can use methods in ggplot2, plyr?</p>
  
  <p>You can find the origional .csv training data here:
  <a href="https://github.com/hanhanwu/Hanhan_Data_Science_Practice/blob/master/R_basics_train.csv" rel="nofollow">train</a></p>