How to find duplicate rows in String Array (vec)

How to find duplicate rows in String Array (vec) ?

Paul

What do you want to do? You can use unique to only get a vector back without duplicate elements.

julia> aa = ["cat", "dog", "dog"]
3-element Array{String,1}:
 "cat"
 "dog"
 "dog"

julia> unique(aa)
2-element Array{String,1}:
 "cat"
 "dog"

or you can use countmap from StatsBase.jl to get a dictionary back to see which element is duplicated.

julia> countmap(aa)
Dict{String,Int64} with 2 entries:
  "cat" => 1
  "dog" => 2
2 Likes

Thanks, :wink: