1

I am having denials dataframe and a payment dataframe. I want to check if a denial has received how many payments and sum of it.

Conditions are denial and payment account id must be same and denial date < payment date.

i want these 'how many payments received' and 'sum of payments' as a seperate features in denials dataframe.

How to achieve this using dplyr mutate

  • Probably something like this: denial %>% join(payment, by = "id") %>% filter(denial_date < payment_date) %>% group_by(id) %>% summarise(payments_received = n(), sum_of_payments = sum(payements)) ungroup() – Eddyvonb Nov 03 '17 at 10:19
  • 1
    Hi! welcome to Stackoverflow. Please read [here for guide on asking questions](https://stackoverflow.com/help/mcve) and [here for guide on making reproducible examples](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Aramis7d Nov 03 '17 at 10:22

0 Answers0