Biobase.Rcheck/tests_i386/test-all.Rout
R version 4.0.0 alpha (Rtools40) (2020-03-31 r78116) -- "Blame Jeroen"
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 -- Tue Apr 14 20:45:16 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
11.17 0.17 11.78
|
Biobase.Rcheck/tests_x64/test-all.Rout
R version 4.0.0 alpha (Rtools40) (2020-03-31 r78116) -- "Blame Jeroen"
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 -- Tue Apr 14 20:46:18 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.25 0.17 26.40
|
Biobase.Rcheck/tests_i386/test-rowMedians.Rout
R version 4.0.0 alpha (Rtools40) (2020-03-31 r78116) -- "Blame Jeroen"
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.56
Random test #2
rowMedians()/apply(): 0.273
rowMedians()/rowMedians2(): 1
Random test #3
rowMedians()/apply(): 0.5
Random test #4
rowMedians()/apply(): 0.273
rowMedians()/rowMedians2(): 0.375
Random test #5
rowMedians()/apply(): 0.355
rowMedians()/rowMedians2(): 0.55
Random test #6
rowMedians()/apply(): 0.2
rowMedians()/rowMedians2(): 0.25
Random test #7
rowMedians()/apply(): 0.622
Random test #8
rowMedians()/apply(): 0
rowMedians()/rowMedians2(): NaN
Random test #9
rowMedians()/apply(): 2
Random test #10
rowMedians()/apply(): 0.588
Random test #11
rowMedians()/apply(): 0.2
Random test #12
rowMedians()/apply(): 0.611
Random test #13
rowMedians()/apply(): 0
rowMedians()/rowMedians2(): NaN
Random test #14
rowMedians()/apply(): 0.679
Random test #15
rowMedians()/apply(): 0.742
Random test #16
rowMedians()/apply(): 0.125
rowMedians()/rowMedians2(): 0.2
Random test #17
rowMedians()/apply(): 0.76
Random test #18
rowMedians()/apply(): 0.25
rowMedians()/rowMedians2(): 1
Random test #19
rowMedians()/apply(): 0.273
rowMedians()/rowMedians2(): 0.6
Random test #20
rowMedians()/apply(): 0.29
rowMedians()/rowMedians2(): 0.191
>
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # 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 576846 17.7 1257644 38.4 1145099 35.0
Vcells 1682070 12.9 10146329 77.5 10653678 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 576863 17.7 1257644 38.4 1145099 35.0
Vcells 1683084 12.9 10146329 77.5 10653678 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 576863 17.7 1257644 38.4 1145099 35.0
Vcells 1682209 12.9 10146329 77.5 10653678 81.3
> stopifnot(all.equal(y0,y1))
> cat(sprintf("rowMedians()/apply(): %.3g\n", (t1/t0)[3]))
rowMedians()/apply(): 0.19
>
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # 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
20.78 0.29 21.07
|
Biobase.Rcheck/tests_x64/test-rowMedians.Rout
R version 4.0.0 alpha (Rtools40) (2020-03-31 r78116) -- "Blame Jeroen"
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.273
Random test #2
rowMedians()/apply(): 0.214
rowMedians()/rowMedians2(): 0.5
Random test #3
rowMedians()/apply(): 0
Random test #4
rowMedians()/apply(): 0.25
rowMedians()/rowMedians2(): 0.75
Random test #5
rowMedians()/apply(): 0.209
rowMedians()/rowMedians2(): 0.409
Random test #6
rowMedians()/apply(): 0.167
rowMedians()/rowMedians2(): 0.333
Random test #7
rowMedians()/apply(): 0.2
Random test #8
rowMedians()/apply(): 0
rowMedians()/rowMedians2(): NaN
Random test #9
rowMedians()/apply(): 0
Random test #10
rowMedians()/apply(): 0.222
Random test #11
rowMedians()/apply(): 0.5
Random test #12
rowMedians()/apply(): 0.286
Random test #13
rowMedians()/apply(): 0.5
rowMedians()/rowMedians2(): Inf
Random test #14
rowMedians()/apply(): 0.0625
Random test #15
rowMedians()/apply(): 0.167
Random test #16
rowMedians()/apply(): 0.182
rowMedians()/rowMedians2(): 0.4
Random test #17
rowMedians()/apply(): 0.167
Random test #18
rowMedians()/apply(): 0.0909
rowMedians()/rowMedians2(): 1
Random test #19
rowMedians()/apply(): 0.294
rowMedians()/rowMedians2(): 1.25
Random test #20
rowMedians()/apply(): 0.167
rowMedians()/rowMedians2(): 0.393
>
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # 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 576847 30.9 1257720 67.2 1144752 61.2
Vcells 2023023 15.5 12255594 93.6 12255097 93.5
> 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 576863 30.9 1257720 67.2 1190566 63.6
Vcells 2024040 15.5 12255594 93.6 12255587 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 576863 30.9 1257720 67.2 1190566 63.6
Vcells 2023165 15.5 12255594 93.6 12255587 93.6
> stopifnot(all.equal(y0,y1))
> cat(sprintf("rowMedians()/apply(): %.3g\n", (t1/t0)[3]))
rowMedians()/apply(): 0.197
>
>
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # 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
22.17 0.51 22.68
|