#' 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
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.