remove data before the first match in r code example
Example 1: r remove all string before : in r data frame
> x <- 'aabb.ccdd'
> sub('.*', '', x)
[1] ""
> sub('bb.*', '', x)
[1] "aa"
> sub('.*bb', '', x)
[1] ".ccdd"
> sub('\\..*', '', x)
[1] "aabb"
> sub('.*\\.', '', x)
[1] "ccdd"
Example 2: r substitute string characters until first :
sub(".*? ", "", D$name)