friedman agricolae返回错误

时间:2015-02-27 21:09:53

标签: r

我正在尝试在agricolae包中进行弗里曼测试。我试过这个:

>with(data,friedman(seeds,trial,site, group=TRUE))

并收到此错误:

>Error in Summary.factor(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,  : 
 min not meaningful for factors
In addition: There were 39 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: In mean.default(x, na.rm = TRUE) :
argument is not numeric or logical: returning NA
2: In mean.default(x, na.rm = TRUE) :
argument is not numeric or logical: returning NA
...

这就是我的数据:

>str(data)
'data.frame':   41 obs. of  6 variables:
$ ID       : int  20 34 41 48 62 69 76 97 104 146 ...
$ site     : Factor w/ 3 levels "Benton N","Benton S",..: 1 1 1 1 2 2 2 2 2 2 
$ plot     : int  3 5 6 7 1 2 3 6 7 13 ...
$ trial    : Factor w/ 2 levels "planting7","preplanting7": 1 1 1 1 1 1 1 1 1 1 
$ treatment: Factor w/ 2 levels "control","seed": 1 1 1 1 1 1 1 1 1 1 ...
$ seeds    : num  27.9 29.3 29.4 29 28.6 ...

我不知道如何让它发挥作用。种子应该已经是数字。网站和情节不是,但为什么他们需要?

感谢

1 个答案:

答案 0 :(得分:0)

我想你混淆了你的论点。根据您的数据描述进行更好的尝试将是:

    with(data, friedman(trial, site, seeds, group=TRUE))

但是,你仍然希望得到一个完整的区块设计,其中包含2个和3个级别以及41个观察值的两个因素?

请参阅帮助:&#34; friedman.test可用于分析未复制的完整区块设计(即,对于组和区块的每个组合,在y中只有一个观察点)...&#34; < / p>