为什么我不能计算霍普金斯检验来评估聚类趋势?

问题描述

我正在尝试为我的数据集计算霍普金斯检验,以评估R中的聚类趋势。我没有成功。我收到以下错误

Error in runif(n,min = c[i],max = d[i]) : invalid argument

这是我运行的代码

hopkins(test,n = nrow(test)-1)

这是一个类似于我的数据结构的伪数据集。

test <- structure(list(respondents_id = c("24421","39808","56240","52198","16928","67878","2697","33653","28415","779"),comorbidities = structure(c(5L,5L,2L,3L,9L,5L),.Label = c("asthma","diabetes_type_one","diabetes_type_two","heart_disease","hypertension","kidney_disease","liver_disease","lung_condition","obesity"),class = "factor"),gender = structure(c(2L,1L,1L),.Label = c("Female","Male","Other"),chills = structure(c(1L,.Label = c("No","Yes"
    ),cough = structure(c(2L,2L),"Yes"),diarrhoea = structure(c(1L,fatigue = structure(c(1L,headache = structure(c(2L,loss_smell_taste = structure(c(1L,muscle_ache = structure(c(2L,nasal_congestion = structure(c(1L,nausea_vomiting = structure(c(1L,shortness_breath = structure(c(1L,sore_throat = structure(c(1L,sputum = structure(c(1L,temperature = structure(c(1L,loss_appetite = structure(c(1L,chest_pain = structure(c(1L,itchy_eyes = structure(c(1L,joint_pain = structure(c(1L,n_cmdt = structure(c(2L,.Label = c(">3 comorbidites","1 morbidity","2 comorbidities"),age_band = structure(c(5L,4L,.Label = c("0-19","20-29","30-39","40-49","50-59","60-69","70-79","80-89","90+"
    ),class = "factor")),row.names = c(NA,10L),class = "data.frame")

有人有同样的错误吗?我不确定为什么会收到此错误?难道是我的数据不是数字的,所以出现了错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)