R/get_stan_function.R

Defines functions get_stan_function

get_stan_function <- function(function_name) {
  filename = paste0(function_name, ".stan")

  full_filename <- system.file("stan_files",
                      "functions",
                      filename,
                      package = methods::getPackageName())

  if (full_filename == "") {
    stop(paste0("Definition for ", function_name, " could not be found."))
  }

  list(source_code = readr::read_file(full_filename))
}
PRIMER-e/probabilityDistributions documentation built on Jan. 4, 2023, 10:32 a.m.