
Dear R Users:
 
I have race-ethnicity groups identified in the factor variable Ethnic_G.
 
I need to collapse Ethnic_G into a new variable with only two factors, 1 (White, non-Hispanic) and 2 (Minority).
 
As seen in the code and output below, the recoded race-ethnicity variable is put into logical format, not factor format.
 
I've used library(car) and the package was updated.
 
Any ideas on how to fix this problem would be apprecidated.
 
Thanks in advance!
 
Best wishes.
 
Tom 
> #####################################################################> # Task - recode Ethnic_G into two breakout groups, White-non-Hispanic> #        and Other> class(Ethnic_G)[1] "factor"> print(Ethnic_G) [1] B A I U W W B W H W N W W B A B H W A H W B I N ILevels: A B H I N U W> Ethnic_G.Character <- as.character(Ethnic_G)> class(Ethnic_G.Character)[1] "character"> print(Ethnic_G.Character) [1] "B" "A" "I" "U" "W" "W" "B" "W" "H" "W" "N" "W" "W" "B" "A" "B" "H" "W" "A" "H" "W" "B" "I" "N" "I"> Ethnic_G.Recode <- recode(Ethnic_G.Character, "c(W)='1'; else='2'",+   as.factor.result=TRUE)> class(Ethnic_G.Recode)[1] "logical"> print(Ethnic_G.Recode) [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA> #####################################################################


_________________________________________________________________
Watch “Cause Effect,” a show about real people making a real difference.

	[[alternative HTML version deleted]]


