1

在尝试使用 read.table 函数将数据表读入 R 时,我遇到了一个非常奇怪的问题。我没有读取实际数据,而是在标题 ÿþD 下得到一列 NA 字符(它不在我的代码或输入文件中的任何位置)。我的代码和数据文件如下。如果您对我为什么会得到这个奇怪的结果有任何建议,请告诉我。我一直在寻找几个小时,却一无所获。

代码:

Raw_Annotation_data_AllDeer<-read.table("Sample.txt", as.is=TRUE, row.names=NULL, 
                                         check.names = TRUE, sep="\t", fill=T, header=T, 
                                         strip.white = T, quote = "", na.strings = "NA", 
                                         comment.char="")

文件(前 5 行):

Document_Name   Sequence_Name   Track_Name  Type    Name    Sequence    Minimum Min_(with_gaps) Maximum Max_(with_gaps) Length  Length_(with_gaps)  #_Intervals Direction   Average_Quality Coverage    modified_by Polymorphism_Type   Strand-Bias Strand-Bias_>50%_P-value    Strand-Bias_>65%_P-value    Variant_Frequency   Variant_Nucleotide(s)   Variant_P-Value_(approximate)
Chr2_FT Chr2    Chr2.bed    CDS 10000_ARHGAP15  GAAAGAATCATTAACAGTTAGAAGTTGATG-AAGTTTCAATAACAAGTGGGCACTGAGAGAAAG    55916421    56019336    55916483    56019399    63  64  1   forward         User                            
Chr2_FT Chr2    Chr2.bed    CDS 10001_ARHGAP15  GATACCACTGTACTATGCAGAAATCTACAAATTCTGATATCCCTGTGGAAACACTGAATCCCACCCGCCAAGGCACTGGAGCTGTGCAAATGAGAATCAAAAATGCCAACAGCCACCATGACAGGCTGAGCCAAAGTAAATCTATGATCCTCACCGAAGTTGGGAAGGTCACTGAACCT 55936395    56039336    55936573    56039514    179 179 1   forward         User                            
Chr2_FT Chr2    Chr2.bed    CDS 10002_HNMT  CTGACACAATAATAATGAGAATCTTAGCATTGGTAGCTAAGAGACTATGGAAGAATTTCAGGGTAGCTGGGATGTCTTTAACATAATACAGCAT  61980947    62093615    61981040    62093708    94  94  1   forward         User                            
Chr2_FT Chr2    Chr2.bed    CDS 10003_HNMT  CTGAATCATATGAATAAAGTCCCACCTCTGAAGTTCTTTTTTCTCCATCATTCTATTTTGATATTCAGATGATGTCTCTTTATGCCAAGCAAACTTTATGTTCTCAAGGTTTGATGTCTTTGCTACAAGCT 61986120    62098794    61986250    62098924    131 131 1   forward         User                            
Chr2_FT Chr2    Chr2.bed    CDS 10004_HNMT  CTTTGTACTTGGTGATTTGTTCAGCACTTGGTTCAACAACTTCATTGATGATATGAACTCCTGGGTACTGAGCTTGCACTTTGGAGAGAATTTGAAGGTCAATTTCAC    61987773    62100453    61987880    62100560    108 108 1   forward         User                            
4

1 回答 1

0

如果标题行中的“#”(comment.char)在数据中,它可能会出现问题。但是 check.names() 似乎已经抓住了它。这“有效”(删除后sep="\t"

Raw_Annotation_data_AllDeer<-read.table(text="Document_Name   Sequence_Name   Track_Name  Type    Name    Sequence    Minimum Min_(with_gaps) Maximum Max_(with_gaps) Length  Length_(with_gaps)  #_Intervals Direction   Average_Quality Coverage    modified_by Polymorphism_Type   Strand-Bias Strand-Bias_>50%_P-value    Strand-Bias_>65%_P-value    Variant_Frequency   Variant_Nucleotide(s)   Variant_P-Value_(approximate)
Chr2_FT Chr2    Chr2.bed    CDS 10000_ARHGAP15  GAAAGAATCATTAACAGTTAGAAGTTGATG-AAGTTTCAATAACAAGTGGGCACTGAGAGAAAG    55916421    56019336    55916483    56019399    63  64  1   forward         User                            
Chr2_FT Chr2    Chr2.bed    CDS 10001_ARHGAP15  GATACCACTGTACTATGCAGAAATCTACAAATTCTGATATCCCTGTGGAAACACTGAATCCCACCCGCCAAGGCACTGGAGCTGTGCAAATGAGAATCAAAAATGCCAACAGCCACCATGACAGGCTGAGCCAAAGTAAATCTATGATCCTCACCGAAGTTGGGAAGGTCACTGAACCT 55936395    56039336    55936573    56039514    179 179 1   forward         User                            
Chr2_FT Chr2    Chr2.bed    CDS 10002_HNMT  CTGACACAATAATAATGAGAATCTTAGCATTGGTAGCTAAGAGACTATGGAAGAATTTCAGGGTAGCTGGGATGTCTTTAACATAATACAGCAT  61980947    62093615    61981040    62093708    94  94  1   forward         User                            
Chr2_FT Chr2    Chr2.bed    CDS 10003_HNMT  CTGAATCATATGAATAAAGTCCCACCTCTGAAGTTCTTTTTTCTCCATCATTCTATTTTGATATTCAGATGATGTCTCTTTATGCCAAGCAAACTTTATGTTCTCAAGGTTTGATGTCTTTGCTACAAGCT 61986120    62098794    61986250    62098924    131 131 1   forward         User                            
Chr2_FT Chr2    Chr2.bed    CDS 10004_HNMT  CTTTGTACTTGGTGATTTGTTCAGCACTTGGTTCAACAACTTCATTGATGATATGAACTCCTGGGTACTGAGCTTGCACTTTGGAGAGAATTTGAAGGTCAATTTCAC    61987773    62100453    61987880    62100560    108 108 1   forward         User                            ", as.is=TRUE, row.names=NULL, check.names = TRUE, fill=T, header=T, strip.white = T, quote = "", na.strings = "NA", comment.char="")
于 2012-12-28T22:27:05.623 回答