and here the tidyverse option. Not saying it's better. Just another option.
You'll get an appropriate warning for the NAs - sometimes you want warnings.
library(tidyverse)
position=c("24,201", "8,915", "45,877:1","251,603")
evindence=c("RA", "RA","RA","RA")
test = data.frame(evindence,position)
test %>%
mutate(position = str_replace(position, ",", "\.")) %>%
separate(position, c("position", "insertion"), sep = ":")
#> Warning: Expected 2 pieces. Missing pieces filled with `NA` in 3 rows [1, 2, 4].
#> evindence position insertion
#> 1 RA 24.201 <NA>
#> 2 RA 8.915 <NA>
#> 3 RA 45.877 1
#> 4 RA 251.603 <NA>
Created on 2021-01-26 by the reprex package (v0.3.0)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…