joachim-gassen / tidycovid19

{tidycovid19}: An R Package to Download, Tidy and Visualize Covid-19 Related Data
https://joachim-gassen.github.io/tidycovid19/
Other
146 stars 44 forks source link

In plot_covid19_spread , set per_capita_x_axis to TRUE when per_capita=TRUE #10

Closed AndreaPi closed 4 years ago

AndreaPi commented 4 years ago

When comparing per capita plots among countries, one should not set the origin of the x-axis to the day the same number of cases/deaths was reached (i.e., use absolute values to define the 'event date' cutoff set by min_cases), but to the day the same fraction of cases/deaths was reached. This is clearly explained by renown epidemiologists and medical researchers here:

https://twitter.com/CT_Bergstrom/status/1249491368507932672?s=20

here:

https://twitter.com/EricTopol/status/1249771636712067073?s=20

and here:

https://twitter.com/CT_Bergstrom/status/1249930299258990592?s=20

Now, in your excellent function plot_covid19_spread, setting per_capita_x_axis = TRUE whenever per_capita = TRUE is sufficient to get this kind of plot, according to plot_covid19_spread help:

per_capita_x_axis | If TRUE, the 'event date' cutoff for the x axis set by min_cases is evaluated based on by capita measures (cases per 100,000 inhabitants). Only feasible when per_capita is TRUE. Defaults to FALSE.

However, currently the default per_capita_x_axis is FALSE, irrespective of the value of per_capita. In order to promote plotting best practices, I suggest to set the default value of per_capita_x_axis so that it follows the value of per_capita. In other words, I suggest setting the following default value:

.
.
.
  per_capita = FALSE,
  per_capita_x_axis = ifelse(per_capita, TRUE, FALSE),
.
.
.
joachim-gassen commented 4 years ago

I agree that this would be a better default. The problem is that I introduced the per_capita_x_axis later and thus, changing its default might break plots that rely on the old default behavior... I'll think about it. Maybe a warning?

AndreaPi commented 4 years ago

Personally, I wouldn't be afraid of changing defaults in a package which is still at version 0.0.0.9000 🙂 If you highlight the change in the release notes and/or in plot_covid19_spread help, it should be fine. After all, it's just a default: if people purposely want to make big countries look better and/or small countries look worse 🙃 they can always pass per_capita = TRUE & per_capita_x_axis = FALSE.

But if you prefer not to touch defaults, a warning would be great!

joachim-gassen commented 4 years ago

You know what? You are right.