Skip to content

Instantly share code, notes, and snippets.

View jonspring's full-sized avatar

Jon Spring jonspring

View GitHub Profile
@jonspring
jonspring / Sunsets for pundit
Last active December 18, 2019 17:51
When the lights go down in the city.... Local sunset times
# https://twitter.com/jonlovett/status/1191490424965218304
# What I'm curious about is how we're distributed inside of our time zones, because the further east you are inside of a time zone, the harder standard time hits. Boston's sunset is 4:34pm today. Brutal. Detroit's sunset, on the other side of the same time zone, is 5:22pm.
# I'm a big fan of Jon Lovett's podcasts, and I love trying new things in R, so it was Game On when I saw the tweet above. I googled around and combined a few data sources to get US counties' populations, coordinates, sunsets, and time zones. From those you can see who has it worst in the evenings when standard time kicks in.
# Curiously, big cities in the US tend to be on the east, "darker evening" end of their time zones.
####### Libraries #####
@brandmaier
brandmaier / position_jitter_gaussian.R
Created December 13, 2017 20:00
A ggplot jitter function based on Gaussian noise: position_jitter_gaussian()
#
# provides function position_jitter_gaussian() for ggplot2
#
# Use parameters width and height for scaling of dispersion
#
# Example:
#df <- data.frame(
# x = rep(c(1,3,2,5,5,5,5),5),
# y = rep(c(1,3,2,5,5,5,5),5)
#)