# NOT RUN {
library(magrittr)
library(dplyr)
library(qpNCA)
x <- Theoph
ntad <- c(0,0.25,0.5,1,2,4,5,7,9,12,24)
for(i in 1:nrow(x)){
time <- x$Time[[i]]
delta <- abs(ntad - time)
best <- min(delta)
index <- match(best, delta)
nom <- ntad[[index]]
x$ntad[[i]] <- nom
}
rm(list = c('time','delta','best','index','nom', 'i','ntad'))
x %<>% rename(time = Time, dv = conc)
x %<>% mutate(bloq = ifelse(dv==0,1,0), loq = 0.01, tad = time, loqrule = 1,
subject=as.numeric(Subject), ntad=as.numeric(ntad))
x %>% head
x %<>% correct.loq('subject')
x %>% head
# }
Run the code above in your browser using DataLab