-2

This is a sample of my dataframe(data.table in R) called "aligned_input_dt_in"

Image of data

The line of code I am having trouble understanding is given below -->

i=3

output = aligned_input_dt_in[, .(Delta_denominator = aligned_input_dt_in[pt_period_life >= i + .BY$periods -1][.(.BY$product),uniqueN(patient_id, na.rm = T)]),
      by = .(periods, product)]

Can anyone please help me understand this line of code?

And also, if anyone can convert this to Python, it'll be really helpful..

Thanks!

MrFlick
  • 178,638
  • 15
  • 253
  • 268

0 Answers0