Last updated: 2022-11-02
Checks: 6 1
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.
The R Markdown file has unstaged changes. To know which version of
the R Markdown file created these results, you’ll want to first commit
it to the Git repo. If you’re still working on the analysis, you can
ignore this warning. When you’re finished, you can run
wflow_publish
to commit the R Markdown file and build the
HTML.
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 ede7222. 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: analysis/figure/
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/2022_11_01.Rmd
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 | ede7222 | opus1993 | 2022-11-02 | initial commit |
blogdown::shortcode('tweet', '1587245920604897284')
{{% tweet "1587245920604897284" %}}
library(tidyverse, quietly = TRUE)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.3.6 ✔ purrr 0.3.5
✔ tibble 3.1.8 ✔ dplyr 1.0.10
✔ tidyr 1.2.1 ✔ stringr 1.4.1
✔ readr 2.1.3 ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
library(rtweet)
Attaching package: 'rtweet'
The following object is masked from 'package:purrr':
flatten
library(lubridate)
Attaching package: 'lubridate'
The following objects are masked from 'package:base':
date, intersect, setdiff, union
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)
Name | movies_raw |
Number of rows | 32540 |
Number of columns | 21 |
_______________________ | |
Column type frequency: | |
character | 11 |
Date | 1 |
logical | 1 |
numeric | 8 |
________________________ | |
Group variables | None |
Variable type: character
skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
---|---|---|---|---|---|---|---|
original_title | 0 | 1.00 | 1 | 191 | 0 | 30296 | 0 |
title | 0 | 1.00 | 1 | 191 | 0 | 29563 | 0 |
original_language | 0 | 1.00 | 2 | 2 | 0 | 97 | 0 |
overview | 1286 | 0.96 | 1 | 1000 | 0 | 31020 | 0 |
tagline | 19833 | 0.39 | 1 | 237 | 0 | 12515 | 2 |
poster_path | 4474 | 0.86 | 30 | 32 | 0 | 28048 | 0 |
status | 0 | 1.00 | 7 | 15 | 0 | 4 | 0 |
backdrop_path | 18995 | 0.42 | 29 | 32 | 0 | 13536 | 0 |
genre_names | 0 | 1.00 | 6 | 144 | 0 | 772 | 0 |
collection_name | 30234 | 0.07 | 4 | 56 | 0 | 815 | 0 |
poster | 0 | 1.00 | 39 | 69 | 0 | 28049 | 0 |
Variable type: Date
skim_variable | n_missing | complete_rate | min | max | median | n_unique |
---|---|---|---|---|---|---|
release_date | 0 | 1 | 1950-01-01 | 2022-12-31 | 2012-12-09 | 10999 |
Variable type: logical
skim_variable | n_missing | complete_rate | mean | count |
---|---|---|---|---|
adult | 0 | 1 | 0 | FAL: 32540 |
Variable type: numeric
skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
---|---|---|---|---|---|---|---|---|---|---|
id | 0 | 1.00 | 445910.83 | 305744.67 | 17 | 146494.8 | 426521.00 | 707534.00 | 1033095.00 | ▇▆▆▅▅ |
popularity | 0 | 1.00 | 4.01 | 37.51 | 0 | 0.6 | 0.84 | 2.24 | 5088.58 | ▇▁▁▁▁ |
vote_count | 0 | 1.00 | 62.69 | 420.89 | 0 | 0.0 | 2.00 | 11.00 | 16900.00 | ▇▁▁▁▁ |
vote_average | 0 | 1.00 | 3.34 | 2.88 | 0 | 0.0 | 4.00 | 5.70 | 10.00 | ▇▂▆▃▁ |
budget | 0 | 1.00 | 543126.59 | 4542667.81 | 0 | 0.0 | 0.00 | 0.00 | 200000000.00 | ▇▁▁▁▁ |
revenue | 0 | 1.00 | 1349746.73 | 14430479.15 | 0 | 0.0 | 0.00 | 0.00 | 701842551.00 | ▇▁▁▁▁ |
runtime | 0 | 1.00 | 62.14 | 41.00 | 0 | 14.0 | 80.00 | 91.00 | 683.00 | ▇▁▁▁▁ |
collection | 30234 | 0.07 | 481534.88 | 324498.16 | 656 | 155421.0 | 471259.00 | 759067.25 | 1033032.00 | ▇▅▅▅▅ |
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 = 60,
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, -6
), 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 = "There have been more and more 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 = 100,
vjust = -50,
hjust = 0.1,
family = "creepster"
),
plot.subtitle = ggtext::element_markdown(
color = "gray80",
size = 20
),
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 on Horror Movie Budgets. Special thanks 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
)
blogdown::shortcode("tweet", "1587245920604897284")
{{% tweet "1587245920604897284" %}}
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 repr_1.1.4
[7] tidytuesdayR_1.0.2 splines_4.2.2 listenv_0.8.0
[10] usethis_2.1.6 digest_0.6.29 foreach_1.5.2
[13] yulab.utils_0.0.5 htmltools_0.5.3 yardstick_1.1.0
[16] viridis_0.6.2 magick_2.7.3 parsnip_1.0.2.9001
[19] fansi_1.0.3 magrittr_2.0.3 memoise_2.0.1
[22] tune_1.0.1 paletteer_1.5.0 googlesheets4_1.0.1
[25] tzdb_0.3.0 recipes_1.0.2 globals_0.16.1
[28] modelr_0.1.9 gower_1.0.0 R.utils_2.12.0
[31] vroom_1.6.0 sysfonts_0.8.8 hardhat_1.2.0
[34] rsample_1.1.0 dials_1.0.0 colorspace_2.0-3
[37] skimr_2.1.4 rvest_1.0.3 textshaping_0.3.6
[40] haven_2.5.1 xfun_0.33 prismatic_1.1.1
[43] callr_3.7.2 crayon_1.5.2 jsonlite_1.8.3
[46] survival_3.4-0 iterators_1.0.14 glue_1.6.2
[49] gtable_0.3.1 gargle_1.2.1 ipred_0.9-13
[52] distributional_0.3.1 R.cache_0.16.0 future.apply_1.9.1
[55] scales_1.2.1 infer_1.0.3 DBI_1.1.3
[58] showtextdb_3.0 Rcpp_1.0.9 gridtext_0.1.5
[61] viridisLite_0.4.1 gridGraphics_0.5-1 bit_4.0.4
[64] GPfit_1.0-8 lava_1.7.0 prodlim_2019.11.13
[67] httr_1.4.4 ellipsis_0.3.2 R.methodsS3_1.8.2
[70] pkgconfig_2.0.3 farver_2.1.1 nnet_7.3-18
[73] sass_0.4.2 dbplyr_2.2.1 utf8_1.2.2
[76] here_1.0.1 labeling_0.4.2 ggplotify_0.1.0
[79] tidyselect_1.2.0 rlang_1.0.6 DiceDesign_1.9
[82] later_1.3.0 munsell_0.5.0 cellranger_1.1.0
[85] tools_4.2.2 cachem_1.0.6 cli_3.4.0
[88] generics_0.1.3 broom_1.0.1 evaluate_0.17
[91] fastmap_1.1.0 ragg_1.2.4 yaml_2.3.5
[94] rematch2_2.1.2 bit64_4.0.5 processx_3.7.0
[97] knitr_1.40 fs_1.5.2 workflowsets_1.0.0
[100] showtext_0.9-5 future_1.28.0 whisker_0.4
[103] R.oo_1.25.0 xml2_1.3.3 compiler_4.2.2
[106] rstudioapi_0.14 curl_4.3.3 reprex_2.0.2
[109] lhs_1.1.5 bslib_0.4.0 stringi_1.7.8
[112] highr_0.9 ps_1.7.1 blogdown_1.13
[115] lattice_0.20-45 Matrix_1.5-1 markdown_1.2
[118] styler_1.8.0 conflicted_1.1.0 vctrs_0.5.0
[121] tidymodels_1.0.0 pillar_1.8.1 lifecycle_1.0.3
[124] furrr_0.3.1 jquerylib_0.1.4 httpuv_1.6.6
[127] R6_2.5.1 promises_1.2.0.1 gridExtra_2.3
[130] parallelly_1.32.1 codetools_0.2-18 MASS_7.3-58.1
[133] assertthat_0.2.1 rprojroot_2.0.3 withr_2.5.0
[136] ggtext_0.1.2 parallel_4.2.2 hms_1.1.2
[139] grid_4.2.2 rpart_4.1.19 ggfun_0.0.7
[142] timeDate_4021.106 class_7.3-20 rmarkdown_2.17
[145] googledrive_2.0.0 git2r_0.30.1 getPass_0.2-2
[148] base64enc_0.1-3