Using SparkR with Zeppelin
The latest Hortonworks Sandbox provides a preconfigured Zeppelin service, which can be used to work with SparkR scripts. For other virtual machines such as Cloudera or MapR, we need to manually install and configure Zeppelin. Follow the steps created in the The manual method section under the Installing Apache Zeppelin section in Chapter 6, Notebooks and Dataflows with Spark and Hadoop.
Open the Zeppelin UI at http://localhost:9999
. Create a new notebook and enter the following SparkR code in a paragraph. In the next paragraph, query the data using SQL. DataFrames returned from SparkR will be displayed using Zeppelin's built-in interactive visualizations, as shown in the following charts (bar plot and pie chart).
If you get an error such as interpreter not found
, click on the Interpreter binding icon in the top-right corner of the notebook, and then click on Save to resolve the issue:
%r data(mtcars) cars <- createDataFrame(mtcars) createOrReplaceTempView...