On Mar 7, 2012, at 7:11 AM, Berend Hasselman wrote:
On 07-03-2012, at 12:09, RMSOPS wrote:
Good Day,
I have a small question, I think it is simple to solve,
I have a column with the following records
name
saucer
cup
tea
saucer
saucer
I assume that name is a column header. Otherwise the following makes
no sense.
what is the quickest way to create a new column codes
1
1
3
1
1
I assume that the second 1 here is actually intended to be a 2.
Maybe:
as.numeric(factor(x,levels=(c("saucer","cup","tea"))))
Oh, what the heck. I will add yet a third guess .... that you wanted:
table(name)
--
David Winsemius, MD
West Hartford, CT
______________________________________________
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.