0
     loan_number date_component
2542  2020121604     2020-12-19
2544  2020121604     2020-12-19
2548  2020121604     2020-12-19
2557  2020121607     2020-12-19
2560  2020121607     2020-12-19
2563  2020121607     2020-12-19

I have data of loan numbers in the range of date (2020-12-18 & 2020-12-28) and some of the loan numbers are repeating in these dates.

I want the unique count of loan number from each date and taking into account the fact that the loan number is unique and has not occurred in the previous dates.

Example - if the 19th of the month has 3 unique loan-id and 20th of the same month has 2 unique loan-id then these 2 loan id's should be unique from the ones in 19th.

Rui Barradas
  • 70,273
  • 8
  • 34
  • 66
  • `aggregate(loan_number ~ date_component, df1, function(x) length(unique(x)))`. This is probably a duplicate. – Rui Barradas Jan 04 '21 at 06:48
  • See also [this SO post](https://stackoverflow.com/questions/12840294/counting-unique-distinct-values-by-group-in-a-data-frame). – Rui Barradas Jan 04 '21 at 06:51

0 Answers0