Find duplicated rows (based on 2 columns) in Data Frame in R

后端 未结 6 703
独厮守ぢ
独厮守ぢ 2020-11-27 06:10

I have a data frame in R which looks like:

| RIC    | Date                | Open   |
|--------|---------------------|--------|
| S1A.PA | 2011-06-30 20:00:00         


        
6条回答
  •  再見小時候
    2020-11-27 06:48

    dplyr is so much nicer for this sort of thing:

    library(dplyr)
    yourDataFrame %>%
        distinct(RIC, Date, .keep_all = TRUE)
    

    (the ".keep_all is optional. if not used, it will return only the deduped 2 columns. when used, it returns the deduped whole data frame)

提交回复
热议问题