Skip to content
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

Use rlang::check_installed() #4375

Merged
merged 6 commits into from
Mar 18, 2021

Conversation

malcolmbarrett
Copy link
Contributor

@malcolmbarrett malcolmbarrett commented Mar 17, 2021

This PR replaces various requireNamespace() + abort() checks with the new rlang function check_installed(), which offers to install the suggested package then proceeds or aborts. This PR also bumps the rlang dependency to 0.4.10

Screen Shot 2021-03-17 at 3 23 00 PM

I didn't use the reason argument in any check_installed() calls, which can add a bit of context. I'd be happy to add that, if desired.

Closes #4370, fixes #4344

@yutannihilation
Copy link
Member

Thanks, I think we can use reason argument on where ggplot2 already uses try_require(), which contains the reason.

@malcolmbarrett
Copy link
Contributor Author

malcolmbarrett commented Mar 18, 2021

Yeah, I agree; I think this is better. Added! It now looks like this, depending on the function:

Screen Shot 2021-03-17 at 7 17 05 PM

Copy link
Member

@yutannihilation yutannihilation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good! Do you think this needs a news item?

@malcolmbarrett
Copy link
Contributor Author

✔️ Added to news

Thanks! 🙏

@yutannihilation yutannihilation merged commit be50f53 into tidyverse:master Mar 18, 2021
@yutannihilation
Copy link
Member

Thanks!

@malcolmbarrett malcolmbarrett deleted the check_installed branch March 18, 2021 17:00
leogama added a commit to leogama/ggtern that referenced this pull request Jul 5, 2021
ggplot2 removed `try_require` in favor of rlang's `check_installed` function.
See tidyverse/ggplot2#4375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using rlang::check_installed() Better error message when using coord_map() without {maproj} installed
2 participants