[R] matching type question, please
Eric Berger
er|cjberger @end|ng |rom gm@||@com
Thu Dec 16 21:38:35 CET 2021
> a <- cbind(c(xr1,xs1),c(xr2,xs2))
> a[duplicated(a)]
[1] 4 4
On Thu, Dec 16, 2021 at 10:18 PM Erin Hodgess <erinm.hodgess using gmail.com> wrote:
>
> Hello!
>
> I have the following:
>
> cbind(xr1,xr2)
>
> xr1 xr2
>
> [1,] 8 0
>
> [2,] 7 1
>
> [3,] 6 2
>
> [4,] 5 3
>
> [5,] 4 4
>
> [6,] 3 5
>
> [7,] 2 6
>
> [8,] 1 7
>
> [9,] 0 8
>
> > cbind(xs1,xs2)
>
> xs1 xs2
>
> [1,] 9 4
>
> [2,] 8 4
>
> [3,] 7 4
>
> [4,] 6 4
>
> [5,] 5 4
>
> [6,] 4 4
>
> [7,] 3 4
>
> >
>
> These are ordered pairs. I would like to get something that shows that the
> pair (4,4) appears in both. I have tried cbind with match and %in% and
> intersect, but not getting the exact results.
>
> Any suggestions would be appreciated. I have a feeling that it's something
> really easy that I'm just not seeing.
>
> Thanks,
> Erin
>
>
> Erin Hodgess, PhD
> mailto: erinm.hodgess using gmail.com
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
More information about the R-help
mailing list