This file contains 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
################################################################################ | |
# Copyright 2011 | |
# Andrew Redd | |
# 11/23/2011 | |
# | |
# Description of File: | |
# Makefile for knitr compiling | |
# | |
################################################################################ | |
all:pdf # default rule DO NOT EDIT |
This file contains 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
%% 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] |
This file contains 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
This post examines the features of [R Markdown](http://www.rstudio.org/docs/authoring/using_markdown) | |
using [knitr](http://yihui.name/knitr/) in Rstudio 0.96. | |
This combination of tools provides an exciting improvement in usability for | |
[reproducible analysis](http://stats.stackexchange.com/a/15006/183). | |
Specifically, this post | |
(1) discusses getting started with R Markdown and `knitr` in Rstudio 0.96; | |
(2) provides a basic example of producing console output and plots using R Markdown; | |
(3) highlights several code chunk options such as caching and controlling how input and output is displayed; | |
(4) demonstrates use of standard Markdown notation as well as the extended features of formulas and tables; and | |
(5) discusses the implications of R Markdown. |
This file contains 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
digraph G { | |
subgraph cluster_1 { | |
Rscript -> localDir; | |
localDir -> Rscript; | |
Rscript -> Sweave; | |
Sweave -> TeX; | |
TeX -> PDF [ label = "laTeX"] | |
Rscript -> Rmarkdown; | |
RCurl -> Rscript; |
This file contains 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
require(lattice) | |
require(latticeExtra) | |
require(directlabels) | |
require(reshape2) | |
require(quantmod) | |
require(PerformanceAnalytics) | |
data(managers) | |
managers[which(is.na(managers),arr.ind=TRUE)[,1], |
This file contains 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(twitteR) | |
library(ggplot2) | |
library(grid) | |
# download all that you can | |
pol <- userTimeline('BeijingAir', n=3200) | |
length(pol) | |
# 3200 | |
myGrep <- function(x){ |
This file contains 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
#look at steps in constructing a horizon plot version | |
#of http://www.mebanefaber.com/timing-model/ | |
#do horizon of percent above or below 10 month / 200 day moving average | |
require(lattice) | |
require(latticeExtra) | |
require(quantmod) | |
#since we are focused on the horizon plot, let's just look at one stock |
This file contains 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
require(RColorBrewer) | |
require(quantmod) | |
require(PerformanceAnalytics) | |
data(managers) | |
#let's do managers from 2002 to 2004 to get positive and negative | |
x <- cumprod(1+managers["2002::2004"])[,1] - 1 | |
#get some decent colors from RColorBrewer |
This file contains 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
require(fAssets) | |
require(latticeExtra) | |
require(quantmod) | |
require(PerformanceAnalytics) | |
#my.url will be the location of the zip file with the data | |
my.url="http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ftp/48_Industry_Portfolios_daily.zip" | |
#this will be the temp file set up for the zip file | |
my.tempfile<-paste(tempdir(),"\\frenchindustry.zip",sep="") | |
#my.usefile is the name of the txt file with the data |
This file contains 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
## Corey Chivers, 2012 ## | |
sim_bayes<-function(p=0.5,N=100,y_lim=20,a_a=2,a_b=10,b_a=8,b_b=3) | |
{ | |
## Simulate outcomes in advance | |
outcomes<-sample(1:0,N,prob=c(p,1-p),replace=TRUE) | |
success<-cumsum(outcomes) | |
for(frame in 1:N) | |
{ | |
png(paste("plots/",1000+frame,".png",sep="")) |
OlderNewer