In order to use sparkR in RStudio, we have to call the package installed in SPARK_HOME.

Here is a script to be initiated at the beginning of the program:

Here is an example with my configuration with Hortonworks HDP: