Learn R Programming

ctypesio (version 0.1.3)

Read and Write Standard 'C' Types from Files, Connections and Raw Vectors

Description

Interacting with binary files can be difficult because R's types are a subset of what is generally supported by 'C'. This package provides a suite of functions for reading and writing binary data (with files, connections, and raw vectors) using 'C' type descriptions. These functions convert data between 'C' types and R types while checking for values outside the type limits, 'NA' values, etc.

Copy Link

Version

Install

install.packages('ctypesio')

Monthly Downloads

211

Version

0.1.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Mike Cheng

Last Published

July 28th, 2025

Functions in ctypesio (0.1.3)

read_raw

Read raw bytes
write_f64

Convert values to the given type and write to a connection
set_na_check

Check for NAs in values before writing
set_bounds_check

For this connection, set the response when values do not fit into given type before writing.
scan_dbl

Read values encoded as characters strings
write_uint8

Convert values to the given type and write to a connection
set_endian

Tag a connection with the preferred endianness
set_integer_promotion

Tag a connection with the preferred integer promotion method for types larger that R's integer type i.e. uint32, uint64, int64
write_raw

Write raw bytes
set_eof_check

Set EOF (End-of-file) handling for this connection
write_utf8

Write UTF8 string
write_hex

Write hexadecimal string as raw bytes
aperm_vector_to_array

Permute a linear vector of data into an R array
read_hex

Read bytes as hexadecimal strings
read_uint8

Read integer data from a connection
fprintf

Print formatted strings to a connection
read_str

Read a character string from a connection
read_f64

Read floating point values from a connection
ctypesio-package

ctypesio: Read and Write Standard 'C' Types from Files, Connections and Raw Vectors
flip_endian

Flip the endianness of elements in a vector
aperm_array_to_vector

Permute an R array to a linear vector of data