Defines functions YEAR

Documented in YEAR

# YEAR Function from Excel
#' Basic YEAR function from excel
#' It acts similiarly to Excel's YEAR function. Function will extract year component of your date.
#' @param date Give the date argument so it can extract year from the date. Preferable to give the date via DATE function of this package.
#' @import base
#' @import lubridate
#' @export
#' @examples
#' YEAR(DATE(2020,1,1))
#' @return In this example function returns 2020 as it is the year part of the date specified. Function will always return numeric class..


    as.numeric(format(date, '%Y'))


Try the ExcelFunctionsR package in your browser

Any scripts or data that you put into this service are public.

ExcelFunctionsR documentation built on July 1, 2020, 8:35 p.m.