-2
$\begingroup$

I have a dataset of latitude and longitude coordinates with 140000 values in each and when I apply k means clustering using r I am getting this error:

"Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)"

However, the dataset doesn't contain any missing values I don't think. How should I solve this issue and get clusters out of these locations? Is there any other algorithm which is suitable for this purpose? The intention behind the task is to get areas/regions with more accidents.

$\endgroup$
1
  • $\begingroup$ It's your job to check your input data. k-means can only work with non-missing data. $\endgroup$
    – SmallChess
    Commented Nov 28, 2016 at 0:39

1 Answer 1

0
$\begingroup$

First of all,

"the dataset doesn't have any missing values I don't think"

If you are not sure that the data is clean, you should probably check it first. You should check for both columns of your input data frame that there are no NAs and all values are numerical. Then check the datatype within R and the datatypes accepted by kmeans.

If that does not lead anywhere, a small sample of your data and your code would be helpful.

Concerning an alternative approach, I can think of agglomerative clustering and the dbscan algorithm, but I think that is not your issue.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.