[R] Write signed short into a binary file

L.Nanetti at med.umcg.nl L.Nanetti at med.umcg.nl
Mon Aug 28 15:34:50 CEST 2006


I'm using R 2.3.1 on WinXPsp2, 32 bit
What I want to do is to write a signed short integer (16 bit) (actually, a sequence of them) into a binary file.
I'm trying with writeBin, but the "what" clause is not supported, and an integer is 4 bytes long, nor it seems to exist something like as.int (coerce doesn't know the "int" type).
My workaround until now has been to use python to write a binary files containing my values, open that file in "rb" mode, reading it using "raw" data, and thus writing values in my file.
But of course, this workaround is poorly satisfactory...any ideas?
Thank you in advance,
Luca Nanetti



More information about the R-help mailing list