Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add notification helpers #136

Merged
merged 27 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: gDRutils
Type: Package
Title: A package with helper functions for processing drug response data
Version: 1.5.1
Version: 1.5.2
Date: 2024-11-05
Authors@R: c(person("Bartosz", "Czech", role=c("aut"),
comment = c(ORCID = "0000-0002-9908-3007")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export(get_default_identifiers)
export(get_duplicated_rows)
export(get_env_assay_names)
export(get_env_identifiers)
export(get_env_var)
export(get_expect_one_identifiers)
export(get_experiment_groups)
export(get_header)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## gDRutils 1.5.2 - 2024-11-05
* add `get_env_var` helper

## gDRutils 1.5.1 - 2024-11-05
* synchronize Bioconductor and GitHub versioning

Expand Down
1 change: 1 addition & 0 deletions R/duplicates.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,4 @@ throw_msg_if_duplicates <- function(dt, assay_name = "unknown", msg_f = stop, pr
msg_f(paste0(msg, msg2, msg3))
}
}

20 changes: 20 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -761,3 +761,23 @@ calc_sd <- function(x) {
}
}



#' safe wrapper of Sys.getenv()
#'
#' So far the helper is needed to handle env vars containing `:`
#' for which the backslash is automatically added in some contexts
#' and R could not get the original value for these env vars.
#'
#' @param x string with the name of the environemntal variable
#' @param ... additional params for Sys.getenev
#' @keywords package_utils
#'
#' @examples
#' get_env_var("HOME")
#
#' @export
#' @return sanitized value of the env variable
get_env_var <- function(x, ...) {
j-smola marked this conversation as resolved.
Show resolved Hide resolved
gsub("\\\\", "", Sys.getenv(x, ...))
}
25 changes: 25 additions & 0 deletions man/get_env_var.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading