title: str_extract_all returns a list but I want a column in a dataframe
body: <p>I'd like to use <code>str_extract_all</code> from the <code>stringr</code> package to extract digits from strings, and I'd like the output as numerics in a column of an existing dataframe. The problem is that the <code>str_extract_all</code> output's a list. </p>
  
  <p><strong>UPDATE</strong>: My overall goal is to use the extracted digits to filter the columns of another dataframe called <code>film_main</code>. <code>film_main</code> is where the data in the originally posted dataframe <code>film</code> comes from.  </p>
  
  <p>So, if a column in <code>film_main</code> has the digits 1 and 0 in the column name, then the only permitted entries in that column are 1s, 0s, and NAs. Any other entry in that column should be set to NA. See below pseudocode and <code>film_main_desired</code>. </p>
  
  <p>Sorry for not being very clear in my original post, I thought less was more but I ended up not doing a very good job presenting my problem.</p>
  
  <pre><code># Load package
  library(stringr)
  
  # Toy dataset
  film_main = data.frame("grey..0..yellow..1.."=c(0, 1, 0, NA, 2), "grey..0..brown..1.."=c(3, 0, 0, NA, 2), "grey..0..blue..1...brown..2.."=c(0, 2, 1, 6, 1), "3grey..0..purple..1...brown..2.."=c(0, 1, 2, 3, NA), "3grey..0..purple..1...brown..2..brown..3.."=c(0, 1, 2, 3, NA))
  
  
  # Extracting digits using stringr::str_extract_all
  film = data.frame(var = names(film_main))
  film$var2 = str_extract_all(film$var, "[:digit:]+")
  
  # Result for string extraction
  class(film$var2)
  "list"    
  
  # Desired result for string extraction 
  class(film$var2)
  "numeric"
  
  # Filtering film_main - PSEUDOCODE 
  lapply(film_main, function(x) ifelse(film_main$x %in% SOME_SORT_OF_A_FILTER_FEATURING_PERMITTED_DIGITS, df_main$x, NA))
  
  
  # OVERALL GOAL 
  film_main_desired= data.frame("grey..0..yellow..1.."=c(0, 1, 0, NA, NA), "grey..0..brown..1.."=c(NA, 0, 0, NA, NA), "grey..0..blue..1...brown..2.."=c(0, 2, 1, NA, 1), "3grey..0..purple..1...brown..2.."=c(0, 1, 2, 3, NA), "3grey..0..purple..1...brown..2..brown..3.."=c(0, 1, 2, 3, NA))
  </code></pre>
  
  <p>Thanks for any help!</p>