Skip to contents

Evaluate whether a semantically enriched observational vector can be coerced into stricter semantic representations.

Usage

semantic_stabilisation(x)

semantic_stabilization(x)

Arguments

x

A semantically enriched vector, typically a prelabelled vector.

Value

A named list containing:

valid

Logical. TRUE if coercion succeeded.

message

Diagnostic warning or error message, if any.

Details

The function currently evaluates whether a vector with provisional semantic overlays can be represented as a labelled::labelled() vector.

Semantic stabilization is interpreted progressively:

  • observational vectors preserve raw observed values;

  • prelabelled vectors attach provisional semantic overlays;

  • stricter semantic representations may require additional semantic normalization or stabilization.

The function therefore does not evaluate semantic correctness, but rather structural readiness for coercion into stricter semantic representations.

Examples

x <- prelabel(
  c("r", "png", "csv"),
  labels = c(
    r = "source_code",
    png = "visualisation",
    csv = "tabular_data"
  )
)

semantic_stabilisation(x)
#> $valid
#> [1] TRUE
#> 
#> $message
#> NULL
#>