R/imported.R

Defines functions month2

Documented in month2

# ==================================================================== #
# TITLE                                                                #
# Tools for Data Analysis at Certe                                     #
#                                                                      #
# AUTHORS                                                              #
# Berends MS (m.berends@certe.nl)                                      #
# Meijer BC (b.meijer@certe.nl)                                        #
# Hassing EEA (e.hassing@certe.nl)                                     #
#                                                                      #
# COPYRIGHT                                                            #
# (c) 2019 Certe Medische diagnostiek & advies - https://www.certe.nl  #
#                                                                      #
# LICENCE                                                              #
# This R package is free software; you can redistribute it and/or      #
# modify it under the terms of the GNU General Public License          #
# version 2.0, as published by the Free Software Foundation.           #
# This R package is distributed in the hope that it will be useful,    #
# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the         #
# GNU General Public License for more details.                         #
# ==================================================================== #

#' Maand bepalen
#' @importFrom lubridate month
#' @source \code{\link[lubridate]{month}} uit het pakket \code{lubridate}.
#' @export
month2 <- function(x, label = TRUE, abbr = TRUE, locale = "Dutch") {
  tryCatch(
    month(x = x, label = label, abbr = abbr, locale = locale),
    error = function(e) {
      warning(gsub("(converted from warning) ", "", e$message, fixed = TRUE), call. = FALSE)
      month(x = x, label = label, abbr = abbr, locale = Sys.getlocale("LC_TIME"))
    })
}
msberends/certedata documentation built on Nov. 26, 2019, 5:19 a.m.