Biobase.Rcheck/tests_i386/test-all.Rout
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)
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.
> BiocGenerics:::testPackage("Biobase")
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, basename, cbind, colnames, dirname, do.call,
duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
tapply, union, unique, unsplit, which, which.max, which.min
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
RUNIT TEST PROTOCOL -- Sat Oct 17 01:54:52 2020
***********************************************
Number of test functions: 101
Number of errors: 0
Number of failures: 0
1 Test Suite :
Biobase RUnit Tests - 101 test functions, 0 errors, 0 failures
Number of test functions: 101
Number of errors: 0
Number of failures: 0
>
> proc.time()
user system elapsed
12.46 0.21 13.68
|
Biobase.Rcheck/tests_x64/test-all.Rout
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
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.
> BiocGenerics:::testPackage("Biobase")
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, basename, cbind, colnames, dirname, do.call,
duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
tapply, union, unique, unsplit, which, which.max, which.min
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
RUNIT TEST PROTOCOL -- Sat Oct 17 01:55:40 2020
***********************************************
Number of test functions: 101
Number of errors: 0
Number of failures: 0
1 Test Suite :
Biobase RUnit Tests - 101 test functions, 0 errors, 0 failures
Number of test functions: 101
Number of errors: 0
Number of failures: 0
>
> proc.time()
user system elapsed
14.57 0.25 14.81
|
Biobase.Rcheck/tests_i386/test-rowMedians.Rout
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)
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(Biobase)
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, basename, cbind, colnames, dirname, do.call,
duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
tapply, union, unique, unsplit, which, which.max, which.min
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
> set.seed(1)
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Consistency checks
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> # rowMedians() by rowQ()
> rowMedians2 <- function(imat) {
+ nr <- ncol(imat)
+ half <- (nr + 1)/2
+ if (nr%%2 == 1) {
+ return(rowQ(imat, half))
+ } else {
+ return((rowQ(imat, half) + rowQ(imat, half+1))/2)
+ }
+ }
>
> cat("Consistency checks:\n")
Consistency checks:
> set.seed(1)
> for (kk in 1:20) {
+ cat("Random test #", kk, "\n", sep="")
+
+ # Simulate data in a matrix of any shape
+ nrow <- sample(2000, size=1)
+ ncol <- sample(2000, size=1)
+ x <- rnorm(nrow*ncol)
+ dim(x) <- c(nrow, ncol)
+
+ # Add NAs?
+ nas <- sample(c(TRUE,FALSE), size=1)
+ if (nas) {
+ nna <- sample(nrow*ncol, size=1)
+ x[sample(length(x), size=nna)] <- NA
+ }
+
+ na.rm <- nas
+ t1 <- system.time({
+ y1 <- rowMedians(x, na.rm=na.rm)
+ })
+ t2 <- system.time({
+ y2 <- apply(x, MARGIN=1, FUN=median, na.rm=na.rm)
+ })
+ # When all values of 'y2' are NA, 'y2' is logical
+ if (is.logical(y2)) y2 <- as.double(y2)
+ stopifnot(all.equal(y1,y2))
+ cat(sprintf("rowMedians()/apply(): %.3g\n", (t1/t2)[3]))
+
+ if (!nas) {
+ t3 <- system.time({
+ y3 <- rowMedians2(x)
+ })
+ stopifnot(all.equal(y1,y3))
+ cat(sprintf("rowMedians()/rowMedians2(): %.3g\n", (t1/t3)[3]))
+ }
+ }
Random test #1
rowMedians()/apply(): 0.472
Random test #2
rowMedians()/apply(): 0.143
rowMedians()/rowMedians2(): 0.375
Random test #3
rowMedians()/apply(): 0
Random test #4
rowMedians()/apply(): 0.25
rowMedians()/rowMedians2(): 0.455
Random test #5
rowMedians()/apply(): 0.283
rowMedians()/rowMedians2(): 0.464
Random test #6
rowMedians()/apply(): 0.455
rowMedians()/rowMedians2(): 0.625
Random test #7
rowMedians()/apply(): 0.545
Random test #8
rowMedians()/apply(): 0
rowMedians()/rowMedians2(): NaN
Random test #9
rowMedians()/apply(): 0.667
Random test #10
rowMedians()/apply(): 0.56
Random test #11
rowMedians()/apply(): 0.4
Random test #12
rowMedians()/apply(): 0.615
Random test #13
rowMedians()/apply(): 0
rowMedians()/rowMedians2(): 0
Random test #14
rowMedians()/apply(): 0.513
Random test #15
rowMedians()/apply(): 0.646
Random test #16
rowMedians()/apply(): 0.2
rowMedians()/rowMedians2(): 0.429
Random test #17
rowMedians()/apply(): 0.634
Random test #18
rowMedians()/apply(): 0.0667
rowMedians()/rowMedians2(): 0.333
Random test #19
rowMedians()/apply(): 0.316
rowMedians()/rowMedians2(): 0.75
Random test #20
rowMedians()/apply(): 0.358
rowMedians()/rowMedians2(): 0.487
>
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Benchmarking
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> cat("Benchmarking:\n")
Benchmarking:
>
> # Simulate data in a matrix of any shape
> nrow <- 1000
> ncol <- 1000
> x <- rnorm(nrow*ncol)
> dim(x) <- c(nrow, ncol)
>
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 576948 17.7 1252452 38.3 1108688 33.9
Vcells 1682378 12.9 10146329 77.5 10653013 81.3
> t0 <- system.time({
+ for (rr in 1:20)
+ y0 <- apply(x, MARGIN=1, FUN=median, na.rm=FALSE)
+ })
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 576965 17.7 1252452 38.3 1127356 34.5
Vcells 1683392 12.9 10146329 77.5 10653013 81.3
> t1 <- system.time({
+ for (rr in 1:20)
+ y1 <- rowMedians(x, na.rm=FALSE)
+ })
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 576965 17.7 1252452 38.3 1127356 34.5
Vcells 1682517 12.9 10146329 77.5 10653013 81.3
> stopifnot(all.equal(y0,y1))
> cat(sprintf("rowMedians()/apply(): %.3g\n", (t1/t0)[3]))
rowMedians()/apply(): 0.207
>
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Consistency checks
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> cat("Consistency checks without NAs:\n")
Consistency checks without NAs:
> for (kk in 1:20) {
+ cat("Random test #", kk, "\n", sep="")
+
+ # Simulate data in a matrix of any shape
+ nrow <- sample(1000, size=1)
+ ncol <- sample(1000, size=1)
+ x <- rnorm(nrow*ncol)
+ dim(x) <- c(nrow, ncol)
+
+ t0 <- system.time({
+ y0 <- apply(x, MARGIN=1, FUN=median, na.rm=FALSE)
+ })
+ t1 <- system.time({
+ y1 <- rowMedians(x, na.rm=FALSE)
+ })
+ stopifnot(all.equal(y0,y1))
+ } # for (kk in ...)
Random test #1
Random test #2
Random test #3
Random test #4
Random test #5
Random test #6
Random test #7
Random test #8
Random test #9
Random test #10
Random test #11
Random test #12
Random test #13
Random test #14
Random test #15
Random test #16
Random test #17
Random test #18
Random test #19
Random test #20
>
>
>
> cat("Consistency checks with NAs:\n")
Consistency checks with NAs:
> for (kk in 1:20) {
+ cat("Random test #", kk, "\n", sep="")
+
+ # Simulate data in a matrix of any shape
+ nrow <- sample(1000, size=1)
+ ncol <- sample(1000, size=1)
+ x <- rnorm(nrow*ncol)
+ dim(x) <- c(nrow, ncol)
+
+ # Add NAs
+ nna <- sample(nrow*ncol-1, size=1)
+ x[sample(length(x), size=nna)] <- NA
+
+ t0 <- system.time({
+ y0 <- apply(x, MARGIN=1, FUN=median, na.rm=TRUE)
+ y0[is.na(y0)] <- NA
+ })
+ t1 <- system.time({
+ y1 <- rowMedians(x, na.rm=TRUE)
+ })
+ stopifnot(all.equal(y0,y1))
+ } # for (kk in ...)
Random test #1
Random test #2
Random test #3
Random test #4
Random test #5
Random test #6
Random test #7
Random test #8
Random test #9
Random test #10
Random test #11
Random test #12
Random test #13
Random test #14
Random test #15
Random test #16
Random test #17
Random test #18
Random test #19
Random test #20
>
> proc.time()
user system elapsed
31.48 0.40 31.87
|
Biobase.Rcheck/tests_x64/test-rowMedians.Rout
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
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(Biobase)
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, basename, cbind, colnames, dirname, do.call,
duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
tapply, union, unique, unsplit, which, which.max, which.min
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
> set.seed(1)
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Consistency checks
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> # rowMedians() by rowQ()
> rowMedians2 <- function(imat) {
+ nr <- ncol(imat)
+ half <- (nr + 1)/2
+ if (nr%%2 == 1) {
+ return(rowQ(imat, half))
+ } else {
+ return((rowQ(imat, half) + rowQ(imat, half+1))/2)
+ }
+ }
>
> cat("Consistency checks:\n")
Consistency checks:
> set.seed(1)
> for (kk in 1:20) {
+ cat("Random test #", kk, "\n", sep="")
+
+ # Simulate data in a matrix of any shape
+ nrow <- sample(2000, size=1)
+ ncol <- sample(2000, size=1)
+ x <- rnorm(nrow*ncol)
+ dim(x) <- c(nrow, ncol)
+
+ # Add NAs?
+ nas <- sample(c(TRUE,FALSE), size=1)
+ if (nas) {
+ nna <- sample(nrow*ncol, size=1)
+ x[sample(length(x), size=nna)] <- NA
+ }
+
+ na.rm <- nas
+ t1 <- system.time({
+ y1 <- rowMedians(x, na.rm=na.rm)
+ })
+ t2 <- system.time({
+ y2 <- apply(x, MARGIN=1, FUN=median, na.rm=na.rm)
+ })
+ # When all values of 'y2' are NA, 'y2' is logical
+ if (is.logical(y2)) y2 <- as.double(y2)
+ stopifnot(all.equal(y1,y2))
+ cat(sprintf("rowMedians()/apply(): %.3g\n", (t1/t2)[3]))
+
+ if (!nas) {
+ t3 <- system.time({
+ y3 <- rowMedians2(x)
+ })
+ stopifnot(all.equal(y1,y3))
+ cat(sprintf("rowMedians()/rowMedians2(): %.3g\n", (t1/t3)[3]))
+ }
+ }
Random test #1
rowMedians()/apply(): 0.238
Random test #2
rowMedians()/apply(): 0.15
rowMedians()/rowMedians2(): 0.375
Random test #3
rowMedians()/apply(): 0
Random test #4
rowMedians()/apply(): 0.2
rowMedians()/rowMedians2(): 0.364
Random test #5
rowMedians()/apply(): 0.2
rowMedians()/rowMedians2(): 0.333
Random test #6
rowMedians()/apply(): 0.273
rowMedians()/rowMedians2(): 0.429
Random test #7
rowMedians()/apply(): 0.191
Random test #8
rowMedians()/apply(): 0
rowMedians()/rowMedians2(): NaN
Random test #9
rowMedians()/apply(): 1
Random test #10
rowMedians()/apply(): 0
Random test #11
rowMedians()/apply(): 0
Random test #12
rowMedians()/apply(): 0
Random test #13
rowMedians()/apply(): 0
rowMedians()/rowMedians2(): 0
Random test #14
rowMedians()/apply(): 0.16
Random test #15
rowMedians()/apply(): 0.263
Random test #16
rowMedians()/apply(): 0.158
rowMedians()/rowMedians2(): 0.5
Random test #17
rowMedians()/apply(): 0.15
Random test #18
rowMedians()/apply(): 0.188
rowMedians()/rowMedians2(): 1.5
Random test #19
rowMedians()/apply(): 0.227
rowMedians()/rowMedians2(): 0.625
Random test #20
rowMedians()/apply(): 0.326
rowMedians()/rowMedians2(): 0.652
>
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Benchmarking
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> cat("Benchmarking:\n")
Benchmarking:
>
> # Simulate data in a matrix of any shape
> nrow <- 1000
> ncol <- 1000
> x <- rnorm(nrow*ncol)
> dim(x) <- c(nrow, ncol)
>
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 576949 30.9 1252997 67.0 1107913 59.2
Vcells 2023545 15.5 12255594 93.6 12255594 93.6
> t0 <- system.time({
+ for (rr in 1:20)
+ y0 <- apply(x, MARGIN=1, FUN=median, na.rm=FALSE)
+ })
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 576965 30.9 1252997 67.0 1190677 63.6
Vcells 2024562 15.5 12255594 93.6 12255594 93.6
> t1 <- system.time({
+ for (rr in 1:20)
+ y1 <- rowMedians(x, na.rm=FALSE)
+ })
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 576965 30.9 1252997 67.0 1190677 63.6
Vcells 2023687 15.5 12255594 93.6 12255594 93.6
> stopifnot(all.equal(y0,y1))
> cat(sprintf("rowMedians()/apply(): %.3g\n", (t1/t0)[3]))
rowMedians()/apply(): 0.22
>
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Consistency checks
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> cat("Consistency checks without NAs:\n")
Consistency checks without NAs:
> for (kk in 1:20) {
+ cat("Random test #", kk, "\n", sep="")
+
+ # Simulate data in a matrix of any shape
+ nrow <- sample(1000, size=1)
+ ncol <- sample(1000, size=1)
+ x <- rnorm(nrow*ncol)
+ dim(x) <- c(nrow, ncol)
+
+ t0 <- system.time({
+ y0 <- apply(x, MARGIN=1, FUN=median, na.rm=FALSE)
+ })
+ t1 <- system.time({
+ y1 <- rowMedians(x, na.rm=FALSE)
+ })
+ stopifnot(all.equal(y0,y1))
+ } # for (kk in ...)
Random test #1
Random test #2
Random test #3
Random test #4
Random test #5
Random test #6
Random test #7
Random test #8
Random test #9
Random test #10
Random test #11
Random test #12
Random test #13
Random test #14
Random test #15
Random test #16
Random test #17
Random test #18
Random test #19
Random test #20
>
>
>
> cat("Consistency checks with NAs:\n")
Consistency checks with NAs:
> for (kk in 1:20) {
+ cat("Random test #", kk, "\n", sep="")
+
+ # Simulate data in a matrix of any shape
+ nrow <- sample(1000, size=1)
+ ncol <- sample(1000, size=1)
+ x <- rnorm(nrow*ncol)
+ dim(x) <- c(nrow, ncol)
+
+ # Add NAs
+ nna <- sample(nrow*ncol-1, size=1)
+ x[sample(length(x), size=nna)] <- NA
+
+ t0 <- system.time({
+ y0 <- apply(x, MARGIN=1, FUN=median, na.rm=TRUE)
+ y0[is.na(y0)] <- NA
+ })
+ t1 <- system.time({
+ y1 <- rowMedians(x, na.rm=TRUE)
+ })
+ stopifnot(all.equal(y0,y1))
+ } # for (kk in ...)
Random test #1
Random test #2
Random test #3
Random test #4
Random test #5
Random test #6
Random test #7
Random test #8
Random test #9
Random test #10
Random test #11
Random test #12
Random test #13
Random test #14
Random test #15
Random test #16
Random test #17
Random test #18
Random test #19
Random test #20
>
> proc.time()
user system elapsed
27.14 0.40 27.56
|