if (is.na(n) || n > 65536L) 中的错误停止“大小不能为 NA 也不能超过 65536”:缺少需要 TRUE/FALSE 的值

问题描述

我有几个小时进行聚类分析,但每次我运行代码时,它都会向我显示错误:“if (is.na(n) || n > 65536L) stop("size不能是 NA 也不能超过 65536"): 缺少需要 TRUE/FALSE 的值”,或者这个“在 dist(BD) 中:强制引入的 NA”。如果有人可以帮助我,我会很感激。

以下代码是我尝试做的以及我在谷歌中找到的一些意图(但我无法完成):

#clusters
library(ggplot2)
library(car)
library(dplyr)
library(factoextra)
library(cluster)
library(simstudy)
library(data.table)
library(tidyverse)
library(PerformanceAnalytics)
library()


?hclust
BD2 <- matrix( data = c[P1,P2,P5,P11,P21],nrow = 1600,byrow = FALSE,dimnames = NULL)
?dist
hclustfunc <- function(Encuesta_de_Opinion_Nacional_Prueba_GB) { cluster_complete <- hclust(Encuesta_de_Opinion_Nacional_Prueba_GB,method="complete")
result <- list(cluster_complete)  
return(result)
Cl2 <- scale(Encuesta_de_Opinion_Nacional_Prueba_GB,center = TRUE,scale = TRUE)
Clabels <- row.names(Encuesta_de_Opinion_Nacional_Prueba_GB$P5)
cluster_complete <- hclust(d = dist(Encuesta_de_Opinion_Nacional_Prueba_GB),method = "complete")
Cluster_single   <- hclust(d = BD,method = "single")
Cluster_average  <- hclust(d = dist(BD),method = "average")
Cluster_Km  <- kmcluster(Encuesta_de_Opinion_Nacional_Prueba_GB,center = 4,nstart = 50) 
hclust(d = BD,method = "ward.D")

解决方法

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

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

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