Skip to content

Stats imports #5514

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

Merged
merged 3 commits into from
Nov 10, 2023
Merged

Stats imports #5514

merged 3 commits into from
Nov 10, 2023

Conversation

klin333
Copy link
Contributor

@klin333 klin333 commented Nov 9, 2023

Add utils:: and stats:: in front of functions not explicitly imported.

Fixes #5186

Copy link
Collaborator

@teunbrand teunbrand left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, the proposed changed look good to me.
Can I just quickly check in that these changes have resolved the issue that you were experiencing?

@klin333
Copy link
Contributor Author

klin333 commented Nov 9, 2023

yes, this use to complain about approxfun not found if stats package is not in namespace: tibble(x = seq(10), y = seq(10)) %>% ggplot() + geom_area(aes(x = x, y = y)). But it works now.

@klin333
Copy link
Contributor Author

klin333 commented Nov 9, 2023

also note that utils::head and utils::tail are used in various places in ggplot2. i didn't prepend utils:: to them as i didn't want to make too many file changes. probably best to explicitly import these 2 functions in ggplot2-package.R?

naked head and tail calls may be in the files below based on regex search, though i didn't manually check for false positives.
1 R/guide-colorsteps.R
2 R/guide-legend.R
3 R/guides-.R
4 R/scale-.R

@teunbrand
Copy link
Collaborator

probably best to explicitly import these 2 functions in ggplot2-package.R?

Yeah that might be wise. You could use usethis::use_import_from("utils", c("head", "tail")) to automatically write the namespace as well.

@teunbrand teunbrand merged commit 4f05313 into tidyverse:main Nov 10, 2023
@teunbrand
Copy link
Collaborator

Great, thanks for the contribution!

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.

Several occurrences of unimported stats and utils function calls
3 participants