Guys I'm new to this language ,I'm running cluster analysis on a data frame but when I calculate the distance I get this warning "NAs introduced by coercion". What does this mean?
d <- dist(as.matrix(mydata1))
Warning message:
In dist(as.matrix(mydata1)) : NAs introduced by coercion
My data sample is
Metafamily Total July cpc July cse_pla July offline July organic
xerox 8560 275.829417 0.20943223 0.032628862 0.169210813 0.1130048
office-supplie 246.9125664 0.057833047 0.020209909 0.535358617 0.136165617
In this apart from Metafamily column all columns are numeric in class.
Guys please help me out from this issue.
It's that first column that creates the issue:
Inside
dist
there must be a coercion to numeric, which generates the NA as above.I'd suggestion to apply
dist
without the first column or better move that torownames
if possible, because the result will be different:btw: you don't need
as.matrix
when callingdist
. It'll do that anyway internally.EDIT: using rownames