Learn R Programming

MQMF (version 0.1.0)

countgtzero: countgtzero used in apply to count how many numbers are greater than zero in a vector

Description

countgtzero used in apply to count how many numbers are greater than zero in a vector

Usage

countgtzero(invect)

Arguments

invect

vector of values

Value

A single integer counting how many numbers are > 0

Examples

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab