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
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
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
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
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?
&
I had something like this problem where the program read files but some files
would be missing the last line of data. My solution was to write another
program that looked at the files and if a file did not end in a line feed to
add one. Possibly a bit primitive, but it worked.
Regards,
Tim
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
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
8 matches
Mail list logo