Skip to content

Instantly share code, notes, and snippets.

@seasmith
seasmith / sf3_base_to_ggplot2.R
Last active May 30, 2017 16:52
From base to ggplot2: Converting the NC affine transformation example from sf vignette #3
# The following is a "conversion" from base to ggplot2
# of the affine transformation from the sf package's
# third vignette:
# https://cran.r-project.org/web/packages/sf/vignettes/sf3.html#affine-transformations
library(sf)
library(magrittr)
nc <- st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)
@seasmith
seasmith / houston_crime_data.R
Last active August 17, 2017 18:08
Download and union all Houston crime report Excel files
# A final version of the image created below
# can be found at: https://twitter.com/lksmth/status/892849692576329730
# -- Load dependencies
library(tidyverse)
library(stringi)
library(readxl)
library(rvest)
@seasmith
seasmith / cran_graph_plots.R
Created August 17, 2017 18:22
Creating a hairball graph of CRAN package dependencies (with version info striped)
library(dplyr)
library(purrr)
library(data.table)
library(stringi)
library(igraph)
library(ggraph)
# Import
cran <- available.packages() %>% as_tibble()
@seasmith
seasmith / nd_sankey.R
Last active August 20, 2017 17:11
Downloading and visualizing North Dakota horizontal-well oil production with the networkD3 package in R
# Load dependencies -------------------------------------------------------
library(httr)
library(rvest)
library(plyr)
library(tibble)
library(dplyr)
library(stringi)
library(igraph)
library(ggraph)
@seasmith
seasmith / R_community.R
Created September 6, 2017 18:22
"R is not software..."
fortunes::fortune("R is not software")
#>
#> I see three drivers of problems with R.
#> The first is that R is useful. [...]
#> The second driver of problems with R is that it is both a programming
#> language and an interactive language. There is a tension there that is
#> unavoidable. [...]
#> The third big driver of problems is that R is not software, it is a
#> community.
#> -- Patrick Burns (Inferno-ish R)
@seasmith
seasmith / .block
Last active December 10, 2017 17:30 — forked from john-guerra/.block
GeoJson Map of US Oil and Gas Basins
license: mit
@seasmith
seasmith / .block
Last active January 3, 2018 06:31
GeoJson Map of US Oil and Gas Basins
license: mit
@seasmith
seasmith / .block
Last active December 11, 2017 23:29
Horizontally Stacked Negative Values
license: gpl-3.0
@seasmith
seasmith / .block
Last active December 18, 2017 06:58
Bar Chart With Negative Values
license: gpl-3.0
@seasmith
seasmith / .block
Last active December 15, 2017 17:22
Rig Count
license: gpl-3.0