Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8632859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:24:33+00:00 2026-06-12T09:24:33+00:00

I have a file where the first row is a header. The header can

  • 0

I have a file where the first row is a header. The header can have spaces and the # symbol (there may be other special characters as well). I am trying to read this file using read.csv or read.table but it keeps throwing me errors:

undefined columns selected 

more columns than column names 

My tab-delimited chromFile file looks like:

Chromosome# Chr chr Size    UCSC NCBI36/hg18    NCBIBuild36 NCBIBuild37
1   Chr1    chr1    247199719   247249719   247249719   249250621
2   Chr2    chr2    242751149   242951149   242951149   243199373

Command:

chromosomes <- read.csv(chromFile, sep="\t",skip =0, header = TRUE,  )

I want to first look for a way to read the file as it as without replacing the space or # with some other readable symbol.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:24:34+00:00Added an answer on June 12, 2026 at 9:24 am

    From the documentation (?read.csv):

    comment.char character: a character vector of length one containing a single character or an empty string. Use “” to turn off the interpretation of comments altogether.

    The default is comment.char = "#" which is causing you trouble. Following the documentation, you should use comment.char = "".

    Spaces in the header is another issue which, as mrdwab kindly pointed out, can be addressed by setting check.names = FALSE.

    chromosomes <- read.csv(chromFile, sep = "\t", skip = 0, header = TRUE,
                            comment.char = "", check.names = FALSE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file. The first row will always contain column headers. Depending
Currently I have a a text file with data at the first row is
I have a problem here im trying to upload a file first time it
I have a file where the first byte contains encoded information. In Matlab I
I have two csv file. First File has date offerid clicks orders Second File
I have one binary file and I want to read this file like first
I have text file with something like first line line nr 2 line three
I have a text file with few first few lines not required and then
I have script file where a command is stored in a variable First i
I have this file which I need to read the first bytes to check

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.