Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = read.table(textConnection("State Region
- Vermont Northeast
- Alabama South
- Iowa Midwest
- Nevada West
- Oregon Northwest"), header=T)
- levels(x$Region)
- ##[1] "Midwest" "Northeast" "Northwest" "South" "West"
- ## Some magic happens
- levels(x$Region)
- ##[1] "Northeast" "South" "Midwest" "West" "Northwest"
- x$Region = as.factor(x$Region, levels=c("Northeast", "South", "Midwest", "West", "Northwest")
Add Comment
Please, Sign In to add comment