countgtzero | R Documentation |
countgtzero used in the base function 'apply', or 'tapply' to count how many numbers are greater than zero in a vector
countgtzero(invect)
invect |
vector of values |
An integer counting how many numbers are > 0
x <- matrix(trunc(runif(20)*10),nrow=4,ncol=5)
print(x)
apply(x,1,countgtzero) # count by rows
apply(x,2,countgtzero) # count by columns
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.