Skip to content

A warning in gzcon but not in gzfile

1 message · Jiefei Wang

#
Hi all,

I used `gzfile` and `gzcon` to read a compressed file but I found that
`gzcon` gave me a different result than `gzfile`. It seems like the `gzcon`
does not handle the data correctly. I have posted an example below. In the
example, a portion of a compressed file is downloaded from Google Cloud as
a raw vector, and the data is saved into a temp file. If I use ` gzfile` to
read the file, it can show the first 1000 lines successfully. However, if I
wrap the raw vector as a connection, and use  `gzcon` to read from that
connection, it shows the first  884 lines along with a warning(see the
output).

code:
## write data to a file
## Read the data using `gzfile`
## Read the data using `gzcon`
output:
I am not sure if this is caused by a bug in `gzcon` or the misuse of the
function. The same result can be observed at R4.0 and R4.1 devel on Win.
Here is my session info, I hope it can be helpful. Any suggestions and help
would be appreciated.

R Under development (unstable) (2020-06-27 r78747)
Best,
Jiefei