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) | |
| 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 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
| --- | |
| output: html_document | |
| --- | |
| ```{r setup, include=FALSE} | |
| knitr::opts_chunk$set(echo = TRUE) | |
| library(gt) | |
| library(gtsummary) | |
| library(tidyverse) | |
| ``` |
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) | |
| color_sequence <- seq_along(grDevices::colors()) | |
| dplyr::tibble( | |
| x11c = grDevices::colors(), | |
| wcag = color_sequence, | |
| apca = color_sequence | |
| ) %>% |
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) | |
| # 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 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(usethis) | |
| labels <- | |
| c( | |
| "Blocked (╥﹏╥)", | |
| "Difficulty: ③ Advanced", | |
| "Difficulty: ② Intermediate", | |
| "Difficulty: ① Novice", | |
| "Effort: ③ High", | |
| "Effort: ② Medium", |
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(palmerpenguins) | |
| informant_pp <- | |
| create_informant( | |
| read_fn = ~ palmerpenguins::penguins, | |
| tbl_name = "penguins", | |
| label = "The `penguins` dataset from the **palmerpenguins** 📦." | |
| ) %>% | |
| info_columns( |
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)) %>% |
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
| 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(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)", |
NewerOlder