r - 当我尝试在 R 中创建时间受限的集群时出现错误
问题描述
我正在尝试做一个按时间顺序排列的集群(时间受限的集群),所以我使用了 R 中的 const.clust 包。我必须构建一个连接矩阵,所以我使用了 contiguity.mat 函数。它从点之间的连接文件中读取的数据构造一个邻接矩阵。就我而言,这些点是采样器日期,不是等距的。我不确定 contiguity.mat 是否是正确的函数,因为在我发现的所有示例中,点都是坐标(用于进行受限空间聚类),而不是日期。
考虑到这一点,当我运行 contiguitiy.mat 时,R 用错误回答我。
library(mvpart)
library(const.clust)
from<-abun0[1:50,1]
from<-as.Date(from)
from<-data.frame(from)
to<- abun0[2:51,1]
to<- as.Date(to)
to<-data.frame(to)
from.to<-cbind(from,to)
links.mat.spp <- contiguity.mat(from.to, 51)
contiguity.mat(from.to, 51) 中的错误:错误:'From' > n
其他选项:
from<-abun0[1:50,1]
from<-as.Date(from)
from<-data.frame(from)
to<- abun0[2:51,1]
to<- as.Date(to)
to<-data.frame(to)
from.to<-cbind(from,to
from.to<-as.matrix(from.to)
links.mat.spp <- contiguity.mat(from.to, 51)
[<-
( , j, i, value = 1)中的错误*tmp*
:数组没有“dimnames”属性
我不明白我现在要做什么。请问,有人可以帮我吗?
解决方案
我不知道const.clust
-package 或contiguity.mat
,但是您确定需要51
作为第二个参数吗?因为from.to
您现在构建的 -matrix 只有 50 行。
推荐阅读
- docker - 没有 SSL 的 Shibboleth
- json - 带有 AliceBundle 的 JSON 对象夹具
- c++ - C++ 指针,++ 运算符行为
- rxjs - 两次订阅一个 observable
- vb.net - 将 mdi 子窗体与其父窗体分离?
- spring-boot - 在地图上百里香的选择选项中嵌套循环?
- javascript - this._delegate.setNgStyle 不是 Angular 8 更新后的函数
- arangodb - 如何获取用于分页的 ArangoDB AQL 总数
- java - 如何在 Spring-Shell 中屏蔽输入字符串
- python - 如何将请求响应对象序列化为 HAR