I cannot provide a reproducible example without sharing private data. Since I do not know why this happens I cannot imitate data to reproduce either.
I have a dplyr transformation on a data frame:
combined_grp <- combined %>%
mutate(temp = 1) %>%
pivot_wider(names_from = TTI_Bin_John,
names_prefix = "TTI_",
values_from = temp,
values_fn = as.numeric,
values_fill = list(temp = 0))
This returns a warning:
Warning message:
Values in `temp` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(temp = list)` to suppress this warning.
* Use `values_fn = list(temp = length)` to identify where the duplicates arise
* Use `values_fn = list(temp = summary_fun)` to summarise duplicates
I tried mutating the output columns by adding this at the end of the block above:
%>% mutate_at(vars(matches("TTI_(<|>)")), as.numeric)
But this throws an error:
Error in values_fn[[value]] : object of type 'builtin' is not subsettable
Does anyone recognize this error or how I can get around it so that the new features that were pivoted wider are numeric and not lists?