(short for interactives-a hat tip to Neal Stephenson), which are simple folder structures that contain a template file used to populate the JS code with R input data
provide the structure for clickme to produce an html file from
- a template in R markdown (template.rmd)
- a translator R script (translator.r)
- a data source
Inspired by the clickme longitudinal heatmap example, I just had to try to create my own ractive. I thought Mike Bostock’s line chart example would serve as a nice template for my first ractive. The data not surprisingly will come from the R finance package PerformanceAnalytics dataset named managers. With very minor modifications to the Bostock source and a simple custom R script translator (translator.R shown below), we have everything we need for this ractive, which I will call multiline.
Now to create our first clickme html page, we just need a couple lines of code in R.
# if not already installed, uncomment the tow lines below # library(devtools) install_github('clickme', 'nachocab') require(clickme) # set location where you put your multiline ractive set_root_path("your-path-goes-here/ractives") require(PerformanceAnalytics) data(managers) #although I use managers, really any xts series of returns will work clickme(managers, "multiline")
Then, we have a web page that will create an interactive d3 line chart using the cumulative growth of the managers return series. If you do not see the embed below, then please follow the link.
Eventually, it will be very nice to have an entire gallery of amazing ractives.