apologies if this is a simple solution I'm still new to R
I have a dataset that has some columns containing both strings and numbers (https://i.stack.imgur.com/MjzvI.png)
I'd like to convert all of the "-" and "&" string values into -998 and -999 respectively as numeric values but cannot find a solution that achieves this
I've tried doing
df[df=="-"] = -998
df[df=="&"] = -999
but I receive
"Error in vec_equal()
:
! Can't combine ..1
and ..2
."
I've also tried putting "-998" into quotes thinking I'd be able to convert it into numeric from there but still received the same error, same thing for using the "which" function