On 7/3/2014 2:00 AM, Dario Strbenac wrote:
> I am writing a R markdown document and I can't suppress the message from
> stat_bin "stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to
> adjust this." How can I make my report neater ?
You can not suppress ggplot from emitting the message, but you can keep
it from appearing in the markdown document (I assume you are using
knitr). Add message=FALSE to the block options and the message will be
kept out of the markdown.
> Also, is there any convenience syntax to specify something like
> range/50. I've only seen examples were people give a constant number
> to binwidth. It would be desirable if there was some nice syntax.
You can specify the width of bins (with binwidth) or the specific breaks
(with breaks), but there is no syntax for specifying just the number of
breaks (in a manner analogous to the default). You would have to
pre-compute one of the other two values.
I can see this as a useful feature, though. It could be implemented as,
if the length of breaks is 1, then that is the number of breaks there
should be. I don't think that would break anything (since a single break
can't produce any bins anyway), but I'm also leery of that because some
functions that have similar behavior (like sample) can give headaches
when the behavior is triggered unintentionally. Alternatively, a
separate argument could be created (with defined precedence with regard
to binwidth and breaks).
--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University