Learn R Programming

rbi (version 0.6.0)

bi_write: Create (init or observation) files for LibBi

Description

This function creates an init file to specify parameter values and initial conditions. This file can then be passed to libbi using the --init-file option.

Usage

bi_write(filename, variables, timed, ...)

Arguments

filename
a path to a NetCDF file to write the variables into, which will be overwritten if it already exists.
variables
a list object, which names should be the variable names and values should be either single values, vectors of equal length, or data frames; or a single element of the type
timed
if TRUE, any elements of variables that are vectors will be assumed to have a time dimension
...
arguments passed to netcdf_create_from_list

Value

None, but creates a NetCDF file at the specified path.

Examples

Run this code
filename <- tempfile(pattern="dummy", fileext=".nc")
a <- list(values = 1:3, dimension = "dim_a")
b <- list(values = 1:5, dimension = "dim_b")
c <- list(values = 5:9, dimension = "dim_b")
d <- 3
e <- data.frame(dim_a = rep(1:3, time = 2), dim_c = rep(1:2, each = 3), value = 1:6)
variables <- list(a=a, b=b, c=c, d=d, e=e)
bi_write(filename, variables)
bi_file_summary(filename)

Run the code above in your browser using DataLab