Skip to content

Instantly share code, notes, and snippets.

Avatar

Jarrett Byrnes jebyrnes

View GitHub Profile
@jebyrnes
jebyrnes / predict_intervals_lm.R
Created Sep 8, 2020
posthoc distribution from linear models
View predict_intervals_lm.R
#-------------------------------
# Let's explore simulating from lm
# fits!
#
# Jarrett Byrnes
# 2020-09-08
#-------------------------------
#some useful libraries
@jebyrnes
jebyrnes / prediction_ranef.R
Created Aug 11, 2020
Predictions of models with nominal or continuous variables using predictInterval and lmer
View prediction_ranef.R
#fit a model
library(lme4)
sleepstudy$c_Days <- as.character(sleepstudy$Days)
#same model, one continuous, one nominal
m1_c <- lmer(Reaction ~ Days + (1 | Subject), sleepstudy)
m1_n <- lmer(Reaction ~ c_Days + (1 | Subject), sleepstudy)
#Making data grid with nominal variables
@jebyrnes
jebyrnes / coauthors_nsf_coa.R
Last active Aug 1, 2020
Get your coauthors for the last 4 years, nsf-style
View coauthors_nsf_coa.R
library(scholar)
library(dplyr)
library(purrr)
library(tidyr)
id <- "hJKBuhkAAAAJ"
#me <- get_profile(id)
pubs <- get_publications(id) %>% as_tibble
@jebyrnes
jebyrnes / goog_mobility_wtg.R
Created May 27, 2020
Google Mobility on world tile map
View goog_mobility_wtg.R
#devtools::install_github("hrbrmstr/worldtilegrid")
library(worldtilegrid)
library(dplyr)
library(ggplot2)
goog <- refresh_covid19mobility_google_country()
data(wtg)
goog_april <- filter(goog,
as.character(date) %in% c("2020-04-15", "2020-02-15", "2020-03-15", "2020-05-15"),
data_type=="retail_and_recreation_percent_change_from_baseline") %>%
@jebyrnes
jebyrnes / iso_3166_2_subdivision_scrape.R
Created May 27, 2020
Get the iso subdivision codes from wikipedia
View iso_3166_2_subdivision_scrape.R
library(rvest)
library(dplyr)
library(purrr)
library(tidyr)
# https://en.wikipedia.org/wiki/ISO_3166-2
baseurl <- "https://en.wikipedia.org"
url <- "https://en.wikipedia.org/wiki/ISO_3166-2"
# get the tables from which spring links!
View get_buoy.R
library(tidyverse)
library(readr)
get_buoy <- function(a_year){
one_buoy <- read_buoy(a_year) %>%
format_buoy %>%
make_monthly_buoy
return(one_buoy)
}
View coronavirus_us_progression.R
library(coronavirus)
library(dplyr)
library(ggplot2)
library(rnaturalearth)
library(sf)
library(ggrepel)
library(wesanderson)
coronavirus <- update_coronavirus()
usa <- ne_states(country = "United States of America", returnclass = "sf")
@jebyrnes
jebyrnes / coronavirus_heatmap.R
Created Mar 7, 2020
A first stab at making useful heatmaps from the coronavirus data
View coronavirus_heatmap.R
#devtools::install_github("RamiKrispin/coronavirus")
library(coronavirus)
library(dplyr)
library(ggplot2)
library(tidyr)
library(rnaturalearth)
library(sf)
View neverWarrenBots.R
#note, above this, use rtweet
#instructions for getting api keys and the like
#from http://dev.twitter.com
library(rtweet)
library(tweetbotornot)
library(ggplot2)
library(dplyr)
library(ggridges)
token <- create_token(
@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"))
You can’t perform that action at this time.