Skip to content

Instantly share code, notes, and snippets.

@malcook
malcook / pvec.R
Created September 20, 2012 19:32
a retake on parallel:pvec
pvec2<-function(v, FUN, ..., mc.set.seed = TRUE, mc.silent = FALSE,
mc.cores = getOption("mc.cores", 2L), mc.cleanup = TRUE
,combineFUN = `c`
) {
### AUTHOR: malcolm_cook@stowers.org
### PURPOSE: an improvement(?) on parallel:pvec which
### (1) does not require v to be a vector, rather, v must
### implement `[`, `length`. Thus, i.e. BioConductor List (including
### GRangesList) is supported.
### (2) uses `parallel:splitIndices` to compute indices into v
@aaronwolen
aaronwolen / ggpairs.r
Last active May 25, 2016 13:12
Modified version of the ggplot2 plotmatrix function that accepts additional variables for aesthetic mapping.
#' Modified version of the ggplot2 plotmatrix function that accepts additional
#' variables for aesthetic mapping.
#'
#' example
#' data(iris)
#' iris.vars <- c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")
#' ggpairs(data = iris, facet.vars = iris.vars,
#' mapping = aes(color = Species, shape = Species))
ggpairs <- function (data, facet.vars = colnames(data), facet.scale = "free",
@andyferra
andyferra / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@ramnathv
ramnathv / gfm-table.md
Created March 16, 2012 16:08
GFM Table with knitr + ascii

Here is how you can make a table in GFM format using knitr + ascii

render_gfm()
gfm_table <- function(x, ...) {
    require(ascii)
    y <- capture.output(print(ascii(x, ...), type = "org"))
 # substitute + with | for table markup