I have a database with the following fields:
NUM_PROPOSTA | DATA_PROPOSTA |
---|---|
7911334 | 2021-08-25 |
7911334 | 2021-08-25 |
7911340 | 2021-08-25 |
7911340 | 2021-08-25 |
I want to make a separate count in RStudio that only group by day, but also unite the numbers of the proposals. But when I do it looks like this:
base_serasa_pj %>%
group_by(NUM_PROPOSTA) %>%
count(DATA_PROPOSTA)
NUM_PROPOSTA | DATA_PROPOSTA | N |
---|---|---|
7911334 | 2021-08-25 | 9 |
7911334 | 2021-08-25 | 8 |
7911360 | 2021-08-25 | 1 |
7911369 | 2021-08-25 | 8 |
It is only grouping the number of proposals, I’ve already tried to do it with count too, but it gives the same result on days. The result I expect is:
NUM_PROPOSTA | DATA_PROPOSTA | N |
---|---|---|
7911334 | 2021-08-25 | 4 |
Because on 25-08-2021 we only had 4 different proposals.
These numbers 9, 8, 1 and 8 occur because each proposal was sent that number of times that day, but for the purpose of what I need they need to be counted only once a day regardless of how many times it is repeated on the same day.
Can anyone help me?
Thanks