Missing Value Where Truefalse Needed R Error