Henrik Bengtsson wrote: > > > 1. Use x <- readBin(..., what="raw", n=35269*(54*4)) to read your raw > ("byte") data. > 2. Turn it into a 54x4x35269 array, e.g. dim(x) <- c(54,4,35269). > 3. Extract the 4-byte time stamps by yT <- x[1:4,,,drop=FALSE]; This > is of type "raw". Use readBin() to parse it, i.e. zT <- readBin(yT, > what="integer", size=4, signed=TRUE, endian="big"). There are your > timestamps. > 4. Extract the 50 1-byte samples by yS <- x[5:54,,,drop=FALSE]; zS <- > readBin(yS, what="integer", size=1, signed=FALSE); > > Something like that. > > /Henrik > Tried it and it works great. I had to make just one adjustment, i.e. specify the size of n, which I did using length:
yT <- x[1:4,,,drop=FALSE] zT <- readBin(yT, what="integer", size=4, n=length(yT), signed=FALSE, endian="big") yS <- x[5:54,,,drop=FALSE]; zS <- readBin(yS, what="integer", size=1, n=length(yS), signed=TRUE) Thanks Henrik! -- View this message in context: http://r.789695.n4.nabble.com/readBin-which-has-two-different-sizes-tp2953365p2953721.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.