Re: [R] adding results to plot

2021-10-08 Thread Rui Barradas
is a bit overkill for my purpose, its use is straightforward and simple. I checked it for several *test functions and did not find any problem. Thanks and best regards. Petr -Original Message- From: Rui Barradas Sent: Friday, September 17, 2021 9:56 PM To: PIKAL Petr ; r-help Subject: R

Re: [R] adding results to plot

2021-10-07 Thread PIKAL Petr
. Thanks and best regards. Petr > -Original Message- > From: Rui Barradas > Sent: Friday, September 17, 2021 9:56 PM > To: PIKAL Petr ; r-help > Subject: Re: [R] adding results to plot > > Hello, > > *.test functions in base R return a list of class "htest"

Re: [R] adding results to plot

2021-09-17 Thread Rui Barradas
Hello, *.test functions in base R return a list of class "htest", with its own print method. The method text.htest for objects of class "htest" below is a hack. I adapted the formating part of the code of print.htest to plot text(). I find it maybe too complicated but it seems to work. Warnin

Re: [R] adding results to plot

2021-09-16 Thread PIKAL Petr
help mailing list project.org> > Subject: Re: [R] adding results to plot > > Hi Petr, > The hard part is the names for the data frame that addtable2plot requires: > > set.seed(753) > res <- shapiro.test(rnorm(100)) > library(plotrix) > plot(0,0,type="n",axes=

Re: [R] adding results to plot

2021-09-16 Thread Jim Lemon
Hi Petr, The hard part is the names for the data frame that addtable2plot requires: set.seed(753) res <- shapiro.test(rnorm(100)) library(plotrix) plot(0,0,type="n",axes=FALSE) addtable2plot(0,0,data.frame(element=names(res)[1:2], value=round(as.numeric(res[1:2]),3)),xjust=0.5, title=res$metho

Re: [R] adding results to plot

2021-09-16 Thread PIKAL Petr
Thanks, I will try to elaborate on it. Best regards. Petr > -Original Message- > From: R-help On Behalf Of Kimmo Elo > Sent: Thursday, September 16, 2021 4:45 PM > To: r-help@r-project.org > Subject: Re: [R] adding results to plot > > Hi! > > Maybe with t

Re: [R] adding results to plot

2021-09-16 Thread PIKAL Petr
Hallo Thanks, I will try wat option is better if yours or Kimmo's Best regards Petr > -Original Message- > From: Bert Gunter > Sent: Thursday, September 16, 2021 5:00 PM > To: PIKAL Petr > Cc: r-help > Subject: Re: [R] adding results to plot > > I was

Re: [R] adding results to plot

2021-09-16 Thread Bert Gunter
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

Re: [R] adding results to plot

2021-09-16 Thread Kimmo Elo
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 +, PIKAL Petr kirjoitti: > Virhe vahvistaessa allekirjoitusta: Virhe tulkittaessa > Dear all > > I know I have seen the answer somewhere but I am not able

Re: [R] adding results to plot

2021-09-16 Thread Bert Gunter
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 )

[R] adding results to plot

2021-09-16 Thread PIKAL Petr
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