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

conflict with patchwork #177

Closed
monkeywithacupcake opened this issue Mar 11, 2022 · 3 comments
Closed

conflict with patchwork #177

monkeywithacupcake opened this issue Mar 11, 2022 · 3 comments

Comments

@monkeywithacupcake
Copy link
Contributor

If user has patchwork loaded, list(area will lead to an unused arguments error.
Loading order does not matter.
Patchwork must be detached before calling formattable(df, list(area

@monkeywithacupcake
Copy link
Contributor Author

monkeywithacupcake commented Oct 17, 2022

I did not leave an example of this issue above, so here goes.

library(formattable)
formattable(mtcars, 
            list(area(col = c(hp, cyl)) ~ normalize_bar("pink", 0.2)
                 )
            )
# works fine

library(ggplot2)
library(patchwork)
formattable(mtcars, 
            list(area(col = c(hp, cyl)) ~ normalize_bar("pink", 0.2)
            )
)
# Error in area(col = c(hp, cyl)) : unused argument (col = c(hp, cyl))

detach("package:patchwork", unload=TRUE)
formattable(mtcars, 
            list(area(col = c(hp, cyl)) ~ normalize_bar("pink", 0.2)
            )
)
# works fine

Note that if we force the area to use formattable, it works.

library(ggplot2)
library(patchwork)
library(formattable)
formattable(mtcars, 
            list(formattable::area(col = c(hp, cyl)) ~ normalize_bar("pink", 0.2)
            )
)
# works fine

@monkeywithacupcake
Copy link
Contributor Author

since, as far as I can tell, using the package::function approach is the right thing for namespace conflicts, I'll close it. I hope this helps someone getting the same error in future.

Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant