Issue
In a data frame, I would like to compare two columns that have opposite values, is there a way to check or even visualize it?
Col1 | Col2
------------
T | F
F | T
T | F
T | F
Solution
Something like this?
Update: See @akrun's comment:
df %>% mutate(isOpposite = Col1 == Col2)
df %>%
mutate(isOpposite = ifelse(Col1 == Col2, TRUE, FALSE))
Col1 Col2 isOpposite
1 TRUE FALSE FALSE
2 FALSE TRUE FALSE
3 TRUE FALSE FALSE
4 TRUE FALSE FALSE
Answered By - TarJae Answer Checked By - Katrina (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.