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
标签:test2,0.122948,separate,snp3,snp2,snp1,203750,一列,多列 来源: https://www.cnblogs.com/liujiaxin2018/p/16545728.html