Description Usage Arguments Details Value Author(s) Examples
View source: R/univariate.tests.R
Given a dataframe, this function predicts the specified categorical variable using each column in the dataset, one at a time. The function will automatically select whether to do a chi-square test, a t-test, or an ANOVA. See details.
1 | univariate.tests(dataframe, exclude.cols = NULL, group, parametric = T, ...)
|
dataframe |
a data frame containing both the variables and the grouping variable |
exclude.cols |
a vector indicating (either numeric or character) which columns should not have a significance test |
group |
a string with the name of the grouping variable |
parametric |
Should parametric tests be used? Defaults to TRUE. |
... |
other arguments passed to t.test or wilcox.test |
Extract the p value from a univariate significance test
univariate.tests
will look at each column in the dataframe, then perform a t-test (or wilcoxen.test if parametric=TRUE), ANOVA
(or kruskal.test if parametric=TRUE), or chi-square test where
the grouping variable serves as the independent variable. The computer will chose a chi-square test of one of the following three conditions is
met: (1) the variable is a factor, (2) the variable is a character variable, or (3) the variable has less than four unique values. An ANOVA (or Kruskall) will be
used if the number of levels of the grouping variable is greater than two. In all other cases, a t-test (or wilcoxen) will be used.
a vector of p values
Dustin Fife
1 2 3 4 5 6 | k = data.frame(cbind(ID=1:100,
A = rnorm(100),
B = rnorm(100),
C = rnorm(100),
Group = rep(1:2, times=50)))
univariate.tests(dataframe = k, exclude.cols=1, group="Group")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.