rstatix
rstatix copied to clipboard
A guide for use tests in R functions? OR how to correct call t_test in a function?
I tried to write a function to do repeated tests on several parameters from two groups,
` my2group_test <- function(source_df, para_name, group_name) { source_df %>% group_by(!! rlang::ensym(group_name)) %>% get_summary_stats(!! rlang::ensym(para_name),show = c("n", "median", "mean", "se", "mad", "ci")) source_df %>% group_by(!! rlang::ensym(group_name)) %>% shapiro_test(!! rlang::ensym(para_name)) source_df %>% levene_test(eval(parse(text=para_name)) ~ eval(parse(text=group_name))) source_df %>% t_test(? ~ ?) }
` I found that for each of these test, the way to pass column names to each test is quite different, but I have no luck to figure out how to pass those "para_name, group_name" to t_test. Any help?