Home > Blockchain >  How to refer to a variable in the Shapiro test?
How to refer to a variable in the Shapiro test?

Time:02-04

I would like to ask you about shapiro test in R. How can I refer to a variable in test result?

r<-shapiro.test(reszty)
r

    Shapiro-Wilk normality test

data:  reszty
W = 0.9226, p-value = 4.967e-07

I would like to refer to w and to p-value.

CodePudding user response:

In general, for function calls in R you can extract information after assigning to a variable doing this:

r<-shapiro.test(reszty)
r$statistic (for W) or r$p.value (for p-val)

or you can not assign to a variable, but extract straight away:

shapiro.test(reszty)$p.value

CodePudding user response:

I'm not sure what you mean. But maybe by doing this?

r$p.value 
r$statistic
  •  Tags:  
  • Related