Skip to content

Problem in is_valid_rij_list() #11

@jacobbien

Description

@jacobbien

Here is a minimal example from @gregfaletto showing the problem:

library(simulator)

set.seed(12375)

simulate_func <- function(x, nsim){
  
  ret_list <- list()
  
  for(i in 1:nsim){
    ret_list[[i]] <- 1
  }
  
  return(ret_list)
}

error_sim_model <- function(x){
  
  my_model <- new_model(name = "error_sim_model", 
                        label = "err_model",
                        params = list(x=x),
                        simulate = simulate_func
  )
  return(my_model)
}

bad_meth <- new_method("bad_meth", "Bad method",
                       method = function(model, draw) {
  if(as.logical(rbinom(n=1, size=1, prob=0.5))){
    return(list(a=2))
  } else{
    return(list(b=3))
  }
  return(ret)
}
)

sim <- new_simulation("sim", "Error sim")

sim <- generate_model(sim, error_sim_model, x=2)

sim <- simulate_from_model(sim, nsim = 20)

sim <- run_method(sim, list(bad_meth))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions