On 2/4/2013 11:46 AM, Kevin wrote:
> I tried to set it globally by placing this in my first chunk:
>
> ```{r opts_chunk$set(message=FALSE,comment=NA, fig.width=8, fig.height=10)}
>
> but it's not working. Any advice?
I don't use knitr markdown that much, but I didn't think that would be
how to set global options. Should it be
```{r}
opts_chunk$set(message=FALSE,comment=NA, fig.width=8, fig.height=10)
```
or if you just want to set it for a single chunk
```{r message=FALSE}
...
As a final alternative, if you want to get rid of the message from just
that one line (not the whole chunk and not the whole document, with the
idea that other messages may be relevant), you could wrap the plotting
call itself: (Note that you have to wrap the printing, since that is
when the message is generated; otherwise the printing is done by the
default return which is outside the suppressMessages).
suppressMessages(print(hist + geom_histogram(aes(y=..density..),
colour="black",
fill="white",bin = NULL) + geom_density(alpha=.2, fill="#FF6666")))
> On Monday, February 4, 2013 10:58:42 AM UTC-8, Ben Bolker wrote:
>>
>> On 13-02-04 01:56 PM, Kevin wrote:
>>> For example, I am documenting a process with Knitr and would like to
>>> disable the output of
>>>
>>> # stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
>>> ## this.
>>>
>>
>>> when using
>>> hist <- ggplot(data, aes(x=BCTransformedAS))
>>>
>>> hist + geom_histogram(aes(y=..density..), colour="black",
>>> fill="white",bin = NULL) + geom_density(alpha=.2, fill="#FF6666")
>>>
>>> I like the auto binning and I don't know a better way to specify that
>>> same binning other than this:
>>> range <- max(BCTransformedAS) - max(BCTransformedAS)
>>> hist <- ggplot(data, aes(x=range/30))
>>
>> I think you want message=FALSE in the chunk options.
>>
>>
>>
>
--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University