A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/react-R/sparklines-example below:

react-R/sparklines-example: Demonstrates adapting a React-based library (react-sparklines) into an htmlwidget

This example demonstrates creating an htmlwidget wrapper around the react-sparklines library.

Because this package includes Javascript source code that requires a compilation step, package installation is in two phases: Javascript tools build the Javascript, and R tools build and install the package. The R package includes the built Javascript files in the inst/ directory.

Javascript Build Requirements

Building Javascript should work on macOS, Linux, and Windows. The following tools are necessary regardless of your platform:

You should install the reactR package if you haven't, as this widget depends on it.

After you've installed Node.js and Yarn, run the following command to resolve and download dependencies:

Now, run yarn to build inst/htmlwidgets/sparklineswidget.js:

yarn run webpack --mode=development

To run yarn webpack automatically whenever sources change, use the command yarn run webpack --mode=development --watch

Now that the Javascript is built, you can install the R package:

devtools::document()
devtools::install()

Next, install the colourpicker and shinySignals packages, as they are used in the example app:

install.packages("colourpicker")
devtools::install_github("shinySignals")

Finally you can try the example app by running app.R.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4