inst/other/vpc.plot.r

# Script to create VPC
# ShinyMixR will add a vector with the selected models, e.g.:
# models <- c("run1","run2")
library(ggplot2)
lapply(files,function(x){
  mdln  <- tools::file_path_sans_ext(basename(x))
  rootl <- normalizePath(paste0(dirname(x),"/../"),winslash = "/")
  res   <- readRDS(paste0(rootl,"/shinyMixR/",mdln,".res.rds"))
  dir.create(paste0(rootl,"/analysis/",mdln),showWarnings=FALSE)
  if(length(find.package("nlmixr2", quiet = TRUE))>0){
    try(R3port::html_plot(nlmixr2plot::vpcPlot(res,n=500,show=list(obs_dv=TRUE)),out=paste0(rootl,"/analysis/",mdln,"/vpc.plot.html"),show=FALSE,title="VPC"))
  }else{
    try(R3port::html_plot(nlmixr::vpc(res,nsim=500,show=list(obs_dv=TRUE)),out=paste0(rootl,"/analysis/",mdln,"/vpc.plot.html"),show=FALSE,title="VPC"))
  }
})
message("Script done!\n")

Try the shinyMixR package in your browser

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

shinyMixR documentation built on April 12, 2025, 2:25 a.m.