Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ the dosing including dose amount and route.
for grouped joins, preserving left-table row order. Missing group validation
ensures no rows are silently dropped.

* `PKNCAresults()` now includes `start` and `end` in `group_vars`

## Breaking changes

Expand Down
2 changes: 1 addition & 1 deletion R/class-PKNCAresults.R
Original file line number Diff line number Diff line change
Expand Up @@ -398,5 +398,5 @@ getGroups.PKNCAresults <- function(object,
#' from the PKNCAconc object within
#' @exportS3Method dplyr::group_vars
group_vars.PKNCAresults <- function(x) {
group_vars.PKNCAconc(as_PKNCAconc(x))
c("start","end",group_vars.PKNCAconc(as_PKNCAconc(x)))
}
4 changes: 2 additions & 2 deletions tests/testthat/test-class-PKNCAresults.R
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,14 @@ test_that("group_vars.PKNCAresult", {
o_data_group <- PKNCAdata(o_conc_group, intervals = data.frame(start = 0, end = 1, cmax = TRUE))
suppressMessages(o_nca_group <- pk.nca(o_data_group))

expect_equal(dplyr::group_vars(o_nca_group), "Subject")
expect_equal(dplyr::group_vars(o_nca_group), c("start", "end", "Subject"))

# Check that it works without groupings as expected [empty]
o_conc_nongroup <- PKNCAconc(as.data.frame(datasets::Theoph)[datasets::Theoph$Subject == 1,], conc~Time)
o_data_nogroup <- PKNCAdata(o_conc_nongroup, intervals = data.frame(start = 0, end = 1, cmax = TRUE))
suppressMessages(o_nca_nogroup <- pk.nca(o_data_nogroup))

expect_equal(dplyr::group_vars(o_nca_nogroup), character(0))
expect_equal(dplyr::group_vars(o_nca_nogroup), c("start","end"))
})

test_that("as.data.frame.PKNCAresults can filter for only requested parameters", {
Expand Down