subset(dat, grepl("ADN", bName) & pName == "2011-02-10_R2" )
Note "&" (and not "&&" which is not vectorized) and that "==" (and not"=" which is assignment).
Note that you could have used:
dat[ with(dat, grepl("ADN", bName) & pName == "2011-02-10_R2" ) , ]
... and that might be preferable when used inside functions, however, that will return NA values for any lines where dat$pName is NA. That defect (which some regard as a feature) could be removed by the addition of & !is.na(dat$pName)
to the logical expression.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…