Re: [R] readLines() and unz() and non-empty final line

2024-10-28 Thread Marttila Mikko via R-help
Subject: Re: [R] readLines() and unz() and non-empty final line Hi again, The unz connection is non-blocking by default. I checked do_unz which calls R_newunz which calls init_con and the only place in any of those functions that sets 'blocking' is init_con which sets it to FAL

Re: [R] readLines() and unz() and non-empty final line

2024-10-28 Thread Marttila Mikko via R-help
half Of Kimmo Elo Sent: Friday, 25 October 2024 15:21 To: r-help@r-project.org Subject: Re: [R] readLines() and unz() and non-empty final line [You don't often get email from kimmo@uef.fi. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] Hi, you could use

Re: [R] readLines() and unz() and non-empty final line

2024-10-25 Thread Marttila Mikko via R-help
rom: Bert Gunter Sent: Thursday, 24 October 2024 18:13 To: Iris Simmons Cc: Marttila Mikko ; r-help@r-project.org Subject: Re: [R] readLines() and unz() and non-empty final line You don't often get email from bgunter.4...@gmail.com<mailto:bgunter.4...@gmail.com>. Learn why this is

Re: [R] readLines() and unz() and non-empty final line

2024-10-25 Thread Kimmo Elo
Hi, you could use "scan" instead, it seems to work fine also when wrapped around "unz". Or, alternatively, you could use "unzip" instead of "unz". It works as expected, i.e. reads the last incomplete line and throws a warning about this. So it seems to me that "unz" creates a non-blocking con

Re: [R] readLines() and unz() and non-empty final line

2024-10-25 Thread Iris Simmons
t; Calls: local ... eval.parent -> eval -> eval -> eval -> eval -> readLines > > Execution halted > > So, the behaviour of unz() seems to be different depending on whether it > was explicitly opened before passed to readLines(). Should this be fixed or > documented? &

[R] readLines() and unz() and non-empty final line

2024-10-25 Thread Marttila Mikko via R-help
Dear list, I'm seeing a strange interaction with readLines() and unz() when reading a file without an empty final line. The final line gets dropped silently: > cat("hello", file = "hello.txt") > zip("hello.zip", "hello.txt") adding: hello.txt (stored 0%) > readLines(unz("hello.zip", "hello.txt"

Re: [R] readLines() and unz() and non-empty final line

2024-10-24 Thread Ebert,Timothy Aaron
-Original Message- From: R-help On Behalf Of Marttila Mikko via R-help Sent: Thursday, October 24, 2024 8:00 AM To: r-help@r-project.org Subject: [R] readLines() and unz() and non-empty final line [External Email] Dear list, I'm seeing a strange interaction with readLines() and unz()

Re: [R] readLines() and unz() and non-empty final line

2024-10-24 Thread Bert Gunter
But note: > zip("hello.zip", "hello.txt") updating: hello.txt (stored 0%) > readChar(unz("hello.zip","hello.txt"),100) [1] "hello" I leave it to you and other wiser heads to figure out. Cheers, Bert On Thu, Oct 24, 2024 at 8:57 AM Iris Simmons wrote: > Hi Mikko, > > > I tried running a few di

Re: [R] readLines() and unz() and non-empty final line

2024-10-24 Thread Iris Simmons
Hi Mikko, I tried running a few different things, and it seems as though explicitly using `open()` and opening a blocking connection works. ```R cat("hello", file = "hello.txt") zip("hello.zip", "hello.txt") local({ conn <- unz("hello.zip", "hello.txt") on.exit(close(conn)) ## you ca