As I read the TraMineR
vignette, I thought this state sequence diagram would be an interesting use case for rcdimple
. I'll throw in a little ggplot2
, dplyr
, tidyr
, and pipeR
for free.
See the live example.
# Install the latest version of DiagrammeR from GitHub | |
devtools::install_github("rich-iannone/DiagrammeR") | |
# Ensure that the package is loaded | |
library("DiagrammeR") | |
# So, here's a script that essentially takes an empty graph series, and | |
# creates a new graph on each new day it is triggered. It will create | |
# random nodes each time it's triggered and add those nodes to the graph | |
# belonging to the current day. Throughout the script, '_SELF_' refers |
library(rgdal) | |
library(rgeos) | |
library(ggplot2) | |
library(readr) | |
library(tidyr) | |
library(dplyr) | |
library(grid) | |
us <- readOGR("us_states_hexgrid.geojson", "OGRGeoJSON") |
#devtools::install_github("rstudio/leaflet", ref="feature/color-legend") | |
library(leaflet) | |
library(RColorBrewer) | |
set.seed(100) | |
pdf <- data.frame(Latitude = runif(100, -90,90), Longitude = runif(100, -180,180)) | |
#make a property with colors | |
pdf$Study <- rep(1:10,10) | |
#need to create a pal using colorbin |
### Title: Back to basics: High quality plots using base R graphics | |
### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015 | |
### | |
### Date created: 20150418 | |
### Last updated: 20150423 | |
### | |
### Author: Michael Koontz | |
### Email: [email protected] | |
### Twitter: @michaeljkoontz | |
### |
(function(){ | |
var margin = { | |
top: 20, | |
right: 40, | |
bottom: 50, | |
left: 40 | |
}, | |
width = 660 - margin.left - margin.right, | |
height = 340 - margin.top - margin.bottom; |
### Cumulative Golf Major Winners | |
library(XML) | |
masters <- readHTMLTable("http://en.wikipedia.org/wiki/Masters_Tournament") | |
masters <- masters[[4]][,1:2] | |
usopen <- readHTMLTable("http://en.wikipedia.org/wiki/U.S._Open_(golf)") | |
usopen <- usopen[[2]][,1:2] |
library(rvest) | |
library(magrittr) | |
library(ggplot2) | |
library(dplyr) | |
library(tidyr) | |
library(scales) | |
# get page | |
pg <- html("http://www.bls.gov/opub/ted/2015/consumer-spending-by-age-group-in-2013.htm#tab-2") |
# Obtain 'dogs.csv' | |
# Created by Alex Bresler, available at: | |
# https://github.com/abresler/abresler.github.io/blob/master/blog/2015/february/exploring_agility_show/data/dogs.csv | |
dat_url <- "http://asbcllc.com/blog/2015/february/exploring_agility_show/data/dogs.csv" | |
dogs <- read.csv(dat_url, header = TRUE, stringsAsFactors = FALSE) | |
library(shiny) | |
# Install the latest DiagrammeR package from GitHub | |
# devtools::install_github("rich-iannone/DiagrammeR") |
library(dplyr) | |
library(streamgraph) | |
library(pbapply) | |
# Grab some employment data from BLS -------------------------------------- | |
url <- "http://www.bls.gov/lau/ststdsadata.txt" | |
dat <- readLines(url) | |
# Small function to grab data for a particular state ---------------------- |