rceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/factor.html" class="external-link">as.factor</a></span><span class="op">(</span><span class="va">x4</span><span class="op">)</span></span>
<span><span class="co">#&gt; [1] Left   Middle Right  &lt;NA&gt;</span></span>
<span><span class="co">#&gt; Levels: Left Middle Right</span></span>
<span></span>
<span><span class="co"># essentially acting as:</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/factor.html" class="external