I'm doing some normality tests for two columns of two dataframes:
# Normality tests
shapiro.test(male$height)
shapiro.test(female$height)
ad.test(male$height)
ad.test(female$height)
cvm.test(male$height)
cvm.test(female$height)
lillie.test(male$height)
lillie.test(female$height)
pearson.test(male$height)
pearson.test(female$height)
sf.test(male$height)
sf.test(female$height)
But this looks very inefficient to me. I tried using tapply and apply functions but I couldn't make it work. Any guess?
You could try with lapply
:
lapply(list(male, female), function(x) {
list(shapiro.test(x$height),
ad.test(x$height),
cvm.test(x$height),
lillie.test(x$height),
pearson.test(x$height),
sf.test(x$height))
})