I've created a List of matrices, and now I want to get the maximum values of row in all matrices, how do I get them?
Here is the code for the list:
i <- 1
tryList <- list()
treeList <- list()
accList <- list()
for(t_mtry in 1:40){
for(t_ntree in 20:300{
rf <- randomForest(class ~., data=training, mtry=t_mtry, ntree=t_ntree)
tbl <- table(predicted = predict(rf,evalSet,type="class"),actual=evalSet$class)
#get the accuracy of the classification as a list
retVal <- accuracy(tbl)
tryList <- c(tryList,t_mtry)
treeList <- c(treeList,t_ntree)
accList <- c(accList,mean(retVal))
}
matrixList[[i]] <- matrix(c(tryList,treeList,accList),length(accList)
i <- i + 1
tryList <- list()
treeList <- list()
accList <- list()
}
Now I want to the maximum values of the accList from every matrix. if I have one matrix i use:
lapply(matrix,max)
max(unlist(matrix[,3]))
But how can I use it with the list?