Interactive charts with the R Manipulate package

Here is a nifty way to use the manipulate package to select different variables to display on a chart.  Here we look at some fake data for website subscribers. Our factors are new monthly users in the database versus the cumulative count of users. This is an R equivalent to using the drop down in Excel. We're basically adding a selector tool to our chart based on the available factors.

[sourcecode language="R"]

library("manipulate") library("ggplot2")

us_users_test us_stage EF_data manipulate( barplot(as.matrix(us_users_test[,factor]), beside = TRUE, main=factor), factor = picker("total_users", "total_new_users"))

manipulate( barplot(as.matrix(us_stage[,factor]), beside = TRUE, main=factor), factor = picker("Total.Users...EOM", "Total.New.Users", "Baby", "Preg")) [/sourcecode]

Get notified about new posts