Clickme is an R package that lets you generate interactive visualizations directly from R. I presented the latest iteration at the 2013 IBSB conference in Kyoto
Bridging data analysis and interactive visualization
1. Bridging
Data Analysis
Interactive
Visualization
&
Nacho Caballero
Boston University
I’m going to talk about data exploration, which is something that most of us do all day.
We explore data to answer questions like: what genes have expression patterns that can
discriminate between different types of tumor, or what are the oscillation dynamics of yeast
metabolites.
2. ?
These are the big questions, but before they can be answered we need to tackle the little questions:
what format should I use to store my data, or how should I normalize it.
3. ?
?
? ?
?
?
?
?
?
????
? ? ? ?
???
These are the big questions, but before they can be answered we need to tackle the little questions:
what format should I use to store my data, or how should I normalize it.
6. Demo rclickme.com
In the year 2013, there is no reason why I shouldn’t be able to simply type the name of a data point
and see where it shows up in my data. No technological reason prevents me from zooming in to a
specific region and hovering over a point to show additional information on demand.
During the past few years, a thriving community of JS developers has turned your internet
browser into a very powerful visualization platform, but these advantages are just now
starting to become adopted by the R community.
I didn’t want to have to choose between R’s ability to work with data in bulk and JS’s ability to
display data interactively, so I built an R package to get the best of both worlds. It’s called
Clickme, and it’s available at rclickme.com
7. data
<-‐
data.frame(
x
=
c(1,
2,
3),
y
=
c("a",
"b",
"c")
)
R
I encountered two major problems while trying to make both platforms talk to each other.
The first was working with different data formats. This is an example of how R and JS store a matrix
containing numbers and strings. Clickme converts R data to JS formatted data by using translator
functions, which ensure that every data type in R has the right format in JS.
8. data
<-‐
data.frame(
x
=
c(1,
2,
3),
y
=
c("a",
"b",
"c")
)
R
var
data
=
[
{"x":1,
"y":"a"},
{"x":2,
"y":"b"},
{"x":3,
"y":"c"}
];
JS
I encountered two major problems while trying to make both platforms talk to each other.
The first was working with different data formats. This is an example of how R and JS store a matrix
containing numbers and strings. Clickme converts R data to JS formatted data by using translator
functions, which ensure that every data type in R has the right format in JS.
9. data
<-‐
data.frame(
x
=
c(1,
2,
3),
y
=
c("a",
"b",
"c")
)
R
var
data
=
[
{"x":1,
"y":"a"},
{"x":2,
"y":"b"},
{"x":3,
"y":"c"}
];
JS
translate(data) Translator
I encountered two major problems while trying to make both platforms talk to each other.
The first was working with different data formats. This is an example of how R and JS store a matrix
containing numbers and strings. Clickme converts R data to JS formatted data by using translator
functions, which ensure that every data type in R has the right format in JS.
10. data
<-‐
data.frame(
x
=
c(1,
2,
3),
y
=
c("a",
"b",
"c")
)
var
data
=
{{
translate(data)
}};
R
Template
The other major problem was data reusability. How to tell the JS code responsible for generating the
visualization what data to use? Clickme does this by using templates: hybrid files that contain both
R and JS code. This makes it possible for the same template to be used to visualize different data
sets.
A template contains mostly JS code, but at critical points it has R code surrounded by double (or
triple) braces. When the user asks to generate a plot, the R code is evaluated and the braces are
replaced with the results, generating a visualization customized to your data.
11. data
<-‐
data.frame(
x
=
c(1,
2,
3),
y
=
c("a",
"b",
"c")
)
var
data
=
{{
translate(data)
}};
R
var
data
=
[
{"x":1,
"y":"a"},
{"x":2,
"y":"b"},
{"x":3,
"y":"c"}
];
JS
Template
The other major problem was data reusability. How to tell the JS code responsible for generating the
visualization what data to use? Clickme does this by using templates: hybrid files that contain both
R and JS code. This makes it possible for the same template to be used to visualize different data
sets.
A template contains mostly JS code, but at critical points it has R code surrounded by double (or
triple) braces. When the user asks to generate a plot, the R code is evaluated and the braces are
replaced with the results, generating a visualization customized to your data.
12. Clickme plots
are easy
to create
and share
The main reason why you should use Clickme for your daily plotting needs is that dynamic plots are
as easy to generate as static plots. You simply call a function and send it a template and some data.
The plots are also easy to share, simply upload them to a server, or email them.
13. rclickme.com
@nachocaballero
You can try Clickme by visiting rclickme.com and following the instructions to install the package in
R.
Right now, you can only create scatter plots, but I’m working on adding more types of visualizations
(line plots, heatmaps).
If you have a visualization that you would like to be able to use directly from R, let me know and I’ll
send you an email when the developer guide is ready.
I hope Clickme helps you solve the little problems more quickly, so you can spend the extra time
thinking about the big questions.