How to load csv file into SparkR on RStudio?

后端 未结 3 848
梦谈多话
梦谈多话 2020-12-17 03:22

How do you load csv file into SparkR on RStudio? Below are the steps I had to perform to run SparkR on RStudio. I have used read.df to read .csv not sure how else to write t

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-17 03:32

    I appreciate everyone's input and solutions!!! I figured out another way to load .csv file into SparkR RStudio. Here it is:

    #set sc
    sc <- sparkR.init(master = "local")
    sqlContext <- sparkRSQL.init(sc)
    
    #load .csv 
    patients <- read.csv("C:/...") #Insert your .csv file path
    
    df <- createDataFrame(sqlContext, patients)
    df
    head(df)
    str(df)
    

提交回复
热议问题