I would like to change the datatypes of a bunch of variables from character to numeric and was trying to use the following for variables 4 all the way to 21:
df <- df%>% mutate_at(vars(4:21), ~(as.numeric))
and I get the following error:
Error: Problem with
ACT 2008. x Input
ACT 2008 must be a vector, not a primitive function. i Input
ACT 2008 is
(structure(function (..., .x = ..1, .y = ..2, . = ..1) ....
Then I tried the following - it doesn't show any error. but the datatype is not changed. Some of the variables start with ACT and some with FC like ACT 2008 and FC 2020:
df <- df%>% mutate_at(vars(contains("ACT|FC")), ~(as.numeric))
How can I change several of these variables to numeric?
Thanks for your help!