error reading HapMap.hmp.txt file in r: more columns than column names

Dear R Studio Community,

I am trying to read the SNPs data as hapmap format (showing in attached photo). I could not find the reason that caused more columns as mentioned in error messages. Do you have any suggestions for it?

> hapmap_toad <- read.table("canetoad_wild_filtered_rename.hmp.txt", header=TRUE, row.names=1, sep="\t")
Error in read.table("canetoad_wild_filtered_rename.hmp.txt", header = TRUE,  : 
  more columns than column names

I recommend you use library(readr)
and readr::read_tsv() for more informative messages

Hi Nirgrahamuk,

Thanks for the quick response. Good to know more information about the table.

The error is solved by removing the "#" symbol from some of the column names.

Thanks,

Jia

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.