Closed shawn-gx closed 1 month ago
Well, I'm unsure exactly what happened in 2.1.3, but 3.0.0 (which I just submitted to cran), does not have this issue:
library(tidyverse)
library(rxode2)
#> rxode2 3.0.0 using 8 threads (see ?getRxThreads)
#> no cache: create with `rxCreateCache()`
mod1 <- rxode2({
EV2BW = ((BW/61)^V2BW)
V2 = tV2 * EV2BW
C2 <- centr/V2
d/dt(centr) <- - CL * C2
})
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
dt <- eventTable() %>%
add.dosing(dose=1200,rate=1200, nbr.doses=20, dosing.interval=21 * 24,start.time=0) %>%
add.sampling(c(0, 0.5, 1, seq(1,21,1) * 24,
399 * 24, 399 * 24+0.5 , 399 * 24+1, seq(400,420,1) * 24)) %>%
et(id=1:2) %>% as.data.frame() %>%
dplyr::mutate(BW=if_else(id==1,70,54),V2BW=if_else(id==1,0.6067,0.4693),
CL=0.012,tV2=2.6,
amt=if_else(evid==1,BW * 20, amt),
rate=if_else(evid==1,BW * 20, rate))
rxSolve(mod1, dt)%>%
dplyr::select(id, BW) %>%
table()
#> BW
#> id 54 70
#> 1 0 48
#> 2 48 0
Created on 2024-09-18 with reprex v2.1.1
@mattfidler Matt, thanks for your prompt reply. 3.0.0 has indeed fixed this issue.
And it even hit CRAN today 😄
I ran the following code using the new version of rxode2, but the results are incorrect, and there were no warnings or error messages. Could anyone help me find the reason?
The new version of rxode2 changed the information of the dataset ("dt") when running the rxSolve function.
rxode2_v2.0.13_R4.3.1.csv rxode2_v2.1.3_R4.4.1.csv