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(USAboundaries) | |
library(sf) | |
library(dplyr) | |
library(elevatr) | |
library(raster) | |
# Get map of lower 48 states | |
usa_l48 <- us_boundaries() %>% | |
filter(state_abbr != "HI" & | |
state_abbr != "AK" & |
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
word_count<-function(txt_doc){ | |
con<-file(txt_doc, "r", blocking=FALSE) | |
x<-readLines(con) | |
#Remove YAML front matter on Rmd | |
if(length(grep("---",x))>0){x<-x[-seq(1,max(grep("---",x)))]} | |
wrds<-0 | |
for(line in x){ | |
#Removes non character and splits | |
split_line<-strsplit(gsub("[^[:alnum:] ]", "", line), " +")[[1]] | |
#Removes empty string |
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(purrr) | |
library(jsonlite) | |
library(dplyr) | |
library(usethis) | |
# The Data.gov API requires a key and has a 1000 request/hour limit | |
# Get Key from https://api.data.gov/signup/ | |
# Save key in r environ | |
usethis::edit_r_environ() | |
# Add DATAGOV_KEY=YOURKEYGOESHERE to the file. Save and restart R |
OlderNewer