Split a string and append it to a vector [duplicate]

Using base R, you can do:

Reprex

sem_tags <- c('F2', 'A1/B1', 'X3.2', 'M3fn', 'E2/Q2')

unlist(strsplit(sem_tags, "/"))
#> [1] "F2"   "A1"   "B1"   "X3.2" "M3fn" "E2"   "Q2"

Created on 2022-01-20 by the reprex package (v2.0.1)


We can scan it in:

scan(text = sem_tags, what = "", sep = "/", quiet = TRUE)
## [1] "F2"   "A1"   "B1"   "X3.2" "M3fn" "E2"   "Q2"  

Note

The question has a syntax error in the definition of the input so we used this.

sem_tags <- c('F2', 'A1/B1', 'X3.2', 'M3fn', 'E2/Q2')