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
as.data.table.raster <- function(x, row.names = NULL, optional = FALSE, xy=FALSE, inmem = canProcessInMemory(x, 2), ...) { | |
stopifnot(require("data.table")) | |
if(inmem) { | |
v <- as.data.table(as.data.frame(x, row.names=row.names, optional=optional, xy=xy, ...)) | |
} else { | |
tr <- blockSize(x, n=2) | |
l <- lapply(1:tr$n, function(i) | |
as.data.table(as.data.frame(getValues(x, | |
row=tr$row[i], |
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
save_outputs <- switch(menu(c("Yes", "No"), title = "Save Outputs?", graphics = T), | |
T, | |
F) |
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
K constant | Genus | Species | Size Class (cm) | Reference | Fuel Class | Classification | Notes | ||
---|---|---|---|---|---|---|---|---|---|
0.002 | Abies | amabilis | 1.5 | Erickson et al. 1985 | branch | Gymnosperm | suspended material | ||
0.009 | Abies | amabilis | 10 | Erickson et al. 1985 | log | Gymnosperm | suspended material | ||
0.003 | Abies | amabilis | 1.5 | Erickson et al. 1985 | branch | Gymnosperm | on ground | ||
0.009 | Abies | amabilis | 10 | Erickson et al. 1985 | log | Gymnosperm | on ground | ||
0.033 | Abies | balsamea | 12.5 | Foster & Lang 1982 | log | Gymnosperm | averaged bole size | ||
0.038 | Abies | balsamea | 12.5 | Foster & Lang 1982 | bark | Gymnosperm | bark | ||
0.049 | Abies | concolor | 20 | Harmon 1987 | large log | Gymnosperm | |||
0.039 | Abies | concolor | branch | Harmon 1987 | branch | Gymnosperm | |||
0.027 | Abies | concolor | bark | Harmon 1987 | bark | Gymnosperm | bark |
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) | |
seq(-2, 2, by = 0.01) %>% | |
expand.grid(x = ., y = .) %>% | |
ggplot(aes(x = (1 - x - sin(y^2)), | |
y = (1 + y - cos(x^2)))) + | |
geom_point(alpha = 0.05, | |
shape = 20, | |
size = 0) + | |
theme_void() + |
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
{ | |
"type": "FeatureCollection", | |
"name": "all_impacts", | |
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | |
"features": [ | |
{ "type": "Feature", "properties": { "county": "Lake of the Woods", "econ_impact": 131647.49328181348, "jobs": 1.1681756879242522 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -95.322964707356888, 48.998907333083032 ], [ -95.153512661955347, 48.998386977382054 ], [ -95.153233692709975, 49.38375958178603 ], [ -95.126376624797402, 49.368819802280491 ], [ -95.058294219232565, 49.352479010067924 ], [ -94.957345828938216, 49.369386615754749 ], [ -94.854084431368136, 49.323276863333881 ], [ -94.816054079842445, 49.320075671456912 ], [ -94.824982783717232, 49.293397322734549 ], [ -94.797316646178714, 49.196945420146783 ], [ -94.773020067331146, 49.119946576813803 ], [ -94.750028408201899, 49.09899485437505 ], [ -94.750086480114476, 48.999352863813307 ], [ -94.718803033463672, 48.999350964506746 ], [ -94.683001176087672, 48.884052337188216 ], [ -94.692464 |
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
cat(paste0("export(", gsub(".R$", "", list.files("R")), ")"), sep = "\n") |
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
list.shp <- function(path) { | |
list.files(path, pattern = ".shp$", full.names = T) | |
} |
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
# add fake columns | |
cols_add <- as.character(2020:2039) | |
DT[, (cols_add) := 0] | |
for (col in cols_add) { | |
set(DT, i = 1L, j = col, value = state[1, total] * abs(rnorm(1, mean = 10)) + state[1, total]) | |
set(DT, i = 2L, j = col, value = state[2, total] * abs(rnorm(1)) + state[2, total]) | |
set(DT, i = 3L, j = col, value = state[3, total] * abs(rnorm(1)) + state[3, total]) |
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
# For R projects | |
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) |
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
options(prompt = glue::glue("[git] {crayon::bgRed(crayon::white(as.character(git2r::repository_head())[1]))} >")) |
OlderNewer