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
| for(n in 35:55) { | |
| demo_data <- palmerpenguins::penguins |> | |
| sample_n(n) |> | |
| filter(!is.na(sex)) |> | |
| group_by(sex, species) |> | |
| count() |> | |
| ungroup() |> | |
| arrange(n) |> |
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
| representation <- dplyr::tibble(party = c("Labour", | |
| "Green", | |
| "Liberal Democrats", | |
| "Trade Unionist and Socialist Coalition", | |
| "Conservative", | |
| "Independent", | |
| "Reform UK", | |
| "General Population"), | |
| women = c(41, 41, 33, 33, 29, 28, 22, 51)) |> | |
| # Keep the parties in current order (proportion) |
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
| # Cheesy Proportions | |
| library(tidyverse) | |
| # Dataset - Source, BBC News | |
| cheese_proportions <- tibble( | |
| name = c("Profit", "Processor", "Retailer", "Farming"), | |
| amount = c(3.5, 42.5, 56, 148) | |
| ) |> | |
| mutate(proportion = amount / sum(amount) * 100) %>% | |
| arrange(proportion) %>% |
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) | |
| # Retrieve data on all tweets ---- | |
| # From documentation: Set n = Inf to download as many results as possible. | |
| my_tweets <- rtweet:: get_timeline(user = "myusername", | |
| n = Inf, retryonratelimit = TRUE) | |
| # Pick only the ones which are the starting points (we'll retrieve all the ones that are replies to it in the next step) ---- | |
| thread_starts <- my_tweets |> |
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(palmerpenguins) | |
| library(tidyverse) | |
| ggplot(penguins, | |
| aes(x = bill_depth_mm, | |
| y = bill_length_mm, | |
| colour = species)) + | |
| geom_point() + | |
| labs(title = "Perfectly Proportional Penguins", | |
| subtitle = "Look at them go!") |
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(sf) | |
| obtn_year <- 2022 | |
| obtn_boundaries_oregon_census_tracts <- read_rds("https://github.com/rfortherestofus/obtn/raw/data-2022/inst/obtn_boundaries_oregon_census_tracts.rds") | |
| obtn_population_by_census_tract <- read_rds("https://github.com/rfortherestofus/obtn/raw/data-2022/inst/obtn_population_by_census_tract.rds") | |