Table.arr consists of a 2x2 matrix of counts followed by a third column of target rates. I would have done the code this way:
Error2.f <- function(mat){
1 - sum(diag(mat[,1:2]))/sum(mat[,1:2]) }
apply(Table.arr,c(1,2),Error2.f) or
apply(Table.arr,c(1:2),Error2.f)
sd.mat <- apply(Error.arr,2:3,sd)
Mean.mat <- apply(Error.arr,2:3,mean)
I get error - Error in mat[, 1:2] : incorrect number of dimensions
apply(Table.arr,c(3:5),Error2.f)
sd.mat <- apply(Error.arr,2:3,sd)
Mean.mat <- apply(Error.arr,2:3,mean)
Table.arr is randomForest output . It is a list of 2x3 matrices
, , 1, 1, 1, 1
[,1] [,2] [,3]
[1,] 152 30 0.1648352
[2,] 55 73 0.4296875
...
I thought the two commas referred to the rows and columns of the output matrices.
Can you help please? Thank you.
MM