Skip to content

Instantly share code, notes, and snippets.

View halpo's full-sized avatar

Andrew Redd halpo

View GitHub Profile
@halpo
halpo / Makefile
Created November 16, 2011 21:45
Makefile for Sweave with pgfSweave/cacheSweave
################################################################################
all:pdf # default rule DO NOT EDIT
################################################################################
MAINFILE := main
RNWFILES :=
RFILES :=
TEXFILES :=
CACHEDIR := cache
FIGUREDIR := figures
DRIVER := pgfSweave
@halpo
halpo / time.R
Created November 16, 2011 18:27
Time formatting for proc_time in R
#' formats proc_time as a "hh:mm:ss" time string
#'
#' @seeAlso print.proc_time, proc.time
#'
formatTime <- function(x){
stopifnot(inherits(x, "proc_time"))
h <- x %/% 3600L
m <- (x %% 3600L) %/% 60L
s <- x %% 60L
ifelse(is.na(x), NA, sprintf("%02d:%02d:%2.2f",h,m,s))