I was wrong. text() will attempt to coerce to character. This may be informative:
> as.character(res) [1] "c(W = 0.992709285275917)" "0.869917232073854" [3] "Shapiro-Wilk normality test" "rnorm(100)" plot(0:1, 0:1); text(0,seq(.1,.9,.2), labels = res, pos = 4) Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Sep 16, 2021 at 7:44 AM Bert Gunter <bgunter.4...@gmail.com> wrote: > > res is a list of class "htest" . You can only add text strings to a > plot via text(). I don't know what ggplot does. > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Thu, Sep 16, 2021 at 7:22 AM PIKAL Petr <petr.pi...@precheza.cz> wrote: > > > > Dear all > > > > I know I have seen the answer somewhere but I am not able to find it. Please > > help > > > > > plot(1,1) > > > res <- shapiro.test(rnorm(100)) > > > res > > > > Shapiro-Wilk normality test > > > > data: rnorm(100) > > W = 0.98861, p-value = 0.5544 > > > > I would like to add whole res object to the plot. > > > > I can do it one by one > > > text(locator(1), res$method) > > > text(locator(1), as.character(res$p.value)) > > ... > > But it is quite inconvenient > > > > I could find some way in ggplot world but not in plain plot world. > > > > Best regards > > Petr > > ______________________________________________ > > R-help@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. ______________________________________________ R-help@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.