Comparing dataset

Hello ! I'm a new user of R and i'm struggling a bit with my dataset !

I'd really be happy if someone could give me a hand or help find somewhere i can find help.

I have two vectors. For example :
A = c(a, b, c, d, ...)
B= c(a', b', c', d', ...)
I need a function that would tell me if a=a', b=b' ...

Thank you in advance !!

Strangely enough you don't really need a function!

A = c(1, 4, 2, 3)

B = c(1, 5, 2, 9)
> A == B
[1]  TRUE FALSE  TRUE FALSE

You could filter using this too:

> A[A == B]
[1] 1 2

Or put your vectors in data frames:

> tibble::tibble(A = A, B = B) %>%
+   dplyr::filter(A == B)
# A tibble: 2 x 2
      A     B
  <dbl> <dbl>
1     1     1
2     2     2
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.