This file contains hidden or 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(httr) | |
# Get the JWT | |
get_jwt <- POST("https://example.com/throwaway/wp-json/jwt-auth/v1/token", | |
query = list(username = "your_username", password = "your_password")) | |
token <- content(get_jwt)$token | |
# Confirm auth is working | |
test <- POST("https://example.com/throwaway/wp-json/jwt-auth/v1/token/validate", | |
add_headers('Authorization' = paste("Bearer", token, sep = " ")), encode = "json") |
This file contains hidden or 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(lubridate) | |
library(gganimate) | |
library(ggrepel) | |
library(ggthemes) | |
NHCintensityModels <- c('FSSE', 'HCCA','GFEX','RVCN','ICON','IVCN','NVGM','NVGI','AVNO','AVNI','GFSO','GFSI','EMX','EMXI','EMX2','EGRR','EGRI','EGR2','CMC','CMCI','HWRF','HWFI','CTCX','CTCI','HMON','HMNI','CLP5','SHF5','DSF5','TCLP','SHIP','DSHP','LGEM') | |
P <- | |
daATCF %>% mutate(datee = ymd(paste0(Year, Month, Day))) %>% filter( | |
Hour == '00' & |
This file contains hidden or 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(tidyverse) | |
library(curl) | |
bbdb <- 'http://world.ty.com/catalog/catPagePrint.cfm' | |
bbnames <- | |
read_html(curl(bbdb, handle = curl::new_handle("useragent" = "Mozilla/5.0"))) %>% | |
html_node('table') %>% | |
html_table() | |
bbnames <- bbnames[3:nrow(bbnames), 2] |
This file contains hidden or 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
username = '', | |
password = '' | |
wdir <- file.path(tempdir(),"Path_for_downloading_folder") | |
bbox_ls <- clipping_bbox(-82.758605,27.631232,-82.732227,27.654636) | |
sres <- lsSearch(startDate = as.Date("01-01-2020", "%d-%m-%Y"), | |
endDate = as.Date("31-01-2020", "%d-%m-%Y"), | |
#pathrow = list(c(200, 31), c(200, 30)), |
This file contains hidden or 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(rvest) | |
library(jsonlite) | |
library(janitor) | |
library(lubridate) | |
library(httr) | |
library(htmlTable) | |
library(mailR) | |
This file contains hidden or 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
## @y dataframe of coordinates | |
## @x vector of buffer sizes for cone diameters | |
coneify <- function(y, x, ref){ | |
points <- y %>% st_as_sf(coords = c('lng', 'lat'), crs = ref) | |
buffs <- st_buffer(points, points$x) | |
cone <- st_sf(st_sfc()) | |
for (i in 2:nrow(buffs)) { | |
tmp <- buffs[(i - 1):i,] |
This file contains hidden or 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
--- | |
title: "Fire Coop: A Peek at the Prevalance of Regime Change Discussions on r/tampabaylightning" | |
output: | |
html_document: | |
df_print: paged | |
code_folding: "hide" | |
--- | |
First, we'll start by installing Mike Kearney's rreddit package. It's kinda still in development, I guess, but it gets the job done. Some functions from it were either not found or broken, but that may be because I was too lazy to update my version of R from 3.5.0. If you have problems, just throw "mkearney %broken function%" into the ol' Google and you'll be good to go. Below, I have included fixed/usable functions that should fulfill everything needed by the rreddit package. |
This file contains hidden or 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
#' Plot US | |
#' | |
#' @param spdf sf data frame | |
#' @param fill_val quoted fill value name | |
#' @param title plot title | |
#' @param palette color palette | |
#' @param ... idk how these work still | |
#' | |
#' @return | |
#' @export |
This file contains hidden or 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(tigris) | |
library(tidyverse) | |
library(sf) | |
# get the states | |
test_states <- tigris::states() %>% | |
filter( | |
STUSPS %in% c( | |
'FL', | |
'GA', |
This file contains hidden or 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(mapgl) | |
library(sf) | |
library(dplyr) | |
magma_pal <- viridisLite::magma(6) | |
magma_substr_pal <- substr(magma_pal, 1, 7) | |
nc <- st_read(system.file('shape/nc.shp', package = 'sf')) | |
nc <- nc %>% mutate(zz = sample(letters[1:6], nrow(.), replace = T)) |