Learn R Programming

fz (version 1.2.0)

fzc: fzc Function

Description

Compiles input file(s) by replacing variable placeholders with values. Each unique combination of values is written to its own subdirectory inside output_dir, named var1=val1,var2=val2,....

Usage

fzc(
  input_path,
  input_variables,
  model,
  output_dir = "output",
  input_static = NULL
)

Value

NULL (invisibly). Called for side effects.

Arguments

input_path

Path to input file or directory.

input_variables

Named list of variable values. Supply a vector of values to generate a full-factorial grid across variables.

model

Model definition dict or alias string.

output_dir

Output directory for compiled files. Default "output".

input_static

Optional character vector of files that are identical across every case (see fzr's input_static). They are symlinked into output_dir rather than templated or duplicated. Default NULL.

Examples

Run this code
# \donttest{
if (fz_available()) {
  tf <- tempfile(fileext = ".txt")
  writeLines(c("P = ${P~1.013}", "V = ${V~22.4}"), tf)

  model <- list(varprefix = "$", delim = "{}", formulaprefix = "@",
                commentline = "#")
  out <- tempfile()

  fzc(tf, list(P = 2.0, V = 11.2), model, out)
  fzc(tf, list(P = c(1.0, 2.0), V = c(11.2, 22.4)), model, out)
}
# }

Run the code above in your browser using DataLab