powered by
It acts similiarly to Excel's YEAR function. Function will extract year component of your date.
YEAR(date)
Give the date argument so it can extract year from the date. Preferable to give the date via DATE function of this package.
In this example function returns 2020 as it is the year part of the date specified. Function will always return numeric class..
# NOT RUN { YEAR(DATE(2020,1,1)) # }
Run the code above in your browser using DataLab