如何从二项式检验中提取p值

Got*_*cks 3 r extraction p-value

我有一个二项式检验的结果,它看起来像这样:

data:  x and n
number of successes = 0, number of trials = 7, p-value = 0.01563
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
 0.0000000 0.4096164
sample estimates:
probability of success 
                     0 
Run Code Online (Sandbox Code Playgroud)

我只想知道如何提取R中的p值。我尝试了grep和pmatch,但它们似乎需要表或向量。

fhe*_*anb 5

您只需要做:

binom.test(3,15)$p.value
Run Code Online (Sandbox Code Playgroud)

看一下看str(binom.test(3,15))二项式检验的其他结果。只要第二个数字大于第一个数字,就可以任意选择3和15。