Displaying 1 result from an estimated 1 matches for "double2raw".
Did you mean:
double2a
2005 Mar 23
0
Looking for function for Double to raw to double conversions
...o work (output: 3 6 9 12, instead of: 3.141593 6.283185
9.424778 12.566371) .
The only way I figured out how to do it is by using:
raw2double = function(x)
{
writeBin(as.raw(x), "temp.bin")
return( readBin("temp.bin", "double", n=length(x)%/%8) )
}
double2raw = function(x)
{
writeBin(as.double(x), "temp.bin")
return( readBin("temp.bin", "raw", n=length(x)*8) )
}
Than:
rawVec = double2raw(doubleVec)
raw2double(rawVec)
Gives correct results.
Is there any other way that does not use temporary files to do th...