This file contains hidden or 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
# Create a simple data frame for testing | |
df <- data.frame(POSIXtime = seq(as.POSIXct('2013-08-02 12:00'), | |
as.POSIXct('2013-08-06 05:00'), len = 45), | |
x = seq(45)) | |
# The Subset Examples | |
# | |
# All data on 2013-08-06 | |
sub.1 <- subset(df, format(POSIXtime,'%d')=='06') |
This file contains hidden or 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
grViz(" | |
graph severalranks { | |
node [shape = circle, fixedsize = true, fontcolor = '#555555', | |
fontname = Helvetica, fontsize = 7, style = filled, | |
fillcolor ='#AAAAAA', color='#555555', width = 0.12, | |
height = 0.12, nodesep = 0.1] | |
edge [color = '#AAAAAA'] |
This file contains hidden or 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
grViz(" | |
graph severalranks { | |
node [shape = circle, fixedsize = true, fontcolor = '#555555', | |
fontname = Helvetica, fontsize = 7, style = filled, | |
fillcolor ='#AAAAAA', color='#555555', width = 0.12, | |
height = 0.12, nodesep = 0.1] | |
edge [color = '#AAAAAA'] |
This file contains hidden or 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(V8) | |
# Create function to generate palette of visually different colors | |
hex_palette <- function(no_colors, | |
hue_range = NULL, | |
chroma_range = NULL, | |
lightness_range = NULL){ | |
pal <- function(col, border = "light gray", ...){ | |
n <- length(col) |
This file contains hidden or 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
# install.packages("downloader") | |
# devtools::install_github("rich-iannone/DiagrammeR") | |
# devtools::install_github("jeroenooms/V8") | |
library("downloader") | |
library("DiagrammeR") | |
library("V8") | |
# Create a function that uses the 'chromatography' JS library to generate a random | |
# set of colors from the CIE Lab color space |
This file contains hidden or 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(DiagrammeR) | |
require(stringr) | |
# Animation test | |
nodes <- c("a", "b", "c") # must be named 'nodes' and should have unique values | |
nodes_df <- data.frame(nodes) | |
edge_from <- c("a", "a", "b") |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# Installation | |
#install.packages("devtools") | |
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
# Create and render an empty graph | |
empty_graph <- create_graph() | |
render_graph(empty_graph, output = "visNetwork") |
This file contains hidden or 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
# Installation | |
#install.packages("devtools") | |
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
# Create a graph of border coordinates for USA, Canada, and Mexico | |
country_graph <- country_graph(iso_a2 = c("US", "CA", "MX")) | |
# Read in a CSV with US city data |
This file contains hidden or 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
# Installation | |
#install.packages("devtools") | |
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
# Create a graph of border coordinates | |
country_graph <- country_graph() | |
# Read in a CSV with location and population data for cities all over the world |
OlderNewer