search for: raw2double

Displaying 1 result from an estimated 1 matches for "raw2double".

2005 Mar 23
0
Looking for function for Double to raw to double conversions
...ortunately I can not find equivalent function in R. Simple minded: doubleVec = (1:4)*pi rawVec = as.raw(doubleVec) as.double(rawVec) Does not seem to 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...