-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ymd() supports
...
making it more convinient
- Loading branch information
Showing
7 changed files
with
46 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: ymd | ||
Title: Parse 'YMD' Format Number or String to Date | ||
Version: 0.0.1.9000 | ||
Version: 0.0.2 | ||
Authors@R: c( | ||
person("Xianying", "Tan", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0002-6072-3521")), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#' Convert 'YMD' format integer or string to Date | ||
#' | ||
#' Transform integer or strings vectors in 'YMD' format to Date objects. | ||
#' It intends to only support limited formats (no separator or one of | ||
#' '.', ' ', '-' and '/' separators). See the possible formats in examples. | ||
#' | ||
#' @param x An integer or string vector in 'YMD' format. Double | ||
#' values without the decimal part are allowed. | ||
#' @param ... The same as `x`. It will be merged into one vector with `x`. | ||
#' It's convinient for interactive use. | ||
#' | ||
#' @return A Date object. When the parse fails for certain input, | ||
#' the value returned would be `NA`, silently. | ||
#' | ||
#' @examples | ||
#' ymd(c(210326, 19981225)) | ||
#' ymd(c("2020/1/8", "20 1 7", "1998.7.1", "1990-02-03")) | ||
#' ymd(210420, 180322) | ||
#' | ||
#' @export | ||
ymd <- function(x, ...) { | ||
if (...length()) { | ||
x <- c(x, unlist(list(...))) | ||
} | ||
rust_ymd(x) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters