title: R - How to add the sum of a specific occurrence in one column to another column
body: <p>Using R.</p>
  
  <p>This is a small subset of my dataset, simplified to only show relevant columns. The data is taken from Capital Bikeshare. The Start.Date column below has exact rental times for a bike.</p>
  
  <pre><code>Start.date              Member.type
  2018-11-01 00:00:45     Member
  2018-11-01 00:00:52     Casual
  2018-11-01 00:01:46     Member
  2018-11-01 01:00:02     Casual
  2018-11-01 01:03:36     Member
  </code></pre>
  
  <p>What I'm trying to do is group all of the data by date, hour of day, number of each member type, and total number of member types (casual+member) for any given hour of any given day. So, in the end, I'll just have "Day - Hour - Number of Rentals per member type" so I can predict trends for hour of the day,</p>
  
  <p>Here is my relevant code</p>
  
  <pre><code>library(dplyr)
  bikeData &lt;- read.csv("2011data.csv")
  
  bikeData &lt;- bikeData %&gt;%
    mutate(Hour = format(strptime(
      bikeData$Start.date, "%Y-%m-%d %H:%M:%S"), "%m-%d %H")) %&gt;%
    mutate(day = wday(Start.date, label=TRUE)) 
  
  groupData &lt;- bikeData %&gt;%
    mutate(Start.date = ymd_hms(Start.date)) %&gt;%
    count(date1 = as.Date(Start.date), Hour1 = hour(Start.date),
          member=(Member.type)) %&gt;%
    group_by(date1, Hour1) %&gt;%
    arrange(date1, Hour1) %&gt;%
    summarise(total=sum(n))
  </code></pre>
  
  <p>What this gives me is the following new dataset, groupData</p>
  
  <pre><code>date1          Hour1     total 
  2018-11-01         0        82
  2018-11-01         1        43 
  2018-11-01         2        17 
  2018-11-01         3         4   
  2018-11-02         0         5 
  2018-11-02         1        24   
  </code></pre>
  
  <p>So I was able to do the total number of Member+Casual for all 24 hours of each day of my dataset, but how do I get another two columns that show the total number of casual and another that shows the total number of member?  Thanks!</p>
  
  <p>Desired below:</p>
  
  <pre><code>date1          Hour1     total     Casual     Member
  2018-11-01         0        82        40          42
  2018-11-01         1        43        20          23
  2018-11-01         2        17        10           7
  2018-11-01         3         4         1           3
  2018-11-02         0         5         1           4
  2018-11-02         1        24        20           4
  </code></pre>