I want to keep only non-duplicated rows in a dataset. This is going one step beyond "removing duplicates"; that is, I want to eliminate ALL copies of duplicated rows, not just the duplicate copies, and keep only the rows that were never duplicated in the first place.
Dataset:
    df <- data.frame(A = c(5,5,6,7,8,8,8), B = sample(1:100, 7))
    df
    A  B
    5 91
    5 46
    6 41
    7 98
    8 35
    8 56
    8 36
Want to turn it into:
    A  B
    6 41
    7 98
Here is what I tried using dplyr:
    df_single <- df %>% count(A) %>% filter(n == 1)
    # Returns all the values of A for which only one row exists
    df %>% filter(A == df_single$A)
    # Trying to subset only those values of A, but this returns error 
    # "longer object length is not a multiple of shorter object length"
Thanks for your help. A nice bonus would be additional code for doing the opposite (keeping all the OTHER rows - i.e., eliminating only the non-duplicated rows from the dataset).
 
     
    