Skip to content

Instantly share code, notes, and snippets.

View raffdoc's full-sized avatar

Rafik Margaryan raffdoc

View GitHub Profile
@raffdoc
raffdoc / phylometa_fxn.R
Created August 18, 2011 08:07 — forked from sckott/phylometa_fxn.R
Conduct phylogenetic meta-analysis from R calling Phylometa - These are functions needed in the code in file phylometa_inR_run.R.
#####################################################################
# Created by Scott Chamberlain
# Ecology and Evolutionary Biology Dept., Rice University
# Houston, TX 77005, USA
# myrmecocystus@gmail.com
#####################################################################
# Function to split confidence intervals, this function is required in the below functions
CI_split <- function(a){
dd<-c(gsub("\\(","",unlist(strsplit(a[5],","))[1]),gsub("\\)","",unlist(strsplit(a[5],","))[2]))
@raffdoc
raffdoc / bowelCancer.Rnw
Created November 5, 2011 21:44 — forked from psychemedia/bowelCancer.Rnw
Sweave script documenting the production of a funnel plot
\documentclass[a4paper]{article}
\SweaveOpts{echo=FALSE, keep.source=TRUE}
\usepackage{a4wide}
\usepackage{color}
\usepackage{hyperref}
\begin{document}
\section{Example of self-documenting data journalism notes}
This is an example of using Sweave to combine code and output from the R statistical programming environment and the LaTeX document processing environment to generate a self-documenting script in which the actual code used to do stats and generate statistical graphics is displayed along the charts it directly produces.
@raffdoc
raffdoc / SweaveXeLaTeXExample.Rnw
Created November 21, 2011 08:05 — forked from mages/SweaveXeLaTeXExample.Rnw
Sweave XeLaTeX Example
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
%% Copyright 2011 Markus Gesmann
\documentclass[a4paper]{article}
\usepackage[noae,nogin]{Sweave}
\usepackage{tikz}
%% attachfile2 is patched to work with xelatex
## title:First Attempt at a knitr Performance Report
## author:Timely Portfolio
require(PerformanceAnalytics)
require(xtable)
data(edhec)
table.CalendarReturns(edhec[,1:3])[13:15]
charts.PerformanceSummary(edhec[,1:3],
colorset=c("gray50","steelblue2","steelblue4"),
@raffdoc
raffdoc / performance summary.r
Created April 14, 2012 09:40 — forked from timelyportfolio/performance summary.r
performance summary RNW and R
require(knitr)
knit2pdf("performance summary.rnw")
@raffdoc
raffdoc / ling-plot.Rnw
Created April 15, 2012 08:35 — forked from JoFrhwld/ling-plot.Rnw
A knitr source file for including linguistic notation as graphical elements in ggplot2
\documentclass{beamer}
\usetheme{Singapore}
\usepackage{tipa}
%% Make the r-code small
\ifdefined\knitrout
\renewenvironment{knitrout}{\begin{footnotesize}}{\end{footnotesize}}
\else
\fi
@raffdoc
raffdoc / margintale_blog_2.R
Created April 15, 2012 20:15 — forked from theHausdorffMetric/margintale_blog_2.R
Time Series Heatmaps in ggplot2
require(quantmod)
require(ggplot2)
require(reshape2)
require(plyr)
require(scales)
# Download some Data, e.g. the CBOE VIX
getSymbols("^VIX",src="yahoo")
# Make a dataframe
%% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,nohyper,noae]{tufte-handout}
\usepackage{helvet}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=1,
breaklinks=true,pdfborder={0 0 0},backref=false,colorlinks=false]
%% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,nohyper,noae]{tufte-handout}
\usepackage{helvet}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=1,
breaklinks=true,pdfborder={0 0 0},backref=false,colorlinks=false]
@raffdoc
raffdoc / ggplot2Cheat.r
Created April 27, 2012 05:41 — forked from jbryer/ggplot2Cheat.r
Graphic Parameters (symbols, line types, and colors) for ggplot2
require(ggplot2)
require(grid)
theme_update(panel.background=theme_blank(),
panel.grid.major=theme_blank(),
panel.border=theme_blank())
#Borrowed (i.e. stollen) from http://research.stowers-institute.org/efg/R/Color/Chart/ColorChart.R
getColorHexAndDecimal <- function(color) {
if(is.na(color)) {