Skip to content

Instantly share code, notes, and snippets.

View ejanalysis's full-sized avatar

ejanalysis ejanalysis

  • Washington DC area, USA
View GitHub Profile
@dholstius
dholstius / aggregate.data.table.r
Last active October 13, 2015 06:57
Fast rollup of rows from a data.frame (uses data.table for speed)
#' aggregate.data.table
#'
#' Use to quickly aggregate rows from a data.frame
#'
#' @param x data.table
#' @param by list of columns to use for grouping
#' @param FUN summary function
#' @param \dots further arguments to summary function
#' @param is.value determines which of the remaining columns should be aggregated (numeric, POSIXct, character, etc.)
#' @author David Holstius \email{[email protected]}
#
# Steve Pittard - [email protected], 03/19/12
# Code to illustrate motivations for using apply function
#
# See www.bimcore.emory.edu/bbseries for slides and code downloads
#
# References include:
# http://statland.org/R/R/Rpulse2.htm , http://www.cyclismo.org/tutorial/R/tables.html#manipulations
# http://nsaunders.wordpress.com/2010/08/20/a-brief-introduction-to-apply-in-r/
#
@bearloga
bearloga / tabletools.R
Created January 9, 2014 00:40
This shows how to add a DataTables plug-in (in this case TableTools) to your Shiny app.
library(shiny)
library(ggplot2)
# Download DataTables JS file and TableTools full package from http://datatables.net/download/
# Change the paths appropriately:
addResourcePath('datatables','/Users/yourusername/Downloads/DataTables-1.9.4/media')
addResourcePath('tabletools','/Users/yourusername/Downloads/TableTools-2.1.5/media')
runApp(list(
ui = basicPage(