-
Notifications
You must be signed in to change notification settings - Fork 0
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
[traits.build adding studies functions] Refinements to automated substitutions #21
Comments
@dfalster - I think this would be a quite useful change to make to the |
Sounds good, no reason not to do it. Relevant code is here. https://github.com/traitecoevo/traits.build/blob/develop/R/process.R#L1177 We can swap out the coder requiring an exact match for a call to the only possible complications I can image are where you have codes that could be confused with other things, e.g. |
Have substitutions process work on individual strings, not entire values. For austraits this will require a bit of playing around with substitutions, but is well worth it for the long-term gains/simplicity. solves issue #21
I thought this was a good idea and it does greatly reduce the number of substitutions required for some studies -- or eliminate the use of
|
See commit fbe21b7 for code I think a solution would be an if else loop where substitution cells that began with a hook such as "^w " would indicate that you use the word-replacing code for whatever comes after this. |
Arising from #613 in austraits.build via @ehwenk:
There are certain circumstances where the automated substitutions code (process.R, line 971) currently requires long lists of substitutions - but maybe could be refined...
Since it only matches entire strings, in circumstances where there are multiple categorical values, one of which needs to be changed, each circumstance with a change to that term needs to be included. For instance, in order to change procumbent to prostrate, there are only 6 times you'd have to replace the term through some variant of str_replace, but 97 different substitutions you'd have to add.
From growth_form branch:
This gets even harder to fix when the words are entered into the data.csv file in non-alphabetical order, because the output is alphabetical and it is tedious to look up each term in the data.csv file to figure out why the substitution isn't "working".
Could the code be rewritten to replace all instances of a term, rather than an exact string match?
(I also occasionally struggle with capital letters in the input causing substitutions to fail, but this shouldn't be a problem, should it?)
The text was updated successfully, but these errors were encountered: