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

Consider including package name in S3 class name(s)? #430

Open
rogiersbart opened this issue May 8, 2024 · 0 comments
Open

Consider including package name in S3 class name(s)? #430

rogiersbart opened this issue May 8, 2024 · 0 comments

Comments

@rogiersbart
Copy link

Since the renaming of the {scales} S3 class to "transform", it clashes with e.g. {raylibr}'s S3 class. The print() method is defined in both packages, and generates a warning, but certain methods from {raylibr} not defined in {scales}, break {scales} and therefore {ggplot2}. In the reprex below, in particular, S3method("$",transform) from {raylibr} is responsible. I realize that clashes with non-CRAN packages may be considered not very important, but the problem could be a lot bigger I suppose, as "transform" is a rather generic name, and it seems to be recommended to include the package name in S3 class names (well, at least according to Advanced R). Maybe it would be useful to consider including the package name in the S3 class names? FYI, I submitted the same suggestion at jeroenjanssens/raylibr#13.

library(raylibr)
#> 
#> Attaching package: 'raylibr'
#> The following object is masked from 'package:base':
#> 
#>     transform
library(ggplot2)
#> Registered S3 method overwritten by 'scales':
#>   method          from   
#>   print.transform raylibr
ggplot2::ggplot(cars) +
  ggplot2::aes(speed, dist) +
  ggplot2::geom_point()
#> Error:
#> ! `transform` has no property transform.

Created on 2024-05-08 with reprex v2.1.0

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

No branches or pull requests

1 participant