similar to: reading binary file with different modes

Displaying 20 results from an estimated 10000 matches similar to: "reading binary file with different modes"

2004 Mar 17
1
reading short int and float from binary connection
Hi, I have a binary file with mixture of short integers (2 bytes) and floats (4 bytes). To get the data into R I use readBin reading each value one at a time (n=1) but it is giving me headaches, two questions: -In the "what" option is there any difference between "integer" and "int"? -To read the short int I use what="int" and size=2 and to read the
2009 Dec 17
1
Problem reading binaries created with fortran (More infos)
The structure of the file is clear (see below) the first line is made of integers and doubles with the fifth being a text string followed by arrays of double precision number.: int1 int2 double1 double2 text int3 int4 int5 (array of double) here is an example of file: 1 1 1.0 1.0 "HEAD" 160 224 3 23.4 34.5 ...... I tried to read the first line with readBin (results are copied below):
2006 Nov 07
1
reading VERY large binary files
Hello, I am trying to read in elements out of a very large binary file ... the total file is 4 gigs. I want to select rows out of the file, and the current procedure I run works but is prohibitively slow (takes more than a day to run and still won't complete). Is there any faster way to accomplish this? My current procedure looks like this: readHH <- function(file_name,
2009 Feb 11
1
Reading Binary Files
Hello I'm encountering some difficulty correctly reading binary files. The binary files store data as "short" rather than "double" , "int", or any of the other modes of the vector being read. The data represents a regular grid of size 419 rows by 264 columns, to make it more interesting, the data are daily records, for a total of 37 years. The file size is
2009 May 18
2
readBin on binary non-blocking connections (Windows & Unix differences/bugs)
R-devel: I am encountering a consistency issue using socketConnection and readBin with *non-blocking* connections on Unix and Windows XP (no Vista to test). I am a bit confused by the behavior of *non-blocking* connections under Windows specifically. When calling readBin on a non-blocking connection when there is no data to read on the socket, the connection under Unix will return a vector of
2010 Mar 25
1
RODBC : reading binary data from a TXT field belonging to a PostgeSQL table
Dear R-List, I am working with binary data that I want to store in a PostgreSQL DataBase. I decided to use a TXT field. I read my binary file with readBin function, I succeed in my data storage in the database but I have some trouble to extract the data : the correct amount of bytes is stored in the TXT field but when I access to the data, the extracted dataframe is truncated !
2004 Jun 01
2
Importing binary data
Hi everybody! I've a large dataset, about 2 Mio entries of the format which I would like to import into a frame: <integer><integer><float><string><float><string><string> Because to the huge data amount I've choosen a binary format instead of a text format when exporting from Matlab. My import function is attached below. It works fine for only
2012 Jun 12
1
Reading binary files
Hey guys, I am currently trying to read in a binary file using this helpful manual: http://www.ats.ucla.edu/stat/r/faq/read_binary.htm Reading binary files I also have the detailed format description from the developer. But somehow the reading of the file does still not work properly. The first entry in the file is the following, according to the manufacturer: "String containing 4 one-byte
2009 Nov 25
3
Test Binary File
I've got an error with the way I'm using readBin on a binary file of unknown internal structure. I know the structure consists of rows and columns, but I'm not sure how many of each. So, does anyone know of a valid test set of binary data that I could reference while trying to figure out the technique of using readBin? It would be really helpful to try out readBin on a readily
2008 Aug 22
2
How I can read the binary file with "different type"?
Hi all, I have a binary file which have 8*100 bytes. The structure of the file is as follows: every eigth bytes represent 2 data:the first four bytes is the little-endian for integer, the next four bytes is the little-endian for floating32. The structure of the following bytes is as the same as the first eight bytes'. As the function readBin only read the binary file with one structure
2001 Feb 15
2
Reading single precision floats from binary file
Dear all, I have a few files with binary data written by a C program a friend wrote. I allready have program to read these files, Thomas Lumley and Prof Brian D Ripley was kind enough to respond to a question to this list earlier with some code that works perfectly, so this is really no problem, it is more out curiousity. Most of my files consists of 40000 single precision floats, and I figured
2012 Apr 13
2
Can't read a binary file
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)
2012 Jun 19
1
seek(), skip by bits (not by bytes) in binary file
Hello, Has a function been built that will skip to a certain bit in a binary file? As of 2009 the answer was 'no': http://r.789695.n4.nabble.com/read-binary-file-seek-td900847.html https://stat.ethz.ch/pipermail/r-help/2009-May/199819.html If you feel I don't need to (like in the links above), please provide some help. (Note this is my first time working with binary files.) I'm
2009 Jun 24
1
Reading 4-byte float into R from binary file
A simple question, I hope.... I have a binary file format that I want to slurp into R using readBin. There are a couple of fields in the file that are 4-byte floats. Since R has no "float" data type (4-byte), I am wondering how to go about this task. I could simply do all the work in C, but the format is pretty simple, so I wanted to do it using just R. I did see as.single, but it
2008 Aug 21
2
skipping values when reading binary files
Hi, I would like to skip a preset number of values when reading in a binary file (readBin). Is there any way to do this? kind regards, and thanks in advance for the help. Pieter Beck [[alternative HTML version deleted]]
2011 Sep 01
4
readBin fails to read large files
Posting for a friend Begin forwarded message: From: "Geier, Florian" <florian.geier08@imperial.ac.uk<mailto:florian.geier08@imperial.ac.uk>> Subject: Fwd: readBin fails to read large files Date: September 1, 2011 4:10:53 PM GMT+01:00 To: Begin forwarded message: Date: 1 September 2011 16:01:45 GMT+01:00 Subject: readBin fails to read large files Dear all, I am trying
2002 Jun 18
3
Maybe a problem in binary read/write (PR#1688)
Full_Name: Johnny Accot Version: 1.5.1 OS: Linux Submission from: (NULL) (198.4.83.52) Hi. I'm having a problem with the binary read/write functions. I'm writing a device driver in R (why not?) and of course I have to send a couple commands to the device. Typically, I send one byte, receive one acknowledgement byte, send another byte, receive an ACK, and so on. At least this is what
2002 Mar 05
3
reading 2-byte integers using readBin and connections
Hi folks: This may be a stupid question, but I cannot seem to find a way to tell readBin that I want to read 2-byte integers from the connection. The input file is 150,720 bytes long containing 75,360 short (2-byte) integers. But specifying "integer" or "int" for what in readBin only returns me a vector of length 37680, leading me to believe that sizeof(integer) or
2013 Mar 04
1
How to loop several binary files from two directories?
I have two binary files(rasters) with the same dimensions. The first file is called `over` and the second is `corr`. I want to replace values in `over` by `NA` whenever `corr` is greater than 0.5. to read the two files we can use: conne <- file("C:corr.bin","rb") over <- readBin(conne, numeric(), size=4, n=1440*720, signed=TRUE) frf <-
2011 Mar 29
2
Reading 64-bit integers
Dear all, I see from some previous threads that support for 64-bit integers in R may be an aim for future versions, but in the meantime I'm wondering whether it is possible to read in integers of greater than 32 bits at all. Judging from ?readBin, it should be possible to read 8-byte integers to some degree, but it is clearly limited in practice by R's internally 32-bit integer type: