Getting the list which are uncommon in 2 lists

I have a dataset of student IDs which are collected in two rounds of surveys. The second round of surveys contain lists of students who have not been surveyed in round 1.
Can I get a list of students which are unique to only round 1?

``` r
library(tidyverse)

tibble::tribble(
  ~student_id_round1, ~student_id_round2,
              "S001",             "S002",
              "S002",             "S006",
              "S003",             "S007",
              "S004",             "S008",
              "S005",             "S009",
              "S006",             "S010",
              "S007",             "S011",
              "S008",             "S020",
              "S009",             "S021",
              "S010",             "S032",
              "S011",             "S044",
              "S012",             "S055",
              "S013",             "S050",
              "S014",             "S074"
  )
#> # A tibble: 14 x 2
#>    student_id_round1 student_id_round2
#>    <chr>             <chr>            
#>  1 S001              S002             
#>  2 S002              S006             
#>  3 S003              S007             
#>  4 S004              S008             
#>  5 S005              S009             
#>  6 S006              S010             
#>  7 S007              S011             
#>  8 S008              S020             
#>  9 S009              S021             
#> 10 S010              S032             
#> 11 S011              S044             
#> 12 S012              S055             
#> 13 S013              S050             
#> 14 S014              S074

Created on 2022-05-04 by the reprex package (v2.0.1)

lets say your data was called 'all_df'


setdiff(all_df$student_id_round1,all_df$student_id_round2)

This works. Thanks a lot.

This topic was automatically closed 7 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.