[R] read.dta function in foreign package

Thomas Lumley tlumley at u.washington.edu
Wed Jul 24 18:39:21 CEST 2002


On Wed, 24 Jul 2002, Ravi Varadhan wrote:

> Hi:
>
> When I import a Stata (version 7) data set into R, the missing values
> for factor and numeric variables are represented as "NaN", but the
> missing values for date variables are represented as "NA".  Can "NaN"
> for numeric variables be treated as the same as "NA" ? Are there
> situations when these two representations are not equivalent?
>

They are almost always treated the same way.  The few exceptions are
things like the function is.nan(), which is FALSE for NA, and the fact
that unique() on a vector containing NA and NaN will report them as
different values.

However, I'm surprised that you are getting NaNs. I get NA for missing
numeric data under both Windows and Linux (though the Windows version is
1.5.1), and the C source code looks as if it should give NA (I certainly
intended it to).


	-thomas



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list