I am working with a large dataset that contains variables measured from plots. These plots are continuously remeasured every couple of years. The data sort of looks like the table below. Now I want to look at growth after a period of time so I want to select the variables (tph and basal area) initial measurements at Time1 and final measurement at Time2 of each plot. But I am not sure how to do it. Should I run a for loop or a foreach loop? or is there any other function or package in R that deals with data like this? And, what would the script look like?
State County Plot Measured_year basal_area tph
1 1 1 2006 10 10
2 1 2 2007 20 20
1 1 1 2009 30 30
2 1 1 2005 40 40
2 1 1 2010 50 50
2 1 2 2013 60 60