| prelabel | R Documentation |
prelabel() applies lightweight semantic mappings to a vector
before formal definition with defined().
prelabel(x, labels, unmatched = "keep", missing_label = "<NA>")
is.prelabelled(x)
x |
A vector. |
labels |
Candidate semantic mappings describing provisional semantic assertions.
|
unmatched |
Behaviour for unmatched observational values. One of:
|
missing_label |
Semantic assertion used internally for missing observational values. |
The prelabelled class is intended for:
provisional harmonisation;
contextual grouping;
lightweight classification;
semantic preprocessing workflows.
Unlike defined(), prelabel() does not enforce
formal semantic definitions, namespaces, or units.
Semantic mappings may be supplied as:
named vectors;
named lists;
two-column data frames.
These mappings are normalised internally with
as_value_key().
is.prelabelled() tests if a vector inherits the prelabelled class.
prelabelled vectors intentionally separate:
observational evidence;
semantic operationalisation;
contextual semantic refinement.
The original observational values remain unchanged while semantic assertions may evolve through iterative refinement workflows.
Semantic operationalisation is provided with:
as.character() for lightweight semantic coercion;
as_character() for provenance-preserving semantic
workspaces.
A vector with:
class "prelabelled";
attached provisional semantic vocabulary stored in the
"prelabel" attribute.
x <- c("R","png", "csv", "unknown")
extension_map <- c(
R = "functional_programming",
png = "visualisation",
csv = "tabular_data"
)
x <- prelabel(x, labels = extension_map)
x
is.prelabelled(x)
as.character(x)
semantic_workspace <- as_character(x)
attributes(semantic_workspace)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.