Loop to replace with condition

In R we don't use loops that often because most functions are vectorized. The example solution @Leon is giving you will work on the entire MONTH column without the need for a loop.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

1 Like