I hereby claim:
- I am holstius on github.
- I am dholstius (https://keybase.io/dholstius) on keybase.
- I have a public key whose fingerprint is 6974 E4D6 0075 DA92 FE5B CA28 D2E8 C03F DDAB A245
To claim this, I am signing this object:
#' Patch data on the fly. | |
#' | |
#' @param object to be patched | |
#' @param cond logical condition(s) to be evaluated within scope of object | |
#' @param \dots name-value pairs | |
#' @param quiet suppress messages | |
#' | |
#' @examples | |
#' patch(mtcars, where(vs == 0, am == 1), gear = Inf, carb = carb + 10) | |
#' |
library(ensurer) | |
ensure_none_missing <- ensures_that(!any(is.na(.)) ~ "There are missing values") | |
ensure_all_positive <- ensures_that(all(int(.)) > 0 ~ "Not all values are positive", +ensure_none_missing) | |
# Everything works as expected with a simple vector | |
x <- 1:4 | |
x %>% ensure_all_positive | |
# Now let's try testing element(s) of a data.frame |
extract_substrings <- function (x, ...) { | |
make_extractor <- function (i) { | |
#message(min(i), " to ", max(i)) | |
function (s) substr(s, min(i), max(i)) | |
} | |
extractors <- lapply(list(...), make_extractor) | |
lapply(extractors, function (f) f(x)) | |
} | |
ALPHABET <- paste0(LETTERS, collapse = "") |
--- | |
title: "Reactive Leaflet" | |
author: "David Holstius" | |
date: "April 16, 2015" | |
output: html_document | |
runtime: shiny | |
--- | |
## Problem Description |
# See http://stackoverflow.com/questions/29310962/variant-of-rgeosgunion-that-wont-dissolve-adjacent-polygons | |
# for the relevant problem formulation. | |
library(sp) | |
unit_rect <- cbind( | |
x = c(0, 0, 1, 1, 0), | |
y = c(0, 1, 1, 0, 0)) | |
translate <- function (spobj, delta = c(0, 0)) { |
library(rgeos) | |
library(dplyr) | |
library(magrittr) | |
n_polygons <- 5 | |
n_vertices_each <- 3 | |
rand_coords <- function (n) | |
sprintf("%0.1f %0.1f", rnorm(n), rnorm(n)) |
mtcars %>% | |
datatable(options = list(columnDefs = list(list(searchable = TRUE, targets = 1:3)))) |
I hereby claim:
To claim this, I am signing this object:
abs_path <- function (...) { | |
normalizePath(file.path(...), mustWork = FALSE) | |
} | |
cache_put <- function (.expr, path, ...) { | |
obj <- eval(.expr) | |
dn <- dirname(path) | |
if (!file.exists(dn)) { | |
dir.create(dn, recursive = TRUE) | |
} |
library(dplyr) | |
library(ggivs) | |
chart_data <- structure(list(CalYr = c(1990L, 1990L, 1990L, 1990L, 1990L, 1990L, | |
1990L, 2000L, 2000L, 2000L, 2000L, 2000L, 2000L, 2000L, 2010L, | |
2010L, 2010L, 2010L, 2010L, 2010L, 2010L, 2020L, 2020L, 2020L, | |
2020L, 2020L, 2020L, 2020L), Speed = c(0, 10, 20, 30, 40, 50, | |
60, 0, 10, 20, 30, 40, 50, 60, 0, 10, 20, 30, 40, 50, 60, 0, | |
10, 20, 30, 40, 50, 60), VMT = c(323694, 940682, 25396442, 43050277, | |
71101181, 16987641, 105467584, 222397, 859767, 57905435, 61835130, |