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
--- | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
library(gt) | |
library(gtsummary) | |
library(tidyverse) | |
``` |
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
library(gt) | |
library(tidyverse) | |
color_sequence <- seq_along(grDevices::colors()) | |
dplyr::tibble( | |
x11c = grDevices::colors(), | |
wcag = color_sequence, | |
apca = color_sequence | |
) %>% |
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
# 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 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 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 |
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
library(gt) | |
library(tidyverse) | |
countrypops |> | |
dplyr::filter(year == 2021) |> | |
dplyr::select(country_code_2, population) |> | |
dplyr::mutate(population_class = cut( | |
population, | |
breaks = scales::breaks_log(n = 20)(population) | |
)) |> |
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
# 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 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) | |
# Table reading | |
news_orgs <- | |
readr::read_csv( | |
file = 'https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-04-05/news_orgs.csv', | |
col_types = cols( | |
publication_name = col_character(), | |
parent_publication = col_character(), |
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
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 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) |
NewerOlder