ProjectMOSAIC / ggformula

Provides a formula interface to 'ggplot2' graphics.
Other
38 stars 11 forks source link

specify package name to `after_stat()` #165

Closed ian-curtis closed 1 year ago

ian-curtis commented 1 year ago

What I Changed

This pull request adds ggplot2:: in front of after_stat(*) in function definitions. I excluded test files and comments (including Roxygen2 comments).

Why I Changed It

I am working on creating a package that includes some wrapper functions around select ggformula functions. This is designed for introductory statistics students at my university and allows for pretty tables and pre-customized plots so students can focus on the concepts and not the R code. All of my functions work great, the examples run fine, and running things interactively work as well.

However, running devtools::check() on my package leads to check failure. The reasoning is that R "could not function after_stat". It's strange that this happens since ggplot2 is a required package for this package and for mine so you'd think that it would work (plus other ggplot2 functions in this package work without problems). I suppose that there could be other reasons why this error occurs, but looking through the source code here, I noticed that this function was not specified with :: notation. My experience with working on packages and getting the "function not found" error is that I need to use function:: to correct the error.

I'm happy to discuss alternatives to this correction or other potential places I could have gone wrong. Thank you!

rpruim commented 1 year ago

@ian-curtis , thanks for the PR. I've already merged locally and hope to get this to CRAN along with a few other changes soon.

rpruim commented 1 year ago

I should have asked: (When) do you plan to submit your package to CRAN?

nicholasjhorton commented 1 year ago

@rpruim thanks for your work on this front!

ian-curtis commented 1 year ago

I should have asked: (When) do you plan to submit your package to CRAN?

Likely not for some time. The professors I'm working with would like to keep things on "test mode" for at least two semesters while we refine how things work and look and fix and unexpected bugs. This could change depending on how things go this semester and if our check problems are resolved.

Thanks!

ian-curtis commented 1 year ago

I should note that after adding ggformula to the Depends section of the DESCRIPTION (rather than Imports), these problems go away since this forces ggformula and ggplot2 to be loaded. This seems to work for now but I think these changes here will be beneficial for the future:

  1. Because it seems to be the guideline to avoid Depending on packages wherever possible.
  2. Because my package is aimed at intro-level students and the less messages printed to the console, the better :D.

That being said, there is no rush in getting these incorporated. If I have to leave ggformula in Depends, I am fine with that and there seems to be no problems with it at this time.

Thanks again!