R Under development (unstable) (2023-10-04 r85267 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(matrixTests) > source("utils/capture.r") > > #--- less than 2 observations -------------------------------------------------- > > wrn <- 'row_andersondarling: 1 of the rows had less than 8 total observations.\nFirst occurrence at row 1' > nacolumns <- c("statistic", "pvalue") > > # single observation > res <- capture(row_andersondarling(1)) > stopifnot(all.equal(res$warning, wrn)) > stopifnot(all(is.na(res$value[,nacolumns]))) > stopifnot(all.equal(res$value$obs, 1)) > > # seven observations with some NA values > res <- capture(row_andersondarling(c(rnorm(7),NA,NA))) > stopifnot(all.equal(res$warning, wrn)) > stopifnot(all(is.na(res$value[,nacolumns]))) > stopifnot(all.equal(res$value$obs, 7)) > > # zero observations > res <- capture(row_andersondarling(NA_integer_)) > stopifnot(all.equal(res$warning, wrn)) > stopifnot(all(is.na(res$value[,nacolumns]))) > stopifnot(all.equal(res$value$obs, 0)) > > > #--- all values are constant --------------------------------------------------- > > wrn <- 'row_andersondarling: 1 of the rows had essentially constant values.\nFirst occurrence at row 1' > nacolumns <- c("statistic", "pvalue") > > # 8 equal observations > res <- capture(row_andersondarling(rep(1,8))) > stopifnot(all.equal(res$warning, wrn)) > stopifnot(all(is.na(res$value[,nacolumns]))) > stopifnot(all.equal(res$value$obs, 8)) > > # 8 equal observations with some NA values > res <- capture(row_andersondarling(c(rep(0.5,8),NA,NA))) > stopifnot(all.equal(res$warning, wrn)) > stopifnot(all(is.na(res$value[,nacolumns]))) > stopifnot(all.equal(res$value$obs, 8)) > > > proc.time() user system elapsed 0.10 0.09 0.18