I would like to transform a string into a number. This is my code:
test <- starwars home <- test$homeworld home <- as.numeric(home) but I have this error:
Error: 'list' object cannot be coerced to type 'double' My goal is to assign a number to every homeworld. Obviously the lines with the same homeworld will have the same number assigned.
How can I fix my code?