Re: [R] Removal/selecting specific rows in a dataframe conditional on 2 columns

2011-11-01 Thread Dennis Murphy
Does this work? library('plyr') # Function to return a data frame if it has one row, else return NULL: f <- function(d) if(nrow(d) == 1L) d else NULL > ddply(RV09, .(set, month), f) record.t trip set month stratum NAFO unit.area time dur.set distance 15 913 110 351 3O

Re: [R] Removal/selecting specific rows in a dataframe conditional on 2 columns

2011-11-01 Thread R. Michael Weylandt
Perhaps use tapply() to split by the survey unit and write a little identity function that returns only those rows you want, then patch them all back together with something like simplify2array(). Michael On Tue, Nov 1, 2011 at 1:16 PM, Aurelie Cosandey Godin wrote: > Dear list, > > After readin

[R] Removal/selecting specific rows in a dataframe conditional on 2 columns

2011-11-01 Thread Aurelie Cosandey Godin
Dear list, After reading different mails, blogs, and tried a few different codes without any success, I am asking your help! I have the following data frame where each row represent a survey unit with the following variables: > names(RV09) [1] "record.t" "trip" "set" "month" "