[R] adding results to plot

Kimmo Elo k|mmo@e|o @end|ng |rom utu@||
Thu Sep 16 16:45:03 CEST 2021


Hi!

Maybe with this:

text(x=0.6, y=1.2, paste0(capture.output(res), collapse="\n"), adj=0)

HTH,

Kimmo

to, 2021-09-16 kello 14:12 +0000, PIKAL Petr kirjoitti:
> 	Virhe vahvistaessa allekirjoitusta: Virhe tulkittaessa
> 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
> 
> ------=_NextPart_000_00C9_01D7AB15.A6E04EE0--
> ______________________________________________
> R-help using 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.


More information about the R-help mailing list