title: coerce colon operator or dash from character to vector inside cell in r
body: <p>I have some df cells that contain lists of years. Most are years typed out and separated by commas: &quot;1990, 1992, 2001&quot;, but some use colon operators: &quot;1990:2000&quot;. Even some use a combination: &quot;1990, 1995:1999, 2001&quot;</p>
  <p>Is there a way in R to convert these different kinds of strings into consistent comma separated values still within one cell in r?</p>
  <pre><code>test2 &lt;- data.frame(series = c(1,2,3),
                      years = c(&quot;1990, 1992, 2001&quot;, &quot;1990:2000&quot;,&quot;1990, 1995:1999, 2001&quot;))
  
  
  
  # Desired output: 
    series             years
  1      1             1990, 1992, 2001
  2      2             1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
  3      3             1990, 1995, 1996, 1997, 1998, 1999, 2001
  
  </code></pre>