Jason
Jason

Reputation: 203

R programming: error in read.table :more columns than column names

I have a data set in an .xls format and i saved it as .csv file. When I'm trying to read it with

read.table("Gene.csv", header=TRUE, sep=",") it shows:

Error in read.table("Gene.csv", header = TRUE, sep = ",") : more columns than column names

I think that maybe the csv file has some format issues because there are unfilled spaces under one Column. Any help would be grateful !!!!

Upvotes: 0

Views: 2510

Answers (1)

user2038042
user2038042

Reputation: 135

options(warn=3)

Then run your code looking for an error message.

> dat <- read.table("June2014-Feb2015.csv",header=TRUE,sep=",")
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  line 3 did not have 10 elements

so I checked line 3 and viola , it was fixed.

Upvotes: -2

Related Questions