View source: R/decimal-places.R
decimal_places_df | R Documentation |
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.
decimal_places_df(
data,
cols = everything(),
check_numeric_like = TRUE,
sep = "\\."
)
data |
Data frame. |
cols |
Select columns from |
check_numeric_like |
Logical. If |
sep |
Substring that separates the mantissa from the integer part.
Default is |
Data frame. The values of the selected columns are replaced by the numbers of their decimal places.
Wrapped functions: decimal_places()
, dplyr::across()
.
# 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.