在base R中,我們可以使用gsub刪除(,然后是數字和),并使用read.table在data.frame中讀取它 read.table(text = gsub("\\(\\d+\\)", "", df1$col1), header = FALSE, sep = "|", fill = TRUE) V1 V2 V31 28316496 28943784 285799192 29343898 NA NA 或者使用str_extract,使用正則表達式查找 library(stringr)str_extract_all(df1$col1, "\\d+(?=\\()")[[1]][1] "28316496" "28943784" "28579919"[[2]][1] "29343898" data df1 <- structure(list(col1 = c("28316496(15)|28943784(8)|28579919(7)", "29343898(1)")), class = "data.frame", row.names = c(NA, -2L))