I have a data frame in R which looks like:
| RIC | Date | Open |
|--------|---------------------|--------|
| S1A.PA | 2011-06-30 20:00:00 | 23.7 |
| ABC.PA | 2011-07-03 20:00:00 | 24.31 |
| EFG.PA | 2011-07-04 20:00:00 | 24.495 |
| S1A.PA | 2011-07-05 20:00:00 | 24.23 |
I want to know if there’s any duplicates regarding to the combination of RIC and Date. Is there a function for that in R?
You can always try simply passing those first two columns to the function
duplicated:assuming your data frame is called
dat. For more information, we can consult the help files for theduplicatedfunction by typing?duplicatedat the console. This will provide the following sentences:So
duplicatedreturns a logical vector, which we can then use to extract a subset ofdat:or you can skip the separate assignment step and simply use: