Skip to content

Instantly share code, notes, and snippets.

View raffdoc's full-sized avatar

Rafik Margaryan raffdoc

View GitHub Profile
#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))
\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}
\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>>=
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)
}
@cjbayesian
cjbayesian / intro_to_simulation.R
Created March 22, 2013 11:50
Introduction to simulation using R
#########################################################
## 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
@timelyportfolio
timelyportfolio / 2013-03-08yen-anonymous.rnw
Last active August 16, 2017 14:59
production quality R knitr latex report on yen
\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}
## 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')
@pssguy
pssguy / global.R
Created May 1, 2013 21:14
Shiny App showing ranking of 140+ TV Shows by episode
# load required packages
library(shiny)
library(shinyIncubator)
library(googleVis)
library(ggplot2)
library(stringr)
library(plyr)
library(XML)
library(httr)
library(Hmisc)
@jmmateoshggm
jmmateoshggm / baplot.R
Created May 17, 2013 13:32
Bland-Altman plot, R code.
# 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
@stephenturner
stephenturner / .Rprofile.r
Last active January 3, 2025 12:36
My .Rprofile
## 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.