Skip to content

Commit

Permalink
add str_year
Browse files Browse the repository at this point in the history
  • Loading branch information
kongdd committed Jul 27, 2021
1 parent 59f128c commit 939c0c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export(smerge)
export(split_data)
export(stat_quantile2)
export(stat_sd)
export(str_year)
export(subl)
export(tabular)
export(transpose)
Expand Down
3 changes: 3 additions & 0 deletions R/tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ file_size <- function(file) {
utils:::format.object_size(file.size(file), "auto")
}

#' @export
str_year <- function(x) stringr::str_extract(basename(x), "\\d{4}")

#' ifelse2
#'
#' ternary operator just like java `test ? yes : no`
Expand Down

0 comments on commit 939c0c6

Please sign in to comment.