[r] R: `which` statement with multiple conditions