-
Notifications
You must be signed in to change notification settings - Fork 108
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
feat: simplified input for ph_with
's location
arg
#623
Comments
Hello, I've been thinking about this and I think it's a good idea, it's similar to what we use for the ggplots I'm not a fan of the numerical index idea, but I'll leave the decision up to you. David |
@davidgohel Great, happy to do it. Please feel free to assign the issue to me :) |
…avidgohel#623) Instead of a `location` object created by the `ph_location_*` function family, `ph_with_*` functions now resolves certain short form input into corresponding `location` objects. For example, instead of using `ph_location_label("<label>")` you can now simply pass the `"<label>"` to the `location` arg. The functionn will convert the string into the corresponding location object automatically. Other examples are `"body [1]"` for `ph_location_type(type = "body", type_idx = 1)`, or the integer `1` for `ph_location_id(id = 1)`.
- Simplified input format for `location` arg in `ph_with_*` functions (#623) Instead of a `location` object created by the `ph_location_*` function family, `ph_with_*` functions now resolves certain short form input into corresponding `location` objects. For example, instead of using `ph_location_label("<label>")` you can now simply pass the `"<label>"` to the `location` arg. The functionn will convert the string into the corresponding location object automatically. Other examples are `"body [1]"` for `ph_location_type(type = "body", type_idx = 1)`, or the integer `1` for `ph_location_id(id = 1)`. - export resolve_location() function. It might be helpful if other packages want to use it in their own wrappers.
When I started out with officer, I was initially confused by the
ph_with
location
argument which expects the output of one of theph_location_*
functions. Now, all make perfect sense. Still I think it would be useful (especially for newcomers) to also offer the option of supplying a simplifiedlocation
arg input (string or numeric), instead of a having to call aph_location_*
function.Providing a string or numeric can - I think unambiguously and without loss of generality - cover most of the common
ph_location_*
use cases. While theph_location_*
functions allow for more customized settings and additional features, I think the simplified version would be a nice UI addition and suffice the most common use cases.NB: Behind the scenes, the simplified input would just be automatically plugged into one of the
ph_location_*
functions.What do you think?
The text was updated successfully, but these errors were encountered: