Displaying 20 results from an estimated 9000 matches similar to: "How to read last (incomplete) line from gzfile()?"
2004 Mar 15
1
gzfile & read.table on Win32
Hello ...
Are there any known problems or even gotchas to look out for when using a
gzfile connection in read.csv/read.table in Windows?
In the package PROcess, available at
www.bioconductor.org/repository/devel/package/html/PROcess.html
there are two files in the PROcess/inst/Test directory which are of the
extension *.csv.gz.
With both files, if I open up a gzfile connection, say:
vv <-
2007 Dec 19
1
unexpected behavior from gzfile and unz
I get unexpected behavior from "readLines()" and
"scan()" depending on how the file is opened with
"gzfile" or "unz". More specifically:
> file <- gzfile("file.gz")
> readLines(file,1)
[1] "a\tb\tc"
> readLines(file,1)
[1] "a\tb\tc"
> close(file)
It seems that the stream is rewound between calls to
readLines.
2018 May 10
2
readLines() behaves differently for gzfile connection
When I read a .gz file with readLines() in 3.4.3, it returns text (and a
warning). In 3.5.0, it gives a warning, but no text. Is this expected
behavior or a bug?
3.4.3:
> source_file = "1k_annotation.gz"
> readfile_con <- gzfile(source_file, "r")
> readLines(readfile_con, n = 5)
[1] "#chr\tpos\tref\talt\t
<truncated output here>
Warning message:
In
2018 May 10
1
readLines() behaves differently for gzfile connection
You bet - it's available on github at
https://github.com/UW-GAC/wgsaparsr/blob/master/tests/testthat/1k_annotation.gz
-Ben
On Thu, May 10, 2018 at 4:17 PM, Michael Lawrence <lawrence.michael at gene.com
> wrote:
> Would it be possible to get that file or a representative subset of it
> somewhere so that I can reproduce this?
>
> Thanks,
> Michael
>
> On Thu, May
2016 Nov 14
0
Read.dcf with no newline ending: gzfile drops last line
I don't know if this is a bug per se, but an undesired behavior in
read.dcf. read.dcf takes a file argument and passes it to gzfile if
it's a character:
if (is.character(file)) {
file <- gzfile(file)
on.exit(close(file))
}
This gzfile connection is passed to readLines (line #39):
lines <- readLines(file)
If no newline is at the end of the file, readLines
2006 Nov 14
2
gzfile with multiple entries in the archive
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!).
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
2011 Jan 21
1
Reading gz compressed csv file - 'incomplete line found'
Hi all,
I am trying to download, decompress and read a csv file. My code:
myurl <-
"ftp://ftp.ncbi.nih.gov/pub/geo/DATA/supplementary/series/GSE24729/GSE24729_MitoNuclear_suppl_male_stats.csv.gz"
#
myfile <- "GSE24729_MitoNuclear_suppl_male_stats.csv.gz"
#
download.file(myurl, destfile=myfile, mode="w")
#
mycon <- gzcon(gzfile(myfile,
2002 Dec 05
1
writing to gzfile: segmentation fault (PR#2347)
Full_Name: Vadim Ogranovich
Version: Version 1.6.0 (2002-10-01)
OS: Red Hat 7.1
Submission from: (NULL) (209.99.241.1)
The following sequence of commands crashes my R session. The first weirdness
happens after the second command that appears not to change the "foo.gz" file,
no error generated.
> con <- gzfile("foo.gz", open="w"); cat("goo\n",
2020 May 04
2
"Earlyclobber" but for a subset of the inputs
Hi all,
I'm working on a target whose registers have equal-sized subregisters and
all of those subregisters can be named (or the other way round: registers
can be grouped into super registers).
So for instance we've got 16 registers W (as in wide) W0..W15 and 32
registers N (as in narrow) N0..N31. This way, W0 is made by grouping N0 and
N1, W1 is N2 and N3, W2 is N4 and N5, ..., W15 is
2010 Jan 13
4
a question about deleting rows
I have a file like this:
id n1 n2 n3 n4 n5 n6
1 3 4 7 8 10 2
2 4 1 2 4 3 10
3 7 0 0 0 0 8
4 10 1 0 0 2 3
5 11 1 0 0 0 5
what I want to do is: only if n2=0 and n3=0 and n4=0 and n5=0 then delete
the row. how can I do that?
thank you,
karena
--
View this message
2015 Nov 06
2
corrupt PACKAGES.gz?
Is it just me, or did a corrupt PACKAGES.gz file get installed in the
bin/windows/contrib/3.2 directory of CRAN mirrors recently? gzfile()
complains about it and Cygwin's gzip cannot decompress it. I tried the
following
repos <- "https://cran.rstudio.com"
v <- "3.2"
pkgs.gz <- paste(sep="/", repos, "bin/windows/contrib", v,
2007 Jul 03
1
bug in closing gzfile-opened connections?
Hi,
I am making multiple calls to gzfile() via read.table(), e.g.
> x <- read.table( gzfile( "xxx.gz" ) )
After i do this many times (I haven't counted, but probably between 50 and
100 times) I get the error message:
Error in open.connection(file, "r") : unable to open connection
In addition: Warning message:
cannot open compressed file 'xxx.gz'
however, I
2013 May 08
1
getting corrupted data when using readBin() after seek() on a gzfile connection
Hi,
I'm running into more issues when reading data from a gzfile connection.
If I read the data sequentially with successive calls to readBin(), the
data I get looks ok. But if I call seek() between the successive calls
to readBin(), I get corrupted data.
Here is a (hopefully) reproducible example. See my sessionInfo() at the
end (I'm not on Windows, where, according to the man page,
2006 Jun 07
2
help with combination problem
hello:
I have 3 data.frame objects.
First df object:
Of dim (149,31). Columns 2:31 are marked as T1..T14
and N1..N16.
Name T1 T2 N1 T3 N2 N3 N4 T4
mu1 10 10 9 10 9 9 8 10
mu2 11 11 9 11 9 9 9 11
...
muN 12 12 9 11 9 9 8 12
Second df object:
of Dim (50000,31). Columns 2:31 are maked as T1...T14
and N1..N16.
2011 Oct 15
2
gctorture() and gzfile() doesn't get along.
Found the simpliest way of seeing I bug I encountered doing "R CMD check --use-gct": Just launch R (with --vanilla), and do this:
> ?gctorture
# this work
> gctorture()
> ?gctorture
Error in gzfile(file, "rb") :
can only weakly reference/finalize reference objects
# this does not
It seems that when gctorture() is on gzfile() doesn't work.
2008 Mar 07
2
Problems installing packages using the inbuilt facility: "Error i n gzfile(file, "r") : unable to open connection"
Hi
I have been trawling the web, FAQs, and R manuals for help on the following issue, but have failed and was wondering if anyone has a solution to the following problem:
After having installed R 2.6.2 for Windows (binary), I tried to install various packages. Every time I try loading a package (any package) via the built-in menu, I run into the following error message.
>
2020 Jun 29
0
A warning in gzcon but not in gzfile
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
2011 Oct 16
1
Error in gzfile(file, mode) when checking a package with rcmd check
Hi,
For the first time I have a strange behaviour when checking a package
before 'packaging' the code. Looks like a file cannot be read.
rcmd check pgirmess
* using log directory 'U:/Documents and Settings/pgiraudo/Mes
documents/R/pgir_arch/pgirmess_arch/On work/pgirmess.Rcheck'
* using R version 2.13.2 (2011-09-30)
* using platform: i386-pc-mingw32 (32-bit)
* using session
2018 May 10
0
readLines() behaves differently for gzfile connection
Would it be possible to get that file or a representative subset of it
somewhere so that I can reproduce this?
Thanks,
Michael
On Thu, May 10, 2018 at 3:31 PM, Ben Heavner <bheavner at gmail.com> wrote:
> When I read a .gz file with readLines() in 3.4.3, it returns text (and a
> warning). In 3.5.0, it gives a warning, but no text. Is this expected
> behavior or a bug?
>
>
2002 Dec 02
1
readLines() changes mode of connection
Hi,
It seems like reading a line from a gzfile() connection changes the mode of
the connection from text to binary (it also alters "can write", in case it
matters). The following transcript, produced on RedHat 7.1, demonstrates
this "feature" (note the evolution of file$text). Is this expected?
Thanks, Vadim
> file <- gzfile("foo.gz")
file <-