I have a data frame with station_name. I have ordered the data frame by station_name frequency. There is some extra debug code in here.
```{r}
df <- filter(df_clean_distances, start_station_name != "NA" )
d <-df %>% select( start_station_name) %>%
group_by(start_station_name) %>%
summarize( freq = n())
head( d$freq )
dput(head(d))
d2 <- d[ order(-d$freq),]
head( d2 )
#plot freq
ggplot(d2, aes( x=start_station_name, y= freq)) +
geom_bar( stat = "identity") +
theme(axis.text.x = element_blank()) +
ylim( c(0,35000))
```
I can see that the data frame is ordered descending, I even added an extra order() to make sure I was getting descending.
```{r}
structure(list(start_station_name = c("Streeter Dr & Grand Ave",
"Clark St & Elm St", "Lake Shore Dr & Monroe St", "Theater on the Lake",
"Lake Shore Dr & North Blvd", "Wells St & Concord Ln"), freq = c(35200L,
32266L, 29748L, 29561L, 26947L, 25053L)), row.names = c(NA, -6L
), class = c("tbl_df", "tbl", "data.frame"))
```
But when I run it through ggplot I get this
How can I tell ggplot to keep the order of descending so that the chart is a smooth left to right descending plot?