我有这张桌子
A B C
1 8.15277310472498 120.119697226183 -19.9730763584375
2 4.83146238750758 127.444687091065 -17.6775842159986
3 -36.2827393317865 141.404497199928 13.3305739285424
4 -17.7694197933543 -127.432770534059 -53.5002410318702
5 25.9688056175644 -72.9976248054808 32.9571663681418
6 -34.9730561135594 4.29842837742877 32.0193630829453
7 -26.9079081708146 57.0696019664296 11.9220941327512
我想检查每一行是否正常分发
我试过
> shapiro.test(csv$A)
> shapiro.test(csv["A"])
> shapiro.test(csv[1])
我收到上述所有命令的错误
Error: is.numeric(x) is not TRUE
答案 0 :(得分:2)
apply(df,1,shapiro.test)
使用来自R的mtcars数据的示例:
> apply(mtcars,1,shapiro.test)
$`Mazda RX4`
Shapiro-Wilk normality test
data: newX[, i]
W = 0.6063, p-value = 3.047e-05
$`Mazda RX4 Wag`
Shapiro-Wilk normality test
data: newX[, i]
W = 0.6071, p-value = 3.119e-05
......(略).....
答案 1 :(得分:1)
这个怎么样?
shapiro.test(as.double(csv$A))