'I keep getting object ‘country_long’ not found

power %>% count(country_long, sort=T) %>% head(10)

capacity <- power %>% 
group_by(country_long, primary_fuel) %>%
summarize(capacity_mw)
    plot(power$capacity_mw,power$country_lon,
     xlab = "Capacity (mw)",
     ylab = "Country",
     main = "Top 10 countries with     Highest Power Production",
     pch = 20,
     col=ifelse(power$primary_fuel == "Biomass","coral1", 
                ifelse(power$primary_fuel == "Coal","cyan4", 
                       ifelse(power$primary_fuel ==  "Gas", "darkgoldenrod2",
                              ifelse(power$primary_fuel == "Geothermal", "yellow",
                                     ifelse(power$primary_fuel == "Hydro", "green",
                                            ifelse(power$primary_fuel == "Nuclear", "black",
                                                   ifelse(power$primary_fuel == "Oil", "darkred",
                                                          ifelse(power$primary_fuel == "Solar", "orange",
                                                                 ifelse(power$primary_fuel == "Waste", "brown",
                                                                         "grey"))))))))))

##legend
legend("bottomright", c("Biomass","Coal", "Gas", "Geothermal", "Hydro", "Nuclear", "Oil", "Solar", "Waste", "Wind"),
       col = c("coral1","cyan4", "darkgoldenrod2", "yellow", "green", "black", "darkred", "orange", "brown", "grey"), pch=20)
r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source