title: R - Substring of column value
body: <p>I'd like to store a substring value from the "Date" column into another variable.
  This is what my data frame looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/kx7Gt.png" alt="Example"></p>
  
  <p>My data frame is called "test".
  What I want to achieve is to take the last two numbers of the Date values and store them into another data frame. So the end result would look like this:</p>
  
  <pre><code>   Value
  1  01
  2  01
  3  01
  </code></pre>
  
  <p>This is what I've done already:</p>
  
  <pre><code>t.sub&lt;-substring(test$Data, 5,6)
  </code></pre>
  
  <p>However, R returned this:</p>
  
  <pre><code>character(0)
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>t.sub&lt;-data.frame(substring(test$Data,5,6))
  </code></pre>
  
  <p>R returned this:</p>
  
  <pre><code>[1] substr(molten$Data, 5, 6)
  &lt;0 rows&gt; (or 0-length row.names)
  </code></pre>