[R] gzfile with multiple entries in the archive
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Nov 14 16:17:33 CET 2006
On Tue, 14 Nov 2006, John James wrote:
> If I open a tgz archive with gzfile and then parse it using readLines I miss
> the initial line of each member of the archive - and also the name of the
> file although the archive otherwise complete (but useless!).
You can use a gzfile connection to read the underlying .tar file, but that
is not a text file and you will need to pick its structure apart yourself
via readBin and readChar.
> Is there any way within R to extract both the list of files in a tgz archive
> and to extract any one of these files?
> Clearly I can use zcat and tar on Linux, but I need this to work within the
> R environment on Windows!
You could use tar on Windows: it is in the R tools set.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list