| p_t.test | R Documentation |
A wrapper function for t.test(), with the data argument listed first to support piping.
p_t.test(data, x = NULL, y = NULL, formula = NULL, ...)
data |
the data |
x |
one of two variables |
y |
one of two variables |
formula |
a formula |
... |
additional arguments passed to |
an htest object
# load the data
data(nhanes)
# define smoking
nhanes<-nhanes |> transform(
smoking=base_match(smq020,'No'=2,'History of smoking'=1)
)
# conduct a one-sample t-test
nhanes |> p_t.test(bpxosy1)
# conduct a two-sample t-test, using formula notation
nhanes |> p_t.test(bpxosy1~smoking)
# conduct a two-sample t-test, using formula notation
nhanes |> p_t.test(formula=bpxosy1~smoking)
# conduct a paired t-test, using x and y
nhanes |> p_t.test(bpxosy1,bpxosy2,paired=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.