I have to decode raw vectors read from a connection like this: +++++++++++++++++++ fl<-file.choose() fb<-file.info(fl)$size
fc<-file(fl) open(fc,open='rb') seek(fc,where=offset) dat<-readBin(fc,'raw',n=(fb-offset),size=1,signed=FALSE) close(fc) ++++++++++++++++++ The decoding performs a combination of a simple bitwise operator and a simple arithmatic operator on every other byte in the raw vector dat. I can code this using a for loop (incrementing the loop counter by 2 every pass) but would rather use vectorized operations for reasons of speed. I can create a function with a for loop and vectorize that function but is there perhaps an easier way to write this? It is enough if this works on windows only. No need to worry about endianness. Thanks in advance. Alex van der Spek ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.