This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(mvtnorm) | |
library(dplyr) | |
#make cyl a factor, like site | |
mtcars$cyl <- as.character(mtcars$cyl) | |
#fit a model | |
mod <- lm(mpg ~ cyl*hp, data = mtcars) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------- | |
# Let's explore simulating from lm | |
# fits! | |
# | |
# Jarrett Byrnes | |
# 2020-09-08 | |
#------------------------------- | |
#some useful libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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") %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(readr) | |
get_buoy <- function(a_year){ | |
one_buoy <- read_buoy(a_year) %>% | |
format_buoy %>% | |
make_monthly_buoy | |
return(one_buoy) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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( |