[R] reading text files compressed by gzip

jim holtman jholtman at gmail.com
Tue Feb 24 17:54:52 CET 2009


What did the data appear like when it was read in?  Have you just
tried to read in the lines (readLines) to see if the decompression is
working?  Does this compare to what you get if you decompress the file
outside of R?  Not exactly sure what you mean by "force" since the
command it probably reading in what it thinks is a complete file.  Are
there characters in the file that might cause it to stop reading, or
to bunch up data differently (e.g., misplaced quotes).

Some more information has to be provided to guess what your problem might be.

On Tue, Feb 24, 2009 at 9:13 AM, Daren Tan <darentan76 at gmail.com> wrote:
> I have a number of text files that were archived by gzip. To save the
> trouble of uncompressing them, I used the following command. Then I
> checked the dimension of m, the number of rows is 14 which should be
> 10000. How can I "force" the remaining rows to be read into m ?
>
>>m <- read.delim(gzfile("Sample.txt.gz"), sep="\t").
>
>> dim(m)
> [1] 14 15
>
>> sessionInfo()
> R version 2.8.0 (2008-10-20)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] gplots_2.6.0 gdata_2.4.2  gtools_2.5.0
>
> loaded via a namespace (and not attached):
> [1] tools_2.8.0
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list