Skip to content

Conversation

@Gero1999
Copy link
Contributor

@Gero1999 Gero1999 commented Nov 2, 2025

No description provided.

hl_col <- object$intervals$half.life
object$intervals <- object$intervals[hl_col & !is.na(hl_col),]

# Only calculate half.life for the results object
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this can be simplified to something like:

group_cols <- names(getGroups(object))
object$intervals <- object$intervals[, c(group_cols, "start", "end", "half.life")]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When groups are not specified in the intervals and I try to do this:

  cols_to_keep <- intersect(names(object$intervals), c("start", "end", "half.life"))
  object$intervals <- object$intervals[, cols_to_keep]
  object$intervals <- unique(object$intervals)
  o_nca <- pk.nca(object)

I get the next error:

Error in purrr::pmap(.l = list(data_conc = splitdata$data_conc, data_dose = splitdata$data_dose,  : 
  ℹ In index: 1.
Caused by error in `if (interval[[n]]) ...`:
! Please report a bug.
: Error with interval start=0, end=Inf: argument is of length zero

Instead, I simplified by making FALSE other parameters:

  params_to_ignore <- setdiff(names(get.interval.cols()), c("half.life", "start", "end"))
  object$intervals[, params_to_ignore] <- FALSE

PS: Making them NA did not work either, so I just kept it simple as this does not affect the generation of the half.life result.

@Gero1999 Gero1999 marked this pull request as ready for review November 24, 2025 04:25
@Gero1999 Gero1999 requested a review from billdenney November 24, 2025 04:25
@billdenney
Copy link
Member

I wanted to check how one thing worked, and it worked as I expected (great work!).

Merging when the tests complete.

@billdenney billdenney merged commit a8f3d1f into humanpred:main Nov 24, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants