gravatar

dEcodeR

LeoCB

Recently Published

Categories removed
Canada and Repatriated Travellers category removed. # Create bar chart of total COVID-19 cases by province # Removes both 'Canada' and 'Repatriated travellers' from the plot # You can also add other exclusions inside the filter() if needed plot_df <- covid_features |> filter(!province %in% c("Canada", "Repatriated travellers")) |> # Removes both unwanted categories group_by(province) |> summarise(total_cases = max(total_cases, na.rm = TRUE), .groups = "drop") |> arrange(desc(total_cases)) ggplot(plot_df, aes(x = reorder(province, -total_cases), y = total_cases, fill = province)) + geom_col(width = 0.7, show.legend = TRUE) + scale_y_continuous(labels = label_number(scale = 1e-6, suffix = " M")) + scale_fill_viridis_d(option = "turbo") + # Options: 'plasma', 'magma', 'inferno', 'cividis' labs( title = "Total COVID-19 Cases by Province in Canada", subtitle = "Cumulative totals (2020–2024)", x = "Province", y = "Total Reported Cases (Millions)", fill = "Province" ) + theme( axis.text.x = element_text(angle = 35, hjust = 1), plot.title = element_text(face = "bold", size = 16, hjust = 0.5), plot.subtitle = element_text(hjust = 0.5) )
Covid 19 Dataset Test Assignment
Instructions on assignment completion: Step by step with #comments.