matter-types: Data Types for "matter" Objects

matter-typesR Documentation

Data Types for “matter” Objects

Description

The matter package defines a number of data types for translating between data elements stored in virtual memory and data elements loaded into R. These are typically set and stored via the datamode argument and slot.

At the R level, matter objects may be any of the following data modes:

  • raw: matter objects of this mode are typically vectors of raw bytes.

  • logical: matter object represented logical vector in R.

  • integer: matter objects represented as integer vectors in R.

  • numeric: matter objects represented as double vectors in R.

  • character: matter objects representated as character vectors in R.

  • list: Not used. This type exists for inferring conversions between R types and C types, but matter_list objects instead report the types of their elements.

In virtual memory, matter objects may be composed of atomic units of the following data types:

  • char: 8-bit signed integer; defined as char.

  • uchar: 8-bit unsigned integer; used for ‘Rbyte’ or ‘raw’; defined as unsigned char.

  • int16: 16-bit signed integer; defined as int16_t. May be aliased as ‘short’ and ‘16-bit integer’.

  • uint16: 16-bit unsigned integer; defined as uint16_t. May be aliased as ‘ushort’ and ‘16-bit unsigned integer’.

  • int32: 32-bit signed integer; defined as int32_t. May be aliased as ‘int’ and ‘32-bit integer’.

  • uint32: 32-bit unsigned integer; defined as uint32_t. May be aliased as ‘uint’ and ‘32-bit unsigned integer’.

  • int64: 64-bit signed integer; defined as int64_t. May be aliased as ‘long’ and ‘64-bit integer’.

  • uint64: 64-bit unsigned integer; defined as uint64_t. May be aliased as ‘ulong’ and ‘64-bit unsigned integer’.

  • float32: 32-bit float; defined as float. May be aliased as ‘float’ and ‘32-bit float’.

  • float64: 64-bit float; defined as double. May be aliased as ‘double’ and ‘64-bit float’.

While a substantial effort is made to coerce data elements properly between data types, sometimes this cannot be done losslessly. Loss of precision is silent, while values outside of the representable range will generate a warning (sometimes many such warnings) and will be set to NA if available or 0 otherwise.

Note that the unsigned data types do not support NA; coercion between signed integer types attempts to preserve missingness. The special values NaN, Inf, and -Inf are only supported by the floating-point types, and will be set to NA for signed integral types, and to 0 for unsigned integral types.


kuwisdelu/matter documentation built on Dec. 8, 2024, 8:09 p.m.