[R] how to eliminate ggplot warning frrom "knitted" document
Thierry Onkelinx
thierry.onkelinx at inbo.be
Tue Nov 17 00:15:03 CET 2015
Add warning = FALSE to the chunk options
Op 17-nov.-2015 00:07 schreef "Daniel Nordlund" <djnordlund op frontier.com>:
> I have the following data.
>
> sumry <- structure(list(group = structure(c(1L, 1L, 1L, 2L, 2L, 2L),
> .Label = c("A",
> "B"), class = "factor"), level = c(0.5, 1, 2, 0.5, 1, 2), n = c(10,
> 10, 10, 10, 10, 10), mean = c(13.23, 22.7, 26.06, 7.98, 16.77,
> 26.14), sd = c(4.45, 3.91, 2.65,
> 2.74, 2.51, 4.79), se = c(1.41,
> 1.23, 0.83, 0.86, 0.79,
> 1.51), lcl = c(10.03, 19.90,
> 24.16, 6.01, 14.972, 22.70
> ), ucl = c(16.42, 25.49, 27.95,
> 9.94, 18.56, 29.57)), .Names = c("group",
> "level", "n", "mean", "sd", "se", "lcl", "ucl"), row.names = c(NA,
> 6L), class = "data.frame")
>
> I want to plot the means with 95% confidence intervals for the means. I
> can use the following ggplot code to get the plot.
>
> ggplot(sumry, aes(x=level, y=mean, group=group, color=group)) +
> geom_line() +
> geom_point()+
> geom_errorbar(aes(ymin=lcl, ymax=ucl), width=.2)
>
> I initially tried using position_dodge() to keep the error bars from
> plotting completely on top of each other. However, I kept getting the
> following warning:
>
> ymax not defined: adjusting position using y instead
>
> I am using knitr to create a pdf document and the warning is cluttering up
> my pdf document. Is there anyway to alter the plot statement to avoid the
> warning? If not, is there a way to get knitr not to print out the warning
> to the markdown document so that it doesn't end up in the pdf document?
>
>
> Thanks,
>
> Dan
>
> --
> Daniel Nordlund
> Bothell, WA USA
>
> ______________________________________________
> R-help op r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list