Coocur矩阵出错:' x'必须是数字

时间:2015-03-05 15:18:37

标签: r matrix

我正在尝试使用R中的cooccur包来确定物种共现。我的数据看起来像示例数据一样格式化,但是我不断得到一个"非数字"运行数据时出错。当我导入数据时,我声明第一行是标题;但是,我认为我的错误与第一行有关。请指教。

>library(cooccur)
>birds.data <- coocurBirdData
>head(birds.data)

    Point BB1 BB2 BM1 BM2 CC1 CC2 CC3 CV1 CV2 ENDO2 ENDO3 ENDON1 EO1G FEBB2 FEE1 FEE2
1    AMCR   1   1   1   1   1   1   1   1   1     1     1      1    1     1    1    1
2    AMRO   1   1   0   0   0   0   0   0   0     0     0      0    0     0    0    0
3    BASW   1   1   1   0   0   1   1   1   1     0     0      0    1     0    0    0
4    BLCC   1   0   0   0   0   0   0   0   1     0     0      0    0     0    0    0

>cooccur.birds <- cooccur(birds.data,
                           type="spp_site",
                           thresh=TRUE,
                           spp_names=TRUE)

Error in rowSums(spp_site_mat, na.rm = T) : 'x' must be numeric
In addition: Warning message:
In Ops.factor(left, right) : ‘>’ not meaningful for factors

> str(birds.data) #my data
'data.frame':   42 obs. of  51 variables:
    $ Point  : Factor w/ 42 levels "AmCr","AmRo",..: 1 2 3 4 5 6 7 8 9 10 ...
    $ BB1    : int  1 1 1 1 1 1 1 1 1 1 ...
    $ BB2    : int  1 1 1 0 0 1 0 0 0 1 ...
    $ BM1    : int  1 0 1 0 1 0 0 0 0 0 ...
    $ BM2    : int  1 0 0 0 0 0 0 0 0 0 ...

> str(finches) # the example data, which works
'data.frame':   13 obs. of  17 variables:
     $ Seymour      : int  0 1 1 0 1 0 0 0 0 0 ...
     $ Baltra       : int  0 1 1 0 1 0 0 0 0 0 ...
     $ Isabella     : int  1 1 1 1 1 0 1 0 1 1 ...
     $ Fernandina   : int  1 1 1 1 0 0 1 0 1 1 ...
     $ Santiago     : int  1 1 1 1 1 0 1 0 1 1 ...
     $ Rabida       : int  1 1 1 0 1 0 1 0 1 1 ...

0 个答案:

没有答案