> Finally I would like to have a data.frame t2 which only contains the 
> entries of the last measurements.
> 

You could also use aggregate to get the max year per plate then join that back
to the original dataframe using merge on year and plate (common columns in both
dataframes).



x<-data.frame(id=(1:8), plate=c(15,15,15,20,20,33,43,43),
year=c(2004,2005,2006,2004,2005,2004,2005,2006), 
height=c(0.40,0.43,0.44,0.90,0.94,0.15,0.30,0.38))

merge(x, aggregate(list(year=x$year), list(plate=x$plate), max))


  plate year id height
1    15 2006  3   0.44
2    20 2005  5   0.94
3    33 2004  6   0.15
4    43 2006  8   0.38

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to