0

I get an error

"Error in if (any(outlier)) { : missing value where TRUE/FALSE needed" when I try to use the rosnerTest, from the package EnvStats.

out1 <- aggregate(x = df$Price, by = list(df$Item), FUN = rosnerTest)

I'm trying to use the aggregate function in place of using for loop to do the rosner test because my data has over 14 million records with about 3 million unique items.

www
  • 38,575
  • 12
  • 48
  • 84

2 Answers2

0

Try tapply instead:

out1 <- tapply(df$Price, df$Item, rosnerTest)

Zelazny7
  • 39,946
  • 18
  • 70
  • 84
0

It's a while ago, but maybe it still helps someone:

I got the same error because I had no outliers in some rows (e.g. all values were the same). In a for loop, you can use the try() function to ignore these errors and the loop will continue with the next row.

jemand-r
  • 1
  • 2