function to raise when NAs
are produced.
coerce_safe
transform the object
to class
in a safe, consistent,
non-destructive way.
Safe means that coercison:
is non-destructive (i.e information is not lost in the transformation )
is reversible: $$ f^{-1}( f(x) ) == x $$
does not introduce (additional) missing values (NA
)
By default, corece_safe
raises an alert (message|warning|error)
when the attempted coercion violates these constraints. The alert
argument (and alert_irreversible
or alert_na
) can be used
to fleixble change the response. Valid values for these are
base::message()
, base::warning()
and base::stop among others.