test <- data.frame(homeworld = c(4000, 30000, 0),
work = c("relaxwork", "stresswork", "lazy"),
starhours = c(30, 60, 0))
home <- test$homeworld
class(test$homeworld)
#THAT´S NUMERIC, OK!
...........x........x...........
#But if you want to transform to factor:
test$homeworld <- as.factor(as.numeric(test$homeworld))
class(test$homeworld)