Displaying 2 results from an estimated 2 matches for "nosex".
Did you mean:
nose
2009 Jun 24
5
How to avoid ifelse statement converting factor to character
...;,..: 10 10 7 7 3 5 5 5 5
2 ...
$ SOCIAL_STATUS : Factor w/ 8 levels "A","B","D","E",..: 4 1 4 1 4 4 4 4 1
6 ...
$ COUNT_OF_GROUPS: num 1 1 1 1 1 3 3 3 1 2 ...
$ MALE : num 1 1 1 1 1 1 1 1 1 0 ...
$ FEMALE : num 1 0 1 0 1 1 1 1 0 0 ...
$ NOSEX : num 0 0 0 0 0 0 0 0 0 2 ...
$ UPLAND : num 0 0 0 0 0 0 0 0 0 0 ...
$ TAG : num 0 0 0 0 0 0 0 0 0 0 ...
> data$SOCIAL_STATUS<-ifelse(data$SOCIAL_STATUS=="B" & data$MALE>4, "C",
data$SOCIAL_STATUS)
> str(data)
'data.frame'...
2009 Jun 23
2
Problem with ifelse statement
...16 16 12 12
4 7 7 7 7 3 ...
$ SOCIAL_STATUS : Factor w/ 9 levels "","A","B","D",..: 5 2 5 2 5 5
5 5 2 8 ...
$ COUNT_OF_GROUPS: num 1 1 1 1 1 3 3 3 1 2 ...
$ MALE : num 1 1 1 1 1 1 1 1 1 0 ...
$ FEMALE : num 1 0 1 0 1 1 1 1 0 0 ...
$ NOSEX : num 0 0 0 0 0 0 0 0 0 2 ...
$ UPLAND : num 0 0 0 0 0 0 0 0 0 0 ...
$ TAG : num 0 0 0 0 0 0 0 0 0 0 ...
$ COMMENT : chr "" "" "" "" ...
> length(which(data$SOCIAL_STATUS=="B"))
[1] 71
> data$SOCIAL...