title: Reorder not working in ggplot with my current data frame
body: <p>I'm currently trying to <a href="https://en.wikipedia.org/wiki/List_of_Justices_of_the_Supreme_Court_of_the_United_States#Timelines" rel="nofollow noreferrer">make my own graphical timeline like the one at the bottom of this page.</a> I scraped the table from that link using the rvest package and cleaned it up. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>library(tidyverse)
  library(rvest)
  library(ggthemes)
  library(lubridate)
  
  URL &lt;- "https://en.wikipedia.org/wiki/List_of_Justices_of_the_Supreme_Court_of_the_United_States"
  
  justices &lt;- URL %&gt;% 
    read_html %&gt;%  
    html_node("table.wikitable") %&gt;% 
    html_table(fill = TRUE) %&gt;% 
    data.frame()
  
  # Removes weird row at bottom of the table
  n &lt;- nrow(justices)
  justices &lt;- justices[1:(n - 1), ]
  
  # Separating the information I want
  justices &lt;- justices %&gt;% 
    separate(Justice.2, into = c("name","year"), sep = "\\(") %&gt;% 
    separate(Tenure, into = c("start", "end"), sep = "\n–") %&gt;% 
    separate(end, into = c("end", "reason"), sep = "\\(") %&gt;% 
    select(name, start, end) 
  
  # Removes wikipedia tags in start column
  justices$start &lt;- gsub('\\[e\\]$|\\[m\\]|\\[j\\]$$','', justices$start)
  
  justices$start &lt;- mdy(justices$start)
  
  # This will replace incumbencies with NA
  justices$end &lt;- mdy(justices$end)
  
  # Incumbent judges are still around! 
  justices[is.na(justices)] &lt;- today()
  
  justices$start = as.Date(justices$start, format = "%m/%d%/Y")
  justices$end = as.Date(justices$end, format = "%m/%d%/Y")
  
  justices %&gt;% 
    ggplot(aes(reorder(x = name, X = start))) +
    geom_segment(aes(xend = name,
                     yend = start,
                     y = end)) +
    coord_flip() + 
    scale_y_date(date_breaks = "20 years", date_labels = "%Y") +
    theme(axis.title = element_blank()) +
    theme_fivethirtyeight() +
    NULL
  </code></pre>
  
  <p>This is the output from ggplot (I'm not worried about aesthetics yet I know it looks terrible!):
  <img src="https://i.stack.imgur.com/hiwBm.png" alt="This is the output from ggplot (I&#39;m not worried about aesthetics yet I know it looks terrible!):"></p>
  
  <p>The goal for this plot is to order the judges chronologically from their start date, so the judge with the oldest start date should be at the bottom while the judge with the most recent should be at the top. As you can see, There are multiple instances where this rule is broken. </p>
  
  <p>Instead of sorting chronologically, it simply lists the judges as the order they appear in the data frame, which is also the order Wikipedia has it in. 
  Therefore, a line segment above another segment should always start further right than the one below it</p>
  
  <p>My understanding of reorder is that it will take the X = start from geom_segment and sort that and list the names in that order. </p>
  
  <p>The only help I could find to this problem is to factor the dates and then order them that way, however I get the error </p>
  
  <blockquote>
    <p>Error: Invalid input: date_trans works with objects of class Date only.</p>
  </blockquote>
  
  <p>Thank you for your help!</p>