Skip to content

Commit

Permalink
Merge pull request #61 from Perugolate/master
Browse files Browse the repository at this point in the history
closes #60
  • Loading branch information
jasmineirx authored Jun 20, 2024
2 parents 4c6f607 + 2c83c66 commit 1d71ba4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/pk_2cmt_inf.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pk_2cmt_inf <- function(
A <- (1/V) * (alpha - (Q/V2))/(alpha-beta)
B <- (1/V) * ((beta - Q/V2)/(beta-alpha))

for(i in 1:(length(unq_dos)-1)) {
for(i in seq(unq_dos)) {
sel <- n_dos >= i-1
tmp <- dat[sel,]
tmp$t <- tmp$t - (i-1)*tau
Expand Down
20 changes: 19 additions & 1 deletion tests/testthat/test_pk_2cmt_inf.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ test_that("PK 2cmt infusion over time", {
Q = 2.28,
V2 = 58.56
)
expect_named(res, c("t", "dv"))
res_t24 <- pk_2cmt_inf(
t = 24,
dose = 1000,
tau = 12,
t_inf = 2,
CL = 2.99,
V = 54,
Q = 2.28,
V2 = 58.56
)
expect_named(res, c("t", "dv"))
expect_s3_class(res, "data.frame")
expect_equal(res$t, 0:24)
expect_equal(
Expand All @@ -23,6 +33,14 @@ test_that("PK 2cmt infusion over time", {
round(res$dv[13:18], 2),
c(7.14, 15.46, 23.03, 21.09, 19.36, 17.81)
)
expect_equal(
res[res$t == 24,]$dv,
res_t24$dv
)
expect_equal(
res[res$t == 24,]$t,
res_t24$t
)
})

test_that("Add RUV to PK 2cmt infusion over time", {
Expand Down

0 comments on commit 1d71ba4

Please sign in to comment.