Skip to content

Commit

Permalink
Release v0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Neitmann authored Oct 10, 2022
2 parents f2d44e9 + 108df48 commit 7059ed1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: admiral
Type: Package
Title: ADaM in R Asset Library
Version: 0.8.1
Version: 0.8.3
Authors@R: c(
person("Thomas", "Neitmann", email = "thomas.neitmann@roche.com", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut"),
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# admiral 0.8.3

- Second attempt to address issue where CRAN identified a failing test when "a strict Latin-1* locale" is used (#1469)
- Fixed a bug in `derive_vars_duration()` that surfaced after changes in R-devel (#1486)

# admiral 0.8.2

- Fixed an issue where CRAN identified a failing test when "a strict Latin-1* locale" is used (#1469)

# admiral 0.8.1

- `derive_var_extreme_dt()` and `derive_var_extreme_dtm()` were updated such
Expand Down
22 changes: 18 additions & 4 deletions R/compute_duration.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,24 @@ compute_duration <- function(start_date,

# Derivation
if (floor_in) {
# remove information more precise than the input unit, e.g., if input unit
# is days, the time part of the dates is removed.
start_date <- floor_date(start_date, unit = in_unit)
end_date <- floor_date(end_date, unit = in_unit)
# Remove information more precise than the input unit, e.g., if input unit
# is days, the time part of the dates is removed. After updates in R `NA`
# values have to be explicitly handled here because otherwise
# `floor_date(as.Date(NA), unit = "days")` will return `"1970-01-01"` rather
# than `NA` (#1486). See also here:
# https://github.com/tidyverse/lubridate/issues/1069
start_date_fun <- if (is.Date(start_date)) as.Date else as.POSIXct
end_date_fun <- if (is.Date(end_date)) as.Date else as.POSIXct
start_date <- if_else(
is.na(start_date),
start_date_fun(NA),
floor_date(start_date, unit = in_unit)
)
end_date <- if_else(
is.na(end_date),
end_date_fun(NA),
floor_date(end_date, unit = in_unit)
)
}

# derive the duration in the output unit
Expand Down
3 changes: 2 additions & 1 deletion R/user_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ print.adam_templates <- function(x, ...) {
cat("No ADaM templates available in package '", pkg, "'\n", sep = "")
} else {
cat("Existing ADaM templates in package '", pkg, "':\n", sep = "")
cat(paste0("\U2022 ", x), sep = "\n")
bullet <- if (is.na(iconv("\U2022"))) "-" else "\U2022"
cat(paste(bullet, x), sep = "\n")
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if (!requireNamespace("remotes", quietly = TRUE)) {
}

remotes::install_github("pharmaverse/admiral.test", ref = "devel") # This is a required dependency of {admiral}
remotes::install_github("pharmaverse/admiraldev", ref = "devel") # This is a required dependency of {admiral}
remotes::install_github("pharmaverse/admiral", ref = "devel")
```

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-user_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ test_that("`adam_templates` objects are printed as intended: some templates", {
structure(class = c("adam_templates", "character"), package = "admiral")
expected_print_output <- c(
"Existing ADaM templates in package 'admiral':",
" ADAE",
" ADSL"
if (is.na(iconv("\U2022"))) "- ADAE" else "\U2022 ADAE",
if (is.na(iconv("\U2022"))) "- ADSL" else "\U2022 ADSL"
)
expect_identical(capture.output(print(templates)), expected_print_output)
})

0 comments on commit 7059ed1

Please sign in to comment.