title: Why are my rows disappearing in my new variable?
body: <p>I am trying to create a new column from two existing columns. However when I run this code, R wants to fit my variables so they match the number of existing rows. In other words, R removes some rows from the variable I assigned first in order to make room for the rows of the second variable. Is there a simpler way to combine columns so that all rows are included?</p>
  <p>Before making new variable:</p>
  <pre><code>&gt; summary(tdata)
   rumpColor   survivalWithFalcon
   blue :102   killed  :101      
   white:101   survived:102  
  </code></pre>
  <p>Making new variable:</p>
  <pre><code>tdata$newvar[tdata$survivalWithFalcon==c(&quot;killed&quot;)] &lt;- &quot;k&quot;
  tdata$newvar[tdata$survivalWithFalcon==c(&quot;survived&quot;)] &lt;- &quot;s&quot;
  tdata$newvar[tdata$rumpColor==c(&quot;blue&quot;)] &lt;- &quot;b&quot;
  tdata$newvar[tdata$rumpColor==c(&quot;white&quot;)] &lt;- &quot;w&quot;
  tdata$newvar&lt;-as.factor(tdata$newvar)
  </code></pre>
  <p>After making new variable:</p>
  <pre><code>&gt; summary(tdata)
   rumpColor   survivalWithFalcon newvar 
   blue :102   killed  :101       b:102  
   white:101   survived:102       w:101  
  </code></pre>
  <p>But I want &quot;newvar&quot; to have:</p>
  <pre><code>newvar
  k:101
  s:102
  b:102
  w:101
  </code></pre>