R语言中 separate函数将一列拆分为多列
001、
root@PC1:/home/test2# cat test.txt 1_55910>snp1 0.05591 1_85204>snp2 0.085204 1_122948>snp3 0.122948 1_203750>snp4 0.20375 1_312707>snp5 0.312707
library(tidyverse) dat <- read.table("test.txt") dat dat1 <- separate(dat, V1, into = c("chr", "pos_id"), sep = "_") ## 拆分第一列,并指定列名 dat1 dat2 <- separate(dat1, pos_id, into = c("pos", "snpID"), sep = ">") ## 拆分pos_id列, dat2