Conversation
| } | ||
|
|
||
| #' @rdname set_variables | ||
| #' @param old_variables (character) Variable names to repair. Should be variable |
There was a problem hiding this comment.
For now I went with old_variables as the argument name, but happy to change this based on feedback.
| stop_no_call( | ||
| "All names in 'old_variables' must contain at least one '.' in the name." | ||
| ) |
There was a problem hiding this comment.
For simplicity I added an error if all the names don't have a . in it. It would be strange to pass in a vector like c("theta.1", "theta[2]") so I don't think we need to write out the logic to handle mixed cases like that. But let me know if you disagree and I can add that logic.
There was a problem hiding this comment.
This logic seems very unhelpful if I have some variables which are scalars. I can no longer just pass the entire list to this function
I believe the set of transformations here is idempotent, so if someone passes theta[1], nothing will be changed, so why not allow it
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files☔ View full report in Codecov by Sentry. |
|
Maybe |
|
I like "repair". Having the dots instead of [] is kind of a thing we don't really want. So we are repairing them to look reasonable again. But I also don't have strong opinions. So completely fine by me if we call it differently. |
|
Re: function name: is the intention to create a function that specifically converts from Stan names, or is the intention that this function might (in the future) support other non-posterior-friendly naming conventions? I think that should influence the naming; e.g. is this "convert_from_stan_names" (though perhaps less verbose) or the more generic "repair_variable_names" or "convert_variable_names"? Or is it "repair_dotted_indices" or "repair_dotted_index_names" or something like that? |
|
Good point @mjskay. If this will only ever be used to convert Stan names we could include that in the function name. What do others think? |
|
I think it would be best to make the function specific for Stan naming conventions, and then add other functions if we add support for other packages. The name "convert_from_stan_names" would be then very descriptive, and I don't know how to make it shorter Furthermore, in #317 @WardBrian wrote
If we want to support these, too, I assume that we would like to have something like And the natural complex type support is a separate issue #319 and PR #321 |
|
I agree with Jonah and Aki. |
|
If you did want to support tuple names, this essentially just needs to split on |
|
@jgabry is this PR still relevant? |
closes #317
Summary
repair_variable_namesconverts names using periods (theta.1.1) to square brackets (`theta[1,1])Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: