I have the following data:
> dat
ID Gene Value1 Value2
1 NM_013468 Ankrd1 Inf Inf
2 NM_023785 Ppbp Inf
You can't check for NaN
with the normal compare operators. You can do so for Inf
, but you would also have to check for the negative case. Better to use one of those functions: https://stat.ethz.ch/R-manual/R-devel/library/base/html/is.finite.html
Edit: tonytonov pointed out, that is.finite(NaN)
is FALSE
, which makes it sufficient to use in this case. You therefore just need
dat[is.finite(dat$Value1) & is.finite(dat$Value2), ]