Skip to content

Instantly share code, notes, and snippets.

View rich-iannone's full-sized avatar

Richard Iannone rich-iannone

View GitHub Profile
@rich-iannone
rich-iannone / information_palmerpenguins.R
Last active January 19, 2021 23:48
A pointblank information report for the `peguins` dataset in the `palmerpenguins` package
library(pointblank)
library(palmerpenguins)
informant_pp <-
create_informant(
read_fn = ~ palmerpenguins::penguins,
tbl_name = "penguins",
label = "The `penguins` dataset from the **palmerpenguins** 📦."
) %>%
info_columns(
@rich-iannone
rich-iannone / gh_issue_labels.R
Last active March 4, 2021 16:32
GitHub Issue Labels
library(usethis)
labels <-
c(
"Blocked (╥﹏╥)",
"Difficulty: ③ Advanced",
"Difficulty: ② Intermediate",
"Difficulty: ① Novice",
"Effort: ③ High",
"Effort: ② Medium",
@rich-iannone
rich-iannone / news-orgs-early.R
Created April 5, 2022 16:46
An in-progress build of a gt table that uses the `2022-04-05/news_orgs.csv` TidyTuesday dataset
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(),
@rich-iannone
rich-iannone / gt-color-contrast-computation-comparison.R
Last active October 20, 2023 15:31
This gist generates a gt table that compares text color choices from the WCAG and APCA contrast methods. Implemented in the `data_color()` function of the gt package, where the background is set first (based on cell data) and the color of the overlaid text is determined from the color contrast algorithm.
library(gt)
library(tidyverse)
color_sequence <- seq_along(grDevices::colors())
dplyr::tibble(
x11c = grDevices::colors(),
wcag = color_sequence,
apca = color_sequence
) %>%
@rich-iannone
rich-iannone / new_gt_0.8.0.Rmd
Created December 2, 2022 17:38
This is the slightly revised R Markdown source of the Posit blog post at https://posit.co/blog/new-features-upgrades-in-gt-0-8-0/.
---
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(gt)
library(gtsummary)
library(tidyverse)
```
@rich-iannone
rich-iannone / gt_populations.R
Created April 6, 2023 18:31
Population Ranges
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)
)) |>