I have a dataset which has tree measurements at time t1 and t2. These trees are identified by state, county, plot and tree number. There are some trees that have died and some have grown in the time interval between t1 and t2.
State County Plot Tree Meas_yr
1 9 1 1 t1
1 9 1 2 t1
1 9 1 3 t1
1 9 1 1 t2
1 9 1 2 t2
1 9 1 4 t2
1 9 1 5 t2
I am trying to separate out the trees the new grown trees from the trees that were present in both t1 and t2 and the trees that have died in t2. I am trying to create something like below.
State County Plot Tree Meas_yr tree_survival
1 9 1 1 t1 1
1 9 1 2 t1 1
1 9 1 3 t1 0
1 9 1 1 t2 1
1 9 1 2 t2 1
I would really appreciate the help. Thanks in advance.