decimal_places_df {scrutiny} | R Documentation |
Count decimal places in a data frame
Description
For every value in a column, decimal_places_df()
counts its decimal places.
By default, it operates on all columns that are coercible to numeric.
Usage
decimal_places_df(
data,
cols = everything(),
check_numeric_like = TRUE,
sep = "\\."
)
Arguments
data |
Data frame. |
cols |
Select columns from |
check_numeric_like |
Logical. If |
sep |
Substring that separates the mantissa from the integer part.
Default is |
Value
Data frame. The values of the selected columns are replaced by the numbers of their decimal places.
See Also
Wrapped functions: decimal_places()
, dplyr::across()
.
Examples
# Coerce all columns to string:
iris <- iris %>%
tibble::as_tibble() %>%
dplyr::mutate(across(everything(), as.character))
# The function will operate on all
# numeric-like columns but not on `"Species"`:
iris %>%
decimal_places_df()
# Operate on some select columns only
# (from among the numeric-like columns):
iris %>%
decimal_places_df(cols = starts_with("Sepal"))
[Package scrutiny version 0.4.0 Index]