manipulateWidget lets you create in just a few lines of R code a nice
user interface to modify the data or the graphical parameters of one or
multiple interactive charts. It is useful to quickly explore visually
some data or for package developers to generate user interfaces easy to
maintain.
This R package is largely inspired by the manipulate package from
Rstudio. It provides the function manipulateWidget that can be used to
create in a very easy way a graphical interface that let the user modify
the data or the parameters of an interactive chart. Technically, the
function generates a Shiny gadget, but the user does not even have to
know what is Shiny.
Features
Easily combine multiple interactive charts (htmlwidgets) in a
single interactive chart with function combineWidgets.
With only a few lines of code, create a complete user interface that
lets a user change the settings of a chart: filter the input data,
change the model, modify the chart type or anything else.
Comparison mode: compare at a glance two set of parameters. For
instance compare the same chart for two different countries or
compare the results of several models or whatever.
Export to HTML or to PNG with a single click.
Why should you use it?
All functionalities of this package can be replicated with other
packages like shiny,
flexdashboard,
crosstalk and others. So why
another package?
manipulateWidget has three advantages:
It is easy and fast to use. Only a few lines of R are necessary to
create a user interface.
Code can be included in any R script. No need to create a dedicated
.R or .Rmd file.
It works with all htmlwidgets. In contrast, crosstalk only
supports a few of them.
manipulateWidget can be especially powerful for users who are
exploring some data set and want to quickly build a graphical tool to
see what is in their data. manipulateWidget has also some advanced
features that can be used with almost no additional code and that could
seduce some package developers: grouping inputs, conditional inputs and
comparison mode.
Installation
The package can be installed from CRAN:
install.packages("manipulateWidget")
You can also install the latest development version from
github:
The hard part for the user is to write a code that generates an
interactive chart. Once this is done, he only has to describe what
parameter of the code should be modified by what input control. For
instance, consider the following code that identifies clusters in the
iris data set and uses package plotly to generate an interactive
scatter plot.
We create a second function that represents the share of a given country
in the world energy consumption and population. We create also create a
custom tooltip.
So we now have some R code that generates a nice interactive chart. Now
we would like to create a user interface that lets a user choose the
country and the period that he wants to visualize.
Here comes the magic of package manipulateWidget! With this package,
you only have to write a few more lines of R code to achieve this
result:
manipulateWidget(
combinedPlots(Period, Country),
Period = mwSlider(1960, 2014, c(1960, 2014)),
Country = mwSelect(sort(unique(worldEnergyUse$country)), "United States")
)
This Source Code is subject to the terms of the GNU General Public
License, version 2 or any higher version. If a copy of the GPL-v2 was
not distributed with this file, You can obtain one at
https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html.
Add more interactivity to interactive charts
manipulateWidgetlets you create in just a few lines of R code a nice user interface to modify the data or the graphical parameters of one or multiple interactive charts. It is useful to quickly explore visually some data or for package developers to generate user interfaces easy to maintain.This R package is largely inspired by the
manipulatepackage from Rstudio. It provides the functionmanipulateWidgetthat can be used to create in a very easy way a graphical interface that let the user modify the data or the parameters of an interactive chart. Technically, the function generates a Shiny gadget, but the user does not even have to know what is Shiny.Features
htmlwidgets) in a single interactive chart with functioncombineWidgets.Why should you use it?
All functionalities of this package can be replicated with other packages like shiny, flexdashboard, crosstalk and others. So why another package?
manipulateWidgethas three advantages:Rare necessary to create a user interface.crosstalkonly supports a few of them.manipulateWidgetcan be especially powerful for users who are exploring some data set and want to quickly build a graphical tool to see what is in their data.manipulateWidgethas also some advanced features that can be used with almost no additional code and that could seduce some package developers: grouping inputs, conditional inputs and comparison mode.Installation
The package can be installed from CRAN:
You can also install the latest development version from github:
Getting started
The hard part for the user is to write a code that generates an interactive chart. Once this is done, he only has to describe what parameter of the code should be modified by what input control. For instance, consider the following code that identifies clusters in the iris data set and uses package
plotlyto generate an interactive scatter plot.We create a second function that represents the share of a given country in the world energy consumption and population. We create also create a custom tooltip.
We can combine two charts with the helper function
combineWidgets(). We create a new function for clarity, but this is not a requirement.So we now have some R code that generates a nice interactive chart. Now we would like to create a user interface that lets a user choose the country and the period that he wants to visualize.
Here comes the magic of package
manipulateWidget! With this package, you only have to write a few more lines of R code to achieve this result:And voila!
For more information take a look at the package vignette.
License Information:
Copyright 2015-2020 RTE (France)
This Source Code is subject to the terms of the GNU General Public License, version 2 or any higher version. If a copy of the GPL-v2 was not distributed with this file, You can obtain one at https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html.