[R] readLines on open connection reads only first write on MacOS

2024-10-28 Thread martin gregory via R-help
I was using readLines to read data from a file which is being written to by another process. readLines documentation says "If the connection is open it is read from its current position". With R 4.4.1 on Linux 5.15.160 this is true but does not seem to be the case as far as R 4.4.1 on MacOS 12.7

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

2024-10-28 Thread Marttila Mikko via R-help
Hi, That’s curious. Isn’t the point of non-blocking connections that you keep them open across multiple read calls? So why would it be useful to default-open unz() as non-blocking only to close it again? The most similar connection type to unz() seems to me to be gzfile() which is opened as block

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

2024-10-28 Thread Marttila Mikko via R-help
Hi Kimmo, Thanks, scan() does indeed seem to work for just reading lines, at least with the following options: scan(what = character(), sep = "\n", na.strings = "", quiet = TRUE) However, I can't say I'm confident I didn't forget some option for an edge case; and it's a bit of a mouthful.