first day in here and already a question. I have a problem quite similar to this:
(SOLVED: Recode variable from text to numbers)
I found that in here on my quest for a solution.
But unlike the original User, my data contains also free text strings, which i want to recode with a certain number. So my Data looks like
Data$Variable <- c(Germany, Switzerland, Bolivia, Togo,...)
and i want to recode it like
"Germany"=1, "Switzerland"=2 ...
but, here's the thing: Bolivia, Togo and some other more exotic Countries should get assigned the Number "3".
I have solved the recoding/mutating part, but i can't find a appropriate expression for "all the rest"=3.
I have tried several if-then-else or dplyr::ifelse constructions, but those didn't work out. Mainly because i'm confused by logical arguments, vectors, data frames and all that stuff.
So, my question is: is there an expression for "all other values" or how can i solve it in another fashion?
I'm quite new to R and RStudio (as you can tell from my question) and i hope helping me isn't too boring...