Skip to content
Back to formatted view

Raw Message

Message-ID: <dae9a2a60904301101q46936d58g6838b2a4e2b3af40@mail.gmail.com>
Date: 2009-04-30T18:01:31Z
From: Dimitri Liakhovitski
Subject: problem in reading data
In-Reply-To: <23316321.post@talk.nabble.com>

What kind of .txt file is it? If it's a tab-delimited file, try
read.delim("tt_mb_200409.txt")
Dimitri

On Thu, Apr 30, 2009 at 9:28 AM, tedzzx <zengzhenxing at gmail.com> wrote:
>
> Dear R users
> I am runing into a problem in reading data in R
> This is the error information
>
> a<-read.table("tt_mb_200409.txt",as.is=T)
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
> :
> ?line 1653997 did not have 5 elements
>
> It seams that some lines don't have equal variables. I want to try
>
>> a<-read.table("tt_mb_200409.txt",as.is=T,fill=T)
>> a[1653997,]
> ? ? ? ? ? V1 ? ? ?V2 ? ? ? ?V3 ? ? V4 ? ? V5
> 1653997 00992 2777010
>
> But, I want to delect the rows that do not have the same number of variables
> with others, how can I do this?
>
> Many thanks
>
> Ted
>
>
> --
> View this message in context: http://www.nabble.com/problem-in-reading-data-tp23316321p23316321.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.
>



-- 
Dimitri Liakhovitski
MarketTools, Inc.
Dimitri.Liakhovitski at markettools.com