首页 > 解决方案 > 尝试在 R 中运行friedman.test 时错误提示dim(x) 必须具有正长度

问题描述

问这个问题我觉得很傻,但我试图在 R 中做一个简单的friedman.test,但遇到了错误。我想比较各种事物,包括仅在两个样本均值之间进行比较,但出于说明目的,我想比较以下四种均值。

ch03 <- 0.2251
Ic03 <- 0.2181
Pe03 <- 0.1768
Ta03 <- 0.2155

sample<-matrix(c(ch03,Ic03,Pe03,Ta03),ncol=4)

sample
      [,1]   [,2]   [,3]   [,4]
[1,] 0.2251 0.2181 0.1768 0.2155

#just doing the most basic thing to get the test working
friedman.test(sample)

#error
Error in apply(y, 1L, rank) : dim(X) must have a positive length

但我认为我正在做的事情应该有效,基于此处的示例在此处输入链接描述

任何想法将不胜感激

标签: rstatistics

解决方案


推荐阅读