This is a sample of my dataframe(data.table in R) called "aligned_input_dt_in"
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!