R/detect_ode_syntax.R

Defines functions detect_ode_syntax

Documented in detect_ode_syntax

#' Auto-detect the syntax for the ODE code
#'
#' Either PKPDsim or RxODE
#'
#' @param code character string with ODE code
#' @export
#' @return List with elements `from` and `to` indicating the syntax for the ODE
#'   code
#' @md
detect_ode_syntax <- function(code) {
  ## currently very simple, supports only PKPDsim / RxODE
  from <- "PKPDsim"
  to <- "RxODE"
  if(any(stringr::str_detect(tolower(code), "d/dt"))) {
    to <- "PKPDsim"
    from <- "RxODE"
  }
  return(list(from = from, to = to))
}

Try the PKPDsim package in your browser

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

PKPDsim documentation built on March 7, 2023, 5:40 p.m.