首页 > 解决方案 > 如何为 shapiro.test 创建一个循环

问题描述

我想为这些测试创建一个循环,但我不能使用“table1:table10),有什么建议吗?

shapiro.test(table1)
shapiro.test(table2)
shapiro.test(table3)
shapiro.test(table4)
shapiro.test(table5)
shapiro.test(table6)
shapiro.test(table7)
shapiro.test(table8)
shapiro.test(table9)
shapiro.test(table10)

标签: r

解决方案


你去:

for (i in 1:10) {
  print(shapiro.test(eval(parse(text=paste("table", i, sep = "")))))
}

推荐阅读