'Error in reorder(Country_Name, Average_per_capita_growth) : object 'Country_Name' not found >
I am using the following code but keep getting an error in reorder: object 'Country_Name' not found >
library(tidyr)
library(readr)
gather(GDP_per_capita, "country", "GDP per capita annual growth", 24:24)
ggplot(GDP_per_capita, aes(reorder(Country_Name, Average_per_capita_growth), Average_per_capita_growth)) +
geom_point(col = "red", size = 3) +
geom_segment(aes(x = country,
xend = country,
y = min(average_per_capita_growth),
yend = max(average_per_capita_growth)),
linetype = "dashed",
size = .1) +
labs(y = "Average per capita growth (%)",
x = "Country Name") +
coord_flip() +
theme_classic(base_family = "Times New Roman", base_size = 13)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
