Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我收到一个错误
当我尝试使用来自 EnvStats 包的 rosnerTest 时,“if (any(outlier)) { 中的错误:需要 TRUE/FALSE 的缺失值”。
out1 <- aggregate(x = df$Price, by = list(df$Item), FUN = rosnerTest)
我正在尝试使用聚合函数而不是使用 for 循环来进行 rosner 测试,因为我的数据有超过 1400 万条记录和大约 300 万个唯一项目。
不久前,但也许它仍然可以帮助某人:
我得到了同样的错误,因为我在某些行中没有异常值(例如,所有值都相同)。在 for 循环中,您可以使用该try()函数忽略这些错误,循环将继续下一行。
try()
请尝试tapply:
tapply
out1 <- tapply(df$Price, df$Item, rosnerTest)