[R] Anyone See a Problem with my Header/Data?
David Winsemius
dwinsemius at comcast.net
Fri Dec 9 20:44:13 CET 2011
On Dec 9, 2011, at 2:12 PM, David Winsemius wrote:
>
> On Dec 9, 2011, at 12:57 PM, Lost in R wrote:
>
>> 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
>>>
>
> 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?)
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
>
>
>
>>
>> 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.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list