[R] reading partial file content

Marc Mamin M.Mamin at intershop.de
Fri Oct 8 09:38:33 CEST 2004


hi,


I'd like to extract data from very large files (ca 1-2 Mio lines),
and I already know which lines of these files I need.

Is there a way to do it without filling the memory with the whole file content?

The lines I need are randomly distributed within the files.

Thanks,

Marc






-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Kunal Shetty
Sent: Friday, October 08, 2004 5:16 AM
To: Austin, Matt
Cc: R-help
Subject: RE: [R] Read.Table Reading a Text file




  thanks austin, it worked..it was exactly what I was looking for

regards
Kunal


"Austin, Matt" <maustin at amgen.com> wrote:
> x.1$V1
> or
> x.1[,1]
> or
> x.1['V1']
> 
> and you shouldn't need to call print.default() directly, just call
> print().
> 
> --Matt
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Kunal Shetty
> Sent: Thursday, October 07, 2004 18:44 PM
> To: james.holtman at convergys.com
> Cc: R-help
> Subject: Re: [R] Read.Table Reading a Text file
> 
> 
> 
> James
>            Thank you for response. I am working on treatment for missing
> data for both bivariate and multivariate normal data. Coming back to
> example. My problem was that once we do execute this command 
> x.1 <- read.table('/tempxx.txt', fill=T)
> 
> 
> How can access the particular column say X8 and all it's values so that I
> could assign some other operations on them.
> Because if I say 
> print.default(x.1)
> 
> the result..
> 
>    V1  V2
> 1  X    y
> 2  8    10
> 3 11   1 4
> 4 16   16
> 5 18   15
> 6  6    20
> 7  4     4
> 8 20   18
> 9 25    22
> 
> 
> and I want to access V1  values.....
> 
> 
> thank you
> regards
> Kunal
> 
> 
> james.holtman at convergys.com wrote:
> >
> >
> >
> >
> > If you have an unequal number of columns, then use 'fill=T' onread.table
> >
> > It putsNAs.
> >
> > Is this what youwant?
> >
> > Here is what happens on the input file which is your data and someextra
> >columns:
> >
> > 8           10
> > 11          14
> > 16          16
> > 18           15  12
> > 6           20
> > 4            4  12
> > 20          18
> >
> >
> > > x.1 <- read.table('/tempxx.txt',fill=T)
> > >x.1
> >    X8X10
> > 11 14 NA
> > 16 16 NA
> > 18 15 12
> > 6  20 NA
> > 4   4 12
> > 20 18 NA
> >__________________________________________________________
> > James Holtman        "What is the problem you are trying tosolve?"
> > Executive Technical Consultant  --  Office of Technology,Convergys
> >james.holtman at convergys.com
> > +1 (513)723-2929
> >
> >
> >
> > KunalShetty
> > <kshe4 at student.monash To:r-help at stat.math.ethz.ch
> > .edu>cc:
> > Sent by: Subject: [R] Read.Table Reading a Textfile
> >r-help-bounces at stat.m
> >ath.ethz.ch
> >
> >
> > 10/07/200416:18
> >
> >
> >
> >
> >
> >
> > Dear R users andHelpers
> >
> > I am beginner with using R and interested in carrying out certaintask
> >for
> > my statisticalresearch.
> > I am reading data for a text file, which could contain data infollowing
> >pattern
> >
> > x           y
> > 8           10
> > 11          14
> > 16          16
> > 18          15
> > 6           20
> > 4           4
> > 20          18
> >
> > As per the example I have two columns and 7 rows of data ineach.
> > However is real life data situation I may not know how many columnsare
> > present and how rows are present  and also with the certain datais
> > missing. Yes I am assuming the data is delimited myTab.
> >
> >
> > My question or rather problem is I want read data from each colum saycol
> >x
> > (8,11,16,18âEUR¦.20) and store it into a variable so that I couldperform
> >some
> > operations onthem.
> >
> > I have also looked into certain R-help for Read.table and data.framebut
> > still struggling on my requirement. Theyare
> >
> >http://tolstoy.newcastle.edu.au/R/help/04/07/2040.html
> >http://tolstoy.newcastle.edu.au/R/help/04/07/3152.html
> >
> >
> >Regards
> >Kunal
> >
> >______________________________________________
> > R-help at stat.math.ethz.ch mailinglist
> >https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the postingguide!
> >http://www.R-project.org/posting-guide.html
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list