I know that there is a function to convert binary data to string named rawToChar.but I wander is there any similar function for "Integer" and "float".I need to read some binary file in "integer" and "float" data. I can do this job in this way: (as below) first convert 4 byte raw to bits then pack bits back to "integer", but it not work for "float",I worry about the performance. raw4 = raw_buffer[1:4] bits = rawToBits(raw4) packBits(bits, type = "integer") Best wishes Really hope to get your response [[alternative HTML version deleted]]
See ?readBin - works also with raw objects. Henrik On Apr 3, 2013 1:18 AM, "Mike Chen" <chenminyi1984@gmail.com> wrote: I know that there is a function to convert binary data to string named rawToChar.but I wander is there any similar function for "Integer" and "float".I need to read some binary file in "integer" and "float" data. I can do this job in this way: (as below) first convert 4 byte raw to bits then pack bits back to "integer", but it not work for "float",I worry about the performance. raw4 = raw_buffer[1:4] bits = rawToBits(raw4) packBits(bits, type = "integer") Best wishes Really hope to get your response [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]