This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#copied this function almost entirely from http://tradeblotter.wordpress.com/ | |
#I only take credit for the ugly/bad code | |
#amended to accept data in long form and replace time with manager | |
# Histogram, QQPlot and ECDF plots aligned by scale for comparison | |
page.Distributions.long <- function (R, mgrcol, perfcol, ylim=c(0,0.25)) { | |
require(PerformanceAnalytics) | |
op <- par(no.readonly = TRUE) | |
# c(bottom, left, top, right) | |
par(oma = c(5,0,2,1), mar=c(0,0,0,3)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[nohyper,justified]{tufte-handout} | |
%\documentclass{article} | |
%\usepackage[absolute,showboxes]{textpos} | |
\usepackage[absolute]{textpos} | |
\usepackage{sidecap} | |
%\usepackage{color} | |
%\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} | |
\begin{document} | |
\SweaveOpts{concordance=TRUE} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[nohyper,justified]{tufte-handout} | |
%\documentclass{article} | |
%\usepackage[absolute,showboxes]{textpos} | |
\usepackage[absolute]{textpos} | |
\usepackage{sidecap} | |
%\usepackage{color} | |
%\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} | |
\begin{document} | |
<<include=FALSE>>= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bigcorPar <- function(x, nblocks = 10, verbose = TRUE, ncore="all", ...){ | |
library(ff, quietly = TRUE) | |
require(doMC) | |
if(ncore=="all"){ | |
ncore = multicore:::detectCores() | |
registerDoMC(cores = ncore) | |
} else{ | |
registerDoMC(cores = ncore) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################### | |
## Intro to Simulation - R/Stats Intro Series | |
## Designed by: Corey Chivers, 2013 | |
## Department of Biology, McGill University | |
######################################################### | |
##@ 0.1 @## | |
rm(list=ls()) # Housekeeping | |
#setwd('<my working directory>') # set working dir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[nohyper,justified]{tufte-handout} | |
\usepackage{xltxtra,fontspec,xunicode} | |
\usepackage{sectsty} %% change fonts for sections | |
\setmainfont{Source Sans Pro Light} | |
\begin{document} | |
\pagenumbering{gobble} | |
\setlength{\parindent}{0pt} | |
\setlength{\parskip}{6pt} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## load "pander" package | |
## http://rapporter.github.com/pander/ | |
library(pander) | |
## "brew" the below file to Pandoc's markdown | |
Pandoc.brew('example.brew') | |
## or convert to HTML at one go | |
## NOTE: `pandoc` is needed for the conversion | |
Pandoc.brew('example.brew', output = tempfile(), convert = 'html') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load required packages | |
library(shiny) | |
library(shinyIncubator) | |
library(googleVis) | |
library(ggplot2) | |
library(stringr) | |
library(plyr) | |
library(XML) | |
library(httr) | |
library(Hmisc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bland-Altman plot R function. | |
# Author: [email protected] | |
baplot <- function(m1, m2, ...) { | |
# m1 and m2 are the measurements | |
means <- (m1 + m2) / 2 | |
diffs <- m1 - m2 | |
mdiff <- mean(diffs) | |
sddiff <- sd(diffs) | |
# Compute the figure limits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## See http://gettinggeneticsdone.blogspot.com/2013/06/customize-rprofile.html | |
## Load packages | |
library(BiocInstaller) | |
## Don't show those silly significanct stars | |
options(show.signif.stars=FALSE) | |
## Do you want to automatically convert strings to factor variables in a data.frame? | |
## WARNING!!! This makes your code less portable/reproducible. |