我使用的是R包phytools中的
phylANOVA()
函数,如下:
phylANOVA(HoloceneTree, HolDat$Category,
HolDat$Niche_Breadth, nsim = 1000, posthoc = T)
我不断收到错误消息:
Warning: no labels for x. Assuming order of tree$tip.label.
Warning: no labels for y. Assuming order of tree$tip.label.
x 和 y 分别是类别和连续数据。 HolDat 如下所示:
structure(list(label = c("Aegotheles_novazelandiae", "Alauda_arvensis",
"Anas_chlorotis", "Anas_platyrhynchos", "Anomalopteryx_didiformis",
"Chen_caerulescens"), Category = c("Flightless", "True Fliers",
"True Fliers", "True Fliers", "Flightless", "True Fliers"), biovar = c(1L,
1L, 1L, 1L, 1L, 1L), Niche_Breadth = c(5.259427983, 3.207528743, 4.208010193,
29.52295142, 6.985928971, 32.54111922)), row.names = c("Aegotheles_novazelandiae",
"Alauda_arvensis", "Anas_chlorotis", "Anas_platyrhynchos", "Anomalopteryx_didiformis",
"Chen_caerulescens"), class = "data.frame")
如您所见,我将物种名称作为行名称。我还尝试将第一列(包含物种)重命名为“Species”、“Species_Name”和“Label”,但每次我都会收到相同的错误,表明 x 和 y 没有标签。如何使该函数可以将物种名称读取为物种标签?
HoltDat<-tibble(label = c("Aegotheles_novazelandiae", "Alauda_arvensis","Anas_chlorotis", "Anas_platyrhynchos", "Anomalopteryx_didiformis","Chen_caerulescens"),
Category = c("Flightless", "True Fliers","True Fliers", "True Fliers", "Flightless", "True Fliers"),
biovar = c(1L, 1L, 1L, 1L, 1L, 1L),
Niche_Breadth = c(5.259427983, 3.207528743, 4.208010193,29.52295142, 6.985928971, 32.54111922),
row.names = c("Aegotheles_novazelandiae", "Alauda_arvensis", "Anas_chlorotis", "Anas_platyrhynchos", "Anomalopteryx_didiformis", "Chen_caerulescens"))
请注意,这不是错误,只是警告。如果树中尖端标签的顺序与表中物种的顺序相同,那么它就可以正常工作。 为了避免树中提示标签的顺序不同时出现问题,请在 phylANOVA 命名向量中使用而不是“HolDat$Category”和 HolDat$Niche_Breadth,可以通过以下方式创建:
HoltDatGroups <- HoltDat$Category
names(HoltDatGroups) <- HoltDat$label
HoltDatTraits <- HoltDat$Niche_Breadth
names(HoltDatTraits) <- HoltDat$label