Re: [R] wrtiteBin in conjunction with seek : the position in the file is not good when writing

2024-05-21 Thread Laurent Rhelp
It works !! Thank you VERY much because I didn't understand the rw argument for the seek command and endeed it is explained: File connections can be open for both writing/appending, in which case*R*keeps separate positions for reading and writing. Which|seek|refers to can be set by

Re: [R] wrtiteBin in conjunction with seek : the position in the file is not good when writing

2024-05-21 Thread Ivan Krylov via R-help
В Tue, 21 May 2024 11:29:33 +0200 Laurent Rhelp пишет: > pos <- seek(con_in,2,origin="start") > # We have to repeat the command to return the good amount of read > # bytes > print(paste0("pos is not equal to 2, pos = ",pos)) That's because seek() returns the previous position ("before any

[R] wrtiteBin in conjunction with seek : the position in the file is not good when writing

2024-05-21 Thread Laurent Rhelp
Dear RHelp-list,  I want to write at a specific position in a file without reading all the file because it is very large and I cannot read it in my RAM. But I miss something about the use of the command writeBin in conjunction with seek. In the example bellow the seek commands works well with