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
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
library(magrittr) | |
# Create a graph | |
graph <- | |
create_graph() %>% | |
set_global_graph_attr("graph", "rankdir", "LR") %>% | |
add_node("A") %>% add_node("B") %>% add_node("C") %>% | |
add_node("D") %>% add_node("E") %>% add_node("F") %>% |
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
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
library(DiagrammeRsvg) | |
library(magrittr) | |
# Create three groups (Setosa, Versicolor, and Virginica) | |
# of x,y datapoints for petal length (x) and petal width (y) | |
setosa <- | |
create_xy_pts( | |
series_label = "Setosa", |
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(DiagrammeR) | |
library(DiagrammeRsvg) | |
library(magrittr) | |
# The CSV file is located inside a zip file at: | |
# https://www.kaggle.com/kaggle/sf-salaries/downloads/ | |
# sf-salaries-release-2015-12-21-03-21-32.zip | |
salaries <- read.csv("Salaries.csv", | |
stringsAsFactors = FALSE) |
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
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
library(DiagrammeRsvg) | |
library(magrittr) | |
# Read in the data | |
sp500 <- read.csv(system.file("examples/sp500.csv", | |
package = "DiagrammeR"), | |
stringsAsFactors = FALSE) |
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
# Load in several packages | |
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
library(DiagrammeRsvg) | |
library(magrittr) | |
library(stationaRy) | |
library(dplyr) | |
# Get the daily rainfall values (in mm) during 2015 at | |
# the Vancouver Internation Airport (YVR) |
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(pointblank) | |
library(log4r) | |
library(blastula) | |
# Create a connection to the game analytics data | |
# This is the `intendo` database | |
con <- | |
DBI::dbConnect( | |
drv = RMariaDB::MariaDB(), | |
dbname = Sys.getenv("DBNAME"), |
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(tidyverse) | |
library(paletteer) | |
library(gt) | |
pizzaplace %>% | |
mutate(type = case_when( | |
type == "chicken" ~ "chicken (pizzas with chicken as a major ingredient)", | |
type == "classic" ~ "classic (classical pizzas)", | |
type == "supreme" ~ "supreme (pizzas that try a little harder)", | |
type == "veggie" ~ "veggie (pizzas without any meats whatsoever)", |
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
reencode_utf8 <- function(x) { | |
# Ensure that we encode non-UTF-8 strings to UTF-8 in a | |
# two-step process: (1) to native encoding, and then | |
# (2) to UTF-8 | |
if (Encoding(x) != 'UTF-8') { | |
x <- enc2utf8(x) | |
} | |
# Use `iconv()` to convert to UTF-32 (big endian) as |
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(pointblank) | |
library(here) | |
library(intendo) | |
# Note: while this table is hosted on a database, the table can be obtained | |
# from the {intendo} package (https://github.com/rich-iannone/intendo) | |
informant_revenue_postgres <- | |
create_informant( | |
read_fn = |
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(gt) | |
library(tidyverse) | |
order_countries <- c("Germany", "Italy", "United States", "Japan") | |
best_gas_mileage_city <- | |
gtcars %>% | |
dplyr::arrange(desc(mpg_c)) %>% | |
dplyr::slice(1) %>% | |
dplyr::mutate(car = paste(mfr, model)) %>% |