Displaying 1 result from an estimated 1 matches for "sec00".
Did you mean:
ec00
2005 Nov 27
5
creating a factor from other factors and ifelse
Hi,
Given
> sec98 <- factor(rep(1:2,3), labels=c("A", "B"))
> sec99 <- factor(rep(2:1,3), labels=c("A", "B"))
> sec99[c(2,5)] <- NA
> sec00 <- factor( c( rep(1,3), rep(2,3) ), labels=c("A", "B"))
> sec00[c(2,4)] <- NA
> sec1 <- ifelse(!is.na(sec99), sec99,
ifelse(!is.na(sec00), sec00, NA ))
We get
> sec1; class(sec1)
[1] 2 NA 2 1 2 1
[1] "integer"
I wonder why sec1 as a...