title: Pivot Table in R, Summarizing Based on Most Frequently Appearing Value in Column of Character Values
body: <p>I am attempting to create a pivot table in R.</p>
  
  <p>I have code like so:</p>
  
  <pre><code> Grps &lt;- c("MoveNumber","TripOrderNumber","BillToParentAssignment","AccountOwner","MonthYear",
             "Shipper_Latitude","Shipper_Longitude","Shipper.CompanyAddress",
            "ShipCity_New","ShipperState","ShipperZip","ShipCntry1","ShipCntry2",
             "Consignee_Latitude","Consignee_Longitude","Consignee.CompanyAddress",
             "ConsCity_New","ConsigneeState","ConsigneeZip","ConsCntry1","ConsCntry2",
             "InvoiceCurrency","CommodityDesc","One.TrailerAxles","Two.TrailerAxles","Trailer_tsID",
             "TariffNumber","DateBilled","IndexEndDate")
  
  Start2 &lt;- Start2 %&gt;% group_by_at(Grps) %&gt;%
     summarise(
       TM = sum(Travel.Miles),
       LM = sum(LoadedMiles),
       EM = sum(EmptyMiles),
       LH = sum(LinehaulRev),
       FSC = sum(FuelRev),
       Terminal = mode(Terminal),
       AccessRev = sum(AccessorialRev),
       StopCount = sum(StopCount),
       Pickups = sum(Pickups),
       Deliveries = sum(Delivery)
     )
  </code></pre>
  
  <p>The pivot works fine except for Terminal.  What I am looking for is the most frequently appearing value in a column of characters.  Instead, I get "character" in every row.</p>
  
  <p>Would be grateful for a solution.</p>