[R] Error in dist command
Friedrich Leisch
Friedrich.Leisch at ci.tuwien.ac.at
Fri Jan 14 15:38:30 CET 2000
>>>>> On Fri, 14 Jan 2000 15:26:22 +0100,
>>>>> Casper Frederiksen (CF) wrote:
CF> Can anybody tell me why I get the following error:
CF> Error in dist(airquality) : NA/NaN/Inf in foreign function call (arg 1)
This data set contains missing values as can be seen in:
R> summary(airquality)
Ozone Solar.R Wind Temp
Min. : 1.00 Min. : 7.0 Min. : 1.700 Min. :56.00
1st Qu.: 18.00 1st Qu.:115.8 1st Qu.: 7.400 1st Qu.:72.00
Median : 31.50 Median :205.0 Median : 9.700 Median :79.00
Mean : 42.13 Mean :185.9 Mean : 9.958 Mean :77.88
3rd Qu.: 63.25 3rd Qu.:258.8 3rd Qu.:11.500 3rd Qu.:85.00
Max. :168.00 Max. :334.0 Max. :20.700 Max. :97.00
NA's : 37.00 NA's : 7.0
Month Day
Min. :5.000 Min. : 1.0
1st Qu.:6.000 1st Qu.: 8.0
Median :7.000 Median :16.0
Mean :6.993 Mean :15.8
3rd Qu.:8.000 3rd Qu.:23.0
Max. :9.000 Max. :31.0
(NA's in Ozone and Solar.R) which dist cannot handle.
Try something like
dist(airquality[complete.cases(airquality),])
to use only observations without missing values.
--
-------------------------------------------------------------------
Friedrich Leisch
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität Wien Fax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071 Friedrich.Leisch at ci.tuwien.ac.at
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
PGP public key http://www.ci.tuwien.ac.at/~leisch/pgp.key
-------------------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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