Skip to content

Instantly share code, notes, and snippets.

Avatar

timelyportfolio timelyportfolio

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

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.

library(plotly)
library(dplyr)
library(tidyr)
library(purrr)
library(quantmod)
library(magrittr)
@timelyportfolio
timelyportfolio / Readme.md
Last active September 27, 2022 13:04
vega-lite changing bar size and spacing
@timelyportfolio
timelyportfolio / Readme.md
Last active September 12, 2022 18:26
experiment with vega formula transform and new zip functionality
View Readme.md

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
timelyportfolio / README.md
Created April 19, 2016 18:11 — forked from jcheng5/README.md
Using arbitrary Leaflet plugins with Leaflet for R
View README.md

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
timelyportfolio / README.md
Last active July 11, 2022 06:14
d3 hierarchies in R
View README.md

Built with blockbuilder.org

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
timelyportfolio / example.R
Last active February 9, 2022 03:59
rhansontable tooltips on column headers
View example.R
library(rhandsontable)
library(htmltools)
browsable(tagList(
rhandsontable(
data = mtcars,
rowHeaders = NULL,
# see http://jsfiddle.net/pn3rv48p/ for another example with afterGetColHeader
afterGetColHeader = htmlwidgets::JS(htmltools::HTML(
sprintf(
@timelyportfolio
timelyportfolio / .block
Last active December 10, 2021 02:30
vue and networkD3 in R
View .block
license: mit
@timelyportfolio
timelyportfolio / .block
Last active September 28, 2021 13:28
trelliscope and sparkline example
View .block
license: mit
@timelyportfolio
timelyportfolio / example.Rmd
Last active September 17, 2021 17:16
summary widget with flexdashboard valueBox
View example.Rmd
---
title: "Example of filtered values boxes"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
mathjax: null
---
```{r setup, include=FALSE}
@timelyportfolio
timelyportfolio / Readme.md
Last active August 15, 2021 17:49
R visualization of arules with arulesViz + igraph + visNetwork
View Readme.md

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

library(arules)
library(arulesViz)
library(visNetwork)