
Convert BUGS Model to Julia's `@bugs` Macro Format
bugs2juliaBUGS.Rd
Formats a BUGS model string to Julia's `@bugs("""...""", convert_var_name, true)` syntax, used in the Julia ecosystem for running BUGS models. By default, this macro converts R-style variable names (e.g., `a.b.c`) to Julia-style (`a_b_c`). You can disable this behavior by setting `convert_var_name = FALSE`.
Examples
model <- "
for i in 1:N
y[i] ~ dnorm(mu, tau)
end
mu ~ dnorm(0.0, 1.0E-6)
tau ~ dgamma(0.001, 0.001)
"
bugs2juliaBUGS(model)
#> [1] "model = @bugs(\"\"\"\nfor i in 1:N\n y[i] ~ dnorm(mu, tau)\n end\n mu ~ dnorm(0.0, 1.0E-6)\n tau ~ dgamma(0.001, 0.001)\n\"\"\", true, true)"
bugs2juliaBUGS(model, convert_var_name = FALSE)
#> [1] "model = @bugs(\"\"\"\nfor i in 1:N\n y[i] ~ dnorm(mu, tau)\n end\n mu ~ dnorm(0.0, 1.0E-6)\n tau ~ dgamma(0.001, 0.001)\n\"\"\", false, true)"