Prepare data for use with the
$set_data() method. This is not
required for use but tries to simplify the most common use case
where you have a data.frame with some column indicating "model
name_step), and other columns that might be use in your
data_compare function. Each row will be turned into a named R
list, which your
dust_data function can then work with to get
this time-steps values. See Details for use with multi-pars
dust_data(object, name_step = "step", multi = NULL)
An object, at this point must be a data.frame
The name of the data column within
Control how to interpret data for multi-parameter dust object; see Details
The data object as accepted by
data_set must be a list and
each element must itself be a list with two elements; the model
step at which the data applies and any R object that corresponds
to data at that point. We expect that most of the time this second
element will be a key-value list with scalar keys, but more
flexibility may be required.
For multi-data objects, the final format is a bit more awkward;
each time step we have a list with elements
n parameters. There are two ways of
creating this that might be useful: sharing the data across all
parameters and using some column as a grouping value.
The behaviour here is driven by the
NULL: (the default) do nothing; this creates an object that
is suitable for use with a
pars_multi = FALSE dust
<integer> (e.g., multi = 3); share the data across 3 sets of
parameters. This number must match the number of parameter sets
that your dust object is created with
<column_name> (e.g., multi = "country"); the name of a column
within your data to split the data at. This column must be a
factor, and that factor must have levels that map to integers 1,
2, ..., n (e.g.,
A list of dust time/data pairs that will be used for the compare function in a compiled model. Each element is a list of length two or more where the first element is the time step and the subsequent elements are data for that time step.
d <- data.frame(step = seq(0, 50, by = 10), a = runif(6), b = runif(6)) dust::dust_data(d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.