as.Date function giving incorrect year [duplicate]
Here is the solution + explanation:
> # %Y is used for 4 digit numbers
>
> as.Date('28/3/2021', '%d/%m/%Y')
[1] "2021-03-28"
>
> # while %y for 2 digits
>
> as.Date('28/3/21', '%d/%m/%y')
[1] "2021-03-28"
>