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
library(OIdata) | |
library(RColorBrewer) | |
library(classInt) | |
# load state data from OIdata package: | |
data(state) | |
# set constants: | |
nclr <- 8 # number of bins | |
min <- 0 # theoretical minimum |
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
rm(list=ls()) | |
library(ggplot2) | |
df <- read.csv("~/RStats/data/ResearchGrants2013.csv", stringsAsFactors=F, strip.white=T) | |
df <- df[,-6] #get rid of the trailing blank | |
dim(df) | |
#quick check | |
unique(df$Research.Category) | |
table(df$Research.Category) |
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
# The MIT License (MIT) | |
# | |
# Copyright (c) 2012 Schaun Jacob Wheeler | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
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. |
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
# 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
## 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
\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
######################################################### | |
## 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
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) | |
} |