R/update.R

Defines functions updata

Documented in updata

updata <-
function(data = data, lastdose, npt, ndlt){#browser()
if (!(lastdose %in% data$dose)) {stop("dose do not treat")}
if (ndlt > npt) {stop("ndlt > npt is impossible")}
if (npt == 0){return(data)}
if (ndlt < 0 | npt < 0) {stop("ndlt & npt must be positive")}
idx<-which(data$dose==lastdose)
data[idx, "npt"] <- data[idx,"npt"] + npt
data[idx, "ndlt"] <- data[idx,"ndlt"] + ndlt
return(data)
}

Try the UBCRM package in your browser

Any scripts or data that you put into this service are public.

UBCRM documentation built on May 17, 2022, 1:07 a.m.