Skip to content

Instantly share code, notes, and snippets.

View halpo's full-sized avatar

Andrew Redd halpo

View GitHub Profile
@halpo
halpo / dostats.R
Created January 31, 2012 17:45
Compute statistics for a vector with renaming
library(plyr)
library(stringr)
#' Convenient interface for computing statistics on a vector
#' @author Andrew Redd
#'
#' @param x the vector
#' @param ... statistics to compute, must take a vector and return a vector
#' @param .na.action the action to take on NA values, for all statistics
#'
#' @return A one row \code{data.frame} with columns named as in \code{...}