Patrick de Guzman
July 31, 2019
Application: Interactive scatterplot graph with ability to dynamically select 'x' and 'y' variables, as well as filter by some factor 'z'.
For the purposes of this demonstration, the iris data in the R datasets package was analyzed and plotted in the graph.
The complete application can be found in the following link: https://patrickdg.shinyapps.io/DDP-Project-InteractiveScatterplot/
The iris set within the R datasets packages has the following structure:
library(datasets)
data(iris)
str(iris)
'data.frame': 150 obs. of 5 variables:
$ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
$ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
$ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
$ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
$ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
In a normal setting, performing exploratory data analysis on the dataset would require the creation of multiple plots with no easy way of dynamically selecting variables (except for manually changing them). Below is an example of this:
library(ggplot2)
qplot(iris$Sepal.Length, iris$Sepal.Width, data = iris, col = iris$Species)
However, with the interactive scatterplot app, we can use the input boxes to dynamically select which variables we'd like to plot against each other, and we also have the ability to filter out by species within the dataset.
On the left side of the application, the X, Y, and Species filter variables can be selected and on the right is the resulting scatterplot (as well as additional documentation on the project and instructions on using the app).