==> Testing R file using 'testthat'
ℹ Loading greta
ℹ Initialising python and checking dependencies, this may take a moment.
✔ Initialising python and checking dependencies ... done!
# using distributional
options(tidyverse.quiet = TRUE)
library(tidyverse)
library(distributional)
dat_dist <- tibble(
means = c(1:5),
sds = c(5:1),
vals = means + rnorm(5, 0.1, 0.1),
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
pct_resupply <- tibble::tribble( | |
~Section, ~Days, ~`Distance.(mi)`, ~`Total.(mi)`, ~Resupply, | |
"Campo to Mt. Laguna", 3L, 42.9, 42.9, "B", | |
"Mt. Laguna to Warner Springs", 4L, 66.6, 109.5, "B", | |
"Warner Springs to Idyllwild", 5L, 69.9, 179.4, "B", | |
"Idyllwild to Big Bear City", 6L, 95.6, 275, "B", | |
"Big Bear City to Wrightwood", 6L, 94.5, 369.5, "B", | |
"Wrightwood to Agua Dulce", 6L, 85, 454.5, "B", | |
"Agua Dulce to Tehachapi or Mojave", 6L, 112, 566.5, "B", | |
"Tehachapi to Kennedy Meadows", 8L, 135.5, 702.2, "M", |
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
clean_site_name_forbes <- function(site_name, out_name){ | |
dplyr::case_when( | |
str_detect(site_name, "ST") ~ "STP Forbes", | |
str_detect(site_name, "Muddy") ~ "STP Forbes", | |
str_detect("ST", site_name) ~ "STP Forbes", | |
.default = "unmatched" | |
) | |
} |
n.pixel <- 1000
n.other.spec <- 20
spec.names <- letters[1:(n.other.spec+1)]
## Geographic covariates affecting species abundance
x <- matrix(rnorm(2*n.pixel),nrow=n.pixel)
## Geographic covariate causing selection bias (correlated with x1)
z <- scale(x[,1] + rnorm(n.pixel)*sqrt(.95^(-2)-1))
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(polite) | |
library(tidyverse) | |
library(httr2) | |
library(rvest) | |
url <- "https://njt.micro.blog/2023/08/19/pct-day-kennedy.html" | |
extract_pct_summary <- function(url){ | |
raw <- bow(url) %>% scrape() | |
raw %>% |
library(tidyverse)
# 4 data sets
# survey
n <- 100
create_survey <- function(n, year, id = 1:n){
tibble(
id = id,
year = year,
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) | |
# 4 data sets | |
# survey | |
n <- 100 | |
create_survey <- function(n, year, id = 1:n){ | |
tibble( | |
id = id, | |
year = year, | |
province = sample(1:9, size = n, replace = TRUE), |
library(tidyverse)
cause_for_dismissal <- c("A",
"B",
"C")
vic_moz_long <- tibble(
id = 1:5,
species = c("B", "C", "D", "E", "F")
)