Я пытаюсь создать K-среднее кластеризацию и получить ошибку NA / NaN / Inf при вызове сторонней функции (аргумент 1). Это мой код
library(tidyverse)
library(readr)
library(jsonlite)
library(dplyr)
df<-fromJSON('https://raw.githubusercontent.com/lequanngo/WorldHappiness/master/WorldHappiness.json')
df <- na.omit(df)
glimpse(df)
Observations: 156
Variables: 11
$ Country <chr> "Finland", "Denmark", "Norway", "Iceland", "Netherlan…
$ Ladder <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16…
$ SD_of_ladder <int> 4, 13, 8, 9, 1, 11, 18, 15, 23, 10, 26, 62, 14, 3, 16…
$ Positive_affect <int> 41, 24, 16, 3, 12, 44, 34, 22, 18, 64, 47, 4, 104, 62…
$ Negative_affect <int> 10, 26, 29, 3, 25, 21, 8, 12, 49, 24, 37, 87, 69, 19,…
$ Social_support <int> 2, 4, 3, 1, 15, 13, 25, 5, 20, 31, 7, 42, 38, 27, 9, …
$ Freedom <int> 5, 6, 3, 7, 19, 11, 10, 8, 9, 26, 17, 16, 93, 28, 63,…
$ Corruption <int> 4, 3, 8, 45, 12, 7, 6, 5, 11, 19, 13, 58, 74, 9, 15, …
$ Generosity <int> 47, 22, 11, 3, 7, 16, 17, 8, 14, 25, 6, 75, 24, 30, 4…
$ Log_of_GDP_per_cap <int> 22, 14, 7, 15, 12, 8, 13, 26, 19, 16, 18, 67, 31, 2, …
$ Healthy_life_exp <int> 27, 23, 12, 13, 18, 4, 17, 14, 8, 15, 10, 28, 11, 16,…
set.seed(12345)
countries <- df
df_clus <- df[-1]
cluster_solution <- kmeans(df_clus, centers = 5)
Может кто-нибудь помочь мне с этим?