#Omit missing values
na.omit(kiva_loans)%>%
#Group by country label
group_by(country_code)%>%
dplyr::count(country_code, sort = TRUE)%>%
ungroup() %>% # add thia to ungroup
top_n(20)%>%
ggplot(aes(reorder(x=country_code,n),y=n))+
geom_col(position="dodge",
color = "black",
fill="purple")+
coord_flip()
只是
ungroup()
在你打电话之前
top_n
从
?top_n
您可以阅读以下内容:
n要返回的行数。如果x被分组,这是每个组的行数。如果有关联,将包含超过n行。