This reproducible example is a very simplified version of my code:
x <- c(NaN, 2, 3) #This is fine, as expected max(x) > NaN #Why does na.rm remove N
It's a language decision:
> is.na(NaN) [1] TRUE
is.nan differentiates:
is.nan
> is.nan(NaN) [1] TRUE > is.nan(NA) [1] FALSE
So you may need to call both.