Open marialma opened 3 years ago
Hi Maria,
Nope, we don't have that implemented at the moment.
For your case I'd recommend implementing a new renderer. Something like,
CategoryRender <- R6::R6Class(
'CategoryRender',
private = list(
.output = NULL, # a char matrix representing the state of every individual at each timestep
.categories = NULL
),
public = list(
initialize = function(timesteps, n_individuals, categories) {
private$.categories <- categories
private$.output <- matrix(NA, nrow = timesteps, ncol = n_individuals)
},
render = function(category_variable, timestep) {
for (category in private$.categories) {
private$.output[timestep, category_variable$get_index_of(category)$to_vector()] <- category
}
},
#' @description
#' Make a dataframe for the render
to_dataframe = function() {
# turn your private$.output into the dataframe you want :)
}
)
)
If it works well for you we're happy to accept a pull request :)
Thank you! I'll give it a shot and report back 😄
Great! LMK
This is becoming relevant again to output population NAT for safir to calculate seroprevalence. @giovannic I'm assigning myself to this, I'll get to it in the next few weeks.
storage.mode
to the proper integer type, or could just do it in C++ and return NumericMatrix.One thing to be aware of is that if we resize variables mid-simulation, the size of rendered objects changes. Not sure yet how to deal with that, for now I'll assume we're not using resizable variables. One nice feature would be to only output at some subset of time points, such as every integer day, for models which update with small dt.
Very cool!
if we resize variables mid-simulation
That's cool, let's not support resizeable variables until we understand what works for standard variables
That's cool, let's not support resizeable variables until we understand what works for standard variables
We may not even need to do anything, based on what Azra and Alexandra need in safir, we can just do the appropriate summary of data in the render process as double_count_render_process_daily
in this vignette! https://mrc-ide.github.io/safir/articles/vaccine_notypes.html#run-safir
Hi individual team! I had a question/ request about the output formats
Instead of generating a data frame that contains the counts of each compartment at each time step, I'm interested in creating a data frame that shows each individual's status at each time point. Is there a way to do this within the Render class?