continuous_2g {BiVariAn} | R Documentation |
Bivariate analysis for 2 groups
Description
Automatic test for continuous variables for 2 groups. Variable names can be assigned using table1::label()
function.
Usage
continuous_2g(
data,
groupvar,
ttest_args = list(),
wilcox_args = list(),
flextableformat = TRUE
)
Arguments
data |
Data frame from which variables will be extracted. |
groupvar |
Grouping variable as character. Must have exactly 2 levels. |
ttest_args |
Arguments to be passed to |
wilcox_args |
Arguments to be passed to |
flextableformat |
Logical operator to indicate the output desired. Default is TRUE. When FALSE, function will return a dataframe format. |
Value
Returns a dataframe or flextable of 2 groups 2 sided Mann Whitney's U or T test, along with Shapiro-Wilk's p values and Levene's p value.
Examples
df <- mtcars
df$am <- as.factor(df$am)
continuous_2g(data = df,
groupvar = "am",
flextableformat = FALSE)
# Set names to variables
if(requireNamespace("table1")){
table1::label(df$mpg) <- "Miles per gallon"
table1::label(df$cyl) <- "Number of cylinders"
table1::label(df$disp) <- "Displacement"
table1::label(df$hp) <- "Gross horsepower"
table1::label(df$drat) <- "Rear axle ratio"
continuous_2g(data = df, groupvar = "am", flextableformat = FALSE)
}
[Package BiVariAn version 1.0.1 Index]