Hi When I run my script using ggplot and geom_smooth I get messages that I would like to suppress: p <- ggplot(dataSubset) p <- p + aes(x = as.Date(factor(key),format="%Y%m%d")) + geom_line() p <- p + geom_smooth(span=0.2,se=FALSE,size=0.7) The messages look like this: geom_smooth: method="auto" and size of largest group is <1000, so using loess. Use 'method = x' to change the smoothing method. There were 15 warnings (use warnings() to see them) I have tried p <- p + suppressMessages(geom_smooth(span=0.2,se=FALSE,size=0.7)) but this does not work. I would like to keep using method="auto" but without any messages. Any ideas on how to suppress the messages when using geom_smooth? Thank you! -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-goem-smooth-and-suppress-messages-tp4476700p4476700.html Sent from the R help mailing list archive at Nabble.com.
ggplot2: goem_smooth and suppress messages
3 messages · tibaker, Brian Diggs
On 3/15/2012 4:11 PM, tibaker wrote:
Hi When I run my script using ggplot and geom_smooth I get messages that I would like to suppress: p<- ggplot(dataSubset) p<- p + aes(x = as.Date(factor(key),format="%Y%m%d")) + geom_line() p<- p + geom_smooth(span=0.2,se=FALSE,size=0.7) The messages look like this: geom_smooth: method="auto" and size of largest group is<1000, so using loess. Use 'method = x' to change the smoothing method. There were 15 warnings (use warnings() to see them)
The warning is printed not when p is assigned, but when it is plotted (printed).
I have tried p<- p + suppressMessages(geom_smooth(span=0.2,se=FALSE,size=0.7)) but this does not work. I would like to keep using method="auto" but without any messages. Any ideas on how to suppress the messages when using geom_smooth? Thank you!
Use suppressWarnings when printing. p <- ggplot(mtcars, aes(wt, mpg)) + geom_smooth() suppressMessages(print(p)) If you are getting display by implicit printing of the plot, then this won't work.
Brian S. Diggs, PhD Senior Research Associate, Department of Surgery Oregon Health & Science University
3 days later
Thank you for your help! -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-goem-smooth-and-suppress-messages-tp4476700p4486427.html Sent from the R help mailing list archive at Nabble.com.