billdenney/pknca

Error `time.dosing` `argument must be coercible to non-negative integer`

billdenney opened this issue · 2 comments

An issue was reported by email. The crux was that the following code was caused by a placebo subject with one PK measurement at 2 hr. As a guess, the placebo subject probably had no dosing record.

NCA_conc1 <- PKNCAconc(data = PK,
                       formula = Concentration ~ Nominal_time | Subject)

NCA_dose1 <- PKNCAdose(data = PK[PK$Nominal_time == 0 & PK$dose > 0,],
                       formula = dose ~ Nominal_time | Subject)

NCA_data1 <- PKNCAdata(NCA_conc1, NCA_dose1)
# Error in seq_len(length(time.dosing) - 1) :
#   argument must be coercible to non-negative integer

The error is likely coming from here:

seq_len(length(time.dosing)-1)[
mask_dose_conc[-1] &
mask_dose_conc[-length(mask_dose_conc)]
]

I cannot replicate this, and the user has not provided a reproducible example. Closing.