Markus Skyttner 2019-06-10
# to render this into GitHub markdown:
# rmarkdown::render("name_of_this_file.R")
library(staplr)
# from SO post at https://stackoverflow.com/questions/72922418/create-rows-from-part-of-column-names/72939299 | |
library(readr) | |
library(tidyr) | |
library(dplyr) | |
library(knitr) | |
so_blurb <- | |
"id|Date (05/19/2020)|Type (05/19/2020)|Date (06/03/2020)|Type (06/03/2020)|Type (10/23/2020|Date (10/23/2020)|Type (10/23/2020) | |
10629465|null|null|06/01/2020|E |
#!/usr/bin/env Rscript | |
# usage for example: | |
# cat data/mydatafile.tsv | head -n 1000 | ./duckstream.R --sql "select mycolumn from stdin;" | |
library(optparse) | |
library(readr) | |
suppressPackageStartupMessages(library(duckdb)) | |
option_list <- list( |
#!/bin/bash | |
# usage: ./duckdb-load.sh data.tsv duckdb tablename | |
# for example: | |
# ./duckdb-load.sh ark/hcaf_species_native.tsv duckdb_database hcaf_species_native | |
# TODO set pragma journal_mode=off or equiv settings | |
# if using .import and .sep '\t', an error appears: | |
# Error: multi-character column separators not allowed for import |
library(dplyr) | |
library(duckdb) | |
library(vroom) | |
duckdb_version <- function() { | |
con <- duckdb::dbConnect(duckdb::duckdb()) | |
on.exit(duckdb::dbDisconnect(con, shutdown = TRUE)) | |
res <- DBI::dbGetQuery(con, "PRAGMA version;") | |
parse_semver <- function(x) { | |
re <- "(\\d)+\\.(\\d+)\\.(\\d+).*$" |
FROM rocker/r-ver:3.6.1 | |
# this is the trestletech/plumber layers, now on a versioned R base | |
RUN apt-get update -qq && apt-get install -y --no-install-recommends \ | |
git-core \ | |
libssl-dev \ | |
libcurl4-gnutls-dev \ | |
curl \ | |
libsodium-dev \ |
library(vikingr) | |
library(dplyr) | |
library(purrr) | |
library(stringr) | |
log <- read_ais_log(vikingr_example("vikingr-visby-2019-ais-2")) | |
log_tail <- | |
log$message %>% | |
str_replace("(.*?,){5}(.*?)", "\\2") |
server_config <- list( | |
max_occurrence_records = 500000, | |
server_max_url_length = 8150, | |
brand = "ALA4R", | |
notify = "Please use https://github.com/AtlasOfLivingAustralia/ALA4R/issues/ or email to [email protected]", | |
support_email = "[email protected]", | |
reasons_function = "ala_reasons", | |
fields_function = "ala_fields", | |
occurrences_function = "occurrences", | |
config_function = "ala_config", |