[R] Handling 8GB .txt file in R?

Jan van der Laan rhelp at eoos.dds.nl
Sun Mar 25 12:16:45 CEST 2012


What you could try to do is skip the first 5 lines. After that the file 
seems to be 'normal'. With read.table.ffdf you could try something like

# open a connection to the file
con <- file('yourfile', 'rt')
# skip first 5 lines
tmp <- readLines(con, n=5)
# read the remainder using read.table.ffdf
ffdf <- read.table.ffdf(file=con)
# close connection
close(con)

HTH

Jan

On 03/25/2012 06:20 AM, iliketurtles wrote:
> Thanks to all the suggestions. To the first individual that replied, I can't
> do any stuff with unix or perl. All I know is R.
>
> @KEN:
> I'm using Windows 7, 64 bit.
>
> @Steve:
> Here's the readLines output.. As we can see, lines 1-3 are empty and line 5
> is empty, and there's also empty elements after line 5!.
>
>   [1] " "
>    [2] "
> "
>    [3] " "
>    [4] "  PERMNO          DATE    TICKER        PERMCO             PRC
> VOL    NUMTRD        vwretd        ewretd"
>    [5] ""
>    [6] "   10000    06/01/1986                    7952          .
> .         .     -0.000138      0.001926"
>    [7] "   10000    07/01/1986    OMFGA           7952        -2.56250
> 1000         .      0.013809      0.011061"
>    [8] "   10000    08/01/1986    OMFGA           7952        -2.50000
> 12800         .     -0.020744     -0.005117"
>    [9] "   10000    09/01/1986    OMFGA           7952        -2.50000
> 1400         .     -0.011219     -0.011588"
>   [10] "   10000    10/01/1986    OMFGA           7952        -2.50000
> 8500         .      0.000083      0.003651"
>   [11] "   10000    13/01/1986    OMFGA           7952        -2.62500
> 5450         .      0.002749      0.002433"
>
> -----
> ----
>
> Isaac
> Research Assistant
> Quantitative Finance Faculty, UTS
> --
> View this message in context: http://r.789695.n4.nabble.com/Handling-8GB-txt-file-in-R-tp4500971p4502706.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.



More information about the R-help mailing list