Reading in a file - Warning Message in R
- by Sheila
I have a file that has 22268 rows BY 2521 columns. When I try to read in the file using this line of code:
file <- read.table(textfile, skip=2, header=TRUE, sep="\t", fill=TRUE, blank.lines.skip=FALSE)
I get the following error:
Warning message: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : number of items read is not a multiple of the number of columns
I also used this command to see what rows had an incorrect number of columns:
x <-count.fields("train.gct", sep="\t", skip=2)
which(x != 2521)
and got back a list of about 20 rows that were incorrect.
Is there a way to fill these rows with NA values?
I thought that is what the "fill" parameter does in the read.table function, but it doesn't appear so. Any help would be greatly appreciated.
Thank you.