The Condition Has Length 1 Error In R