title: Create a new vector with same length as another and based on values of a third
body: <p>Existing data frame <code>ww</code> has two vectors, <code>X</code> and <code>Y</code>, both characters (this probably does not matter, but I just declare it).</p>
  
  <p>Now I need: create a third vector <code>ZZ</code> in the same data frame <code>ww</code>, that is :</p>
  
  <ol>
  <li><p>as long as <code>X</code> (I think i can use <code>length.out=length(x)</code>, but not sure how to structure it)</p></li>
  <li><p><code>Y</code> has four distinctive values (<code>"M1"</code>, <code>"M2"</code>, <code>"M3"</code>, <code>"M4"</code>). If <code>Y == "M1"</code> or <code>Y == "M4"</code> then <code>ZZ ="C"</code>. Else if <code>Y == "M2"</code> or <code>Y == "M3"</code> then <code>ZZ = "V"</code>. </p></li>
  </ol>