Learn R Programming

bitfield (version 1.0.0)

.assessEncodingQuality: Assess encoding quality

Description

Internal function to analyze data and compute quality metrics for encoding. This function is used both by bf_analyze for user-facing analysis and by bf_map to store quality metrics in the provenance.

Usage

.assessEncodingQuality(
  values,
  type,
  enc = NULL,
  isRaster = FALSE,
  rasterLevels = NULL,
  range = NULL,
  decimals = NULL,
  max_bits = 16L,
  fields = NULL,
  errorOnAllNA = FALSE
)

Value

list of quality metrics appropriate for the encoding type. For float without specific enc, returns a list with data summary and results data.frame.

Arguments

values

vector of values to assess (will be cleaned of NAs internally)

type

encoding type ("bool", "enum", "int", "float")

enc

list with encoding parameters (sign, exponent, significand, bias). If NULL (for bf_analyze), type-appropriate defaults or multiple configs are tested.

isRaster

logical, whether data comes from a SpatRaster (enum only)

rasterLevels

data.frame with raster attribute table (enum only)

range

optional target range c(min, max) for float analysis

decimals

optional decimal precision for float comparison

max_bits

maximum total bits to consider (default 16)

fields

optional list specifying which exp/sig configurations to analyze (float only)