https://researchdatapod.com/how-to-solve-r-error-the-condition-has-length-1/
How to Solve R Error: the condition has length > 1