How to stop messages from appearing in knitr report

Please ask your questions about R Markdown here.
I used a code chunk to suppress messages when showing a ggplot2 plot.

```{r,  fig.width=12, fig.height=5, echo=FALSE, message=FALSE}
average_holds_June %>% 
  mutate(time = as.POSIXct(hms::parse_hm(time))) %>% 
  ggplot(aes(time, avg_holds, color=year)) +
  geom_point() +
  geom_line() +
  scale_x_datetime(date_breaks ="1 hour",date_labels = "%H:%M")+
labs(title= "Average number of calls with excessive hold times")
theme_classic()
```

My plot was fine, followed by a 3 pages of messages. How can I stop the messages?

Very likely the cause of your problem is the missing "+" symbol after the labs() command

average_holds_June %>% 
  mutate(time = as.POSIXct(hms::parse_hm(time))) %>% 
  ggplot(aes(time, avg_holds, color=year)) +
  geom_point() +
  geom_line() +
  scale_x_datetime(date_breaks ="1 hour",date_labels = "%H:%M")+
labs(title= "Average number of calls with excessive hold times") +
theme_classic()

If this doesn't solve your problem, please provide a REPRoducible EXample (reprex) ilustrating your issue.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.