gpt4 book ai didi

r - Shapiro 测试 : is. 数字 (x) 不为 TRUE

转载 作者:行者123 更新时间:2023-12-02 04:23:01 25 4
gpt4 key购买 nike

我在使用 shapiro.test 函数检查正常性时遇到问题。我不断收到错误

is.numeric (x) is not TRUE

我使用以下数据集(名称:Abund2014layer):

Abundance
0.91567
0.01256
...
0.85605

共 75 行。

我的实现如下:

shapiro.test(Abund2014layer)

但我不断收到错误。输入应该是数据值的数字向量,我看不出哪里出了问题。

最佳答案

您提供给 shapiro.test 的数据是向量吗?如果它是一个data.frame,那么它将返回此错误。尝试使用 shapiro.test(Abund2014layer$Abundance)

如果仍然出现错误,您可以使用 class(Abund2014layer$Abundance) 函数查看向量的class。如果它不是数字,您可以将其转换并在一行中执行夏皮罗检验,如下所示;

shapiro.test( as.numeric( Abund2014layer$Abundance ) )

关于r - Shapiro 测试 : is. 数字 (x) 不为 TRUE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28962152/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com