2023-01-21 23:47:20 +01:00
# ==================================================================== #
2023-07-08 17:30:05 +02:00
# TITLE: #
2023-01-21 23:47:20 +01:00
# AMR: An R Package for Working with Antimicrobial Resistance Data #
# #
2023-07-08 17:30:05 +02:00
# SOURCE CODE: #
2023-01-21 23:47:20 +01:00
# https://github.com/msberends/AMR #
# #
2023-07-08 17:30:05 +02:00
# PLEASE CITE THIS SOFTWARE AS: #
2023-01-21 23:47:20 +01:00
# Berends MS, Luz CF, Friedrich AW, Sinha BNM, Albers CJ, Glasner C #
# (2022). AMR: An R Package for Working with Antimicrobial Resistance #
# Data. Journal of Statistical Software, 104(3), 1-31. #
2023-05-27 10:39:22 +02:00
# https://doi.org/10.18637/jss.v104.i03 #
2023-01-21 23:47:20 +01:00
# #
# Developed at the University of Groningen and the University Medical #
# Center Groningen in The Netherlands, in collaboration with many #
# colleagues from around the world, see our website. #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# We created this package for both routine data analysis and academic #
# research and it was publicly released in the hope that it will be #
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
# #
# Visit our website for the full manual and a complete tutorial about #
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
2023-12-03 11:34:48 +01:00
# #' Deprecated Functions
# #'
# #' These functions are so-called '[Deprecated]'. **They will be removed in a future release.** Using the functions will give a warning with the name of the function it has been replaced by (if there is one).
# #' @keywords internal
# #' @name AMR-deprecated
# #' @rdname AMR-deprecated
# #' @export
# NULL
2023-01-24 10:20:27 +01:00
2023-03-11 14:24:34 +01:00
deprecation_warning <- function ( old = NULL , new = NULL , extra_msg = NULL , is_function = TRUE ) {
2023-01-21 23:47:20 +01:00
if ( is.null ( old ) ) {
warning_ ( extra_msg )
} else {
env <- paste0 ( " deprecated_" , old )
if ( ! env %in% names ( AMR_env ) ) {
AMR_env [ [paste0 ( " deprecated_" , old ) ] ] <- 1
2023-03-11 14:24:34 +01:00
if ( isTRUE ( is_function ) ) {
old <- paste0 ( old , " ()" )
new <- paste0 ( new , " ()" )
type <- " function"
} else {
type <- " argument"
}
2023-01-23 15:01:21 +01:00
warning_ (
ifelse ( is.null ( new ) ,
2023-03-11 14:24:34 +01:00
paste0 ( " The `" , old , " ` " , type , " is no longer in use" ) ,
paste0 ( " The `" , old , " ` " , type , " has been replaced with `" , new , " `" )
) ,
ifelse ( type == " argument" ,
" . While the old argument still works, it will be removed in a future version, so please update your code." ,
" , see `?AMR-deprecated`."
2023-01-23 15:01:21 +01:00
) ,
ifelse ( ! is.null ( extra_msg ) ,
paste0 ( " " , extra_msg ) ,
" "
) ,
" \nThis warning will be shown once per session."
)
2023-01-21 23:47:20 +01:00
}
}
}