首页 > 解决方案 > r中文件的read.table和Skype第一行

问题描述

我有一个文件,例如:

文件1.txt

#some info
#some other info 
#information again 
# Busco id  Status  Contig  Start   End Score   Length
EOG091B0006 Complete    scaffold_A  9626    40090   11575.7 6724
EOG091B0007 Fragmented  scaffold_B  455 4244    1660.7  935
EOG091B000H Complete    scaffold_C  4456    43328   7631.6  5014

我想阅读以下内容:

Busco id    Status  Contig  Start   End Score   Length
EOG091B0006 Complete    scaffold_A  9626    40090   11575.7 6724
EOG091B0007 Fragmented  scaffold_B    455   4244    1660.7  935
EOG091B000H Complete    scaffold_C  4456    43328   7631.6  5014

我试过了: tab_busco=read.table(file1.txt",header=T,sep='\t',skip = 4)但它不起作用......

标签: rdataframe

解决方案


"#"可能问题在于以因为"#"被解释为注释开头的行。

尝试用任何其他字符替换它,例如:

df <- read.table("file1.txt", header = TRUE, skip = 3, 
                 comment.char = "@", fill = TRUE)

推荐阅读