R has a handy function called ifelse
Try violations$outcome = ifelse(violations$RESULT == 'Active', 1, 0)
. The first argument is the condition you're testing, the second argument is what to return if it is TRUE
and the third agrument is what to return if it's FALSE
.