title: making a presence/absence timeline in r for multiple y objects
body: <p>This is my first time using SO and I am an R newbie; sorry if this is a little basic or unclear (or if the question has already been answered... I'm struggling with coding and need pretty specific answers to understand)</p>
  
  <p>I would like to produce an image similar to this one:</p>
  
  <p><img src="https://i.stack.imgur.com/4zbWj.png" alt="here">    </p>
  
  <p>Except I would like it to be oriented horizontally on a timeline, and with two vertical lines drawn from the x-axis. </p>
  
  <p>I can set the data up simply, and there are only two variables - date and Tag.</p>
  
  <pre><code>    Tag Date
  1   1   1/1/2014
  2   3   1/1/2014
  3   1   1/3/2014
  4   2   1/3/2014
  5   3   1/3/2014
  6   5   1/3/2014
  7   2   1/4/2015
  8   3   1/4/2015
  9   4   1/4/2015
  10  6   1/4/2015
  11  1   1/5/2014
  12  2   1/5/2014
  13  4   1/5/2014
  14  6   1/5/2014
  15  1   1/6/2014
  16  2   1/6/2014
  17  3   1/6/2014
  18  4   1/6/2014
  19  6   1/6/2014
  20  2   1/7/2014
  21  4   1/7/2014
  22  1   1/8/2014
  23  2   1/8/2014
  24  6   1/8/2014
  </code></pre>
  
  <p>Here is a drawn image of what I would like to accomplish:</p>
  
  <p><img src="https://i.stack.imgur.com/A73Pf.jpg" alt="enter image description here"></p>
  
  <p>To recap -  I want to take this data, which shows the dates of detection of animals at a certain location and plot it on a timeline with two vertical lines on two dates.  If an animal (say, tag 2) was detected on consecutive days, I would like to connect those dates with a line, and if the detection happened without detection on consecutive days, a simple dot will suffice.  I imagine the y-axis is stacked with each individual Tag, and the x-axis is a date scale - for each date, if A tag ID was detected, then its corresponding x,y coordinate will be marked; if a tag was not detected on a certain date; the corresponding x,y coordinate will remain blank.</p>
  
  <p><strong>Here's a follow-up question:</strong></p>
  
  <p>I want to add a shaded background to some of the dates.  I figured that I can use this using <code>geom_rect</code>, but i keep getting the following error:
  <code>Error: Invalid input: date_trans works with objects of class Date only</code></p>
  
  <p>using the code you wrote, this is what I have added to receive the error:</p>
  
  <p><code>geom_rect(aes(xmin=16075, xmax=16078, ymin=-Inf, ymax=Inf), fill="red", alpha=0.25)</code></p>
  
  <p>this code will plot, but is not transparent, and so becomes fairly useless:
  <code>geom_rect(xmin=16075, xmax=16078, ymin=-Inf, ymax=Inf)</code></p>