
Drop units attribute and class.
drop_units(x)
an object with units metadata.
the numeric without any units attributes, while preserving other attributes like dimensions or other classes.
Equivalent to units(x) <- NULL
, or the pipe-friendly version
set_units(x, NULL)
, but drop_units
will fail if the object has
no units metadata. Use the alternatives if you want this operation to succeed
regardless of the object type.
# NOT RUN {
x <- 1
y <- set_units(x, m/s)
# this succeeds
drop_units(y)
set_units(y, NULL)
set_units(x, NULL)
# }
# NOT RUN {
# this fails
drop_units(x)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab