Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

How to create a minimal example

Jim Thorson edited this page May 28, 2021 · 5 revisions

If you'd like a package author to explore your code, we request that you provide a "minimal example". Most times, a minimal example involves:

  1. Running your personal code up until right before you would call fit_model
  2. Save your global variables (i.e., the objects in your R terminal at that point) using save.image
  3. Create a new R script that loads the save.image object using load.image, runs fit_model, and any plotting function you would like help with.
    • Note that some uses might instead replace fit_model with mid-level functions, e.g., Data_Fn, Build_TMB_Fun, and TMBhelper::Optimize
  1. Confirm that this R script re-creates your problem in a new R terminal
  2. Send the R script and your save.image object to the package author.

This process involves sending only two files (the single R script, and the output of save_image). For large models, it can be helpful to include a third file, ParHat = fit$ParHat after running the model, so that a person can start from the MLE when exploring.