title: How to use substr() to remove NA in mpg$trans data
body: <p>Turn the variable trans to a factor variable, of which unique values are “auto” and “manu” (Hint: use the function substr() to extract substrings in a character vector before converting to a factor vector)</p>
  <pre><code>unique(mpg$trans)
  mpg$trans &lt;- substr(mpg$trans, 1, 234)
  mpg$trans &lt;- factor(mpg$trans, levels = c(&quot;auto&quot;, &quot;manu&quot;))
  str(mpg)
  </code></pre>
  <p>However, trans still doesn't work.</p>