you could use chickwts$feed<- as.numeric(levels(chickwts$feed))[as.integer(chickwts$feed)] I got this by searching archives of old messages. I can't recall why the simpler as.numeric(chickwts$feed) is not an appropriate all around solution. -- "I like nonsense, it wakes up the brain cells. Fantasy is a necessary ingredient in living, it's a way of looking at life through the wrong end of a telescope. Which is what I do, and that enables you to laugh at life's realities." - Dr. Suess
________________________________ From: r-help-boun...@r-project.org on behalf of schung Sent: Wed 5/6/2009 10:55 AM To: r-help@r-project.org Subject: [R] changing variables in a dataset Hi! I just quasi-learned how to use R and I'm trying to change the feed from horsebean, linseed, etc to 1, 2, 3, etc The dataset I'm practicing on is pre-loaded in R data(chickwts) chickwts Any help is much appreciated!! Thank you!! -- View this message in context: http://www.nabble.com/changing-variables-in-a-dataset-tp23407765p23407765.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.