Surely im wondering what is the best way to plot the data to make the audieces interested in data visualisation.
For example I have the OECD health data and choose immunisation part.
Cleaning data and wrangling it into left "year" from 2010 to 2022, "country", "% Measles Immunisation", "% Hep B Immunisation", "% DPT Immunisation" on children across the country.
In summary, it has 284 obs and 5 variable. make it 6 variable because I mutate country into factor AND it still has NA value.
Do I need select the data to make more simple? What should I do?
# display some data using world map and ggplot containing the DPT immunisation values
# Load world map with country-level detail
world <- ne_countries(scale = "medium", returnclass = "sf")
world <- world %>%
select(admin, geometry)
# Assuming 'DPT_immunisation' contains the dataset with no NA value, and only include DPT values
output2 <- DPT_immunisation %>%
select(country_fct, year, `% DPT Immunisation of Children`)
# Left join world map data with the DPT immunisation data
plotdata <- inner_join(world, output2, by = c("admin" = "country_fct"))
# save plot data as a file
write.csv(plotdata, "plotdata.csv")
# Creating the ggplot for animation
ggsf <-
ggplot (plotdata) +
geom_sf(aes(fill = `% DPT Immunisation of Children`)) +
geom_sf_text(aes(label = admin), size = 2, color = "black", check_overlap = TRUE) +
scale_fill_viridis_c() +
ggtitle("DPT Immunisation of Children (%) - {closest_state}") +
ggplotly(ggsf)
# Convert ggplot to interactive plotly graph
interactive_plot <- ggplotly(ggsf)
Why cant the ggsf plotly show?? It said no object ggsf and I also tried to used gganimate but it cant show either save as a gif.
Extra question: how to input ~long, ~lat into our dataset OR change from geometry into ~long, ~lat column??
click for: data sources