Dear all, I have question but cannot explain without providing some context first:
I want to calculate how many policy-connected coalitions between 7 parties are possible. I have positions on an one-dimensional scale for each party and I have sorted the parties on the positions (it is sorted from extreme left to extreme right, hence using a left-right scale). A policy-connected coalition consists of parties that are connected on this left-right scale, hence there cannot be a party outside the coalition that is in-between two parties in the coalition on the left-right scale. My question is: how do a make a matrix that excludes those coalitions that are not policy-connected. I made a matrix with each combination of 0 (out of coalition) and 1 (in coalition), for 7 parties. a <- expand.grid(rep(list(c(0,1)),7)) a gives all possible coalitions between these 7 parties. Now I want to exclude those rows with coalition that are not policy-connected. Hence: this one should be out, because the fifth party is not in. 0 1 1 1 0 1 1 And this one should be in, 0 0 0 1 1 1 1. Hope this is clear and that someone has a good suggestion. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.