| lib_metadata_name_lookup | R Documentation |
lib_metadata_name_lookup() returns the default editable rules used to
merge synonymous metadata columns. lib_clean_name() converts names to
lowercase underscore form. lib_clean_metadata() cleans table names and
coalesces columns that map to the same canonical name.
lib_metadata_name_lookup(
...,
regex = NULL,
defaults = TRUE,
match_without_underscores = TRUE,
match_singular_plural = TRUE
)
lib_clean_name(x)
lib_clean_metadata(
x,
name_lookup = lib_metadata_name_lookup(),
clean_values = FALSE
)
... |
named character vectors of exact aliases, where each argument name
is the canonical name, or data.frame/data.table rule tables with
|
regex |
an optional named character vector or named list of regular expressions. Names identify the canonical metadata names. |
defaults |
logical; whether to include OpenSpecy's default semantic aliases before merging user rules. |
match_without_underscores |
logical; whether names that differ only by underscores should match automatically. |
match_singular_plural |
logical; whether names that differ only by one
terminal |
x |
a character vector of names for |
name_lookup |
a table returned by |
clean_values |
logical; whether |
Exact rules determine a column's target before automatic matching that can
ignore underscores and a single terminal plural s. When values are
coalesced, canonical and mechanically equivalent canonical names come before
semantic aliases. Regular-expression rules are applied last to names that
remain unmatched. Regex patterns are evaluated against names after
lib_clean_name() has been applied.
Matching options selected in lib_metadata_name_lookup() are stored
with the returned table and used by lib_clean_metadata(). User rules
supplied through ... are merged with the defaults. Set
defaults = FALSE to construct a lookup from only user rules.
lib_metadata_name_lookup() returns a data.table of rules.
lib_clean_name() returns a character vector.
lib_clean_metadata() returns a data.table with cleaned, coalesced
columns.
lib_clean_name(c("User Name", "Laser (%)", "Method...3"))
name_lookup <- lib_metadata_name_lookup(
project_code = "campaign name",
regex = list(instrument_mode = "^method_[0-9]+$")
)
metadata <- data.frame(
UserName = c("A", NA),
user_name = c(NA, "B"),
Campaign.Name = c("one", "two"),
Method.23 = c("ftir", "raman")
)
lib_clean_metadata(metadata, name_lookup)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.