I\'m trying to make a graph to depict a population over a period of time. However, the dates are not in chronological order. In the imported CSV the dates are all correct an
Convert to a Date class:
sumc$Date = as.Date(sumc$Date, format = "%m/%d%/Y")
Then your same plotting code will work just fine.
See ?as.Date or strptime for details about the conversion or the format argument.
If your dates are imported in the correct order in the data frame, use
sumc$Date <- factor(sumc$Date, ordered = T)
prior to plotting. This will make them as ordered factors based on the order they appear, and ggplot will understand that it has to keep them that way.
Edit: if the dates are not ordered, you can order them and save to a vector:
dates <- unique(sort(sumc$Date))
sumc$Date <- factor(sumc$Date, labels = dates, ordered = T)