Running 'dense_matrix.R' [174s]
  Running 'dense_matrix_inplace.R' [0s]
  Running 'dense_matrix_pairwise.R' [0s]
  Running 'dense_vecvec.R' [159s]
  Running 'naomit.R' [171s]
  Running 'scale.R' [168s]
  Running 'sparse_matrix.R' [0s]
  Running 'sparse_utils.R' [0s]
  Running 'use_method.R' [161s]
Running the tests in 'tests/dense_matrix.R' failed.
Complete output:
  > library(coop)
  > m <- 10
  > n <- 3
  > 
  > x <- matrix(rnorm(m*n), m, n)
  > tx <- t(x)
  > cpx <- crossprod(x)
  > tcpx <- tcrossprod(x)
  > 
  > y <- x
  > colnames(y) <- letters[1:ncol(x)]
  > rownames(y) <- sample(letters, size=nrow(x), replace=TRUE)
  > ty <- t(y)
  > 
  > check <- function(x, fun1, fun2)
  + {
  +   t1 <- fun1(x)
  +   t2 <- fun2(x)
  +   stopifnot(all.equal(t1, t2))
  + }
  > 
  > 
  > 
  > ### Covariance
  > check(x, cov, coop::covar)
  > check(tx, cov, coop::covar)
  > check(tcpx, cov, coop::covar)
  > check(tcpx, cov, coop::covar)
  > 
  > stopifnot(all.equal(cov(x), tcovar(tx)))
  > stopifnot(all.equal(cov(tx), tcovar(x)))
  > stopifnot(all.equal(cov(cpx), tcovar(cpx)))
  > stopifnot(all.equal(cov(tcpx), tcovar(tcpx)))
  > 
  > check(y, cov, coop::covar)
  > check(ty, cov, coop::covar)
  > 
  > stopifnot(all.equal(solve(cov(x)), coop::covar(x, inverse=TRUE)))
  > 
  > 
  > 
  > ### Pearson correlation
  > check(x, cor, coop::pcor)
  > check(tx, cor, coop::pcor)
  > check(cpx, cor, coop::pcor)
  > check(tcpx, cor, coop::pcor)
  > 
  > stopifnot(all.equal(cor(x), tpcor(tx)))
  > stopifnot(all.equal(cor(tx), tpcor(x)))
  > stopifnot(all.equal(cor(cpx), tpcor(cpx)))
  > stopifnot(all.equal(cor(tcpx), tpcor(tcpx)))
  > 
  > check(y, cor, coop::pcor)
  > check(ty, cor, coop::pcor)
  > 
  > stopifnot(all.equal(solve(cor(x)), coop::pcor(x, inverse=TRUE)))
  > 
  > 
  > 
  > ### Cosine similarity
  > cosine <- function(x)
  + {
  +   cp <- crossprod(x)
  +   rtdg <- sqrt(diag(cp))
  +   cos <- cp / tcrossprod(rtdg)
  +   return(cos)
  + }
  > 
  > check(x, cosine, coop::cosine)
  > check(tx, cosine, coop::cosine)
  > check(cpx, cosine, coop::cosine)
  > check(tcpx, cosine, coop::cosine)
  > 
  > stopifnot(all.equal(cosine(x), tcosine(tx)))
  > stopifnot(all.equal(cosine(tx), tcosine(x)))
  > stopifnot(all.equal(cosine(cpx), tcosine(cpx)))
  > stopifnot(all.equal(cosine(tcpx), tcosine(tcpx)))
  > 
  > check(y, cosine, coop::cosine)
  > check(ty, cosine, coop::cosine)
  > 
  > stopifnot(all.equal(solve(cosine(x)), coop::cosine(x, inverse=TRUE)))
  > 
  > proc.time()
     user  system elapsed 
     0.17    0.12    0.25 
Running the tests in 'tests/dense_vecvec.R' failed.
Complete output:
  > cosine <- function(x, y)
  + {
  +   cp <- crossprod(x, y)
  +   cp / sqrt(crossprod(x) * crossprod(y))
  + }
  > 
  > 
  > x <- rnorm(30)
  > y <- rnorm(30)
  > 
  > t1 <- as.vector(cosine(x, y))
  > t2 <- coop::cosine(x, y)
  > stopifnot(all.equal(t1, t2, check.attributes=FALSE))
  > 
  > 
  > t1 <- cor(x, y)
  > t2 <- coop::pcor(x, y)
  > stopifnot(all.equal(t1, t2, check.attributes=FALSE))
  > 
  > 
  > t1 <- cov(x, y)
  > t2 <- coop::covar(x, y)
  > stopifnot(all.equal(t1, t2, check.attributes=FALSE))
  > 
  > proc.time()
     user  system elapsed 
     0.14    0.12    0.23 
Running the tests in 'tests/naomit.R' failed.
Complete output:
  > library(coop)
  > set.seed(1234)
  > 
  > naomit = coop:::naomit
  > check = function(a, b) stopifnot(all.equal(a, b, check.attributes=FALSE))
  > 
  > test = function(m, n, prop=.01)
  + {
  +   x = matrix(rnorm(m*n, sd=10000), m, n)
  +   
  +   check(na.omit(x), naomit(x))
  +   
  +   x[sample(m*n, size=m*n*prop)] = NA
  +   
  +   truth = na.omit(x)
  +   if (any(dim(truth) == 0))
  +     stop("zero rows - bad test seed/prop values")
  +   
  +   check(truth, naomit(x))
  +   
  +   storage.mode(x) = "integer"
  +   check(na.omit(x), naomit(x))
  + }
  > 
  > test(100, 20)
  > test(10, 2)
  > 
  > 
  > 
  > ### TODO
  > # if (require(slam))
  > # {
  > #   library(slam)
  > #   csc = as.simple_triplet_matrix(y)
  > #   z = as.matrix(coop:::naomit_coo(as.double(csc$v), csc$i, csc$j))
  > #   stopifnot(all.equal(na.omit(y), z, check.attributes=FALSE))
  > # }
  > 
  > proc.time()
     user  system elapsed 
     0.23    0.09    0.26 
Running the tests in 'tests/scale.R' failed.
Complete output:
  > library(coop)
  > 
  > m <- 20
  > n <- 5
  > x <- matrix(rnorm(m*n, mean=10, sd=3), m, n)
  > 
  > # center/scale
  > t1 <- scale(x)
  > t2 <- scaler(x)
  > stopifnot(all.equal(t1, t2))
  > 
  > # center
  > t1 <- scale(x, scale=FALSE)
  > t2 <- scaler(x, scale=FALSE)
  > stopifnot(all.equal(t1, t2))
  > 
  > # scale
  > t1 <- scale(x, center=FALSE)
  > t2 <- scaler(x, center=FALSE)
  > stopifnot(all.equal(t1, t2))
  > 
  > proc.time()
     user  system elapsed 
     0.17    0.09    0.25 
Running the tests in 'tests/use_method.R' failed.
Complete output:
  > library(coop)
  > m <- 10
  > n <- 3
  > 
  > set.seed(1234)
  > x <- matrix(rnorm(m*n), m, n)
  > x[c(1,3,9), c(1, 1, 2)] <- NA
  > 
  > use <- "everything"
  > t1 <- cor(x, use=use)
  > t2 <- pcor(x, use=use)
  > stopifnot(all.equal(t1, t2))
  > 
  > use <- "all"
  > t1 <- try(cor(x, use=use), silent=TRUE)
  > t2 <- try(pcor(x, use=use), silent=TRUE)
  > stopifnot(inherits(t1, "try-error") && inherits(t2, "try-error"))
  > 
  > use <- "complete"
  > t1 <- cor(x, use=use)
  > t2 <- pcor(x, use=use)
  > stopifnot(all.equal(t1, t2))
  > 
  > 
  > 
  > 
  > set.seed(1234)
  > x <- rnorm(10)
  > y <- runif(10)
  > x[c(1,3,9)] <- NA
  > 
  > use <- "everything"
  > t1 <- cor(x, y, use=use)
  > t2 <- pcor(x, y, use=use)
  > stopifnot(all.equal(t1, t2))
  > 
  > use <- "all"
  > t1 <- try(cor(x, y, use=use), silent=TRUE)
  > t2 <- try(pcor(x, y, use=use), silent=TRUE)
  > stopifnot(inherits(t1, "try-error") && inherits(t2, "try-error"))
  > 
  > use <- "complete"
  > t1 <- cor(x, y, use=use)
  > t2 <- pcor(x, y, use=use)
  > stopifnot(all.equal(t1, t2))
  > 
  > proc.time()
     user  system elapsed 
     0.12    0.10    0.21