Using SparkR for data visualization
The SparkR extension of the ggplot2 package, ggplot2.SparkR
, allows SparkR users to build powerful visualizations.
In this section, we use various to visualize our data. Additionally, we also present examples of plotting of data on maps and visualizing graphs:
> csvPath <- "file:///Users/aurobindosarkar/Downloads/bank-additional/bank-additional-full.csv" > df <- read.df(csvPath, "csv", header = "true", inferSchema = "true", na.strings = "NA", delimiter= ";") > persist(df, "MEMORY_ONLY") > require(ggplot2)
Note
Refer to the ggplot website for different options available to improve the displays of each of your plots at http://docs.ggplot2.org.
In the next step, we plot a basic bar that gives frequency counts for the different marital statuses in the data:
> ldf <- collect(select(df, df$age, df$duration, df$education, df$marital, df$job)) > g1 <- ggplot(ldf, aes(x = marital)) > g1 + geom_bar()
In the following example, we...