EcoHealth Alliance seeks a research software engineer to build and maintain technical infrastructure to support scientific research across our field, lab, and computational teams. We are seeking someone with the ability to learn and use a variety of system administration and development operations tools, and to work with a diverse, multi-disciplinary team that includes scientists from across the globe. This is a key position at a rapidly growing NGO with diverse funded scientific research programs around the world focused on conservation
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
QUANTITATIVE ECOLOGY RESEARCH SCIENTIST | |
https://www.ecohealthalliance.org/career/quantitative-ecology-research-scientist | |
EcoHealth Alliance is seeking a quantitative ecologist to work closely with our team on multiple projects studying bat-borne zoonotic viruses. We are seeking someone with excellent statistical and computational skills, strong communication skills, and the ability to work with a diverse, multi-disciplinary team that includes scientists from across the globe. This is a key position at a rapidly growing NGO with diversely funded scientific research programs around the world focused on conservation and zoonotic disease emergence. This position requires experience with, and an ability to learn, a variety of ecological and epidemiological statistical techniques including generalized linear and additive, spatiotemporal, mixed-effect, Bayesian mixture and occupancy models, as well as proficiency with R and reproducible methods. Responsibilities include leading analysis of longitudinal and spatial |
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(mgcv) | |
library(spdep) | |
library(sf) | |
library(ggplot2) | |
# Columbus crime data from mgcv/spdep | |
example(columbus) | |
# Make a neighborhood object compatible with mgcv's MRF | |
nb <- poly2nb(columbus) |
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(ggplot2) | |
dat <- data.frame(a = letters[1:10], b = exp(rnorm(10))) | |
ggplot(dat, aes(x = a, y = b)) + geom_col() + scale_y_log10() # Basic log scale transform | |
trans = scales::trans_new("logshift", \(x) log10(x*10), \(x) (10^x)/10) # Custom transformation | |
ggplot(dat, aes(x = a, y = b)) + geom_col() + scale_y_continuous(trans = trans) # Use custom transformation | |
ggplot(dat, aes(x = a, y = b)) + geom_col() + scale_y_continuous(trans = trans, breaks = c(0.25, 0.5, 1, 2, 4, 8)) # Add breaks | |
ggplot(dat, aes(x = a, y = b)) + | |
geom_col() + |
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(sys) | |
library(RMariaDB) | |
library(DBI) | |
library(withr) | |
# Clean up from previous session | |
unlink("doltdb", recursive = TRUE) | |
try(dbDisconnect(conn), silent = TRUE) | |
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(leaflet) | |
library(tidyverse) | |
outline <- quakes[chull(quakes$long, quakes$lat),] | |
map <- leaflet(quakes) %>% | |
addTiles(group = "OSM (default)") %>% | |
# Overlay groups | |
addCircles(~long, ~lat, ~10^mag/5, stroke = F, group = "Quakes") %>% | |
addPolygons(data = outline, lng = ~long, lat = ~lat, |
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(ggplot) | |
library(sf) | |
library(ggspatial) | |
library(snapbox) | |
library(raster) | |
worldclim <- raster::getData('worldclim', var='prec', res=2.5, lon = 142.61, lat = -23.64) | |
area <- st_bbox( | |
c(xmin = 101.03, ymin = -44.82, xmax = 168.23, ymax = -9.09), |
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
#!/bin/bash | |
funzip $1| # uncompress first file in zip | |
tr -d '\000' | #remove null characters | |
sed "/^\s*$/d; s/ \{1,\}\t/\t/g; s/\t \{1,\}/\t/g; s/\r//" | #removes empty lines, whitespace around tabs, extra newlines | |
cut -s -f 1,3,4,5,6,8,12,13,14,15,16,17,18,19,20,21,23,24,25,26,34,35,36,38,40,42,44,45,46,85,86,87,88,89 #| #only select certain columns | |
pv -N Process -c | | |
gzip -9 | | |
pv -N Compress -c > $1.gz |
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
#' Create a random effect basis with integers rather than factors | |
#' @import mgcv | |
#' @export | |
smooth.construct.re2.smooth.spec <- function (object, data, knots) { | |
if (!is.null(object$id)) | |
stop("random effects don't work with ids.") | |
if(any(sapply(data, is.numeric))) data <- lapply(data, as.factor) ## <-- All I did was this (and below) | |
form <- as.formula(paste("~", paste(object$term, collapse = ":"), | |
"-1")) | |
object$X <- model.matrix(form, data) |
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
#' Function to partition unequal sized groups into shards of similar size. | |
#' | |
#' Based on the greedy algorithm described in [The Wikipedia article on the | |
#' the partitioning problem](https://en.wikipedia.org/wiki/Partition_problem#The_greedy_algorithm) | |
#' | |
#' @param groups_vector An integer vector of group ids, such as a group ID | |
#' column in a data frame | |
#' @param n_shards The number of shards to split groups up into | |
#' @examples | |
#' n_groups <- 200 |