[R] Analyse the effect of group membership

2014-03-24 Thread Tom Wright
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

Re: [R] Analyse the effect of group membership

2014-03-24 Thread Noah Marconi
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) })

Re: [R] Analyse the effect of group membership

2014-03-24 Thread Jim Lemon
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