Skip to content

Instantly share code, notes, and snippets.

View timelyportfolio's full-sized avatar

timelyportfolio timelyportfolio

View GitHub Profile
@timelyportfolio
timelyportfolio / measuring worth data in r.r
Created March 15, 2013 19:23
gold prices from measuring worth in r
#R example of using prices from http://www.measuringworth.com
#if you use and like their data, I strongly encourage donating to the cause http://www.measuringworth.com/contribute.php
require(latticeExtra)
require(xts)
#ugly way to specify url for prices you would like
#shiny would provide a very nice interface once I get motivated
#this particular example will download prices from 1718 to 2013 for New York and London market
#redundant since London market dataset switched to New York in 1950
@timelyportfolio
timelyportfolio / example.Rmd
Last active August 2, 2024 16:33
summary widget with flexdashboard valueBox
---
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
Created April 19, 2016 18:11 — forked from jcheng5/README.md
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
timelyportfolio / Readme.md
Last active June 22, 2024 16:32
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.

library(plotly)
library(dplyr)
library(tidyr)
library(purrr)
library(quantmod)
library(magrittr)
@timelyportfolio
timelyportfolio / code.R
Last active May 26, 2024 00:41
rCharts Implements d3.js Sankey Plugin
require(rCharts)
require(rjson)
#get source from original example
#this is a JSON, so will need to translate
#this is complicated and unnecessary but feel I need to replicate
#for completeness
#expect most data to come straight from R
#in form of source, target, value
@timelyportfolio
timelyportfolio / README.md
Last active April 1, 2024 12:45 — forked from mbostock/.block
demo programmatic control of a d3 brush

Programmatically Control a d3 brush

Forked from Mike Bostock's focus+context zoom gist to demonstrate how we can drive a d3 brush with code.

anybody know how to brush with code in #d3js?

— klr (@timelyportfolio) September 10, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

So I found this discussion, but I could not find an example demonstrating the steps proposed by Athan Reines.

For auto-redraw such that the focus of a 1D brush matches the graphed domain, you need to do as follows:
@timelyportfolio
timelyportfolio / BarChart.js
Last active September 30, 2023 02:44
dexvis map experiment
BarChart.prototype = new DexComponent();
BarChart.constructor = BarChart;
function BarChart(userConfig)
{
DexComponent.call(this, userConfig,
{
parent : null,
labels : [ "X", "Y" ],
id : "BarChart",
@timelyportfolio
timelyportfolio / Readme.md
Last active August 15, 2023 16:10
R ( igraph + DiagrammeR + pipeR +htmltools ) + JS ( mermaid.js + d3.js + dagre-d3.js )

This is an example how we might integrate the R package igraph with the new DiagrammeR which uses htmlwidgets to allow us access to the very popular new Javascript library mermaid.js.

code

@timelyportfolio
timelyportfolio / Readme.md
Created July 6, 2018 01:41
dygraphs point fun

supplement to Stack Overflow

Code

library(dygraphs)
library(scales)

lungDeaths <- xts::as.xts(cbind(mdeaths, fdeaths))
@timelyportfolio
timelyportfolio / Readme.md
Last active September 27, 2022 13:04
vega-lite changing bar size and spacing