Re: [R] Test for column equality across matrices

2013-07-14 Thread Thiem Alrik
] Gesendet: Samstag, 13. Juli 2013 19:57 An: William Dunlap Cc: mailman, r-help; Thiem Alrik Betreff: Re: [R] Test for column equality across matrices I tried it on a slightly bigger dataset: A1 - matrix(t(expand.grid(1:90, 15, 16)), nrow = 3) B1 - combn(90, 3) which(is.element(columnsOf(B1

Re: [R] Test for column equality across matrices

2013-07-14 Thread William Dunlap
Dunlap Cc: R help; Thiem Alrik Subject: Re: [R] Test for column equality across matrices I tried it on a slightly bigger dataset: A1 - matrix(t(expand.grid(1:90, 15, 16)), nrow = 3) B1 - combn(90, 3) which(is.element(columnsOf(B1), columnsOf(A1))) # [1]  1067  4895  8636 12291 15861 19347

Re: [R] Test for column equality across matrices

2013-07-13 Thread William Dunlap
Try columnsOf - function(mat) split(mat, col(mat)) newB - B[ , !is.element(columnsOf(B), columnsOf(A))] Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Thiem Alrik

Re: [R] Test for column equality across matrices

2013-07-13 Thread arun
. - Original Message - From: William Dunlap wdun...@tibco.com To: Thiem Alrik th...@sipo.gess.ethz.ch; mailman, r-help r-help@r-project.org Cc: Sent: Saturday, July 13, 2013 1:30 PM Subject: Re: [R] Test for column equality across matrices Try   columnsOf - function(mat) split(mat, col(mat))   newB

Re: [R] Test for column equality across matrices

2013-07-13 Thread arun
Hi, One way would be:  which(apply(t(B),1,paste,collapse=)%in%apply(t(A),1,paste,collapse=)) #[1] 105 196 274 340 395 B[,105] #[1]  1 15 16  B[,196] #[1]  2 15 16  B1-B[,!apply(t(B),1,paste,collapse=)%in%apply(t(A),1,paste,collapse=)]  dim(B1) #[1]   3 555  dim(B) #[1]   3 560 #or