Skip to content

Anyone See a Problem with my Header/Data?

3 messages · Lost in R, David Winsemius

#
First time using R. Having problems importing my data. Can anyone take a look
at my data to see if there is something stupid that I'm doing? This is the
error that I'm getting.

 <- read.table("C:\\CM3_DATASET.out.txt",
+ sep="\t",header=TRUE)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
: 
  line 1 did not have 194 elements
Thanks in Advance....

lost http://r.789695.n4.nabble.com/file/n4177606/Data_Sample.xlsx
Data_Sample.xlsx 

--
View this message in context: http://r.789695.n4.nabble.com/Anyone-See-a-Problem-with-my-Header-Data-tp4177606p4177606.html
Sent from the R help mailing list archive at Nabble.com.
#
On Dec 9, 2011, at 12:57 PM, Lost in R wrote:

            
http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows&s=excel

(You offer a link to an .xlsx file but you are attempting to read  
a .txt file?)
David Winsemius, MD
West Hartford, CT
#
On Dec 9, 2011, at 2:12 PM, David Winsemius wrote:

            
Presuming you used the save as ... tab or comma separators

count.fields() is a useful function at this stage of data input tasks.

You have a bunch of unmatched single-quotes. Try ignoring them with a  
modification of the defaults for read.table.

 > count.fields("~/Downloads/Data_Sample.csv",  sep=",", quote='"')
  [1] 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192  
192
 > count.fields("~/Downloads/Data_Sample.txt",  sep="\t", quote='"')
  [1] 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192 192  
192
 >
David Winsemius, MD
West Hartford, CT