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

Is there a convenient way to extract input units from pknca. #202

Closed john-harrold closed 1 year ago

john-harrold commented 1 year ago

So I want to extract the supplied units when running pk.nca(). For example if nca_res below is the output from pk.nca() I'm currently doing something like this to extract the time units supplied:

time_units = nca_res$data$units[nca_res$data$units$PPTESTCD == "start", ][["PPORRESU"]]

But I don't think that would be ideal if say I did unit conversions somewhere along the way.

billdenney commented 1 year ago

That is the correct way to get the input units. If there are conversions, then they would be stored in the "PPSTRESU" column, and the conversion is in the "conversion_factor" columns of the same data frame where "PPORRESU" is stored.

Does that answer the question?

john-harrold commented 1 year ago

facepalm Sorry I misread the documentation :).

billdenney commented 1 year ago

All good 😊

billdenney commented 1 year ago

If the docs could be clarified, lemme know (PRs accepted!)