title: Finding the Matching Characters after Pattern in R DataFrame
body: <p>I am fairly new to string manipulation, and I am stuck on a problem regarding string and character data in an R dataframe. I am attempting to extract numeric values from a long string <strong>after a pattern</strong> and then store the result as a new column in my dataframe. I have a fairly large dataset, and I am attempting to get out some useful information stored in a column called &quot;notes&quot;.</p>
  <p>For instance, the strings I am interested in always follow this pattern (there is nothing significant about the tasks):</p>
  <pre><code>df$notes[1] &lt;- &quot;On 5 June, some people walked down the street in this area. [size=around 5]&quot; 
  df$notes[2] &lt;- &quot;On 6 June, some people rode bikes down the street in this area. [size= nearly 4]&quot; 
  df$notes[3] &lt;- &quot;On 7 June, some people walked into a grocery store in this area. [size= about 100]&quot;
  </code></pre>
  <p>In some columns, we do not get a numeric value, and that is a problem I can deal with after I get a solution to this one. Those rows follow something similar to this:</p>
  <pre><code>df$notes[4] &lt;- &quot;On 10 July, an hundreds of people drank water from this fountain [size=hundreds]&quot;
  df$notes[5] &lt;- &quot;on 15 August, an unreported amount of people drove their cars down the street. [size= no report]&quot; 
  </code></pre>
  <p>I am trying to extract the entire match after &quot;size= <em>(some quantifier)</em>&quot;, and store the value into an appended column of my dataframe.</p>
  <p>Eventually, I need to write a loop that goes through this column (call it &quot;notes&quot;) in my dataframe, and storing the values &quot;5, 4, 100&quot; into a new column (call it &quot;est_size&quot;).</p>
  <p>Ideally, my new column will look like this:</p>
  <pre><code>df$est_size[1] &lt;- &quot;around 5&quot;
  df$est_size[2] &lt;- &quot;nearly 4&quot;
  df$est_size[3] &lt;- &quot;about 100&quot;
  df$est_size[4] &lt;- &quot;hundreds&quot;
  df$est_size[5] &lt;- &quot;no report&quot;
  </code></pre>
  <p>Code that I have tried / stuck on:</p>
  <pre><code>stringr::str_extract(notes[1], \w[size=]\d&quot;
  </code></pre>
  <p>but all I get back is &quot;size=&quot; and not the value <em>after</em></p>
  <p>Thank you in advance for helping!</p>