tests/testthat/helper.R

# helper functions for tests, will automatically be sourced by testthat before tests

get_project <- function(project, runPopEstimationIfNeed = TRUE, runStdErrorsIfNeed = FALSE) {
  .loadProject(project, software = "monolix")
  tmpProject <- file.path(tempdir(), basename(project))
  .lixoftCall("saveProject", list(projectFile = tmpProject))
  
  if (runPopEstimationIfNeed | runStdErrorsIfNeed) {
    if (! .lixoftCall("getLaunchedTasks")[["populationParameterEstimation"]] | 
        ! .lixoftCall("getLaunchedTasks")[["standardErrorEstimation"]]) {
      if (runStdErrorsIfNeed &
          ! .lixoftCall("getScenario")[["tasks"]][["standardErrorEstimation"]]) {
        scenario = .lixoftCall("getScenario")
        scenario$tasks["standardErrorEstimation"] = TRUE
        .lixoftCall("setScenario", scenario)
      }
      .lixoftCall("runScenario")
    } 
  }
  
  return(tmpProject)
}

Try the RsSimulx package in your browser

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

RsSimulx documentation built on June 22, 2024, 9:36 a.m.