Learn R Programming

wrMisc (version 2.0.0)

combineSingleT: Get All Combinations With TRUE From Each Column

Description

This function addresses the case when multiple alternatove ways exit to combine two elements. combineSingleT makes combinatory choices : if multiple TRUE in given column of 'mat' make all multiple selections with always one TRUE from each column The resultant output contains index for first and second input columns elements to be combined.

Usage

combineSingleT(mat, silent = FALSE, debug = FALSE, callFrom = NULL)

Value

This function returns a matrix with indexes of conbinations of TRUE

Arguments

mat

2-column matrix of logical values

silent

(logical) suppress messages

debug

(logical) additional messages for debugging

callFrom

(character) allows easier tracking of messages produced

Examples

Run this code
## Example: Fist column indicates which boys want to dance and second column  
## which girls want to dance. So if several boys want to dance each of the girls 
## will have the chance to dance with each of them.  
matr <- matrix(c(TRUE,FALSE,TRUE,FALSE,TRUE,FALSE),ncol=2)
combineSingleT(matr)

Run the code above in your browser using DataLab