Learn R Programming

stheoreme (version 1.2)

utild2bin: Matrix Binarizer

Description

Function utild2bin is applied to a pair of matrices and convert them to matrices of binaries with a rule specified by user

Usage

utild2bin(d2arr0, d2arr1, method = "mean", trsh = 0, inverted = FALSE)

Arguments

d2arr0
matrix to be binarized
d2arr1
matrix to be binarized
method
method of setting a threshold:

method='mean' threshold is mean(c(d2arr0, d2arr1)) for both matrices (used as default)

method='imean' setting individual thresholds as mean values

method='imed' setting individual thresholds as median values

method='i1stQ' setting individual thresholds as 1st quartile values

method='i3rdQ' setting individual thresholds as 3rd quartile values

method='isubsd' setting individual thresholds as (mean(d2arrN)-sd(d2arrN))

method='iaddsd' setting individual thresholds as (mean(d2arrN)+sd(d2arrN))

method='med' threshold is median(c(d2arr0, d2arr1)) for both

method='med0' threshold is median(c(d2arr0)) for both

method='med1' threshold is median(c(d2arr1)) for both

method='mean0' threshold is mean(c(d2arr0)) for both

method='mean1' threshold is mean(c(d2arr1)) for both

method='spec' threshold is specified by the 2 numbers of argument trsh individually for matrices

trsh
specifies the individual threshold values for binarizations when method='spec' is chosen. If it contains one number it will be interpreted as one threshold for both matrices
inverted
logical item specifying if the result will be inverted (zeros replaced by ones and ones replaced by zeros) after bianrization

Value

bin0
result of d2arr0 binarization
bin1
result of d2arr1 binarization
counts
summary/report of how the arrays were binarized

See Also

utild1bin

Examples

Run this code
s0<-array(c(-1,1,3,7,10),c(2,5))
s1<-array(c(1:7), c(7,2))

s0; s1
a<-utild2bin(d2arr0=s0, d2arr1=s1); a
a<-utild2bin(s0, s1, method='isubsd', inverted=TRUE); a
a<-utild2bin(s0, s1, method='spec', trsh=c(-1,2)); a

Run the code above in your browser using DataLab