fill.partial.date: Fill partial dates.

Description Usage Arguments Value Author(s) Examples

View source: R/convert_dates.R

Description

This function convert a partial date of the form Unknown.mm.YYYY or Unknown.Unknown.YYYY to the typical placeholders 15.mm.YYYY and 01.07.YYYY, respectively. Other partial.date.string can be specified. Alternatively, the 'exact' midpoint of the month/year can be used, i.e. floor(ndays/2) and 02.07.YYYY.

Usage

1
2
3
## S3 method for class 'partial.date'
fill(date.string, partial.date.string = "Unknown",
  .format = "%Y-%m-%d", exact = FALSE)

Arguments

date.string

string containing a partial date

partial.date.string

string used for unknown data components (e.g. 'Unknown' or '–')

.format

format of the dates (default: '%Y-%m-%d')

exact

use the exact modpoints floor(ndays/2) and 02.07.YYYY

Value

Date string, converted if applicable.

Author(s)

Pascal Benkert

Examples

1
2
fill.partial.date("Unknown.02.2014", "Unknown", .format="%d.%m.%Y", exact=TRUE) # 14.02.2014
fill.partial.date("2014/--/--", "--", .format="%Y/%m/%d") # 2014/07/01

SwissClinicalTrialOrganisation/DM_secuTrial_R documentation built on May 21, 2019, 10:16 a.m.