Database Reference
In-Depth Information
Building Applications for Data Interactivity
In practice, the ability to ask ad hoc questions about datasets is an important goal
for data analysts. The ability to generate plots and visualizations quickly is useful for
exploring data interactively as well as sharing insights about the data with others.
There is an enormous number of tools, both commercial and open-source, for cre-
ating graphs and visualizations for both general data visualization and niche industries.
Products from companies such as Tableau and Qlikview focus on providing interactiv-
ity with a variety of data sources. Other commercial data products, such as Splunk,
incorporate visualization into their data analytics workf low.
For those who are either exploring data sets interactively or building their own
Web-based applications, a commercial solution isn't always the most f lexible choice.
In some cases, writing the code to provide a custom visualization is a more practical
solution.
Interactive Visualizations with R and ggplot2
R is currently the most popular open-source scientific and numerical analysis lan-
guage. R features an intuitive design inspired by other functional languages as well as
a massive community of users who contribute modules for solving an incredible range
of analysis challenges. A seemingly underappreciated strength of the language contrib-
uting to R's impact is its rich set of functions and installable libraries available for plot-
ting and graphics.
Let's retell the story taken from a well-cited and interesting 2002 paper by Shaugh-
nessy and Pfannkuch entitled “How Faithful is Old Faithful?” This paper is an excel-
lent foray into the world of statistical analysis. Furthermore, the Old Faithful eruption
dataset used in the paper is one of many available public datasets in the core R distri-
bution for testing.
A scatterplot is an excellent visualization tool for looking for possible correlations,
and because it is also a great type of plot to explore two-dimensional numerical data,
R makes it tremendously easy to create one: It's a matter of simply typing plot() .
Listing 7.1 shows how to do this and how to save an R plot as a PNG file, useful for
publications. For an example of the output, see Figure 7.3.
Listing 7.1 Simple example of the plotting functions of R
# Show the first three lines of the faithful dataset
head(faithful,3)
eruptions waiting
1 3.600 79
2 1.800 54
3 3.333 74
 
 
Search WWH ::




Custom Search