title: Split date in wide format with R
body: <p>do you have a solution for splitting dates from one column to two columns in R when the original variable contains &quot;after&quot; and &quot;before&quot; like in the example below?</p>
  <pre><code>library(data.table)
  library(splitstackshape)
  date &lt;- c(&quot;2012-2015&quot;,&quot;2016&quot;,&quot;after 2006&quot;, &quot;before 1930&quot;)
  
  df &lt;- data.table(date)
  df_l &lt;- splitstackshape::cSplit(df, &quot;date&quot;, sep = &quot;-&quot;, direction = &quot;wide&quot;)
  df_l
  
  # how can I achieve this
  
  df_l$date_1 &lt;- c( &quot;2012&quot;, &quot;2016&quot;, &quot;2006&quot;, &quot;1900&quot;)
  df_l$date_2 &lt;- c( &quot;2015&quot;, &quot;NA&quot;, &quot;2022&quot;, &quot;1930&quot;)
  df_l
  </code></pre>