-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lastdose appears to have a side effect of changing AMT column in data frame it is ran on #40
Comments
Reproducing this: library(tidyverse)
pk <-
Theoph %>%
transmute(
ID = dense_rank(Subject),
WTBL = Wt,
DOSE = Dose,
TIME = Time,
DV = conc,
EVID = 0
)
dosing <-
pk %>%
distinct(ID, DOSE, TIME, WTBL) %>%
mutate(EVID = 1, AMT = DOSE)
pk$AMT <- NA_real_
nm_1 <-
bind_rows(pk, dosing) %>%
arrange(ID, TIME) %>%
as_tibble()
# nm_1 has NA AMT (which is OK)
head(nm_1$AMT) # NA 4 NA 4 NA 4
#> [1] NA 4 NA 4 NA 4
# Create nm_2
nm_2 <- lastdose::lastdose(nm_1, include_tafd = TRUE)
# nm_2 has new AMT (which is OK)
head(nm_2$AMT) # 0 4 0 4 0 4
#> [1] 0 4 0 4 0 4
# nm_1 has new AMT (not OK?)
head(nm_1$AMT) # 0 4 0 4 0 4
#> [1] 0 4 0 4 0 4 Created on 2023-09-22 with reprex v2.0.2 |
This is now fixed with d5cfec7 library(tidyverse)
pk <-
Theoph %>%
transmute(
ID = dense_rank(Subject),
WTBL = Wt,
DOSE = Dose,
TIME = Time,
DV = conc,
EVID = 0
)
dosing <-
pk %>%
distinct(ID, DOSE, TIME, WTBL) %>%
mutate(EVID = 1, AMT = DOSE)
pk$AMT <- NA_real_
nm_1 <-
bind_rows(pk, dosing) %>%
arrange(ID, TIME) %>%
as_tibble()
# nm_1 has NA AMT (which is OK)
head(nm_1$AMT) # NA 4 NA 4 NA 4
#> [1] NA 4 NA 4 NA 4
# Create nm_2
nm_2 <- lastdose::lastdose(nm_1, include_tafd = TRUE)
# nm_2 has same AMT
head(nm_2$AMT) # 0 4 0 4 0 4
#> [1] NA 4 NA 4 NA 4
# nm_1 has same AMT
head(nm_1$AMT) # 0 4 0 4 0 4
#> [1] NA 4 NA 4 NA 4 Created on 2023-09-22 with reprex v2.0.2 |
@kylebaron Will this fix be released to a new version that will make it MPN? |
Hi @andersone1 - we can release it. |
Merged
Sounds good @kylebaron . I am OK closing this issue if you are. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: