I would like to extract duplicated strings from a list. As, the unique function does not work on non-numerical data, I used the stringi package with the stri_duplicated function to obtain logical values (TRUE or FALSE). I would like to extract the strings that are duplicated from the list (the strings for which stri_duplicated reports a TRUE).
Here a minimal example:
ex1 <- c("SE1", "SE2", "SE5", "SE2")
dupl <- stri_duplicated(ex1)
> dupl
[1] FALSE FALSE FALSE TRUE
Many thanks in advance.
In base-R there is
duplicated(ex1)
[1] FALSE FALSE FALSE TRUE
if you want to extract the duplicated items
ex1[duplicated(ex1)]
[1] "SE2"