Hi, I've read up on readBin() and chapter 6 in the R Data Import/Export manual, but I still can't read a binary file. Here is how the creator of the file described the code that would be needed in Fortran:
"Every record has a return in fortran. The length of each record is nx*ny*4. To read you would use the following: nlayx = nx*ny*4 do iz=1,nz,4 read(binary file) var(1:nlayx) enddo nrest=mod(nx*ny*nz,nlayx) read(binary file) var(1:nrest)" The first value in the file should be 0.05, and all of the data values are real. Here is what I get (with similar answers using double): > v<-readBin("plotb.251", numeric(), size=4, n=1) > v [1] 1.614296e-39 > v<-readBin("plotb.251", numeric(), size=4, n=1, endian="swap") > v [1] 1.359775e-38 Platform is Intel Linux. How can I read the file described above? Thanks, Scott Waichler, PhD Hydrology Group, Energy & Environment Directorate Pacific Northwest National Laboratory scott.waich...@pnnl.gov ______________________________________________ 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.