[R] read.dta function in foreign package
ripley at stats.ox.ac.uk
Wed Jul 24 18:48:00 CEST 2002
On Wed, 24 Jul 2002, Ravi Varadhan wrote:
> 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?
The following may help:
> is.na(c(NA, NaN))
 TRUE TRUE
> is.nan(c(NA, NaN))
 FALSE TRUE
So for almost all purposes NaN is treated the same as missing NA, but
if you really need to the two can be distinguished.
It looks to me as if this is something we should fix in the foreign
package (unless it has already been given that your version of R is two
versions old). Could you provide an example file where you get NaN and
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
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