| NEWS | R Documentation |
News for Package pkr
Version 0.1.6 (2026-07-30)
plotPKno 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 gaveNA, 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.plotPKdraws 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.plotPKlays treatment panels out in a grid of at most four columns. The former single row ofnTRTpanels asked for a right margin of2.5*nTRTlines and a raster700*nTRTpixels wide, which failed with “figure margins too large” from about eight treatments onward.plotPKdrops non-finite values before computing axis ranges. A singleNAconcentration used to abort the whole function with “need finite 'ylim' values”.plotPKcloses 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.plotPKsanitizes the file-name stem taken from theconcDataargument, and accepts an explicitnameargument. Calling it with an expression such asd[d$ID != "S001", ]used to fail with “cannot open file”.plotPKprints 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,pdfNCAandrtfNCAare aligned to whole decades enclosing the data. The previoustrunc()-based tick positions could all fall outsideylim, leaving the y axis blank.plotFitplots 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 unknownID.conv.ppworks with a single-column result; it used to fail with “subscript out of bounds”.Subsetcompares whole columns instead of one cell at a time, and rejects an unknown key with a clear message.foreNCAchecks for the columns it needs and reports an empty selection instead of failing inside forestplot.NCA0uses a single concentration unit and warns when the PC records disagree.readEXno longer requires anEXENDTCcolumn.plotPKreturns the paths it wrote, invisibly.rNCAnow runs at all. Since the first release it has passed a one-row data.frame toNCA0, 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 - withexandpcfromloadEXPC()- died insideNonCompart::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.rNCAsorts EX and PC records by date and time, so the result no longer depends on the row order of the input. Previouslyunique()preserved file order, so EX rows supplied in another order - whichcombXPTcan 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.rNCAends 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.rNCAbinds result rows by name.rbindmatches 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.rNCAfinds 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 becauseNCA0places 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.rNCAcloses 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.rNCAtreats a blank EXROUTE as extravascular, asNCA0always 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.rNCAorders 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.rNCAresolvesstudy,trt,idandanalyteto 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.rNCAno 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.rNCAmatches 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.rNCAtolerates a non-numeric PCSTRESN, warning and ignoring it, instead of aborting the whole run with “missing value where TRUE/FALSE needed”. It also acceptscharacter(0)andNULLselections, checks for the SDTM columns it needs, supplies the same defaults asreadEX/readPCfor 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.rNCAandNCA0estimate the terminal slope of an infusion from post-infusion samples only, controlled by the newexcludeInfusionargument 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. PassexcludeInfusion=FALSEto reproduce results from an earlier version. The restriction applies to the SDTM entry points, which know the dosing record;sNCAandtblNCAremain faithful wrappers around NonCompart.sNCAgainedUsePoints, passed through to NonCompart, which fixes the terminal-slope window explicitly instead of searching for it. TheUsedPointsattribute now survives thereturnNA=TRUEpadding.NCA0decides 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.
Version 0.1.5 (2026-07-22)
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
NAconcentrations insNCAand the column mis-alignment oftblNCA/NCAwith heterogeneous subjects.NCA()with a treatment (trt) argument no longer errors on an undefined dose object.readPCnow defaults optionalPCSPEC/PCLLOQ/PCSTAT/PCORREScolumns correctly and recognizes more BLQ codes.combXPTno longer requires the first folder to contain the domain file.plotPKnow writes to theoutdirargument, and its mean annotations use the actual means.txtNCAreports the correct administration route and infusion length.plotFitdraws the semi-log axis and terminal-slope line correctly.foreign, binr, forestplot, and rtf moved from Depends to Imports; NonCompart added to Imports.
Version 0.1.4 (2022-07-10)
Rare cases raising NaN in
BestSlopeare handled.
Version 0.1.3 (2020-06-10)
Column order bug with bolus infusion fixed.
Version 0.1.2 (2018-06-04)
Deprecated option in
Sys.timezone()is removed.
Version 0.1.1 (2017-07-10)
pkr A bug in C0 calcuation of IV bolus case was fixed.
Version 0.1.0 (2017-03-15)
First version