I think this answer can go down two paths. You can talk about IEEE 754 and the various types of NaN (signaling NaN and "quiet" NaN) and if that is where your curiosity is leading towards. It may be worth researching.
However in R, NaN is a "special value" and reserved word. It will be treated as a numerical (float, real, imaginary, complex etc.)
It is a general rule in R that any computations involving NaN will return either NaN or NA. "Which may depend on the R platform". (See link below). Essentially, depending how R chooses to interpret your code, it will normally typically always throw NaN or NA.
The only sure-fire way of testing if an NaN exists is to use the predicate is.nan()
https://stat.ethz.ch/R-manual/R-devel/library/base/html/is.finite.html