Skip to content

Commit

Permalink
Cleanup dependencies and fix documentation (#71)
Browse files Browse the repository at this point in the history
* Cleanup dependencies and fix documentation

* Fix lintr issue

* Bump changed-files version
  • Loading branch information
galachad authored Jul 24, 2024
1 parent 2cc2a43 commit bdbafc9
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Get changed files in renv/profiles
id: changed-files
uses: tj-actions/changed-files@v35
uses: tj-actions/changed-files@v41
with:
files: renv/profiles/**/renv.lock

Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
else
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
fi
- name: Call deploy docker image action for every renv
uses: insightsengineering/r-image-creator@v1
Expand Down
24 changes: 12 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Depends: R (>= 4.2)
Imports:
admiraldev,
admiraldev (>= 1.1.0),
dplyr (>= 1.0.0),
memoise,
assertthat,
purrr (>= 0.3.3),
rlang (>= 0.4.4),
purrr (>= 1.0.1),
rlang (>= 1.0.2),
tibble (>= 3.2.0),
vctrs (>= 0.5.0),
stringr (>= 1.4.0),
tibble,
vctrs,
readr,
glue,
DT,
pillar
memoise (>= 2.0.1),
assertthat,
pillar,
cli
Suggests:
knitr,
htmltools,
lifecycle,
magrittr,
rmarkdown,
spelling,
testthat (>= 3.1.7)
testthat (>= 3.1.7),
DT,
readr
VignetteBuilder: knitr
Config/testthat/edition: 3
Config/testthat/parallel: true
6 changes: 1 addition & 5 deletions R/assertions.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ assert_logical_vector <- function(arg, optional = FALSE) {
}

if (!is.logical(arg)) {
err_msg <- sprintf(
"`arg` must be a logical vector but is %s.",
admiraldev::what_is_it(arg)
)
rlang::abort(err_msg)
cli::cli_abort("`arg` must be a logical vector but is {.obj_type_friendly {arg}}")
}

invisible(arg)
Expand Down
9 changes: 5 additions & 4 deletions R/ct.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ assert_ct_spec <- function(ct_spec, optional = FALSE) {
}

if (!is.null(ct_spec) && anyNA(ct_spec[[ct_spec_vars("ct_clst")]])) {
rlang::abort(glue::glue("`{ct_spec_vars('ct_clst')}` can't have any NA values."))
rlang::abort(stringr::str_glue("`{ct_spec_vars('ct_clst')}` can't have any NA values."))
}

if (!is.null(ct_spec) && anyNA(ct_spec[[ct_spec_vars("to")]])) {
rlang::abort(glue::glue("`{ct_spec_vars('to')}` can't have any NA values."))
rlang::abort(stringr::str_glue("`{ct_spec_vars('to')}` can't have any NA values."))
}

invisible(ct_spec)
Expand Down Expand Up @@ -340,7 +340,8 @@ ct_map <-
#'
#' @export
read_ct_spec <- function(file = stop("`file` must be specified")) {
ct_spec <- readr::read_csv(file = file, col_types = "c")
ct_spec <- utils::read.csv(file = file, na.strings = c("NA", ""), colClasses = "character") |>
tibble::as_tibble()
assert_ct_spec(ct_spec)

ct_spec
Expand Down Expand Up @@ -388,7 +389,7 @@ ct_spec_example <- function(example) {

if (identical(local_path, "")) {
stop(
glue::glue(
stringr::str_glue(
"'{example}' does not match any ct spec files. Run `ct_spec_example()` for options."
),
call. = FALSE
Expand Down
2 changes: 2 additions & 0 deletions R/derive_blfl.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ dtc_datepart <- function(dtc, partial_as_na = TRUE) {
#' @export
#'
#' @keywords internal
#'
#' @examples
#' ## Partial or missing times set to NA and seconds ignored by default
#' sdtm.oak:::dtc_timepart(
#' c(NA, "", "2021-12-25", "2021-12-25T12", "2021-12-25T12:30", "2021-12-25T12:30:59")
Expand Down
7 changes: 5 additions & 2 deletions R/domain_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ domain_example <- function(example) {

if (identical(local_path, "")) {
stop(
glue::glue(
stringr::str_glue(
"'{example}' does not match any domain example files. Run `domain_example()` for options."
),
call. = FALSE
Expand Down Expand Up @@ -125,5 +125,8 @@ read_domain_example <- function(example) {
}

path <- domain_example(example)
readr::read_rds(file = path)
con <- file(path)
on.exit(close(con))

readRDS(con)
}
72 changes: 29 additions & 43 deletions man/dtc_timepart.Rd

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

0 comments on commit bdbafc9

Please sign in to comment.