'list' object cannot be coerced to type 'double'
Steviey opened this issue · 1 comments
Steviey commented
What could be wrong with this:
df <- tibble(
factors_col = factor(c("A", "B", "C")),
characters_col = c("Apple", "Banana", "Cherry"),
numbers_col = c(1, 2, 3)
)
#df <-df %>% dplyr::mutate(across(where(is.factor),as.numeric))
df <-collapse::settransform(df,get_vars(df, function(x) is.factor(x)) %>%
as.numeric())
glimpse(df[1:2,])
Error in get_vars(df, function(x) is.factor(x)) %>% as.numeric() :
'list' object cannot be coerced to type 'double'
Steviey commented
df <-df %>% collapse::fmutate(across(is.factor,list(as.numeric)))