plotPK no longer loses series when a study has more than 18 subjects or treatments. The colour vector had a fixed length of 18, and indexing past its end gave NA, which draws nothing at all, so every subject after the 18th was silently missing from the pooled profiles. Colours are now generated for any number of series, and plotting symbols vary as well.
plotPK draws the subject legend in a panel of its own, sizing the text and the number of columns to fit. Previously the legend was placed inside the plot region with a fixed colour vector, so with many subjects it overlapped the curves, ran off the figure, and mislabelled series through silent recycling.
plotPK lays treatment panels out in a grid of at most four columns. The former single row of nTRT panels asked for a right margin of 2.5*nTRT lines and a raster 700*nTRT pixels wide, which failed with “figure margins too large” from about eight treatments onward.
plotPK drops non-finite values before computing axis ranges. A single NA concentration used to abort the whole function with “need finite 'ylim' values”.
plotPK closes every graphics device it opens, even when a panel fails. A failed call used to leave the device open, so the caller's next plot was written into the half-finished file.
plotPK sanitizes the file-name stem taken from the concData argument, and accepts an explicit name argument. Calling it with an expression such as d[d$ID != "S001", ] used to fail with “cannot open file”.
plotPK prints the per-bin counts as one line; the whole vector used to be drawn on top of itself. Its mean profile also sizes the y axis to the error bars instead of clipping them, warns about subjects left out of the mean, and no longer requires binr.
Semi-logarithmic axes in plotPK, pdfNCA and rtfNCA are aligned to whole decades enclosing the data. The previous trunc()-based tick positions could all fall outside ylim, leaving the y axis blank.
plotFit plots only positive concentrations instead of substituting 0.1 for zeros, includes the fitted intercept in the y range, and reports a clear error for an unknown ID.
conv.pp works with a single-column result; it used to fail with “subscript out of bounds”.
Subset compares whole columns instead of one cell at a time, and rejects an unknown key with a clear message.
foreNCA checks for the columns it needs and reports an empty selection instead of failing inside forestplot.
NCA0 uses a single concentration unit and warns when the PC records disagree. readEX no longer requires an EXENDTC column.
plotPK returns the paths it wrote, invisibly.
rNCA now runs at all. Since the first release it has passed a one-row data.frame to NCA0, which indexes its EX argument by name; the result was a one-column data.frame where a string was expected, and every call made the way the documentation prescribes - with ex and pc from loadEXPC() - died inside NonCompart::Unit() with “non-character argument”. Passing a matrix instead failed differently, because subsetting a matrix drops a single matching row to a vector. Both input shapes are now accepted and normalized once on entry.
rNCA's six near-duplicate code paths (single versus multiple dosing, interior versus last dosing interval, one versus several analytes) are one loop over dosing intervals. A single dose is simply a subject whose only interval is also its last.
rNCA sorts EX and PC records by date and time, so the result no longer depends on the row order of the input. Previously unique() preserved file order, so EX rows supplied in another order - which combXPT can produce, since it binds folders in directory order - silently merged two dosing intervals into one and dropped the other, and unsorted PC rows either produced a scrambled profile or failed inside NonCompart.
rNCA ends each dosing interval at the subject's next dose of any treatment. In a crossover trial analysed one treatment at a time, the first period used to run open-ended and absorb the second period's samples, overstating AUClast about threefold and taking Cmax from the wrong period.
rNCA binds result rows by name. rbind matches by position and takes its column names from the first row, so a cohort mixing administration methods - whose parameter sets differ in length - wrote later rows' values under the wrong headers, reporting for instance a volume of distribution as a clearance, with only a recycling warning.
rNCA finds the pre-dose sample as the last record in the day before the dose rather than by matching calendar dates. The old rule made the result depend on the wall-clock time of dosing: a dose shortly after midnight could never recover a trough drawn the previous evening. The lookback is bounded in real time because NCA0 places a pre-dose record at time zero, so an unbounded search would report a sample from the previous period as this dose's initial concentration.
rNCA closes a dosing interval only at a real dose of the study being analysed. A placebo or zero dose delivers no drug and no longer truncates an interval, and a record that merely shares a subject identifier with another study no longer does either.
rNCA treats a blank EXROUTE as extravascular, as NCA0 always has, so a cohort mixing intravenous with blank-route records is refused rather than silently reported with two different models side by side. A blank PCSPEC likewise now means plasma, as an absent PCSPEC column already did.
rNCA orders duplicate sampling and dosing times deterministically and reports them, so a repeated PCDTC or EXSTDTC can no longer make the result depend on the row order of the input. Negative concentrations are also reported.
rNCA resolves study, trt, id and analyte to the spellings found in the data, so every selector matches case-insensitively end to end. id=c("SUBJ-01","subj-02") used to return only the first subject, silently.
rNCA no longer drops the last sample of every interior dosing interval when a PCTPTNUM column is present but blank, which the old unguarded string comparison did silently.
rNCA matches analyte names case-insensitively throughout, and labels the output PCTESTCD from the data rather than from the caller's spelling. analyte="druga" against data holding "DRUGA" used to select nothing, and case variants of one code were analysed as two half profiles.
rNCA tolerates a non-numeric PCSTRESN, warning and ignoring it, instead of aborting the whole run with “missing value where TRUE/FALSE needed”. It also accepts character(0) and NULL selections, checks for the SDTM columns it needs, supplies the same defaults as readEX/readPC for the optional ones, warns when records are dropped for an unusable date/time or when a dosed subject has no plasma record, and checks routes after selection rather than before.
rNCA and NCA0 estimate the terminal slope of an infusion from post-infusion samples only, controlled by the new excludeInfusion argument and ON BY DEFAULT. The automatic search constrains itself to samples after the maximum concentration, which says nothing about an infusion, so a sample drawn while drug was still going in could win on adjusted R-squared and be reported as terminal elimination; a terminal phase does not exist while drug is still going in. The same maximum-adjusted-R-squared criterion still selects the window, now among the post-infusion samples. Only lambda z and what derives from it (half-life, AUCIFO, AUCPEO, Vz) are affected; Cmax and AUClast cannot change. Too few post-infusion samples produces a warning naming the profile and falls back to the unrestricted search, so no profile is lost silently. Pass excludeInfusion=FALSE to reproduce results from an earlier version. The restriction applies to the SDTM entry points, which know the dosing record; sNCA and tblNCA remain faithful wrappers around NonCompart.
sNCA gained UsePoints, passed through to NonCompart, which fixes the terminal-slope window explicitly instead of searching for it. The UsedPoints attribute now survives the returnNA=TRUE padding.
NCA0 decides the administration method from EXROUTE first. Testing the recorded duration first classified any extravascular record carrying an EXENDTC - routine in real EX domains - as an infusion, so an oral dose was reported with VZO/CLO/VSS in place of VZFO/CLFO/MRTEV.
Core noncompartmental computation is now delegated to the NonCompart package, so pkr and NonCompart share one maintained engine and always give identical results. This fixes, among others, the handling of NA concentrations in sNCA and the column mis-alignment of tblNCA/NCA with heterogeneous subjects.
NCA() with a treatment (trt) argument no longer errors on an undefined dose object.
readPC now defaults optional PCSPEC/PCLLOQ/PCSTAT/PCORRES columns correctly and recognizes more BLQ codes.
combXPT no longer requires the first folder to contain the domain file.
plotPK now writes to the outdir argument, and its mean annotations use the actual means.
txtNCA reports the correct administration route and infusion length.
plotFit draws the semi-log axis and terminal-slope line correctly.
foreign, binr, forestplot, and rtf moved from Depends to Imports; NonCompart added to Imports.
Rare cases raising NaN in BestSlope are handled.
Column order bug with bolus infusion fixed.
Deprecated option in Sys.timezone() is removed.
pkr A bug in C0 calcuation of IV bolus case was fixed.
First version