R - dplyr Summarize and Retain Other Columns
<p>I am grouping data and then summarizing it, but would also like to retain another column. I do not need to do any evaluations of that column's content as it will always be the same as the group_by column. I can add it to the group_by statement but that does not seem "right". I want to retain <code>State.Full.Name</code> after grouping by <code>State</code>. Thanks</p>

<pre><code>TDAAtest &lt;- data.frame(State=sample(state.abb,1000,replace=TRUE))
TDAAtest$State.Full.Name &lt;- state.name[match(TDAAtest$State,state.abb)]


TDAA.states &lt;- TDAAtest %&gt;%
  filter(!is.na(State)) %&gt;%
  group_by(State) %&gt;%
  summarize(n=n()) %&gt;%
  ungroup() %&gt;%
  arrange(State)
</code></pre>