Learn R Programming

nscancor (version 0.7.0-6)

colCardinalities: Cardinality of Column Vectors

Description

Computes the cardinality (the number of non-zero elements) of each column of the matrix \(\mathbf{w}\).

Usage

colCardinalities(w)

Value

A vector containing the number of non-zero elements of each column of w

Arguments

w

a numeric matrix, e.g. xcoef as returned by nscancor

Examples

Run this code
# returns c(2, 1)
colCardinalities(matrix(c(1, 0, 2, -1, 0, 0), ncol = 2))


Run the code above in your browser using DataLab