Skip to content
Prev 171786 / 398503 Next

R question - combine values

Hi: John Fox's recode function in his car package provides a convenient 
way for doing what
you need. I don't know what your factor is specifically but below is 
mostly taken out
of the help for "recode" and shows how to take a factor and recode it to 
make it a new
factor. you can apply that for your particular problem.

x <- gl(3,3,length=9)
print(x)
print(str(x))

temp <- recode(x,"1:2 = 'A'; 3 = 'B'")
print(temp)
print(str(temp))
On Wed, Feb 25, 2009 at 10:33 PM, choonhong ang wrote: