Connect R with Spark in Rstudio-Failed to launch Spark shell. Ports file does not exist
<p>I am trying to connect R with a local instance of Spark using Rstudio. However, I get the error message shown. What am I missing? I am using windows 10. I am following the tutorial on <a href="http://spark.rstudio.com/" rel="nofollow">rstudio</a>.</p>

<pre><code>  library(sparklyr)
  spark_install(version = "1.6.1")
  library(sparklyr)
  library(dplyr)
  sc &lt;- spark_connect(master = "local")
</code></pre>

<p>The error message I am getting:</p>

<pre><code>     Error in start_shell(scon, list(), jars, packages) : 
     Failed to launch Spark shell. Ports file does not exist.
    Path: C:\Users\username\AppData\Local\rstudio\spark\Cache\spark-1.6.1-  bin-hadoop2.6\bin\spark-submit.cmd

 Parameters: --packages "com.databricks:spark-csv_2.11:1.3.0,com.amazonaws:aws-java-sdk-pom:1.10.34" --jars "C:\Users\user\Documents\R\win-library\3.3\sparklyr\java\rspark_utils.jar"   sparkr-shell C:\Users\aaaa\AppData\Local\Temp\Rtmpw9PBxS\filea5860886dd1.out

 'cmd' is not recognized as an internal or external command,
  operable program or batch file.
</code></pre>