billdenney / pknca

An R package is designed to perform all noncompartmental analysis (NCA) calculations for pharmacokinetic (PK) data.
http://billdenney.github.io/pknca/
GNU Affero General Public License v3.0
67 stars 24 forks source link

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

Closed billdenney closed 7 months ago

billdenney commented 1 year ago

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
billdenney commented 12 months ago

The error is likely coming from here:

https://github.com/billdenney/pknca/blob/8a81912aaa45844b5b5d559f7834209f1496f776/R/choose.intervals.R#L55-L58

billdenney commented 7 months ago

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