Hi, Brandon Invergo wrote: > You can use the length() and which() functions for that: > > > length(which(m == 2)) Or even shorter since TRUE Values have a value of 1 mymatrix <- matrix(sample(x=1:10, size=1000, replace=TRUE), ncol=5) sum(mymatrix==2) length(which(mymatrix==2)) #should give the same result Best, Roland