Home > OS >  Can I chronologically order dates as characters in R?
Can I chronologically order dates as characters in R?

Time:03-17

I have data in a .csv. The first column is dates, the second column counts a number of days. I want to plot number of days vs. date. (see enter image description here

CodePudding user response:

openingData %>% 
  mutate(dateOpened = as.Date(dateOpened,"%m/%d/%y")) %>% 
  arrange(dateOpened) %>% 
  mutate(id = factor(row_number(),labels = dateOpened)) %>% 
  ggplot()   
  geom_col(mapping = aes(x = id, y = daysPrior)) 
  labs(x = "Date Opened", y = "Days prior to opening at or above 11.0")
  • Related