title: Trouble converting list into factor in R
body: <p>I am having problems creating a boxplot of my data, because one of my variables is in the form of a list. 
  I am trying to create a boxplot:</p>
  
  <pre><code>boxplot(dist~species, data=out)
  </code></pre>
  
  <p>and received the following error:</p>
  
  <pre><code>Error in model.frame.default(formula = dist ~ species, data = out) : 
  invalid type (list) for variable 'species'
  </code></pre>
  
  <p>I have been unsuccessful in forcing 'species' into the form of a factor:</p>
  
  <pre><code>out[species]&lt;- as.factor(out[[out$species]])
  </code></pre>
  
  <p>and receive the following error:</p>
  
  <pre><code>Error in .subset2(x, i, exact = exact) : invalid subscript type 'list'
  </code></pre>
  
  <p>How can I convert my 'species' column into a factor which I can then use to create a boxplot? Thanks.</p>
  
  <p>EDIT:</p>
  
  <pre><code>str(out)
  'data.frame':   4570 obs. of  6 variables:
   $ GridRef         : chr  "NT73" "NT80" "NT85" "NT86" ...
   $ pred            : num  154 71 81 85 73 99 113 157 92 85 ...
   $ pred_bin        : int  0 0 0 0 0 0 0 0 0 0 ...
   $ dist            : num  20000 10000 9842 14144 22361 ...
   $ years_since_1990: chr  "21" "16" "21" "20" ...
   $ species         :List of 4570
  ..$ : chr "C.splendens"
  ..$ : chr "C.splendens"
  ..$ : chr "C.splendens"
  .. [list output truncated]
  </code></pre>