count.distinct: Counts distinct values of a vector

Description Usage Arguments Value Author(s) Examples

View source: R/data.helper.functions.r

Description

mimics count(distinct value) in mysql when using a group by statement. Used most in apply.

Usage

1

Arguments

x

The vector for which you want distinct values counted

Value

a scalar with the count of unique values in a vector

Author(s)

Daniel Duplisea

Examples

1
2
3
mat=matrix(rep(1:10,each=10),ncol=10)
apply(mat,2,length); apply(mat,2,count.distinct)
apply(mat,1,length); apply(mat,1,count.distinct)

duplisea/ddhelper documentation built on Nov. 4, 2019, 11:04 a.m.