diff --git a/NAMESPACE b/NAMESPACE index 67ecafc0..5dacc2db 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,6 +13,8 @@ S3method(PKNCAdose,tbl_df) S3method(as.data.frame,PKNCAconc) S3method(as.data.frame,PKNCAdose) S3method(as.data.frame,PKNCAresults) +S3method(dplyr::group_vars,PKNCAconc) +S3method(dplyr::group_vars,PKNCAdose) S3method(exclude,default) S3method(filter,PKNCAconc) S3method(filter,PKNCAdose) @@ -22,6 +24,9 @@ S3method(formula,PKNCAdose) S3method(full_join,PKNCAconc) S3method(full_join,PKNCAdose) S3method(full_join,PKNCAresults) +S3method(getDataName,PKNCAconc) +S3method(getDataName,PKNCAdose) +S3method(getDataName,PKNCAresults) S3method(getDepVar,PKNCAconc) S3method(getDepVar,PKNCAdose) S3method(getGroups,PKNCAconc) @@ -35,6 +40,9 @@ S3method(group_by,PKNCAresults) S3method(inner_join,PKNCAconc) S3method(inner_join,PKNCAdose) S3method(inner_join,PKNCAresults) +S3method(is_sparse_pk,PKNCAconc) +S3method(is_sparse_pk,PKNCAdata) +S3method(is_sparse_pk,PKNCAresults) S3method(left_join,PKNCAconc) S3method(left_join,PKNCAdose) S3method(left_join,PKNCAresults) @@ -51,6 +59,7 @@ S3method(print,summary_PKNCAresults) S3method(right_join,PKNCAconc) S3method(right_join,PKNCAdose) S3method(right_join,PKNCAresults) +S3method(setDuration,PKNCAconc) S3method(setDuration,PKNCAdose) S3method(setRoute,PKNCAdose) S3method(signifString,data.frame) diff --git a/R/class-PKNCAconc.R b/R/class-PKNCAconc.R index ff206cba..efd0682f 100644 --- a/R/class-PKNCAconc.R +++ b/R/class-PKNCAconc.R @@ -203,6 +203,7 @@ formula.PKNCAconc <- function(x, ...) { #' order. #' @export #' @importFrom stats model.frame +#' @method model.frame PKNCAconc model.frame.PKNCAconc <- function(formula, ...) { formula$data[, all.vars(formula$formula), drop=FALSE] } @@ -265,6 +266,7 @@ group_vars.PKNCAconc <- function(x) { } #' @rdname getDataName +#' @export getDataName.PKNCAconc <- function(object) { if (is_sparse_pk(object)) { "data_sparse" @@ -273,6 +275,8 @@ getDataName.PKNCAconc <- function(object) { } } +#' @rdname setDuration +#' @export setDuration.PKNCAconc <- function(object, duration, ...) { if (missing(duration)) { object <- @@ -364,6 +368,7 @@ print.PKNCAconc <- function(x, n=6, summarize=FALSE, ...) { } #' @rdname is_sparse_pk +#' @export is_sparse_pk.PKNCAconc <- function(object) { "data_sparse" %in% names(object) } diff --git a/R/class-PKNCAdata.R b/R/class-PKNCAdata.R index 95b44afb..9f7ab6de 100644 --- a/R/class-PKNCAdata.R +++ b/R/class-PKNCAdata.R @@ -191,6 +191,7 @@ PKNCAdata.default <- function(data.conc, data.dose, ..., } #' @rdname is_sparse_pk +#' @export is_sparse_pk.PKNCAdata <- function(object) { is_sparse_pk(object$conc) } diff --git a/R/class-PKNCAdose.R b/R/class-PKNCAdose.R index 2ae2f271..10d0d12f 100644 --- a/R/class-PKNCAdose.R +++ b/R/class-PKNCAdose.R @@ -50,12 +50,14 @@ PKNCAdose <- function(data, ...) #' @rdname PKNCAdose #' @export -PKNCAdose.default <- function(data, ...) +PKNCAdose.default <- function(data, ...) { PKNCAdose.data.frame(as.data.frame(data), ...) +} #' @rdname PKNCAdose #' @export -PKNCAdose.tbl_df <- function(data, ...) +PKNCAdose.tbl_df <- function(data, ...) { PKNCAdose.data.frame(as.data.frame(data), ...) +} #' @rdname PKNCAdose #' @export @@ -242,6 +244,7 @@ formula.PKNCAdose <- function(x, ...) { #' @rdname model.frame.PKNCAconc #' @export #' @importFrom stats model.frame +#' @method model.frame PKNCAdose model.frame.PKNCAdose <- function(formula, ...) { cbind(getDepVar.PKNCAdose(formula), getIndepVar.PKNCAdose(formula), @@ -281,8 +284,10 @@ group_vars.PKNCAdose <- function(x) { } #' @rdname getDataName -getDataName.PKNCAdose <- function(object) +#' @export +getDataName.PKNCAdose <- function(object) { "data" +} #' @rdname print.PKNCAconc #' @export diff --git a/R/class-PKNCAresults.R b/R/class-PKNCAresults.R index 238b8cd1..aa4cdfa5 100644 --- a/R/class-PKNCAresults.R +++ b/R/class-PKNCAresults.R @@ -59,11 +59,13 @@ as.data.frame.PKNCAresults <- function(x, ..., out.format=c('long', 'wide')) { } #' @rdname getDataName +#' @export getDataName.PKNCAresults <- function(object) { "result" } #' @rdname is_sparse_pk +#' @export is_sparse_pk.PKNCAresults <- function(object) { is_sparse_pk(object$data) } diff --git a/R/pk.calc.urine.R b/R/pk.calc.urine.R index 3f48a750..a72b0c2c 100644 --- a/R/pk.calc.urine.R +++ b/R/pk.calc.urine.R @@ -32,7 +32,7 @@ pk.calc.ae <- function(conc, volume, check=TRUE) { } else if (any(mask_missing_vol)) { message_vol <- sprintf("%g of %g volumes are missing", sum(mask_missing_vol), length(conc)) } - message_all <- na.omit(c(message_both, message_conc, message_vol)) + message_all <- stats::na.omit(c(message_both, message_conc, message_vol)) ret <- sum(conc*volume) if (length(message_all) != 0) { message <- paste(message_all, collapse = "; ") diff --git a/README.md b/README.md index 6d1d65a6..13088be1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/PKNCA)](https://cran.r-project.org/package=PKNCA) [![R-CMD-check](https://github.com/billdenney/pknca/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/billdenney/pknca/actions/workflows/R-CMD-check.yaml) -[![Code_Coverage_Badge](https://codecov.io/github/billdenney/pknca/coverage.svg?branch=main)](https://codecov.io/github/billdenney/pknca?branch=main) +[![Code_Coverage_Badge](https://codecov.io/github/billdenney/pknca/coverage.svg?branch=main)](https://app.codecov.io/github/billdenney/pknca?branch=main) [![CodeFactor](https://www.codefactor.io/repository/github/billdenney/pknca/badge?style=plastic)](https://www.codefactor.io/repository/github/billdenney/pknca) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2054/badge)](https://bestpractices.coreinfrastructure.org/projects/2054) diff --git a/man/group_vars.PKNCAconc.Rd b/man/group_vars.PKNCAconc.Rd index 10161985..f19127af 100644 --- a/man/group_vars.PKNCAconc.Rd +++ b/man/group_vars.PKNCAconc.Rd @@ -5,9 +5,9 @@ \alias{group_vars.PKNCAdose} \title{Get grouping variables for a PKNCA object} \usage{ -\method{group_vars}{PKNCAconc}(x) +group_vars.PKNCAconc(x) -\method{group_vars}{PKNCAdose}(x) +group_vars.PKNCAdose(x) } \arguments{ \item{x}{The PKNCA object} @@ -20,6 +20,6 @@ Get grouping variables for a PKNCA object } \section{Functions}{ \itemize{ -\item \code{group_vars(PKNCAdose)}: Get group_vars for a PKNCAdose object +\item \code{group_vars.PKNCAdose()}: Get group_vars for a PKNCAdose object }} diff --git a/man/setDuration.Rd b/man/setDuration.Rd index 0accdd59..ac8f2690 100644 --- a/man/setDuration.Rd +++ b/man/setDuration.Rd @@ -1,10 +1,13 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class-PKNCAdose.R -\name{setDuration} +% Please edit documentation in R/class-PKNCAconc.R, R/class-PKNCAdose.R +\name{setDuration.PKNCAconc} +\alias{setDuration.PKNCAconc} \alias{setDuration} \alias{setDuration.PKNCAdose} \title{Set the duration of dosing or measurement} \usage{ +\method{setDuration}{PKNCAconc}(object, duration, ...) + setDuration(object, ...) \method{setDuration}{PKNCAdose}(object, duration, rate, dose, ...) @@ -12,11 +15,11 @@ setDuration(object, ...) \arguments{ \item{object}{An object to set a duration on} -\item{...}{Arguments passed to another setDuration function} - \item{duration}{The value to set for the duration or the name of the column in the data to use for the duration.} +\item{...}{Arguments passed to another setDuration function} + \item{rate}{(for PKNCAdose objects only) The rate of infusion} \item{dose}{(for PKNCAdose objects only) The dose amount}