The problem I'm facing is that I have the results of a survey with answers reaching from 1 to 5. How do I give 3 =< the value 1 and < 3 the value 0. Any help would be greatly appreciated!
Here is an example with some data I invented.
DF <- data.frame(Score = c(3,2,4,4,1,2,1,5,4,3,2,4))
DF$Binary <- as.numeric(DF$Score >= 3)
DF
Score Binary
1 3 1
2 2 0
3 4 1
4 4 1
5 1 0
6 2 0
7 1 0
8 5 1
9 4 1
10 3 1
11 2 0
12 4 1
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.