SparkR error in Rstudio and Rcmd <p>head(df) SparkR error</p> <p>Error in invokeJava(isStatic = TRUE, className, methodName, ...) : org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 6.0 failed 1 times, most recent failure: Lost task 0.0 in stage 6.0 (TID 6, localhost): java.io.IOException: Cannot run program "Rscript": CreateProcess error=2, The system cannot find the file specified</p> <pre><code> at java.lang.ProcessBuilder.start(Unknown Source) at org.apache.spark.api.r.RRDD$.createRProcess(RRDD.scala:407) at org.apache.spark.api.r.RRDD$.createRWorker(RRDD.scala:445) at org.apache.spark.api.r.BaseRRDD.compute(RRDD.scala:62) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:300) at org.apache.spark.rdd.RDD.iterator(RDD.scala:264) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:300) at org.apache.spark.rdd.RDD.iterator(RDD.scala:264) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.sc </code></pre>