So I am following an example in the "Data Visualization - A practical introduction by Kieran Healy" where I have to create a US map to visualize the data of the 2016 US election. I am just redoing what are shown in the book and not creating anything new yet. However, there is a particular problem about the theme_map() function where Rstudio keeps saying that it could not find this function. I am running the latest R version for Windows (4.0.3) and have even tried install/reinstall "ggplot2", "mapproj", etc., yet this problem still persists. Does anyone know why?
p0 <- ggplot(data = us_states_elec,
mapping = aes(x = long, y = lat,
group = group, fill = party))
p1 <- p0 + geom_polygon(color = "gray90", size = 0.1) +
coord_map(projection = "albers", lat0 = 39, lat1 = 45)
p2 <- p1 + scale_fill_manual(values = party_colors) +
labs(title = "Election Results 2016", fill = NULL)
p2 + theme_map()