Hi,
Given a matrix
set.seed(500)
matrix(round(runif(100,0,1)),
ncol=5,
dimnames=list(Subject=1:20,
Group=c('A','B','C','D','E')))
Is there an easy way to identify which combinations of groups exist,
i.e. subject2 is a member of group 'A+B+D+E' however no one is a member
of
Does this help?
set.seed(500)
mtx - matrix(round(runif(100,0,1)),
ncol=5,
dimnames=list(Subject=1:20,
Group=c('A','B','C','D','E')))
groupCombo - apply(mtx, 1, function(x){
x - paste(
names(x)[as.logical(x)],
collapse='+'
);
return(x)
})
On 03/25/2014 04:50 AM, Tom Wright wrote:
Hi,
Given a matrix
set.seed(500)
matrix(round(runif(100,0,1)),
ncol=5,
dimnames=list(Subject=1:20,
Group=c('A','B','C','D','E')))
Is there an easy way to identify which combinations of groups exist,
i.e. subject2 is a member of
3 matches
Mail list logo