Removing rows on multiple parameters is not too diffcult, e.g.: data[!(data$fd==0 & data$cl==0),]
However, in the following dataframe:
d
It's really better if you give a minimal example and complete desired output. It makes it much easier to test.
From your description, i'm guessing this will work
deleteable <- with(data, ave(fd, id, sq, p, FUN=function(x) all(x==0)))
Here we use ave
to look at the "fd" values grouping by "id","sq","p" and we check if they are all 0. If they are deleteable
will equal 1; if not, 0; Then we can remove those rows with
data[deleteable==0, ]