Decision logic:
If
yis NULL, one-sample t-test against zero.If
paired = TRUE, paired t-test if differences are normal, otherwise Wilcoxon signed-rank.If two independent samples, check both-normal (Shapiro-Wilk for n<=5000, otherwise D'Agostino-Pearson); if both normal, run Student's or Welch's t depending on Levene's test; otherwise Mann-Whitney U.