library(stringr)
#col_names 为字符串集集合
new_names<-unlist(lapply(col_names, FUN = function(x) {return(substr(x,1,16))})) # 截取1:16的字符串
new_names<-unlist(lapply(col_names, FUN = function(x) {return(strsplit(x, split = ".tsv",fixed=T)[[1]][1])})) #以.tsv作为分割,截取之前的
网友评论