FUN(X[[i]], ...) 中的错误:仅在数据框上定义,所有数字变量都在 运行 素食主义者的 MDS 中
Error in FUN(X[[i]], ...) : only defined on a data frame with all numeric variables in running a MDS in vegan
您好,我正在尝试 运行 MDS 来创建绘图
这些是我的数据
A B C D
B_2016 54.67 3.67 10 1
Emb_2016 37.67 10.33 1.67 10.33
Fes_2016 19.33 32.67 2.67 2.33
Ku_2016 0 5.33 1.67 28.33
Ra_2016 6 20.33 11.33 29.33
Ud_2016 8 5.33 1.33 4.33
Ve _2016 84.67 4.67 1 21
Ba _2017 0 3 2 6.97
Emb _2017 0 4 2.77 4.47
Fes_2017 0 0.01 0 0
Ku_2017 0 0.1 0.02 0.16
Ra_2017 0 0 1 11
Ud_2017 0 5 3 4
Ve_2017 0 0 0 0
这是我的代码
mds<-metaMDS(macnally, k=2, distance="bray", autotransform=FALSE, trymax=100)
但是我得到这个错误:
Error in FUN(X[[i]], ...) :
only defined on a data frame with all numeric variables
In addition: Warning message:
In Ops.factor(left, right) : ‘<’ not meaningful for factors
可以帮我画图吗?非常感谢
Ve_2016、Ba_2017 和 Emb_2017 的行名称中有空格,这可能会给您一条错误消息。
library(vegan)
A <- c(54.67, 37.67, 19.33, 0, 6, 8, 84.67, 0,0,0,0,0,0,0)
B <- c(3.67, 10.33, 32.67, 5.33, 20.33, 5.33, 4.67, 3, 4, 0.01, 0.1, 0, 5, 0)
C <- c(10, 1.67, 2.67, 1.67, 11.33, 1.33, 1, 2, 2.77, 0, 0.02, 1,3,0)
D <- c(1,10.33, 2.33, 28.33, 29.33, 4.33, 21, 6.97, 4.47, 0, 0.16, 11, 4,0)
df <- cbind(A,B,C,D)
row.names(df) <- c('B_2016', 'Emb_2016', 'Fes_2016', 'Ku_2016', 'Ra_2016', 'Ud_2016',
'Ve_2016', 'Ba_2017', 'Emb_2017', 'Fes_2017', 'Ku_2017', 'Ra_2017',
'Ud_2017', 'Ve_2017')
mds <- metaMDS(df, distance='bray')
plot(mds)
您好,我正在尝试 运行 MDS 来创建绘图 这些是我的数据
A B C D
B_2016 54.67 3.67 10 1
Emb_2016 37.67 10.33 1.67 10.33
Fes_2016 19.33 32.67 2.67 2.33
Ku_2016 0 5.33 1.67 28.33
Ra_2016 6 20.33 11.33 29.33
Ud_2016 8 5.33 1.33 4.33
Ve _2016 84.67 4.67 1 21
Ba _2017 0 3 2 6.97
Emb _2017 0 4 2.77 4.47
Fes_2017 0 0.01 0 0
Ku_2017 0 0.1 0.02 0.16
Ra_2017 0 0 1 11
Ud_2017 0 5 3 4
Ve_2017 0 0 0 0
这是我的代码
mds<-metaMDS(macnally, k=2, distance="bray", autotransform=FALSE, trymax=100)
但是我得到这个错误:
Error in FUN(X[[i]], ...) : only defined on a data frame with all numeric variables In addition: Warning message: In Ops.factor(left, right) : ‘<’ not meaningful for factors
可以帮我画图吗?非常感谢
Ve_2016、Ba_2017 和 Emb_2017 的行名称中有空格,这可能会给您一条错误消息。
library(vegan)
A <- c(54.67, 37.67, 19.33, 0, 6, 8, 84.67, 0,0,0,0,0,0,0)
B <- c(3.67, 10.33, 32.67, 5.33, 20.33, 5.33, 4.67, 3, 4, 0.01, 0.1, 0, 5, 0)
C <- c(10, 1.67, 2.67, 1.67, 11.33, 1.33, 1, 2, 2.77, 0, 0.02, 1,3,0)
D <- c(1,10.33, 2.33, 28.33, 29.33, 4.33, 21, 6.97, 4.47, 0, 0.16, 11, 4,0)
df <- cbind(A,B,C,D)
row.names(df) <- c('B_2016', 'Emb_2016', 'Fes_2016', 'Ku_2016', 'Ra_2016', 'Ud_2016',
'Ve_2016', 'Ba_2017', 'Emb_2017', 'Fes_2017', 'Ku_2017', 'Ra_2017',
'Ud_2017', 'Ve_2017')
mds <- metaMDS(df, distance='bray')
plot(mds)