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

drop_vars can damage the data data frame #1

Closed
struckma opened this issue May 23, 2023 · 2 comments
Closed

drop_vars can damage the data data frame #1

struckma opened this issue May 23, 2023 · 2 comments

Comments

@struckma
Copy link

Thank you for your great general implementation to reduce ggplot2 objects to their needed size, if you would not have done it already, I would have had to do it, great work!

However, in https://github.com/aphalo/gginnards/blob/master/R/data-manip.R#L95, you are missing drop = FALSE, so that data frames for plots that need only one variable, data looses its class and becomes a vector, so that we see errors like the following:

Error in `geom_histogram()` at QualityIndicatorFunctions/R/acc_distributions.R:470:6:
! Problem while computing layer data.Error occurred in the 1st layer.
Caused by error in `unrowname()`:
! Can only remove rownames from <data.frame> and <matrix> objects

you can easily reproduce this with the following code:

library(ggplot2)
p <- ggplot(cars, aes(x = speed)) + geom_histogram()
gginnards::drop_vars(p)

I will, so far, work around this error in my package, but maybe, you could consider to fix that, I would be grateful.

Thank you

Stephan

@aphalo
Copy link
Owner

aphalo commented May 24, 2023

Thanks Stephan! Sorry about this! Fix commited here in GitHub. Submited to CRAN as version 0.1.2.

@aphalo
Copy link
Owner

aphalo commented May 24, 2023

'gginnards' 0.1.2 is on its way to CRAN, i.e., it has passed all checks.
Once again, thanks!

@aphalo aphalo closed this as completed May 24, 2023
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

2 participants