Description Usage Arguments Value Examples

View source: R/expect_distfit.R

Expectation checking whether values from a given sample have a certain mean or that two samples have the same mean. The underlying procedure is Student's t-test `t.test`

.
The expectation throws an error when the test's p-value is smaller than the threshold p-value.

1 | ```
expect_mean_equal(p_value = 0.001, ...)
``` |

`p_value` |
threshold p-value of the test |

`...` |
parameters to pass to t.test function including data sample(s) |

Invisibly returns a p-value of the test

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
# This test doesn't pass
## Not run:
x<-1:1e3
expect_mean_equal(x=x)
## End(Not run)
# This one passes, but shouldn't
x<-rnorm(1e3) + 0.01
expect_mean_equal(x=x)
x<-rnorm(1e3)
expect_mean_equal(x=x)
# check if 2 samples have the same mean
x<-rnorm(1e3, mean=10)
y<-rnorm(1e3, mean=10)
expect_mean_equal(x=x, y=y)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.