Skip to content

Instantly share code, notes, and snippets.

View raffdoc's full-sized avatar

Rafik Margaryan raffdoc

View GitHub Profile
library(ggplot2)
library(colorRamps)
TawiTawiPop <- c(17000, 45000, 46000, 59000, 79000, 110000, 143000, 195000, 228204,
250718, 322317, 450346, 366550)
YearNames <- c("1903", "1918", "1939", "1948", "1960", "1970", "1975", "1980", "1990",
"1995", "2000", "2007", "2010")
qplot(YearNames, TawiTawiPop,
xlab = expression(bold("Censal Year")),
#get very helpful Ken French data
#for this project we will look at Global Factors
#http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp/Global_Factors.zip
require(PerformanceAnalytics)
require(quantmod)
require(RColorBrewer)
#my.url will be the location of the zip file with the data
@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)) {
%% 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 / 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
@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 / 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")
## 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 / 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