Skip to content

Instantly share code, notes, and snippets.

Jarrett Byrnes jebyrnes

Block or report user

Report or block jebyrnes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jebyrnes
jebyrnes / biking.R
Created Nov 5, 2019
A quick interactive map of biking for #tidytuesday
View biking.R
library(tidyverse)
library(ggmap)
library(sf)
library(tmap)
#whereami?
here::here()
#get my apis flowin'
register_google(readLines("~/goog.api"))
@jebyrnes
jebyrnes / chanty_analysis.R
Last active Oct 25, 2019
Some tidytext anaylysis of sea chanties
View chanty_analysis.R
library(tidyverse)
library(tidytext)
library(rvest)
library(ggplot)
#get the initial info from the site
site <- "http://www.guscantieni.com/bindarrr/"
index <- read_html(paste0(site, "index.html"))
View rayshade_maps_gg.R
#Rayshader reprex to try and put a flat raster map under a
#set of 3d points
library(rayshader)
library(ggplot2)
library(dplyr)
library(maps)
library(ggmap)
data(world.cities)
@jebyrnes
jebyrnes / tidy_foodweb.R
Created May 14, 2019
Playing around with tidygraph, ggraph, and NetIndices to draw food webs
View tidy_foodweb.R
#see also https://davidsmale.netlify.com/portfolio/wes-anderson-actor-network/
# https://www.data-imaginist.com/2017/introducing-tidygraph/
# https://www.jessesadler.com/post/network-analysis-with-r/
#load libraries
library(rglobi)
library(tidygraph)
library(ggraph)
library(NetIndices)
@jebyrnes
jebyrnes / spatial_causality.R
Last active May 8, 2019
Looking at spatial lags and anomolies to see if they work out like temporal anomolies/fixed effect models
View spatial_causality.R
library(spdep)
library(spatialreg)
library(SpatialTools)
library(dplyr)
library(nlme)
library(mgcv)
library(purrr)
library(stringr)
library(ggplot2)
library(broom)
@jebyrnes
jebyrnes / gam_v_cor.R
Created Apr 8, 2019
Does a gam act like a fixed effect for autocorrelation?
View gam_v_cor.R
library(MASS)
library(tidyverse)
library(ggplot2)
library(mgcv)
gaussprocess <- function(from = 0, to = 1, K = function(s, t) {min(s, t)},
start = NULL, m = 1000) {
# Simulates a Gaussian process with a given kernel
#
# args:
View spike_wave.R
library(heatwaveR)
library(tsibble)
library(lubridate)
library(dplyr)
# Detect the events in a time series
ts <- ts2clm(sst_WA, climatologyPeriod = c("1982-01-01", "2011-12-31"))
mhw <- detect_event(ts, minDuration = 1, maxGap = 0)
@jebyrnes
jebyrnes / raster_fade.R
Created Feb 20, 2019
crossfading between raster layers in gganimate
View raster_fade.R
library(ggplot2)
library(gganimate)
mygridstart <- tidyr::crossing(x = 1:10, y = 1:10)
mygrid <- rbind(mygridstart, mygridstart, mygridstart)
mygrid$rep <- sort(rep(1:3, nrow(mygrid)/3))
mygrid$pointgroup <- rep(1:100, 3)
mygrid$f <- factor(sample(1:3, replace=TRUE, size = nrow(mygrid)))
@jebyrnes
jebyrnes / bayesian_updating.R
Created Feb 1, 2019
A little animation of Bayesian updating with a
View bayesian_updating.R
library(dplyr)
library(tidyr)
library(stringr)
library(ggplot2)
library(gganimate)
#make those samples!
set.seed(3003)
samps <- replicate(9, rbinom(1,1,prob = 0.3))
running_samps <- cumsum(samps)
@jebyrnes
jebyrnes / same_model_many_responses.R
Created Jan 23, 2019
Quick reprex for @ jess_carilli
View same_model_many_responses.R
#some libraries
library(dplyr)
library(tidyr)
library(broom)
library(purrr)
#let's use the npk data
head(npk)
#but make up a few extra columns
You can’t perform that action at this time.