Last updated: 2022-11-02
Checks: 7 0
Knit directory: myTidyTuesday/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20210907)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 7d843f4. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: data/.Rhistory
Ignored: data/2022_11_01.png
Ignored: data/CNHI_Excel_Chart.xlsx
Ignored: data/Chicago.rds
Ignored: data/CommunityTreemap.jpeg
Ignored: data/Community_Roles.jpeg
Ignored: data/ELL.zip
Ignored: data/SeriesReport-20220414171148_6c3b18.xlsx
Ignored: data/Weekly_Chicago_IL_Regular_Reformulated_Retail_Gasoline_Prices.csv
Ignored: data/YammerDigitalDataScienceMembership.xlsx
Ignored: data/YammerMemberPage.rds
Ignored: data/YammerMembers.rds
Ignored: data/df.rds
Ignored: data/fit_cohesion.rds
Ignored: data/fit_grammar.rds
Ignored: data/fit_phraseology.rds
Ignored: data/fit_syntax.rds
Ignored: data/fit_vocabulary.rds
Ignored: data/grainstocks.rds
Ignored: data/hike_data.rds
Ignored: data/lm_res.rds
Ignored: data/raw_weather.RData
Ignored: data/sample_submission.csv
Ignored: data/submission.csv
Ignored: data/test.csv
Ignored: data/train.csv
Ignored: data/us_states.rds
Ignored: data/us_states_hexgrid.geojson
Ignored: data/weatherstats_toronto_daily.csv
Untracked files:
Untracked: analysis/2022_09_01_kaggle_tabular_playground.qmd
Untracked: code/YammerReach.R
Untracked: code/autokeras.R
Untracked: code/chicago.R
Untracked: code/glmnet_test.R
Untracked: code/googleCompute.R
Untracked: code/work list batch targets.R
Untracked: environment.yml
Untracked: report.html
Unstaged changes:
Modified: analysis/2021_01_19_tidy_tuesday.Rmd
Modified: analysis/2021_03_24_tidy_tuesday.Rmd
Deleted: analysis/2021_04_20.Rmd
Deleted: analysis/2022_02_11_tabular_playground.Rmd
Deleted: analysis/2022_04_18.qmd
Modified: analysis/EnglishLanguageLearning.Rmd
Modified: analysis/Survival.Rmd
Modified: analysis/_site.yml
Modified: code/_common.R
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/2022_11_01.Rmd
) and HTML
(docs/2022_11_01.html
) files. If you’ve configured a remote
Git repository (see ?wflow_git_remote
), click on the
hyperlinks in the table below to view the files as they were in that
past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 7d843f4 | opus1993 | 2022-11-02 | fixed the title |
html | 29388b7 | opus1993 | 2022-11-02 | Build site. |
Rmd | d1b6cde | opus1993 | 2022-11-02 | with my tweet |
Rmd | 788e5d8 | opus1993 | 2022-11-02 | render to html |
html | eae0c10 | opus1993 | 2022-11-02 | Build site. |
Rmd | ede7222 | opus1993 | 2022-11-02 | initial commit |
tweetrmd::tweet_embed('https://twitter.com/thomas_mock/status/1587245920604897284')
The @R4DScommunity welcomes you to week 44 of #TidyTuesday! We're exploring @tanya_shapiro 's Horror Movies!!
— Tom Mock ❤️ @posit_pbc (@thomas_mock) November 1, 2022
📂 https://t.co/sElb4fcv3u
📰 https://t.co/7J0OnYJMCj#r4ds #tidyverse #rstats #dataviz pic.twitter.com/NPqSaw5Bdo
Let’s give this color pallette a try, along with the Google Creepster font.
suppressPackageStartupMessages({
library(tidyverse)
library(rtweet)
library(lubridate)
library(ggdist)
library(ggimage)
})
source(here::here("code","_common.R"))
sysfonts::font_add_google("Creepster", "creepster")
showtext::showtext_auto()
scales::show_col(paletteer::palettes_d$DresdenColor$foolmoon)
base_url <- "https://www.themoviedb.org/t/p/w1280/"
movies_raw <- tidytuesdayR::tt_load("2022-11-01")$horror_movies |>
mutate(poster = paste0(base_url, poster_path))
--- Compiling #TidyTuesday Information for 2022-11-01 ----
--- There is 1 file available ---
--- Starting Download ---
Downloading file 1 of 1: `horror_movies.csv`
--- Download complete ---
# skimr::skim(movies_raw)
There’s a lot of good material in this dataset. Let’s plot some time series
movies_raw |>
mutate(original_language = fct_lump(original_language,
5,
other_level = "Other"
)) |>
group_by(
release_date = floor_date(release_date,
unit = "year",
),
original_language
) |>
summarise(
sum = sum(revenue, na.rm = TRUE),
.groups = "keep"
) |>
mutate(original_language = fct_reorder(
original_language,
sum, max
)) |>
ggplot(aes(x = release_date, sum, fill = original_language)) +
geom_col(show.legend = FALSE) +
scale_y_continuous(labels = scales::dollar) +
paletteer::scale_fill_paletteer_d("DresdenColor::foolmoon") +
labs(
title = "Global Annual Horror Movie Box Office Revenue",
subtitle = "A growing genre, in <span style='color:#532026'>English,</span> <span style='color:#BA141E'>German,</span> <span style='color:#E2E3E7'>Spanish,</span> <span style='color:#61829C'>Japanese,</span> <span style='color:#354C6A'>Portuguese,</span> <span style='color:#050505'>and Other</span> languages<br><br>",
x = NULL, y = NULL, fill = "Language",
caption = "Plot: @jim_gruman Data: The Movie Database via github.com/tashapiro/horror-movies"
) +
theme(
panel.background = element_rect(fill = "gray10"),
legend.text = element_text(color = "gray80"),
plot.title = element_text(
color = "gray80",
size = 40,
family = "creepster"
),
plot.subtitle = ggtext::element_markdown(
color = "gray80",
size = 25
),
plot.caption = element_text(color = "gray80"),
axis.text = element_text(color = "gray80"),
panel.grid = element_line(color = "gray5"),
plot.background = element_rect(fill = "gray10")
)
movies_raw |>
filter(budget > 1e6) |>
mutate(
image = case_when(
budget > 100000000 ~ poster,
release_date < as.Date("1960-01-01") &
budget > 10000000 ~ poster,
TRUE ~ NA_character_
),
profitable = if_else(
revenue > budget,
TRUE, FALSE
)
) |>
ggplot(aes(release_date, budget / 1e6)) +
geom_point(aes(color = profitable),
show.legend = FALSE,
size = 2,
shape = 21
) +
geom_image(aes(
x = release_date + years(3),
image = image
)) +
geom_text(
data = count(movies_raw, release_date = floor_date(release_date, unit = "year")),
aes(y = if_else(year(release_date) %% 2 == 0,
-2, -7
), label = n),
color = "gray80"
) +
scale_y_continuous(
labels = scales::dollar,
position = "right"
) +
scale_x_date(expand = expansion(mult = c(0, 0))) +
scale_color_manual(values = c(
paletteer::palettes_d$DresdenColor$foolmoon[[5]],
paletteer::palettes_d$DresdenColor$foolmoon[[2]]
)) +
labs(
title = "Horror Movie Budgets",
subtitle = "Several massive productions since the 1980s. <span style='color:#354C6A'>Revenue > Budget</span> and <span style='color:#BA141E'>Revenue < Budget</span>",
x = NULL, y = NULL, fill = "Language",
caption = "Numbers are the annual counts of releases with budgets over $1M by year. Budgets in Millions $US. Plot: @jim_gruman Data: The Movie Database via github.com/tashapiro/horror-movies"
) +
theme(
panel.background = element_rect(fill = "gray7"),
plot.title = element_text(
color = "#532026",
size = 80,
vjust = -50,
hjust = 0.1,
family = "creepster"
),
plot.subtitle = ggtext::element_markdown(
color = "gray80",
size = 20
),
plot.title.position = "panel",
plot.caption = element_text(color = "gray80"),
axis.ticks = element_blank(),
axis.ticks.length = unit(c(0, 0, 0, 0), "cm"),
axis.text = element_text(
color = "gray80",
size = 20
),
axis.line = element_blank(),
panel.grid = element_line(color = "gray5"),
plot.background = element_rect(
fill = "gray7",
color = "gray7"
),
plot.margin = unit(c(0, 0.2, 0.1, 0), "cm"),
)
ggsave(here::here("data", "2022_11_01.png"),
width = 6, height = 5, dpi = 300, bg = "black",
device = "png"
)
post_tweet(
status = "#TidyTuesday #DataViz this week on Horror Movie Budgets. Credit to @tanya_shapiro for the dataset. #rstats #r4ds",
media = here::here("data", "2022_11_01.png"),
token = NULL,
in_reply_to_status_id = NULL,
destroy_id = NULL,
retweet_id = NULL,
auto_populate_reply_metadata = FALSE,
media_alt_text = "The Horror Movie Budgets by Year in points, with movie posters for the largest",
lat = NULL,
long = NULL,
display_coordinates = FALSE
)
tweetrmd::tweet_embed("https://twitter.com/jim_gruman/status/1587942905951420422")
#TidyTuesday #DataViz this week on Horror Movie Budgets. Credit to @tanya_shapiro for the dataset. #rstats #r4ds pic.twitter.com/E5yllcDwU5
— 🧢📚🚵♂️⚙📈☕ (@jim_gruman) November 2, 2022
sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggimage_0.3.1 ggdist_3.2.0 lubridate_1.8.0 rtweet_1.0.2
[5] forcats_0.5.2 stringr_1.4.1 dplyr_1.0.10 purrr_0.3.5
[9] readr_2.1.3 tidyr_1.2.1 tibble_3.1.8 ggplot2_3.3.6
[13] tidyverse_1.3.2 workflowr_1.7.0
loaded via a namespace (and not attached):
[1] readxl_1.4.1 backports_1.4.1 systemfonts_1.0.4
[4] workflows_1.1.0 selectr_0.4-2 tidytuesdayR_1.0.2
[7] splines_4.2.2 listenv_0.8.0 usethis_2.1.6
[10] digest_0.6.29 foreach_1.5.2 yulab.utils_0.0.5
[13] htmltools_0.5.3 yardstick_1.1.0 viridis_0.6.2
[16] magick_2.7.3 parsnip_1.0.2.9001 fansi_1.0.3
[19] magrittr_2.0.3 memoise_2.0.1 tune_1.0.1
[22] paletteer_1.5.0 googlesheets4_1.0.1 tzdb_0.3.0
[25] recipes_1.0.2 globals_0.16.1 modelr_0.1.9
[28] gower_1.0.0 R.utils_2.12.0 vroom_1.6.0
[31] sysfonts_0.8.8 hardhat_1.2.0 rsample_1.1.0
[34] dials_1.0.0 colorspace_2.0-3 rvest_1.0.3
[37] textshaping_0.3.6 haven_2.5.1 xfun_0.33
[40] prismatic_1.1.1 callr_3.7.2 crayon_1.5.2
[43] jsonlite_1.8.3 survival_3.4-0 iterators_1.0.14
[46] glue_1.6.2 gtable_0.3.1 gargle_1.2.1
[49] ipred_0.9-13 distributional_0.3.1 R.cache_0.16.0
[52] tweetrmd_0.0.9 future.apply_1.9.1 scales_1.2.1
[55] infer_1.0.3 DBI_1.1.3 Rcpp_1.0.9
[58] showtextdb_3.0 gridtext_0.1.5 viridisLite_0.4.1
[61] gridGraphics_0.5-1 bit_4.0.4 GPfit_1.0-8
[64] lava_1.7.0 prodlim_2019.11.13 httr_1.4.4
[67] ellipsis_0.3.2 R.methodsS3_1.8.2 pkgconfig_2.0.3
[70] farver_2.1.1 nnet_7.3-18 sass_0.4.2
[73] dbplyr_2.2.1 utf8_1.2.2 here_1.0.1
[76] labeling_0.4.2 ggplotify_0.1.0 tidyselect_1.2.0
[79] rlang_1.0.6 DiceDesign_1.9 later_1.3.0
[82] munsell_0.5.0 cellranger_1.1.0 tools_4.2.2
[85] cachem_1.0.6 cli_3.4.0 generics_0.1.3
[88] broom_1.0.1 evaluate_0.17 fastmap_1.1.0
[91] ragg_1.2.4 yaml_2.3.5 rematch2_2.1.2
[94] bit64_4.0.5 processx_3.7.0 knitr_1.40
[97] fs_1.5.2 workflowsets_1.0.0 showtext_0.9-5
[100] future_1.28.0 whisker_0.4 R.oo_1.25.0
[103] xml2_1.3.3 compiler_4.2.2 rstudioapi_0.14
[106] curl_4.3.3 reprex_2.0.2 lhs_1.1.5
[109] bslib_0.4.1 stringi_1.7.8 highr_0.9
[112] ps_1.7.1 lattice_0.20-45 Matrix_1.5-1
[115] markdown_1.2 styler_1.8.0 conflicted_1.1.0
[118] vctrs_0.5.0 tidymodels_1.0.0 pillar_1.8.1
[121] lifecycle_1.0.3 furrr_0.3.1 jquerylib_0.1.4
[124] httpuv_1.6.6 R6_2.5.1 promises_1.2.0.1
[127] gridExtra_2.3 parallelly_1.32.1 codetools_0.2-18
[130] MASS_7.3-58.1 assertthat_0.2.1 rprojroot_2.0.3
[133] withr_2.5.0 ggtext_0.1.2 parallel_4.2.2
[136] hms_1.1.2 grid_4.2.2 rpart_4.1.19
[139] ggfun_0.0.7 timeDate_4021.106 class_7.3-20
[142] rmarkdown_2.17 googledrive_2.0.0 git2r_0.30.1
[145] getPass_0.2-2