I have a matrix m
in R , and I would like to remove -Inf
values , and then calculate the colMeans
of all columns. How can I do this in R?
m <- matrix(c(1, 3, 4, -Inf, 6, 7, 4, -Inf, 6, 0, 1, 3) , nrow = 3)
m
[,1] [,2] [,3] [,4]
[1,] 1 -Inf 4 0
[2,] 3 6 -Inf 1
[3,] 4 7 6 3