I have a matrix of values some of which are -Inf. How can I find the smallest value that is greater than -Inf?
This way:
foo <- matrix(c(1,2,-Inf,3),nrow=2,ncol=2)
min(foo[foo>-Inf])
[1] 1
min( foo[ is.finite(foo) ] #...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.