If I understand you correctly you don't need rows where sampletype equals A
. Given this is correct you may do
d <- subset(x, sampletype != "A")
ddply(d, .(species), summarise,
avg=sum(content) / length(unique(sampletype)))
species avg
1 P1 10.33333
2 P2 14.33333
3 P3 45.00000
4 P4 16.50000