Re: [R] import text file into R

From: Peter Ehlers <ehlers_at_ucalgary.ca>
Date: Fri, 04 Jun 2010 01:18:15 -0600

On 2010-06-03 22:51, Dhanasekaran wrote:
> please look at the error..
>
>> LosA<-read.table("E:\\Temporary
> Tasks\\rub\\Los_R\\ca_los.txt",header=T,sep="\t")
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
> :
> line 11022 did not have 87 elements

That error message seems pretty explicit to me: you have a problem with line 11022. Did you check it with a text editor?

It's always a good idea to run count.fields() on the file, as recommended on the help page for read.table.

If you're trying to import SAS data, you might want to check out the 'foreign' package.

Note also that read.delim is convenient for tab-delimited files.

  -Peter Ehlers

>
> ca_los.txt is my tab delimited large text file which contains about 16lakhs
> observations.
>
> thank you
>
> On Fri, Jun 4, 2010 at 9:44 AM, Erik Iverson<eriki_at_ccbr.umn.edu> wrote:
>
>> Dhanasekaran wrote:
>>
>>> Sorry guys....
>>>
>>> It is a tab delimited text file which I just exported from SAS. I want to
>>> import this in R. Pl let me know what is the delimiter I should use and R
>>> syntax.
>>>
>>> You still don't say the error you're getting when you try your read.table
>> command.
>>
>



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. Received on Fri 04 Jun 2010 - 07:24:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Jun 2010 - 07:50:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive