, 2012 2:09 PM
To: Petr Savicky; r-help@r-project.org
Subject: Re: [R] how to exclude rows with not-connected coalitions
This can be done without nested loops.
a <- expand.grid(rep(list(c(0,1)),7))
tmp <- apply(a, 1, function(x){
var(cumsum(x == 0)[x == 1])
})
a[is.na(tmp) | tmp == 0, ]
ir. T
.
~ John Tukey
-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens
Petr Savicky
Verzonden: donderdag 9 februari 2012 13:44
Aan: r-help@r-project.org
Onderwerp: Re: [R] how to exclude rows with not-connected coalitions
On Thu, Feb 09, 2012 at 12
On Thu, Feb 09, 2012 at 12:18:06PM +, Schumacher, G. wrote:
> 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
3 matches
Mail list logo