Consider this simple example
> tibble(id = c(1,2,3,4),
+ score1 = c('good', 'bad', 'bad', 'ugly'),
+ score2 = c('good', 'ugly', 'good', 'bad'))
# A tibble: 4 x 3
id score1 score2
<dbl> <chr> <chr>
1 1 good good
2 2 bad ugly
3 3 bad good
4 4 ugly bad
Essentially, my scoring variable states that good > bad > ugly. Is there a way in R (maybe using ordered factors?) so that
mutate(mycomp = score1 >= score2)
will return the correct answer? That is TRUE, TRUE, FALSE, FALSE?
Thanks!