将原先包含_N_T_hisens的字符替换成-T:
_N_T_hisens
-T
segment$Sample <- gsub("_N_T_hisens", "-T", segment$segName, fixed = TRUE)
另外一种方法,通过调用包stringr中的str_remove函数实现:
stringr
str_remove
require(stringr) seg$segName <- paste(str_remove(seg$segName,"_N_T_hisens"),"-T",sep = "")