I have a question that I hope some of you can help me with. I am doing a dissertation on pharmaceuticals and the effect of concurrency. I deal with this in R, having a panel dataset
I need a variable that takes into account the given source product - how many parallelists exist for this given period of time.
Product_ID PI t 1 0 1 1 1 1 1 1 1 1 0 2 1 1 2 1 1 2 1 1 2 1 1 2 2 0 1 2 1 1 2 0 2 2 1 2 2 0 3 2 1 3 2 1 3 2 1 3
Ideally, I want a new column here, for example, the number of PI products (PI = 1) for the original (PI = 0) at time t. Thus, the output will look like this:
Product_ID PI t nPIcomp 1 0 1 2 1 1 1 1 1 1 1 0 2 4 1 1 2 1 1 2 1 1 2 1 1 2 2 0 1 1 2 1 1 2 0 2 1 2 1 2 2 0 3 3 2 1 3 2 1 3 2 1 3
Hope I made my problem clear :)
Thanks in advance, Henrik
source share