compare_countries.R 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. library(readr)
  2. library(ggplot2)
  3. library(dplyr)
  4. library(corrr)
  5. df <- read_delim(file = 'data/preprocessed/DIB_dataset.tsv', delim = '\t')
  6. # What countries have more than 100 confirmed deaths by COVID-19?
  7. df %>%
  8. filter(acc_deaths > 100) %>%
  9. group_by(locality_name) %>%
  10. select(locality_name, acc_cases) %>%
  11. slice(n()) %>%
  12. arrange(-acc_cases) %>% View
  13. # What are the top 10 countries by lethality rate?
  14. df %>%
  15. select(locality_name, lethality_rate_percent) %>%
  16. unique %>%
  17. arrange(-lethality_rate_percent) %>%
  18. slice(1:10) %>%
  19. View
  20. # What's the pearson correlation among the localization categories in Google's
  21. # Community Mobility Reports dataset?
  22. df %>%
  23. select(retail_recreation, grocery_pharmacy, parks, transit_stations,
  24. workplaces, residential) %>%
  25. na.omit() %>%
  26. cor %>% View
  27. # What about number of physicians per 1000 people, lethality and population
  28. # density?
  29. df %>%
  30. select(lethality_rate_percent,
  31. `health_personnel:_physicians_(per_1000_population)_2018`,
  32. population_density_2019) %>%
  33. na.omit() %>%
  34. cor %>% View
Tip!

Press p or to see the previous file or, n or to see the next file