Note that conceptually this is similar to the
bbr::build_path_from_model() generic. Perhaps this functionality
should even be exposed as an nmbayes method for that.
However, 1) that would mean build_path_from_model() would return a
non-scalar, which may be okay but probably needs more thought and 2)
at least currently, build_path_from_model() doesn't have support for
specifying a name to use in place of the model ID (which chain_paths()
will gain in the next commit). So, for now at least, expose a
tailored function.
@seth127 said:
I'm not sure when we would prioritize it, but I do like the idea of unifying these, and of adding the name argument to bbr::build_path_from_model().
#' Return output file from each chain subdirectory
#'
#' Starting with the top-level NOMEM Bayes model, construct the paths to the
#' specified per-chain output files.
#'
#' @param .mod A `bbi_nmbayes_model` object.
#' @param name Name of file, without leading path or extension. If unspecified,
#' defaults to "{id}-{chain}".
#' @param extension File extension.
#' @return Absolute file paths, one for each chain.
#' @seealso [bbr_nmbayes] for a high-level description of how NONMEM Bayes
#' models are structured
#' @export
chain_paths <- function(.mod, name = NULL, extension = "") {
Or more generally: reconcile with
bbr.bayes::chain_paths()
behavior?This is a follow-up to https://github.com/metrumresearchgroup/bbr.bayes/pull/104#pullrequestreview-1710663242.
Commit d3e400 says
@seth127 said:
https://github.com/metrumresearchgroup/bbr.bayes/blob/3637c35931063bde312bd2a9a3d76f9d7ef89b9c/R/nmbayes-helpers.R#L40-L53
https://github.com/metrumresearchgroup/bbr/blob/ac4293a28e001ce0977d76ff75c1f003ab85ca34/R/get-path-from-object.R#L200-L221
So the path forward could be something like
update
build_path_from_model
to acceptname
or the equivalentdocument that
build_path_from_model
may return a non-scalar and audit current callers to see if that's an issueNecessary if bbr.bayes is going to add a method to return a path for each submodel.
Then on the bbr.bayes side:
add a
build_path_from_model.bbi_nmbayes_model
methodphase out
chain_paths
(maybe)