2
all.equal()給出這些數據的「無效參數類型」錯誤。任何想法?「無效參數類型」錯誤。 R
>matrix1
1 2 3 4 5
1 0 0 0.0 0 0.0
2 1 0 0.0 0 0.0
3 0 1 0.0 0 0.0
4 0 0 0.5 0 0.5
5 0 0 1.0 0 0.0
>rowSums(matrix1)
1 2 3 4 5
0 1 1 1 1
> !all.equal(as.vector(rowSums(matrix1)), as.vector(rep(1, nrow(matrix1))), check.attributes=FALSE)
Error in !all.equal(as.vector(rowSums(matrix1)), as.vector(rep(1, :
invalid argument type