Skip to content

Instantly share code, notes, and snippets.

@juliasilge
Created February 22, 2023 00:13
Show Gist options
  • Save juliasilge/bf30d7b731bf1ab2c5407f8703a03173 to your computer and use it in GitHub Desktop.
Save juliasilge/bf30d7b731bf1ab2c5407f8703a03173 to your computer and use it in GitHub Desktop.
#TidyTuesday Bob Ross paintings
library(tidyverse)
library(corrr)

bob_ross <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-21/bob_ross.csv')
#> Rows: 403 Columns: 27
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr  (5): img_src, painting_title, youtube_src, colors, color_hex
#> dbl  (4): painting_index, season, episode, num_colors
#> lgl (18): Black_Gesso, Bright_Red, Burnt_Umber, Cadmium_Yellow, Dark_Sienna,...
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

bob_ross %>%
    select(Black_Gesso:Alizarin_Crimson) %>% 
    mutate(across(everything(), as.numeric)) %>% 
    correlate() %>% 
    rearrange() %>%
    shave() %>%
    rplot(shape = 15, colours = c("#CD5C5C", "white", "#0C0040")) +
    silgelib::theme_plex() +
    scale_x_discrete(guide = guide_axis(angle = 90)) +
    coord_fixed() +
    labs(title = "Which colors in Bob Ross paintings are correlated?")
#> Correlation computed with
#> • Method: 'pearson'
#> • Missing treated using: 'pairwise.complete.obs'

Created on 2023-02-21 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment