title: Parking utilization - R
body: <p>I have entry and exit times of parking spots. How to find out the utilization of parking spots at a given time? </p>
  
  <p>Here is a sample of my data: the sID is parking space number, entry and exit times of actual cars. pID is the user ID</p>
  
  <pre><code>p_id    sID        entrytime                exittime
  40114   25     2013-11-18 15:49:27     2013-11-19 05:00:00
  39173   58     2013-11-18 14:34:22     2013-11-19 05:00:00
  12549   07     2013-11-18 13:55:13     2013-11-19 05:00:00
  39475   48     2013-11-18 13:31:14     2013-11-19 05:00:00
  12549   70     2013-11-18 10:35:56     2013-11-19 05:00:00
  39173   99     2013-11-18 10:15:52     2013-11-19 05:00:00
  12549   99     2013-11-18 10:02:06     2013-11-19 05:00:00
  39909   76     2013-11-18 08:04:38     2013-11-19 05:00:00
  39038   01     2013-11-15 15:47:13     2013-11-16 04:00:00
  39807   91     2013-11-15 14:30:19     2013-11-16 02:30:19
  40629   31     2013-11-19 08:13:42     2013-11-19 20:13:42
  </code></pre>
  
  <p>Ideally, this will be my output, which will consist of hourly (or 30-min) utilization of the parking lot accross the different parking dates. 'No.parksUtilized' is the number of parking spots in use at that specific time. Below table is not real data, just for illustration purpose</p>
  
  <pre><code>        time           No.parksUtilized
  2013-11-15 08:00:00         13
  2013-11-15 09:00:00          5
  2013-11-15 10:00:00          9
  </code></pre>
  
  <p>Thanks!</p>