Learn R Programming

⚠️There's a newer version (0.1.3) of this package.Take me there.

ctypesio (version 0.1.2)

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.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Mike Cheng

Last Published

January 18th, 2025

Functions in ctypesio (0.1.2)

set_endian

Tag a connection with the preferred endianness
set_eof_check

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

Write raw bytes
write_f64

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

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

Write UTF8 string
set_bounds_check

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

Print formatted strings to a connection
read_hex

Read bytes as hexadecimal strings
aperm_array_to_vector

Permute an R array to a linear vector of data
read_raw

Read raw bytes
scan_dbl

Read values encoded as characters strings
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
flip_endian

Flip the endianness of elements in a vector
read_str

Read a character string from a connection
ctypesio-package

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

Write hexadecimal string as raw bytes
read_uint8

Read integer data from a connection
read_f64

Read floating point values from a connection
aperm_vector_to_array

Permute a linear vector of data into an R array
set_na_check

Check for NAs in values before writing