ymd_to_datestr: transform ymd data table to string.

View source: R/calendar.R

ymd_to_datestrR Documentation

transform ymd data table to string.

Description

transform ymd data table like data.frame(y=2022,m=5,d=12) to string. NA will be filled by na.fill.

Usage

ymd_to_datestr(
  ymd,
  dateformat = "%Y.%M.%D",
  range_sep = "-",
  na.fill = "?",
  mode = "full"
)

Arguments

ymd

data.frame with column y, m and d for year, month and day.

dateformat

output format with Y, y, M, m, D, d. See detais.

range_sep

separation of range if ymd is range format.

na.fill

filled character for missing element.

mode

determining data filling mode = c("full","maximum","compact","short","minimum"). see detail.

Details

format of each mode is like the following. maximum: always range mode e.g., 2012.03.04-2012.03.04 2023.04.05-2023.05.06 full (default): range mode is used only when beg and end is different e.g., 2012.03.04 2023.04.05-2023.05.06 compact: range mode remove duplicating information e.g., 2023.04.05-05.06 2023.04.?? minimum: (information loss can occur depending on dateformat) remove NA and duplicating info e.g., 2023.04-05 dateformat can use the following special characters. (percent)Yj(at): NOT WORKING (percent)YJ(at): NOT WORKING (percent)Y(at): YYYY年 (percent)y(at): YY年 (percent)M(at): MM月 (percent)m(at): M月 (percent)D(at): DD日 (percent)d(at): D日 (percent)Y: YYYY (percent)y: YY (percent)M: MM (percent)m: M (percent)D: DD (percent)d: D

Value

transformed str


hmito/hmRLib documentation built on March 13, 2024, 9:41 p.m.