as.binary.matrix: Converts a matrix into binary one.

Description Usage Arguments Value Examples

View source: R/as.binary.matrix-functions.R

Description

This function converts a matrix into binary (0/1). NA values become zero and !NA values one.

Usage

1

Arguments

x

matrix

Value

matrix

Examples

1
2
3
4
5
6
7
library("similarity")

m <- matrix(c(1, 2, NA, 2), nrow=2, ncol=2)
as.binary.matrix(m)
#     [,1] [,2]
#[1,]    1    0
#[2,]    1    1

sgibb/similarity documentation built on May 26, 2017, 6:56 a.m.