📅  最后修改于: 2022-03-11 14:52:01.557000             🧑  作者: Mango
library(stringr)
df1 <- read.table(text = "ABC|DEF|GHI, ABCD|EFG|HIJK, ABCDE|FGHI|JKL,
DEF|GHIJ|KLM, GHI|JKLM|NO|PQRS, BCDE|FGHI|JKL")
#extract 1st word before |
word(df1$V1,1,sep = "\\|")