参数必须可强制为R中的非负整数

时间:2018-07-22 15:11:05

标签: r anova

我正在尝试对数据集运行以下命令;

   pbad2way(formula = Balance~Occupation+Gender+Occupation:Gender, data = 
plxsell, est= "mom", nboot= 5000)

数据集名称为plxsell 平衡,职业,性别是列

但是我收到以下错误;

FUN(X [[i]],...)中的错误:   参数必须可强制为非负整数 另外:警告消息: 在FUN(X [[i]],...)中:'length.out'参数使用的第一个元素

请帮助。

谢谢 阿基尔

1 个答案:

答案 0 :(得分:0)

当函数需要一个数字但收到其他内容时,将返回此错误消息。以seq_len函数为例:

seq_len(3) # no error, since function receives a number
seq_len(NA_character_) # Error, since function expected a number and did not receive one
seq_len("a") # Error, since function expected a number and did not receive one

在任何函数希望接收数字但接收到其他内容(例如字符串或NA)的情况下,仔细检查代码和数据。您数据中的NA可能是开始查找的好地方