I have installed both 32-bit and 64-bit versions of R2.12.0 (2010-06-15
r52300) on my Ubuntu 10.04 64-bit system. I observe the following behavior
when running the examples from base::connections. There appears to be a
problem with seek() on a .gz file when using a 32-bit installation of
R2.12.0, but the problem doesn't appear in the 64-bit installation. I
realize that seek() has been difficult in the past, and I don't want to open
old wounds, but is this a known problem? Is this easily fixable? I have a
package that relies on seek() when accessing gzipped files.
Using the 32-bit installation...
*> zz <- file("ex.data", "w") # open an output file connection
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
> cat("One more line\n", file = zz)
> close(zz)
> blah = file("ex.data", "r")
> seek(blah)
[1] 0
>
> zz <- gzfile("ex.gz", "w") # compressed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
> close(zz)
> blah = file("ex.gz", "r")
> seek(blah)
[1] 7.80707e+17
>
> zz <- bzfile("ex.bz2", "w") # bzip2-ed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
> close(zz)
> blah = file("ex.bz2", "r")
> seek(blah)
Error in seek.connection(blah) : 'seek' not enabled for this connection
>*
Using the 64-bit installation...
*> zz <- file("ex.data", "w") # open an output file connection
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> cat("One more line\n", file = zz)
> close(zz)
> blah = file("ex.data", "r")
> seek(blah)
[1] 0
>
> zz <- gzfile("ex.gz", "w") # compressed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> close(zz)
> blah = file("ex.gz", "r")
> seek(blah)
[1] 0
>
> zz <- bzfile("ex.bz2", "w") # bzip2-ed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> close(zz)
> blah = file("ex.bz2", "r")
> seek(blah)
Error in seek.connection(blah) : 'seek' not enabled for this connection
> *
thanks,
Brandon
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel