Skip to content

Instantly share code, notes, and snippets.


timelyportfolio timelyportfolio

View GitHub Profile
timelyportfolio /
Last active February 19, 2023 23:01
3d yield curve with Plotly in R

Nowhere near as spectacular as the Upshot/New York Times 3d yield curve by Amanda Cox and Gregor Aisch, but not bad at all for a couple of lines of R code with the plotly htmlwidget.

timelyportfolio /
Last active September 27, 2022 13:04
vega-lite changing bar size and spacing
timelyportfolio /
Last active September 12, 2022 18:26
experiment with vega formula transform and new zip functionality

Vega Experiments with Stats and Formula Transform and New Zip

Using the barley.json example from the vega package, I wanted to try to add plots with x as

  1. Yield Difference From Site Mean
  2. Yield Difference From Aggregate Mean

Please do not replicate, since I'm guessing I'm performing this ugly hack instead of the more elegant preferred method that I have overlooked. New projects are like puzzles, and I'm still a long way from completing this one.

timelyportfolio /
Created April 19, 2016 18:11 — forked from jcheng5/
Using arbitrary Leaflet plugins with Leaflet for R

Using arbitrary Leaflet JS plugins with Leaflet for R

The Leaflet JS mapping library has lots of plugins available. The Leaflet package for R provides direct support for some, but far from all, of these plugins, by providing R functions for invoking the plugins.

If you as an R user find yourself wanting to use a Leaflet plugin that isn't directly supported in the R package, you can use the technique shown here to load the plugin yourself and invoke it using JS code.

timelyportfolio /
Last active July 11, 2022 06:14
d3 hierarchies in R

Built with

It seems that working with d3.js hierarchies in R causes much consternation. Here is a quick little demonstration of working with the flare.json hierarchy often used in d3, processing, and Protovis. data.tree eases the pain considerably. I also include the purrr code for those interested in this library and/or some hierarchy recursion in R.

loading the data

# work through d3 hierarchies in R
#  using data.tree and dplyr
#  on the commmonly used flare.json
timelyportfolio / example.R
Last active February 9, 2022 03:59
rhansontable tooltips on column headers
View example.R
data = mtcars,
rowHeaders = NULL,
# see for another example with afterGetColHeader
afterGetColHeader = htmlwidgets::JS(htmltools::HTML(
timelyportfolio / .block
Last active December 10, 2021 02:30
vue and networkD3 in R
View .block
license: mit
timelyportfolio / .block
Last active September 28, 2021 13:28
trelliscope and sparkline example
View .block
license: mit
timelyportfolio / example.Rmd
Last active September 17, 2021 17:16
summary widget with flexdashboard valueBox
View example.Rmd
title: "Example of filtered values boxes"
orientation: rows
vertical_layout: fill
mathjax: null
```{r setup, include=FALSE}
timelyportfolio /
Last active August 15, 2021 17:49
R visualization of arules with arulesViz + igraph + visNetwork

Interactive arules with arulesViz and visNetwork

In response to visNetwork issue #6, here is some code to demonstrate how we might interactively visualize an arules object in R using the new htmlwidget visNetwork. Fortunately, arulesViz has already done a lot of the plumbing for us.

# visNetwork view of arules