-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/issue 102 allow specify nt features and nt distances with partial name rather than a vector #114
Conversation
…able specification
- update vignettes and examples - fix issue with IMM vignette's last figure where parameters were in the wrong order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, the changes look good and I got everything to run on my machine, too. However, I noticed that using the regex
option can also use problems, for example if I were to fit the model only to setsize = 4
in the OberauerLin_2017
data then I would have to delete all col_nt
and dist_nt
vars for the nts 4 to 7. However with the paste0("col_nt",1:3)
this does not cause problems.
Maybe we can add this when introducing the regex
option. That this will only work if all variables following a certain naming scheme are used for the model specification. Otherwise, in the above mentioned example, I get an error that there are more nt_features
than max(setsize) - 1
I think this is not too big of an issue, but users might still be confused about it when trying to run models only on specific conditions without adapting their dataset.
I ran one more test and found another issue. In the case where variable are not sorted in the same order the |
I thought about that too, but this is not a problem if you specify the regex with a limited number range. E.g., this will happen if you call
but not if you call
This example is included in the vignettes. In general, we give the regex option, but it's not our task to educate people about regex - it is there to use for those who want it and know how to use (as in any other package that offers regex arguments, for example a few functions in brms, posterior and tidybayes) |
good point. Two thoughts:
So given that this is potentially a really rare case, that it is almost impossible to handle exhaustively, my vote is to leave the responsibility with the user. Maybe we can add a note in the @param section of those models that the order of columns passed to nt_features and nt_distances should match the corresponding items |
I see your points and agree that both the cases I highlighted will likely be rare. So, let's merge this for now and if additional problems pop up the more we use the feature we can re-evaluate if we need to change something about this. |
Summary
Allow users to specify model variable arguments such as nt_features and nt_distances via regular expressions.
replace_regex_variables(model, data)
. If regex is FALSE or NULL or MISSING, the function just returns the model object, making it backwards compatible with all models regardless of whether they have a regex argument or not. if regex=TRUE, the functions checks which variables can be specified via regular expressions, and then looks in the data column names for matching variablesExample usage:
or
or
Tests
[x] Confirm that all tests passed
[x] Confirm that devtools::check() produces no errors
Release notes