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
echo sha, contributor, date, message > log.csv | |
git log --date=local --pretty=format:'%h, %an, %ad, "%s"' >> log.csv |
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
plot.nnet<-function(mod.in,nid=T,all.out=T,all.in=T,bias=T,wts.only=F,rel.rsc=5, | |
circle.cex=5,node.labs=T,var.labs=T,x.lab=NULL,y.lab=NULL, | |
line.stag=NULL,struct=NULL,cex.val=1,alpha.val=1, | |
circle.col='lightblue',pos.col='black',neg.col='grey', | |
bord.col='lightblue', max.sp = F,...){ | |
require(scales) | |
#sanity checks | |
if('mlp' %in% class(mod.in)) warning('Bias layer not applicable for rsnns object') |
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
gar.fun<-function(out.var,mod.in,bar.plot=T,struct=NULL,x.lab=NULL, | |
y.lab=NULL, wts.only = F){ | |
require(ggplot2) | |
require(plyr) | |
# function works with neural networks from neuralnet, nnet, and RSNNS package | |
# manual input vector of weights also okay | |
#sanity checks |
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(patchwork) | |
toplo1 <- sqidat %>% | |
select(MasterID, yr, asci_mean, csci_mean, TN, TP, indexscore_cram) %>% | |
gather('nuts', 'val', TN, TP) %>% | |
na.omit %>% | |
mutate( | |
inddif = asci_mean - csci_mean, | |
cramcat = case_when( |
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
vif_func<-function(in_frame,thresh=10,trace=T,...){ | |
library(fmsb) | |
if(any(!'data.frame' %in% class(in_frame))) in_frame<-data.frame(in_frame) | |
#get initial vif value for all comparisons of variables | |
vif_init<-NULL | |
var_names <- names(in_frame) | |
for(val in var_names){ |
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(gridExtra) | |
library(grid) | |
library(imputeTestbench) | |
library(PSF) | |
library(imputePSF) | |
library(imputeTS) | |
library(scales) | |
# total obs in each simulated time series |
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
# load libraries | |
library(sf) | |
library(maps) | |
library(ggplot2) | |
# get states as sf | |
states <- st_as_sf(map('state', plot = F, fill = T)) | |
# calculate area, add to states | |
area <- st_area(states) |
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
--- | |
title: "Basic mapping" | |
author: "Turbo Todd" | |
output: html_document | |
--- | |
This lessons covers base graphics, ggplot, and other R packags for mapping spatial data. | |
```{r} | |
library(maps) |
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
# load libraries | |
library(sf) | |
library(maps) | |
library(tmap) | |
# get states as sf | |
states <- st_as_sf(map('state', plot = F, fill = T)) | |
# calculate area, add to states | |
area <- st_area(states) |
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
# load packages | |
library(sf) | |
library(plotly) | |
library(mapview) | |
# download data and save in memory | |
wsa <- read.csv("https://www.epa.gov/sites/production/files/2014-10/wsa_siteinfo_ts_final.csv") | |
# make an sf object | |
wsa <- st_as_sf(wsa, coords = c("LON_DD", "LAT_DD"), crs = 4269,agr = "constant") |
NewerOlder