attach_data | R Documentation |
libbi
objectAdds an (output, obs, etc.) file to a libbi
object. This is
useful to recreate a libbi
object from the model and output
files of a previous run
The bi_write
options append
and overwrite
determine what exactly the file will contain at the end of this. If they
are both FALSE (the default), any existing file will be ignored. If
append
is TRUE, the existing data in the file will be preserved, and
any data set passed as data
and not already in the file will be
added. If overwrite
is TRUE, existing data in the file will be
preserved except for variables that exist in the passed data
.
## S3 method for class 'libbi'
attach_data(
x,
file,
data,
in_place = FALSE,
append = FALSE,
overwrite = FALSE,
quiet = FALSE,
time_dim = character(0),
coord_dims = list(),
...
)
x |
a |
file |
the type of the file to attach, one of "output", "obs", "input" or "init" |
data |
name of the file to attach, or a list of data frames that contain the outputs; it will be assumed that this is already thinned |
in_place |
if TRUE, replace the file in place if it already exists in
the libbi object; this can speed up the operation if append=TRUE as
otherwise the file will have to be read and used again; it should be used
with care, though, as it can render existing |
append |
if TRUE, will append variables if file exists; default: FALSE |
overwrite |
if TRUE, will overwrite variables if file exists; default: FALSE |
quiet |
if TRUE, will suppress the warning message normally given if replace=TRUE and the file exists already |
time_dim |
the name of the time dimension, if one exists; default: "time" |
coord_dims |
the names of the coordinate dimension, if any; should be a named list of character vectors, they are matched to variables names |
... |
any options to |
an updated libbi
object
bi <- libbi(model = system.file(package = "rbi", "PZ.bi"))
example_output <- bi_read(system.file(package = "rbi", "example_output.nc"))
bi <- attach_data(bi, "output", example_output)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.