I like ggplot2, and I like facets.
Sometimes I have lots of data, of varying length, and I want to plot it in facets, with geom_line()
and geom_point
. Then I get lots of plots, some with points and lines, some with just a single point, because the line doesn't get drawn (and that's great!).
Whats less great is how I get a 'message' for every facet, saying the same thing, that I already know, and can't straightforwardly suppress.
These links also seem to agree with me that maybe that message is more annoying than it is useful?
Also in a knitr document, you can use: message=FALSE,
, which you almost have to do as the view in RNotebooks is just the same info filling up the entire output, with the chart pushed out of the view.
The 'solution' is currently either to assign the plot to an object, and then explicitly print it to make suppressMessage()
actually work or to suppress all messages from the knitr chunk. The cons being
- the assignment then has to happen (when normally in plotting that isn't actually necessary, so just extra cruft code)
- the whole chunk has all it's messages suppressed, even if those might be useful/needed
My question is really:
Why is printing the same message so many times helpful, when it's a bit of a bother to actually catch it and remove it?
If it was 1 message (in the form of 'geom_path: 17 facets of 50 consist of only one observation, do you need to adjust the group variable?'
), or if the multiple messages were easier to catch (99% of the time I just bang a %>% ggplot() + ...
at the end of my tidyverse pipe and I'm done as the plot auto-displays) it would be really nice.
Maybe I've missed a technical detail here, but I hope you don't mind the suggestion