Just in case someone else needs it, for the second bit of the code provided by the user, this would be the correction:
From:
mutate_all(~na_if(.,""))
To:
mutate_all(~na_if(as.character(.),""))