Skip to content
Prev 386005 / 398525 Next

package(moments) issue

moments::anscombe.test(x) does give errors when x has too few values or if
all the values in x are the same
Error in if (pval > 1) pval <- 2 - pval :
  missing value where TRUE/FALSE needed
Error in if (pval > 1) pval <- 2 - pval :
  missing value where TRUE/FALSE needed

You can use tryCatch() to return some special value where these errors
occur.  E.g., use

tryCatch(anscombe.test(x), error=function(e) list(p.value=NA))

instead of ascombe.test (this assumes you will only look at p.value later -
add other entries as needed.).

-Bill
On Thu, Oct 15, 2020 at 12:09 PM Sania Wadud <sania.wadud at gmail.com> wrote: