【发布时间】:2015-10-03 22:33:30
【问题描述】:
我想将数据帧的每一行分成两部分。这是我的意见:
input <- 'name sample1 sample2 sample3
pr_001 533 411 633
pr_002 478 447 427'
input <- read.table(text=input, header=T)
要获得这个输出:
output <- 'name sample1 sample2 sample3
pr_001-A 533 411 633
pr_001-B 533 411 633
pr_002-A 478 447 427
pr_002-B 478 447 427'
output <- read.table(text=output, header=T)
因此,对于sample1 中的pr_001,结果是具有相同值pr_001-A 和pr_001-A 的两行,并且所有样本和名称必须遵循相同的逻辑。有什么想法来解决这个问题?谢谢!
【问题讨论】: