title: Bucket 2 columns of data (character class) into a newly created column in R
body: <p>I will like to bin data from Column A (rideable_type) and Column B (member_casual) into column C (a newly created column called type_of_users). For instance, if Column A is electric_bike and Column B is member, I will like to show, in Column C, as member_electric. I have googled for a suitable code but nothing seems to work. Seeking anyone who can help me on this issue.  Below are some details which may be vital:</p>
  <ul>
  <li>Dataset name: df1</li>
  <li>Column A (rideable_type) and Column B (member_casual): Given dataset. Both class and mode are “Characters”.</li>
  <li>Column C (type_of_users): End result that I wish to achieve. Both class and mode are to be &quot;Character”.</li>
  </ul>
  <p><a href="https://i.stack.imgur.com/YQtYL.jpg" rel="nofollow noreferrer">Dataset screenshot</a></p>
  <p>I tried with the below code but it duplicate itself on the right hand side of the dataset.</p>
  <pre><code>df1$type_of_users %&gt;% 
    mutate(case_when
           (df1$member_casual =='casual' &amp; df1$rideable_type =='docked_bike' ~ 'casual_docked',
             df1$member_casual =='member' &amp; df1$rideable_type =='docked_bike' ~ 'member_docked',
             df1$member_casual =='casual' &amp; df1$rideable_type =='electric_bike' ~ 'casual_electric',
             df1$member_casual =='member' &amp; df1$rideable_type =='electric_bike' ~ 'member_electric'))
  </code></pre>
  <p>If this isn't the suitable one, what other kinds will be useful? If function? Stack function?</p>
  <p>Thanks.</p>