-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different formats for output data? #77
Comments
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.
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!
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 |
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?
The text was updated successfully, but these errors were encountered: