I have two lists of patient ID's. One is short, the other is very long.
I'd like to know how many times patients from the short list appear in the long list, preferably using dplyr.
library(tidyr)
library(tidyverse)
shortlist<-tribble(
~PatientID,
#--
10,
11,
12,
13,
14,
15
)
longlist<-tribble(
~PatientID,
#--
10,
10,
11,
12,
12,
12,
13,
14,
15,
15,
15,
16,
17
)
Desired output would be something like:
10 2
11 1
12 3
13 1
and so on