something curious happens when applying summarise or mutate, where the class of the data changes.
No errors, the outcome class is OK
# Packages
require(NHANES, # the dataset
tidyverse)
# the dataset
data(NHANES)
# example, no errors
NHANES %>%
group_by(Gender) %>%
summarise(across(c("Age", "Pulse"),
list(mean, min, max), na.rm = T))
The outcome
I'm trying to make the numbers have one decimal place. So, when
# example, errors, some columns are CHR now
NHANES %>%
group_by(Gender) %>%
summarise(across(c("Age", "Pulse"),
list(mean, min, max), na.rm = T)) %>%
mutate(across(is.numeric, format, 1))
some columns are CHR instead their original class
is this a bug or a feature?