Hi R helpers!

I have the following dataframe «choose»
choose<-data.frame(firm=c(1,1,2,2,2,2,3,3,4,4,4,4,4,4), year=c(2000,2001,2000,2001,2002,2003,2000,2003,2001,2002,2003,2004,2005,2006),code=c(10,10,11,11,11,11,12,12,13,13,13,13,13,13))
choose

I want to subset it to obtain another one with those observations for which there more than 2 observations in the column «code». So I want a dataframe «chosen» like this:
chosen<-data.frame(firm=c(2,2,2,2,4,4,4,4,4,4),year=c(2000,2001,2002,2003,2001,2002,2003,2004,2005,2006),code=c(11,11,11,11,13,13,13,13,13,13))
chosen

I’ve tried split() and then nrow() but I got nothing.

Could anyone help me with this?

Thanks
Cecília (Universidade de Aveiro – Portugal)

______________________________________________
R-help@r-project.org 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