I have the following dataframe of all factors:
A B C D
1 0 0 0 0
2 1 1 1 1
3 1 0 0 2
4 0 1 1 3
5 1 0 1 1
6 1 0 0 3
I want to convert all columns that are binary and a factor to numeric (which are columns A ,B, and C). How can I do this?
I tried this as a start just for 1/2 of the logic..
df %>% dplyr::mutate(across(where(is.factor), numeric))
But i get this error:
Error: Problem with `mutate()` input `..1`. ℹ `..1 = across(where(is.factor), numeric)`. x invalid 'length' argument Run `rlang::last_error()` to see where the error occurred.