Skip to content

Instantly share code, notes, and snippets.

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.
@alexwhan
alexwhan / d
Created September 27, 2013 06:20
d
@alexwhan
alexwhan / flare.json
Last active December 24, 2015 07:18
Test of collapsible tree
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
marker position parent contribution
a 5 x 0.25
a 5 y 0.75
b 10 x 0.8
b 10 y 0.2
@alexwhan
alexwhan / data.csv
Last active December 25, 2015 11:49
id Under 5 Years 5 to 13 Years 14 to 17 Years 18 to 24 Years 25 to 44 Years 45 to 64 Years 65 Years and Over
AL 310504 552339 259034 450818 1231572 1215966 641667
AK 52083 85640 42153 74257 198724 183159 50277
AZ 515910 828669 362642 601943 1804762 1523681 862573
AR 202070 343207 157204 264160 754420 727124 407205
CA 2704659 4499890 2159981 3853788 10604510 8819342 4114496
CO 358280 587154 261701 466194 1464939 1290094 511094
CT 211637 403658 196918 325110 916955 968967 478007
DE 59319 99496 47414 84464 230183 230528 121688
DC 36352 50439 25225 75569 193557 140043 70648
@alexwhan
alexwhan / merge_list.R
Created January 13, 2016 03:18 — forked from leeper/merge_list.R
Merge list of data.frames
# packages
library("dplyr")
library("reshape")
library("microbenchmark")
set.seed(1)
# prep data
m <- mtcars
n <- 50L # number of data.frames
library(ggplot2)
set.seed(42)
ran <- expand.grid(y = seq(from = 1, to = 300, length.out = 150),
x = seq(from = 1, to = 300, length.out = 150))
ran$r <- sample(seq(from = 0.7, to = 1, by = 0.05), nrow(ran), replace = TRUE)
ran$g <- sample(seq(from = 0, to = 0.1, by = 0.05), nrow(ran), replace = TRUE)
ran$b <- sample(seq(from = 0, to = 0.4, by = 0.05), nrow(ran), replace = TRUE)
ran$hex <- rgb(ran$r, ran$g, ran$b)
ran$size <- sample(seq(from = 2, to = 5, by = 0.2), nrow(ran), replace = TRUE)
ran$shape <- sample(15:20, nrow(ran), replace = TRUE)

Keybase proof

I hereby claim:

  • I am alexwhan on github.
  • I am alexwhan (https://keybase.io/alexwhan) on keybase.
  • I have a public key ASAxeEb50FSEICQcpOzUeKJ7DAcG6pkBp9pJsabvfrMimQo

To claim this, I am signing this object:

library(ggplot2)
library(gganimate)
library(dplyr)
library(tidyr)
#make a demo layout
ids1 <- 1:20
ids2 <- c(1:10, 21:30)
rep1 <- data.frame(row = c(1:4, 1), range = 1:5) %>%
expand(row, range) %>%