Publications by hrbrmstr

Craft httr calls cleverly with curlconverter

10.02.2016

When you visit a site like the LA Times’ NH Primary Live Results site and wish you had the data that they used to make the tables & visualizations on the site: Sometimes it’s as simple as opening up your browsers “Developer Tools” console and looking for XHR (XML HTTP Requests) calls: You can actually see a preview of those requests (us...

3010 sym R (3570 sym/4 pcs) 6 img 4 tbl

Plot the new SVG R logo with ggplot2

11.02.2016

High resolution and SVG versions of the new R logo are finally available. I converted the SVG to WKT (file here) which means we can use it like we would a shapefile in R. That includes plotting! Here’s a short example of how to read that WKT and plot the logo using ggplot2: library(sp) library(maptools) library(rgeos) library(ggplot2) library(g...

669 sym R (696 sym/1 pcs) 2 img 1 tbl

Making Faceted Heatmaps with ggplot2

14.02.2016

We were doing some exploratory data analysis on some attacker data at work and one of the things I was interested is what were “working hours” by country. Now, I don’t put a great deal of faith in the precision of geolocated IP addresses since every geolocation database that exists thinks I live in Vermont (I don’t) and I know that these ...

5615 sym R (4922 sym/17 pcs) 6 img 21 tbl

Working with the Clinton State Dept Email Dumps in R (Part 1: Graphs)

20.02.2016

I put this together after experimenting with ggplot2 and ggnetwork earlier this week. The changes I made added svgPanZoom into the mix. Consequently, it has a widget in it, so it was just easier to embed the full R markdown HTML into an iframe than to try to extract the content piecemeal into WP. You can bust the iframe via http://r...

956 sym 1 img

Create Vega-Lite specs & widgets with the vegalite package

27.02.2016

Vega-Lite 1.0 was released this past week. I had been meaning to play with it for a while but I’ve been burned before by working with unstable APIs and was waiting for this to bake to a stable release. Thankfully, there were no new shows in the Fire TV, Apple TV or Netflix queues, enabling some fast-paced nocturnal coding to make an R htmlwidge...

4661 sym R (2117 sym/4 pcs) 4 tbl

A Tale of Two Charting Paradigms: Vega-Lite vs R+ggplot2

28.02.2016

This post comes hot off the heels of the nigh-feature-complete release of vegalite (virtually all the components of Vega-Lite are now implemented and just need real-world user testing). I’ve had a few and seen a few questions about “why Vega-Lite”? I think my previous post gave some good answers to “why”. However, Vega-Lite and Vega pro...

4145 sym R (1915 sym/2 pcs) 2 img 2 tbl

Capturing wild widgets with webshot

04.03.2016

NOTE: you won’t need to use this function if you use the development version of knitr Winston Chang released his webshot package to CRAN this past week. The package wraps the immensely useful phantomjs utility and makes it dirt simple to capture whole or partial web pages in R. One beautiful bonus feature of webshot is that you can install pha...

1831 sym R (2600 sym/1 pcs) 1 tbl

Primary Plotting

07.03.2016

My wife tricked me into a partial-weekend project to try to get all the primary/caucus results to-date on a map (the whole us). This is challenging since not all states use counties as boundaries for aggregate results. I’m still piecing together some shapefiles for the primary/caucus summation boundaries for a couple remaining states but I didn...

1633 sym

OS X XQuartz Vulnerability Test Using R

07.03.2016

It’s usually a good thing when my #rstats and infosec worlds collide. Unfortunately, this time it’s a script that R folk running on OS X can use to see if they are using a version of XQuartz that has a nasty vulnerability in the framework it uses to auto-update. If this test comes back with the warning, try to refrain from using XQuartz on in...

905 sym R (1729 sym/1 pcs) 1 tbl

Some Light Image Processing & Creation With R

10.03.2016

A friend, we’ll call him Alen put a call out for some function that could take an image and produce a per-row “histogram” along the edge for the number of filled-in points. That requirement eventually scope-creeped to wanting “histograms” on both the edge and bottom. In, essence there was a desire to be able to compare the number of pix...

3610 sym R (4570 sym/5 pcs) 8 img 5 tbl