[R] vector matching

Henrique Dallazuanna wwwhsd at gmail.com
Fri Apr 16 16:48:17 CEST 2010


If I understand:

unique(t(apply(rbind(x, y), 1, sort)))

On Fri, Apr 16, 2010 at 11:05 AM, Michael Nestrud <mike at ataraxis.org> wrote:
> Hello all,
>
> I have searched the archives for a similar problem to no avail.  I
> could use  your help.
>
> I have a bunch of vectors organized into two matrices, x and y.  These
> vectors (as rows) consist of combinations of elements such that order
> does not matter.
>
> I want to create a third matrix from the first two, which is basically
> all the rows in x and all the rows in y, excluding the rows that they
> both have in common.
>
> %in% seems to match individual elements, not entire rows, so something
> else is needed.
>
> Any help is appreciated.
>
> Thanks,
>
> -Michael
>
> --
> Michael A. Nestrud
> Cornell U. Sensory Science PhD Candidate
> mike at ataraxis.org
> "All that you taste... all that you eat."
>
> ______________________________________________
> R-help at 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list