Parallel sets first published by Robert Kosara in
Kosara, Robert, Fabian Bendix, and Helwig Hauser. "Parallel sets: Interactive exploration and visual analysis of categorical data." Visualization and Computer Graphics, IEEE Transactions on 12.4 (2006): 558-568.
provide a compelling interactive method for visualizing categorical data. Jason Davies, co-author of d3.js
, implemented an extremely well-designed d3
version of parallel sets. Using the infrastructure provided by htmlwidgets
, this package parsetR
allows us to easily integrate parallel sets into our R workflow.
parsetR
is not on CRAN, so please install using devtools::install_github()
.
devtools::install_github("timelyportfolio/parsetR")
table
In this first iteration, parsetR
is designed to work with tables
from R, such as the built-in Titanic
dataset.
library(parsetR) parset(Titanic, width = "80%", height = 400)
Here is another example with the UCBAdmissions
data, and we'll make the lines curvy with the tension
argument.
library(parsetR) parset(UCBAdmissions, tension = 0.5, width = "80%", height = 400)
data.frame
With a data.frame
you'll need to tell parsetR
where to find the numeric column for now. Otherwise, it will appear as a dimension. as shown below.
# demonstrate working with non-table data(Alligator, package="vcdExtra") # with data.frame to demo how it doesn't work parset(Alligator, width = "80%", height = 400)
I thought it be fun to force a little JavaScript
to specify our numeric value
. I will eventually provide a more R
-like interface, but for now please learn this tiny bit of JS :).
parset( Alligator, # dimensions are the categorical columns dimensions = colnames(Alligator)[-5], # use some JavaScript to inform parset that Freq has the value value = htmlwidgets::JS("function(d){return d.count}"), width = "80%", height = 400 )
parsetR
was implemented in a couple of hours to provide a base for feedback, criticism, comments. Please help me make this thing as good as it should be.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.