Skip to content

Instantly share code, notes, and snippets.

View joeroe's full-sized avatar

Joe Roe joeroe

View GitHub Profile
{
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.152 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4143.7 Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.152 Safari/537.36",
"benchmarkIndex": 1620,
"credits": {
"axe-core": "3.5.5"
}
},
@joeroe
joeroe / tidy_rcarbon.R
Created March 5, 2019 10:45
Tidy wrappers for the rcarbon package
# tidy_rcarbon.R
# Tidy wrappers for the rcarbon package
#' Calibrate radiocarbon dates with tidy syntax
#'
#' A thin wrapper of [rcarbon::calibrate()] that returns calibrated dates as a
#' single list rather than a `CalDates`` object. Useful, for example, if you want
#' to add a column of calibrated dates to an existing table with [dplyr::mutate()]
#'
#' @param cra A vector of uncalibrated radiocarbon ages.
@joeroe
joeroe / st_as_sf.deldir.R
Created September 4, 2018 12:49
Convert a deldir::deldir object to an sf::sf
#' @importFrom sf st_as_sf
st_as_sf.deldir <- function(dd, extract = c("tiles", "triangles")) {
extract <- match.arg(extract)
if (extract == "tiles") {
ddlist <- deldir::tile.list(dd)
}
else if (extract == "triangles") {
ddlist <- deldir::triang.list(dd)
}