metrumresearchgroup / mrgsolve

Simulate from ODE-based population PK/PD and QSP models in R
https://mrgsolve.org
129 stars 36 forks source link

Fix as_data_set with data.frame #1196

Closed kylebaron closed 2 months ago

kylebaron commented 3 months ago

Summary

as_data_set() takes event objects or data frames and combines them in to a single data frame / data set. The key moving parts are

  1. We can potentially combine objects with upper or lower case naming
  2. We can combine either data frames or event objects
  3. All subjects get unique IDs

There are methods for handling either data frames or event objects with upper or lower case naming. The data frame method was recently found to be broken in #1115.

The refactor in the PR for the data frame method includes coercing the first object into an event object and then calling the event object method. The worker function for handing events assesses that first object and then makes sure that all the other objects follow the setup discovered for the first object.

There is a function (lc_tran_names) that assess data.frame or event objects and reports if the naming scheme is lower case or not.

I also started calling finalize_ev() which does some checks and puts output columns in a standardized order.