After long and difficult installation process of SparkR i getting into new problems of launching SparkR.
My Settings
R 3.2.0
RStudio 0.98.1103
Rt
I had exact same issue. I can start SparkR in command line, but not in RStudio in Windows. And here is the solution works for me.
clean up all the paths you set when you tried to fix this issue. This including the paths you set in the windows environment from window control panel and uses Sys.unsetenv() to unset the SPARK_HOME.
find out your RStudio default working directory by using getwd() in RStudio. And then create a .Rprofile file in this directory. Put the following line in this file: .libPaths("C:/Apache/Spark-1.5.1/R/lib")
In window control panel->System->Advanced system settings->Environment Variables, add this ";C:\Apache\Spark-1.5.1\bin" at the end of your exsiting PATH variable.
Start RStudio, if you type .libPaths(), you can see the SparkR library path is already in the library path
use library(SparkR) to load SparkR library
sc=sparkR.init(master="local")
I tried this on both Spark 1.4.1 and 1.5.1, they both work fine. I hope this can help whoever still having issue after all the suggestion above.