See https://github.com/yihui/knitr-examples/blob/master/017-auto-dependson.Rnw
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
pdf.options(width = 7, height = 5, family = "AvantGarde") | |
library(RColorBrewer) | |
library(animation) | |
# title page | |
# pdf('titlepic.pdf', width=7, height=4) | |
ani.options(nmax = 66, interval = 0) | |
data(HuSpeech) | |
par(mar = c(4, 4, 0.1, 0.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
% see http://yihui.name/knitr/demo/listings/ for output | |
\documentclass{article} | |
% define a new environment to break lines for error messages | |
\lstnewenvironment{Serror}{\lstset{style=Routstyle,breaklines=true}}{} | |
<<setup, include=FALSE>>= | |
render_listings() | |
@ |
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
#!/usr/bin/env ruby | |
# under Ubuntu, you should install ruby1.9.1 or higher (default 1.8 does not work) | |
require 'json' | |
require 'net/https' | |
require 'pathname' | |
# Extensions |
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
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="author" content="Yihui Xie" /> | |
<title>Writing beautiful and reproducible slides quickly</title> | |
<style type="text/css"> | |
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { | |
margin: 0; padding: 0; vertical-align: baseline; border: none; } | |
table.sourceCode { width: 100%; } | |
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } |
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
# data is a non-negative matrix; x is the timeline vector | |
stream_graph = function(data, x=1:nrow(data)) { | |
m = ncol(data); n = nrow(data) | |
data[is.na(data)] = 0 | |
data = t(apply(cbind(0, as.matrix(data)), 1, cumsum)) | |
data = sweep(data, 1, rowMeans(data)) | |
plot(range(x), range(data, na.rm = TRUE), type = 'n', ann = FALSE) | |
for (j in 1:m) { | |
y = c(data[, j], rev(data[, j + 1])) | |
polygon(xspline(c(x, rev(x)), y, shape = -1, draw = FALSE), col = j, border = NA) |
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 created this file. For more info see http://www.lyx.org/ | |
\lyxformat 413 | |
\begin_document | |
\begin_header | |
\textclass article | |
\use_default_options true | |
\begin_modules | |
knitr | |
\end_modules | |
\maintain_unincluded_children false |