Learn R Programming

multiplex (version 3.7)

dichot: Dichotomize Data with a Cutoff Value

Description

Function to dichotomize the input data for the semigroup construction with a cutoff value.

Usage

dichot(x, c = 1, diag)

Value

Binary values of the input data.

Arguments

x

some data in a numeric form (usually arrays)

c

the cutoff value to perform the dichotomization (default 1)

diag

(optional and logical) whether or not the diagonals should be included (default TRUE)

Author

Antonio Rivero Ostoic

Details

This is a convenient function (or wrapper if you like) of the replace function. In this case, the function is aimed to specify a cutoff value for the dichotomization of the data where the values equal or higher to the cutoff are converted to one, while the others are set to zero. The cutoff value in c can be any real number.

See Also

replace, prev, semigroup.

Examples

Run this code
# create the data: two binary relations among three elements
arr <- round( replace( array(runif(18), c(3,3,2)), array(runif(18),
       c(3,3,2))>.5, 3 ) )

# dichotomize it with a cutoff value of two
dichot(arr, c = 2)

Run the code above in your browser using DataLab