我对R很陌生,我试图在CCA情节中展示物种名称。我发现你可以在创建一个空白的CCA图之后使用orditorp来用截断的物种名称替换默认点。但是,当我尝试运行orditorp函数时,我收到错误消息:
Error in x[ord, ] : subscript out of bounds
In addition: Warning messages:
1: In x[, 1] - w :
longer object length is not a multiple of shorter object length
2: In x[, 1] + w :
longer object length is not a multiple of shorter object length
3: In x[, 2] - h :
longer object length is not a multiple of shorter object length
4: In x[, 2] + h :
longer object length is not a multiple of shorter object length
我正在运行的代码如下:
bmi_all<- read.delim("BMI_data_all_var.txt", header=T, sep="\t", row.names=1)
library(vegan)
taxa.matrix <- subset(bmi_all, select=Chironomidae:Neoporus)
attach(bmi_all)
#perform a correspondance analysis on my bmi data
bmi_ca<- cca(taxa.matrix~TSS+BChla+SChla+DSub, na.action=na.exclude)
cnam<-make.cepnames(names(taxa.matrix))
stems<-colSums(taxa.matrix)
plot(bmi_ca, dis="sp", type="n")
orditorp(bmi_ca,"sp",label=cnam,priority=stems,pch="+",pcol="red")
如果我跑plot(bmi_ca, dis="sp", type="t")
我得到了CCA情节,但正如预期的那样,物种名称会产生非常混乱的排序。在创建taxa.matrix
和bmi_ca
时,我已尝试将cnam
替换为stems
,但在尝试应用orditorp
时出现同样的错误。< / p>
有什么想法吗?
提前致谢!
-Jordan
答案 0 :(得分:0)
经过一番摆弄,我设法解决了我的问题!我从我的数据集中删除了一个站点,这导致一些物种的丰度为零。删除它们并运行代码后,它就可以了!