R/nmlog.R

Defines functions nmlog

Documented in nmlog

#' Create a log of nonmem runs
#'
#' @param vector of run numbers
#' @param project project directory
#'
#' @export
nmlog <- function(run, project) {

  runl <- lapply(run, nmlist, project = project)

  theta <- lapply(runl, function(x) {
    xx <- as.data.frame(x$theta)
    yy <- as.list(x$omega[lower.tri(x$omega, diag=TRUE)])
    names(yy) <- paste0("V",seq_along(yy))
    xx <- cbind(xx,as.data.frame(yy))
    yy <- as.list(x$sigma[lower.tri(x$sigma, diag=TRUE)])
    names(yy) <- paste0("VV", seq_along(yy))
    xx <- cbind(xx,as.data.frame(yy))
    xx$OFV <- x$status$OFV
    xx$TERM <- x$status$TERM
    xx
  })
  theta <- bind_rows(theta)
  theta <- mutate(theta, run = run)
  select(theta, run, OFV,TERM,starts_with("THETA"), everything())
}
kylebaron/nmlist documentation built on Dec. 21, 2021, 8:45 a.m.