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

2024-10-25 Thread Marttila Mikko via R-help
Thanks Iris, Bert, and Tim. Whether unz() is blocking or not by default doesn’t seem to be documented. Indeed, thank you Iris for finding out that explicitly opening it as blocking would work. That made me wonder if it’s non-blocking by default then, which would have been surprising. However, e

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
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 FALSE: https://github.com/wch/r-source/blob/0c26529e807a9b1dd65f7324958c17bf72e1de1a/

Re: [R] Outputting a difftime object in PASTE or AS.CHARACTER is missing the unit + expand the format options?

2024-10-25 Thread Rui Barradas
Às 09:11 de 23/10/2024, Reuver, B de (epi) via R-help escreveu: Hello, I was working on an R script using the datediff object, to log certain durations in the data processing. I ran in to the issue that outputing a datediff object using PASTE will leave out the time unit by default. When you

[R] Outputting a difftime object in PASTE or AS.CHARACTER is missing the unit + expand the format options?

2024-10-25 Thread Reuver, B de (epi) via R-help
Hello, I was working on an R script using the datediff object, to log certain durations in the data processing. I ran in to the issue that outputing a datediff object using PASTE will leave out the time unit by default. When you paste() or as.character() a datediff object it only outputs the n

Re: [R] OSX-specific Bug in randomForest

2024-10-25 Thread Martin Maechler
> "pd" == peter dalgaard > on Thu, 24 Oct 2024 11:00:25 +0200 writes: pd> This is probably Apple Silicon specific, not OSX per se: >> sum(rep(1 / 9, 9)) - 1 pd> [1] 0 >> On 23 Oct 2024, at 07:26 , Stevie Pederson >> wrote: >> >> sum(rep(1 / 9, 9)) - 1 #

[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"