I have been trying to plot an animation which will show the number of refugees over the years. The code runs without issues, but it won't show the output animation. Could someone please tell me what I am doing wrong?
animation <- refugees_clean %>%
ggplot( aes(x=year, y=number, group= origin_region, color=origin_region)) +
geom_line() +
geom_point() +
scale_color_discrete() +
ggtitle("Refugee numbers over the years") +
theme_dark() +
ylab("Number of refugees") +
transition_reveal(year)
animation
dput(head(refugees_clean))
structure(list(origin_country = c("Afghanistan", "Angola", "Armenia",
"Azerbaijan", "Belarus", "Bhutan"), iso3 = c("AFG", "AGO", "ARM",
"AZE", "BLR", "BTN"), origin_region = c("South Asia", "Sub-Saharan
Africa",
"Europe & Central Asia", "Europe & Central Asia", "Europe & Central
Asia",
"South Asia"), origin_continent = c("Asia", "Africa", "Asia",
"Asia", "Europe", "Asia"), year = c(2006, 2006, 2006, 2006, 2006,
2006), number = c(651, 13, 87, 77, 350, 3), year_date =
structure(c(13149,
13149, 13149, 13149, 13149, 13149), class = "Date")), row.names =
c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))