getPlayersFromBMRow {CoopGame} | R Documentation |
Extract players from bit matrix row
Description
getPlayersFromBMRow determines players involved in a coalition from the row of a bit matrix
Usage
getPlayersFromBMRow(bmRow)
Arguments
bmRow |
represents the bit matrix row |
Value
playerVector contains involved players (e.g. c(1,3), see example below for bitIndex=5 and n=3)
Author(s)
Johannes Anwander anwander.johannes@gmail.com
Jochen Staudacher jochen.staudacher@hs-kempten.de
Examples
library(CoopGame)
bm=createBitMatrix(n=3,A=c(0,0,0,1,1,1,2))
getPlayersFromBMRow(bmRow=bm[4,])
library(CoopGame)
bm=createBitMatrix(n=3,A=c(1:7))
#Corresponding bit matrix:
# cVal
#[1,] 1 0 0 1
#[2,] 0 1 0 2
#[3,] 0 0 1 3
#[4,] 1 1 0 4
#[5,] 1 0 1 5 <=Specified bit index
#[6,] 0 1 1 6
#[7,] 1 1 1 7
#Determine players from bit matrix row by index 5
players=getPlayersFromBMRow(bmRow=bm[5,])
#Result:
players
#[1] 1 3
[Package CoopGame version 0.2.2 Index]