It seems like a pretty simple question, but I can\'t find the answer.
I have a dataframe (lets call it df
), containing n=100 columns (C1
, <
Use do.call
with rbind
and lapply
for more simple and compact solution:
df <- data.frame(a = rnorm(100), b = rnorm(100), c = rnorm(100))
do.call(rbind, lapply(df, function(x) shapiro.test(x)[c("statistic", "p.value")]))
#> statistic p.value
#> a 0.986224 0.3875904
#> b 0.9894938 0.6238027
#> c 0.9652532 0.009694794