I hereby claim:
- I am dgrtwo on github.
- I am drobinson (https://keybase.io/drobinson) on keybase.
- I have a public key whose fingerprint is 2BFD FAC9 CDA9 669F FE2C 6973 C0B7 A65C CA30 6675
To claim this, I am signing this object:
parsetidy <- function(x, ...) UseMethod("parsetidy") | |
parsetidy.default <- function(x, ...) { | |
# if it's not a call or name (e.g. it's numeric), | |
# don't need it | |
data.frame() | |
} | |
# somewhat hackish solution to: | |
# https://twitter.com/EamonCaddigan/status/646759751242620928 | |
# based mostly on copy/pasting from ggplot2 geom_violin source: | |
# https://github.com/hadley/ggplot2/blob/master/R/geom-violin.r | |
library(ggplot2) | |
library(dplyr) | |
"%||%" <- function(a, b) { |
## helper and setup functions | |
wrap_party_df <- function(func) { | |
function(x, object, ...) { | |
n <- col_name(substitute(object)) | |
# have to create an expression since we cannot rely on local | |
# variables | |
args <- list(...) | |
expr <- substitute(do.call(func, c(list(.[[colname]][[1]]), args)), |
library(readr) | |
library(dplyr) | |
start <- read_delim("col3 col2 col4 col1 | |
h a t t | |
i v i g | |
k s g n | |
n g n i", delim = " ") | |
start %>% |
theme_blank <- function(...) { | |
ret <- theme_bw(...) | |
ret$line <- element_blank() | |
ret$rect <- element_blank() | |
ret$strip.text <- element_blank() | |
ret$axis.text <- element_blank() | |
ret$plot.title <- element_blank() | |
ret$axis.title <- element_blank() | |
ret$plot.margin <- structure(c(0, 0, -1, -1), unit = "lines", valid.unit = 3L, class = "unit") | |
ret |
I hereby claim:
To claim this, I am signing this object:
# data cleaning based on http://blog.dominodatalab.com/r-in-ecology/ | |
library(dplyr) | |
library(tidyr) | |
library(readr) | |
library(stringr) | |
library(auriel) | |
infolder <- "night_files/" | |
masterdat2 <- data_frame(file = list.files(infolder)) %>% | |
group_by(file) %>% |
#' Add a column counting or tallying observations within groups | |
#' | |
#' \code{add_tally} adds a column named "n" (or similar) to a table based on the number | |
#' of items within each group. These functions are to \code{tally} and | |
#' \code{count} as \code{mutate} is to \code{summarise}: they add an additional | |
#' column. They tally within the groups of the current data, and do not change them. | |
#' | |
#' @param x A table | |
#' @param wt (Optional) If omitted, will count the number of rows. Otherwise, use a weighted tally | |
#' @param sort Whether to sort the result in descending order of n |
grouply <- function(f, ...) { | |
groups <- lazyeval::lazy_dots(...) | |
function(tbl, ...) { | |
dplyr::group_by_(tbl, .dots = groups) %>% | |
f(...) %>% | |
dplyr::ungroup() | |
} | |
} |
#' Convert a dplyr expression to a list of step objects | |
separate_steps <- function(expr, iscall=FALSE) { | |
if (iscall) { | |
call <- expr | |
} else { | |
call <- match.call()[["expr"]] | |
} | |
len <- length(call) | |
if (len == 1) { |