Learn R Programming

binda (version 1.0.4)

is.binaryMatrix: Check For Binary Matrix

Description

is.binaryMatrix tests whether m is a matrix and whether it contains only 0s and 1s.

Note that functions like binda.ranking and binda require a binary matrix as input.

Usage

is.binaryMatrix(m)

Arguments

m

a matrix.

Value

is.binaryMatrix returns either TRUE or FALSE.

Examples

Run this code
# NOT RUN {
# load binda library
library("binda")

# test matrix
m = matrix(c(1, 1, 0, 1, 0, 0,
             1, 1, 1, 1, 0, 0,
             1, 0, 0, 0, 1, 1,
             1, 0, 0, 0, 1, 1), nrow=4, byrow=TRUE)

# Test for binary matrix
is.binaryMatrix(m) # TRUE
# }

Run the code above in your browser using DataLab