-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it possible to deprecated argument 'center'; introduced option '…
…matrixStats.center.onUse'/env var 'MATRIXSTATS_CENTER_ONUSE' for controlling this [#187]
- Loading branch information
1 parent
49d59a7
commit c7db362
Showing
6 changed files
with
51 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
centerOnUse <- function(fcnname, calls = sys.calls(), msg = NULL) { | ||
value <- getOption("matrixStats.center.onUse") | ||
if (is.null(value) || identical(value, "ignore")) return() | ||
|
||
value <- match.arg(value, c("deprecated", "defunct")) | ||
fcn <- switch(value, deprecated = .Deprecated, defunct = .Defunct) | ||
|
||
if (is.null(msg)) { | ||
msg <- sprintf("Argument 'center' of %s::%s() is %s: %s", | ||
.packageName, fcnname, value, deparse(calls[[1]])) | ||
} | ||
|
||
fcn(msg = msg, package = .packageName) | ||
} | ||
|
||
|
||
onLoadSetCenterOnUse <- function() { | ||
## Option is already set? | ||
if (!is.null(getOption("matrixStats.center.onUse", NULL))) return() | ||
|
||
## Is environment variable set? | ||
value <- Sys.getenv("MATRIXSTATS_CENTER_ONUSE", NA_character_) | ||
if (is.na(value)) return() | ||
|
||
value <- match.arg(value, c("ignore", "deprecated", "defunct")) | ||
options(matrixStats.center.onUse = value) | ||
} |
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
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