简体   繁体   English

如何解决错误: storage.mode(x) <- "double": 'list' object 中的错误不能强制输入'double'

[英]how to solve error : Error in storage.mode(x) <- "double" : 'list' object cannot be coerced to type 'double'

Hello Im trying to run som and kmeans analysis.您好我正在尝试运行 som 和 kmeans 分析。 But I can't solve it because there's an error code.但我无法解决它,因为有一个错误代码。 Error in storage.mode(x) <- "double": 'list' object cannot be coerced to type 'double' storage.mode(x) <-“double”中的错误:“list”object 不能强制输入“double”

How can I solve this problem?我怎么解决这个问题?

cdata <- read.delim("Cluster.txt", stringsAsFactors=FALSE)
cdata.n <- scale(subset(cdata, select=-c(ID)))
som_model2 <- supersom(data = cdata.n, grid = somgrid(10, 10, "rectangular"))
k = 6
somClusters <- kmeans(som_model2$codes, centers = 6)

I want to culstering into 6 clusters.我想聚集成 6 个集群。 Please help me请帮我

I use this data.我使用这些数据。 https://github.com/woosa7/R_DataAnalytics/blob/08ea98289f4def3c4f72d4c10d3767784b42619b/R_DataMining/data/Cluster.txt https://github.com/woosa7/R_DataAnalytics/blob/08ea98289f4def3c4f72d4c10d3767784b42619b/R_DataMining/data/Cluster.txt

Try unlist :尝试unlist

somClusters <- kmeans(unlist(som_model2$codes), centers = 6)
somClusters
Cluster means:
        [,1]
1 -0.6702128
2  5.2157179
3  1.2555768
4 -0.2632253
5  2.6067733
6  0.3503127

Clustering vector:
  [1] 1 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 6 6 4 4 4 4 4 4 4
 [50] 4 6 6 4 6 4 4 4 4 4 4 6 3 3 6 6 4 4 4 4 4 3 3 3 3 6 6 4 4 4 4 5 5 3 3 6 6 4 4 4 4 2 5 3 6 6 6 4 6
 [99] 6 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 4 1 1 1 1 1 1 4 1 1 1 1 1 6 6 4 4 4 4 1 4 1 1 3 3 6 6 4 4 4
[148] 1 4 4 3 3 6 6 6 4 4 4 4 4 5 5 3 6 4 6 4 4 4 4 5 5 3 6 6 6 6 6 4 4 2 5 3 3 6 6 6 6 4 4 2 5 3 6 3 6
[197] 6 6 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 4 4 1 1 4 4 4 4 4 3 3 4 4 4
[246] 4 4 4 4 4 3 3 6 4 6 4 6 6 4 4 3 3 6 6 6 6 6 6 6 6 5 3 3 3 3 6 6 6 6 6 5 5 3 3 3 3 3 6 6 6 5 5 5 5
[295] 3 3 3 3 3 6 2 5 3 3 6 6 4 4 4 1 5 5 3 3 6 6 6 4 4 1 5 3 3 6 6 6 4 4 4 1 3 6 6 6 4 6 6 4 4 1 1 1 4
[344] 4 4 4 6 4 4 1 1 1 1 1 4 4 4 4 4 1 1 1 1 1 1 1 4 4 4 1 1 1 1 1 1 1 4 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1
[393] 1 1 1 1 1 1 1 4

Within cluster sum of squares by cluster:
[1] 1.939971 9.714721 4.939015 2.981251 3.051715 3.374086
 (between_SS / total_SS =  93.6 %)

Available components:

[1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss" "betweenss"   
[7] "size"         "iter"         "ifault"  

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:在storage.mode(x)&lt; - “double”:由强制引入的NA - Error: In storage.mode(x) <- “double” : NAs introduced by coercion 如何解决错误“mde(x) 中的错误:'list' object 不能强制键入 'double' Traceback:”? - How to resolve thee error “Error in mde(x): 'list' object cannot be coerced to type 'double' Traceback:”? 如何解释此错误消息:(list) 对象不能被强制输入“double” - How to interpret this error message: (list) object cannot be coerced to type 'double' 计算标准错误时出错:(list) 对象不能被强制输入“double” - Error in calculating standard error: (list) object cannot be coerced to type 'double' R quadprog错误:(列表)对象无法强制键入“ double” - R quadprog error: (list) object cannot be coerced to type 'double' R :(列表)对象不能强制在for循环中键入“ double”错误 - R: (list) object cannot be coerced to type 'double' error in for loop 错误:不能强制“列表”对象在 R 中键入“双精度” - Error: 'list' object cannot be coerced to type 'double' in R (Optim) 错误: (list) object 不能被强制输入'double' - (Optim) Error: (list) object cannot be coerced to type 'double' R 中的逻辑回归错误:'list' object 不能强制输入'double' - Error in logistic regression in R: 'list' object cannot be coerced to type 'double' R:优化错误:'list' object 不能强制输入'double' - R: Error in optim: 'list' object cannot be coerced to type 'double'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM