R/extendr-wrappers.R

Defines functions yday mday wday isowday isoweek quarter month year edate period_end period_begin rust_ymd

Documented in edate isowday isoweek mday month quarter wday yday year

# Generated by extendr: Do not edit by hand

# nolint start

#
# This file was created with the following call:
#   .Call("wrap__make_ymd_wrappers", use_symbols = TRUE, package_name = "ymd")

#' @docType package
#' @usage NULL
#' @useDynLib ymd, .registration = TRUE
NULL

rust_ymd <- function(x) .Call(wrap__rust_ymd, x)

period_begin <- function(x, unit) .Call(wrap__period_begin, x, unit)

period_end <- function(x, unit) .Call(wrap__period_end, x, unit)

#' Calculate the date before / after months
#' @param ref_date a Date vector
#' @param months the number of months that's added to `ref_date`
#' @note The function name is the same as the Excel function `EDATE()` and
#'   does the same. It returns the date that is the indicated number of months
#'   before or after the ref date.
#' @examples
#' edate(as.Date("2020-01-31"), 1)
#' ## supports 'YMD' formatted integer or string
#' edate(200131, 1)
#' edate(200229, -12)
#'
#' @export
edate <- function(ref_date, months) .Call(wrap__edate, ref_date, months)

#' @rdname date_part
#' @export
year <- function(ref_date) .Call(wrap__year, ref_date)

#' @rdname date_part
#' @export
month <- function(ref_date) .Call(wrap__month, ref_date)

#' @rdname date_part
#' @export
quarter <- function(ref_date) .Call(wrap__quarter, ref_date)

#' @rdname date_part
#' @export
isoweek <- function(ref_date) .Call(wrap__isoweek, ref_date)

#' @rdname date_part
#' @export
isowday <- function(ref_date) .Call(wrap__isowday, ref_date)

#' @rdname date_part
#' @export
wday <- function(ref_date) .Call(wrap__wday, ref_date)

#' @rdname date_part
#' @export
mday <- function(ref_date) .Call(wrap__mday, ref_date)

#' @rdname date_part
#' @export
yday <- function(ref_date) .Call(wrap__yday, ref_date)


# nolint end

Try the ymd package in your browser

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

ymd documentation built on Oct. 9, 2023, 5:10 p.m.