What is the difference between NaN and NA? I would like to know why some languages like R has both NA and NaN. What are the differences or are they equally the same? Is it really needed to have NA?
 A: I think of NA standing for 'Not Available', while NaN is 'Not a Number', although this is more mnemonic than explanation. By the way, I know of no language other than R (perhaps Splus?) that has both. Matlab, for example, has only NaN.
A: 
?is.nan
?is.na
?NA
?NaN

Should answer your question.
But, in short:
NaN means $\frac {0} {0}$ -- Stands for Not a Number
NA  is generally interpreted as a missing value and has various forms - NA_integer_, NA_real_, etc.
Therefore, NaN $\neq$ NA and there is a need for NaN and NA.
A: NA means the error was already there when you imported the spreadsheet into R. NaN means you caused the error after importing the data. It's the third type of error that's really hard to catch.
A: NA is for missing data. NaN, as J.M. said is for arithmetic purpose. NaN is usually the product of some arithmetic operation, such as 0/0. NA usually is declared in advance, or is a product of operation when you try to access something that is not there:
 > a <- c(1,2)
 > a[3]
   [1] NA 

A: NA = Not Available
NaN = Not a Number
I think once we expand the acronyms, it should be self explanatory.
