Skip to content

bzfile() in R

4 messages · Roger D. Peng, Dirk Eddelbuettel, Brian Ripley

#
I'm putting together a data package and am finding that I get 
enormous savings in space by using bzip instead of the usual gzip 
in save().  Is it safe to assume that for R versions, say >= 
1.7.1, that the function bzfile() will always be available?

Thanks,

-roger
#
On Sat, Jan 31, 2004 at 08:37:05PM -0500, Roger D. Peng wrote:
I don't think that is correct as this an optional compile-team feature.

help(bzfile) says it 'may' be present whereas gzfile is guaranted (from a
1.9.0 snapshot):

     All platforms support (gz)file connections and 'url("file://")'
     connections.  The other types may be partially implemented or not
     implemented at all.  (They do work on most Unix platforms, and all
     but 'fifo' on Windows.)
		    
but then goes on to say under See Also:

     'capabilities' to see if 'gzfile', 'url', 'fifo' and
     'socketConnection' are supported by this build of R.

which suggests that even gzfile may not be guaranteed.

You could of course test via capabilities() and abort with a clear error.

Dirk
#
Yes, that's true, but I was under the impression that since the 
bzip2 sources are included with the R sources, that the bzip2 
capability is always compiled in (either using the included 
sources or a system library).  Also, the NEWS file for 1.9.0 says:

     o   configure no longer lists bzip2 and PCRE as `additional
         capabilities' as all builds of R have had them since 		 
1.7.0.

-roger
Dirk Eddelbuettel wrote:

            
#
On Sat, 31 Jan 2004, Roger D. Peng wrote:

            
Roger is correct.  Capabilities has not been changed, since earlier 
versions did not have bzfile (and even earlier ones did not have gzfile).