R/implementation.R

Defines functions implementation

Documented in implementation

#' Compute the implementation
#'
#' Compute the implementation which is define as ...
#'
#' @param time individual (and time dependent) times
#' @param comp individual and time dependent compliances (0/1)
#'
#' @return a dataframe including implementation as a function of follow-up time
#'
#' @examples
#' data(onco)
#' onco$compliance <- onco$observed >= onco$expected
#' imp <- implementation(onco$drel, onco$compliance)
#' plot(imp ~ time, imp, type = "l", ylim = 0:1)
#'
#' @export

implementation <- function(time, comp) {
  imp <- aggregate(comp, list(time), mean, na.rm = TRUE)
  names(imp) <- c("time", "imp")
  imp <- imp[order(imp$time), ]
  imp
}
jpasquier/ad_test documentation built on Nov. 14, 2019, 8:09 p.m.