Learn R Programming

crmPack (version 2.0.0)

h_jags_write_model: Writing JAGS Model to a File

Description

[Stable]

This function converts a R function with JAGS model into a text and then writes it into a given file. During the "model into text" conversion, the format of numbers of which absolute value is less than 0.001 or greater than 10000 is changed. These numbers will be converted into scientific format with specified number of significant digits using formatC() function.

Usage

h_jags_write_model(model, file = NULL, digits = 5)

Value

The name of the file where the model was saved.

Arguments

model

(function)
function containing the JAGS model.

file

(string or NULL)
the name of the file (including the optional path) where the model will be saved. If NULL, the file will be created in a R_crmPack folder placed under temporary directory indicated by tempdir() function.

digits

(count)
a desired number of significant digits for for numbers used in JAGS input, see formatC().

Examples

Run this code
# Some model function
my_model <- function() {
  alpha0 <- mean(1:10)
  alpha1 <- 600000
}

h_jags_write_model(my_model, digits = 5)

Run the code above in your browser using DataLab