Back to Multiple platform build/check report for BioC 3.22:   simplified   long
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

This page was generated on 2026-01-15 11:59 -0500 (Thu, 15 Jan 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4886
taishanLinux (openEuler 24.03 LTS)aarch644.5.0 (2025-04-11) -- "How About a Twenty-Six" 4672
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

Package 257/2361HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.74.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-01-12 13:45 -0500 (Mon, 12 Jan 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_22
git_last_commit: d2ce144
git_last_commit_date: 2025-10-29 09:58:55 -0500 (Wed, 29 Oct 2025)
nebbiolo2Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
taishanLinux (openEuler 24.03 LTS) / aarch64  OK    OK    OK  


CHECK results for BufferedMatrix on taishan

To the developers/maintainers of the BufferedMatrix package:
- Allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to reflect on this report. See Troubleshooting Build Report for more information.
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.
- See Martin Grigorov's blog post for how to debug Linux ARM64 related issues on a x86_64 host.

raw results


Summary

Package: BufferedMatrix
Version: 1.74.0
Command: /home/biocbuild/R/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/R/R/site-library --no-vignettes --timings BufferedMatrix_1.74.0.tar.gz
StartedAt: 2026-01-13 07:11:33 -0000 (Tue, 13 Jan 2026)
EndedAt: 2026-01-13 07:12:04 -0000 (Tue, 13 Jan 2026)
EllapsedTime: 31.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/R/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/R/R/site-library --no-vignettes --timings BufferedMatrix_1.74.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.5.0 (2025-04-11)
* using platform: aarch64-unknown-linux-gnu
* R was compiled by
    aarch64-unknown-linux-gnu-gcc (GCC) 14.2.0
    GNU Fortran (GCC) 14.2.0
* running under: openEuler 24.03 (LTS)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.74.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... OK
* used C compiler: ‘aarch64-unknown-linux-gnu-gcc (GCC) 14.2.0’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
checkRd: (-1) BufferedMatrix-class.Rd:209: Lost braces; missing escapes or markup?
   209 |     $x^{power}$ elementwise of the matrix
       |        ^
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 2 NOTEs
See
  ‘/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/R/R/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/home/biocbuild/R/R-4.5.0/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.74.0’
** using staged installation
** libs
using C compiler: ‘aarch64-unknown-linux-gnu-gcc (GCC) 14.2.0’
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -I"/home/biocbuild/R/R-4.5.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -Werror=format-security -c RBufferedMatrix.c -o RBufferedMatrix.o
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -I"/home/biocbuild/R/R-4.5.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -Werror=format-security -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^~~~~~~~~~~~~~~~~~~
doubleBufferedMatrix.c: At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -I"/home/biocbuild/R/R-4.5.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -Werror=format-security -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -I"/home/biocbuild/R/R-4.5.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -Werror=format-security -c init_package.c -o init_package.o
/opt/ohpc/pub/compiler/gcc/14.2.0/bin/aarch64-unknown-linux-gnu-gcc -std=gnu23 -shared -L/home/biocbuild/R/R-4.5.0/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/R/R-4.5.0/lib -lR
installing to /home/biocbuild/R/R-4.5.0/site-library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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(BufferedMatrix);library.dynam("BufferedMatrix", "BufferedMatrix", .libPaths());.C("dbm_c_tester",integer(1))

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

Adding Additional Column
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 

Reassigning values
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 3
Buffer Cols: 3
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Activating Row Buffer
In row mode: 1
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Squaring Last Column
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 900.000000 

Square rooting Last Row, then turing off Row Buffer
In row mode: 0
Checking on value that should be not be in column buffer2.236068 
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
2.236068 3.162278 3.872983 4.472136 5.000000 30.000000 

Single Indexing. Assign each value its square
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Resizing Buffers Smaller
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Activating Row Mode.
Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
Activating ReadOnly Mode.
The results of assignment is: 0
Printing matrix reversed.
900.000000 625.000000 400.000000 225.000000 100.000000 25.000000 
841.000000 576.000000 361.000000 196.000000 81.000000 16.000000 
784.000000 529.000000 324.000000 169.000000 64.000000 9.000000 
729.000000 484.000000 289.000000 144.000000 49.000000 -30.000000 
676.000000 441.000000 256.000000 121.000000 -20.000000 -10.000000 

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.337   0.028   0.350 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478398 25.6    1047041   56   639620 34.2
Vcells 885166  6.8    8388608   64  2080985 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Jan 13 07:11:58 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Jan 13 07:11:58 2026"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0xddacff0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Jan 13 07:11:59 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Jan 13 07:11:59 2026"
> 
> ColMode(tmp2)
<pointer: 0xddacff0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]        [,3]       [,4]
[1,] 100.6365967  0.9933780  1.27563044 -0.5116524
[2,]  -0.1012668 -0.4808680  0.02697948  0.0574561
[3,]   1.2833184 -0.3413942 -1.75801420 -1.3856293
[4,]   0.3263259  0.2374469  0.63922752 -0.5428366
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]       [,3]      [,4]
[1,] 100.6365967 0.9933780 1.27563044 0.5116524
[2,]   0.1012668 0.4808680 0.02697948 0.0574561
[3,]   1.2833184 0.3413942 1.75801420 1.3856293
[4,]   0.3263259 0.2374469 0.63922752 0.5428366
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0317793 0.9966835 1.1294381 0.7152988
[2,]  0.3182245 0.6934465 0.1642543 0.2397000
[3,]  1.1328365 0.5842895 1.3259013 1.1771275
[4,]  0.5712494 0.4872852 0.7995171 0.7367744
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.95439 35.96021 37.57001 32.66464
[2,]  28.28351 32.41533 26.66952 27.45446
[3,]  37.61168 31.18429 40.01703 38.15690
[4,]  31.03882 30.11030 33.63440 32.91058
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0xca8f6c0>
> exp(tmp5)
<pointer: 0xca8f6c0>
> log(tmp5,2)
<pointer: 0xca8f6c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.2945
> Min(tmp5)
[1] 53.54742
> mean(tmp5)
[1] 72.13805
> Sum(tmp5)
[1] 14427.61
> Var(tmp5)
[1] 867.4608
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.30439 67.10264 71.10593 68.73903 68.62112 68.37184 72.73861 68.83523
 [9] 74.57196 71.98978
> rowSums(tmp5)
 [1] 1786.088 1342.053 1422.119 1374.781 1372.422 1367.437 1454.772 1376.705
 [9] 1491.439 1439.796
> rowVars(tmp5)
 [1] 8102.41047   51.01672   71.70654   55.96656   64.30966   59.22574
 [7]   71.52145   87.42123   57.17918   68.51524
> rowSd(tmp5)
 [1] 90.013390  7.142599  8.467971  7.481080  8.019330  7.695826  8.457036
 [8]  9.349932  7.561692  8.277393
> rowMax(tmp5)
 [1] 470.29446  78.66180  83.29020  87.20167  82.44823  86.67102  86.85357
 [8]  89.43777  89.07536  85.87878
> rowMin(tmp5)
 [1] 57.52664 55.50912 57.98241 55.98073 53.54742 58.46627 55.99639 55.48510
 [9] 54.36131 56.84671
> 
> colMeans(tmp5)
 [1] 106.65292  75.14132  68.29067  72.67654  74.67136  66.61059  68.85578
 [8]  72.42768  69.59137  68.85231  69.44785  72.08919  71.70902  65.84892
[15]  66.48190  70.97058  71.17995  66.38595  70.60029  74.27689
> colSums(tmp5)
 [1] 1066.5292  751.4132  682.9067  726.7654  746.7136  666.1059  688.5578
 [8]  724.2768  695.9137  688.5231  694.4785  720.8919  717.0902  658.4892
[15]  664.8190  709.7058  711.7995  663.8595  706.0029  742.7689
> colVars(tmp5)
 [1] 16379.06651    57.99569    86.07064    82.34446    79.79014    56.96909
 [7]    24.02731    91.17393    40.85854    88.93714    50.98904    85.35409
[13]    99.94264    36.81749    79.02804    30.41071    73.94462    84.05183
[19]    58.83064    36.39246
> colSd(tmp5)
 [1] 127.980727   7.615490   9.277427   9.074385   8.932533   7.547787
 [7]   4.901766   9.548504   6.392069   9.430649   7.140661   9.238728
[13]   9.997132   6.067742   8.889772   5.514591   8.599106   9.167979
[19]   7.670113   6.032616
> colMax(tmp5)
 [1] 470.29446  83.20906  83.29020  86.67102  89.07536  76.37685  74.89993
 [8]  89.43777  80.62782  87.20167  78.66180  84.82449  86.85357  73.60222
[15]  84.67102  77.62939  82.80627  86.54893  81.57922  85.81158
> colMin(tmp5)
 [1] 56.39160 62.67064 55.50912 57.14285 60.01966 53.54742 61.66110 57.84798
 [9] 61.84366 57.12464 57.52664 55.99639 57.67071 56.84671 54.36131 63.84643
[17] 61.05509 56.27287 55.48510 66.45440
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 89.30439 67.10264 71.10593 68.73903 68.62112 68.37184 72.73861 68.83523
 [9] 74.57196       NA
> rowSums(tmp5)
 [1] 1786.088 1342.053 1422.119 1374.781 1372.422 1367.437 1454.772 1376.705
 [9] 1491.439       NA
> rowVars(tmp5)
 [1] 8102.41047   51.01672   71.70654   55.96656   64.30966   59.22574
 [7]   71.52145   87.42123   57.17918   65.47974
> rowSd(tmp5)
 [1] 90.013390  7.142599  8.467971  7.481080  8.019330  7.695826  8.457036
 [8]  9.349932  7.561692  8.091955
> rowMax(tmp5)
 [1] 470.29446  78.66180  83.29020  87.20167  82.44823  86.67102  86.85357
 [8]  89.43777  89.07536        NA
> rowMin(tmp5)
 [1] 57.52664 55.50912 57.98241 55.98073 53.54742 58.46627 55.99639 55.48510
 [9] 54.36131       NA
> 
> colMeans(tmp5)
 [1] 106.65292  75.14132  68.29067  72.67654  74.67136  66.61059  68.85578
 [8]  72.42768  69.59137  68.85231  69.44785  72.08919  71.70902  65.84892
[15]  66.48190  70.97058        NA  66.38595  70.60029  74.27689
> colSums(tmp5)
 [1] 1066.5292  751.4132  682.9067  726.7654  746.7136  666.1059  688.5578
 [8]  724.2768  695.9137  688.5231  694.4785  720.8919  717.0902  658.4892
[15]  664.8190  709.7058        NA  663.8595  706.0029  742.7689
> colVars(tmp5)
 [1] 16379.06651    57.99569    86.07064    82.34446    79.79014    56.96909
 [7]    24.02731    91.17393    40.85854    88.93714    50.98904    85.35409
[13]    99.94264    36.81749    79.02804    30.41071          NA    84.05183
[19]    58.83064    36.39246
> colSd(tmp5)
 [1] 127.980727   7.615490   9.277427   9.074385   8.932533   7.547787
 [7]   4.901766   9.548504   6.392069   9.430649   7.140661   9.238728
[13]   9.997132   6.067742   8.889772   5.514591         NA   9.167979
[19]   7.670113   6.032616
> colMax(tmp5)
 [1] 470.29446  83.20906  83.29020  86.67102  89.07536  76.37685  74.89993
 [8]  89.43777  80.62782  87.20167  78.66180  84.82449  86.85357  73.60222
[15]  84.67102  77.62939        NA  86.54893  81.57922  85.81158
> colMin(tmp5)
 [1] 56.39160 62.67064 55.50912 57.14285 60.01966 53.54742 61.66110 57.84798
 [9] 61.84366 57.12464 57.52664 55.99639 57.67071 56.84671 54.36131 63.84643
[17]       NA 56.27287 55.48510 66.45440
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.2945
> Min(tmp5,na.rm=TRUE)
[1] 53.54742
> mean(tmp5,na.rm=TRUE)
[1] 72.08445
> Sum(tmp5,na.rm=TRUE)
[1] 14344.8
> Var(tmp5,na.rm=TRUE)
[1] 871.2642
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.30439 67.10264 71.10593 68.73903 68.62112 68.37184 72.73861 68.83523
 [9] 74.57196 71.42049
> rowSums(tmp5,na.rm=TRUE)
 [1] 1786.088 1342.053 1422.119 1374.781 1372.422 1367.437 1454.772 1376.705
 [9] 1491.439 1356.989
> rowVars(tmp5,na.rm=TRUE)
 [1] 8102.41047   51.01672   71.70654   55.96656   64.30966   59.22574
 [7]   71.52145   87.42123   57.17918   65.47974
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.013390  7.142599  8.467971  7.481080  8.019330  7.695826  8.457036
 [8]  9.349932  7.561692  8.091955
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.29446  78.66180  83.29020  87.20167  82.44823  86.67102  86.85357
 [8]  89.43777  89.07536  85.87878
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.52664 55.50912 57.98241 55.98073 53.54742 58.46627 55.99639 55.48510
 [9] 54.36131 56.84671
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 106.65292  75.14132  68.29067  72.67654  74.67136  66.61059  68.85578
 [8]  72.42768  69.59137  68.85231  69.44785  72.08919  71.70902  65.84892
[15]  66.48190  70.97058  69.88814  66.38595  70.60029  74.27689
> colSums(tmp5,na.rm=TRUE)
 [1] 1066.5292  751.4132  682.9067  726.7654  746.7136  666.1059  688.5578
 [8]  724.2768  695.9137  688.5231  694.4785  720.8919  717.0902  658.4892
[15]  664.8190  709.7058  628.9933  663.8595  706.0029  742.7689
> colVars(tmp5,na.rm=TRUE)
 [1] 16379.06651    57.99569    86.07064    82.34446    79.79014    56.96909
 [7]    24.02731    91.17393    40.85854    88.93714    50.98904    85.35409
[13]    99.94264    36.81749    79.02804    30.41071    64.41390    84.05183
[19]    58.83064    36.39246
> colSd(tmp5,na.rm=TRUE)
 [1] 127.980727   7.615490   9.277427   9.074385   8.932533   7.547787
 [7]   4.901766   9.548504   6.392069   9.430649   7.140661   9.238728
[13]   9.997132   6.067742   8.889772   5.514591   8.025827   9.167979
[19]   7.670113   6.032616
> colMax(tmp5,na.rm=TRUE)
 [1] 470.29446  83.20906  83.29020  86.67102  89.07536  76.37685  74.89993
 [8]  89.43777  80.62782  87.20167  78.66180  84.82449  86.85357  73.60222
[15]  84.67102  77.62939  81.85682  86.54893  81.57922  85.81158
> colMin(tmp5,na.rm=TRUE)
 [1] 56.39160 62.67064 55.50912 57.14285 60.01966 53.54742 61.66110 57.84798
 [9] 61.84366 57.12464 57.52664 55.99639 57.67071 56.84671 54.36131 63.84643
[17] 61.05509 56.27287 55.48510 66.45440
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.30439 67.10264 71.10593 68.73903 68.62112 68.37184 72.73861 68.83523
 [9] 74.57196      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1786.088 1342.053 1422.119 1374.781 1372.422 1367.437 1454.772 1376.705
 [9] 1491.439    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 8102.41047   51.01672   71.70654   55.96656   64.30966   59.22574
 [7]   71.52145   87.42123   57.17918         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.013390  7.142599  8.467971  7.481080  8.019330  7.695826  8.457036
 [8]  9.349932  7.561692        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.29446  78.66180  83.29020  87.20167  82.44823  86.67102  86.85357
 [8]  89.43777  89.07536        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.52664 55.50912 57.98241 55.98073 53.54742 58.46627 55.99639 55.48510
 [9] 54.36131       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.19371  75.02259  67.85138  72.65200  73.92754  67.35527  68.18421
 [8]  70.93311  69.56384  67.76912  70.61574  73.27732  72.73672  66.84917
[15]  66.11169  70.35990       NaN  65.77572  70.22195  73.80146
> colSums(tmp5,na.rm=TRUE)
 [1] 991.7434 675.2033 610.6624 653.8680 665.3479 606.1974 613.6579 638.3980
 [9] 626.0745 609.9221 635.5417 659.4959 654.6305 601.6425 595.0052 633.2391
[17]   0.0000 591.9815 631.9976 664.2132
> colVars(tmp5,na.rm=TRUE)
 [1] 18285.40653    65.08655    94.65844    92.63074    83.53969    57.85170
 [7]    21.95688    77.44121    45.95733    86.85467    42.01789    80.14236
[13]   100.55354    30.16416    87.36464    30.01665          NA    90.36912
[19]    64.57413    38.39873
> colSd(tmp5,na.rm=TRUE)
 [1] 135.223543   8.067623   9.729257   9.624486   9.140005   7.606031
 [7]   4.685817   8.800069   6.779184   9.319586   6.482121   8.952226
[13]  10.027639   5.492191   9.346906   5.478745         NA   9.506267
[19]   8.035803   6.196671
> colMax(tmp5,na.rm=TRUE)
 [1] 470.29446  83.20906  83.29020  86.67102  89.07536  76.37685  74.68131
 [8]  89.43777  80.62782  87.20167  78.66180  84.82449  86.85357  73.60222
[15]  84.67102  77.62939      -Inf  86.54893  81.57922  85.81158
> colMin(tmp5,na.rm=TRUE)
 [1] 56.39160 62.67064 55.50912 57.14285 60.01966 53.54742 61.66110 57.84798
 [9] 61.84366 57.12464 57.52664 55.99639 57.67071 57.98241 54.36131 63.84643
[17]      Inf 56.27287 55.48510 66.45440
> 
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 3
> which.col  <- 1
> cat(which.row," ",which.col,"\n")
3   1 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> rowVars(tmp5,na.rm=TRUE)
 [1] 169.2738 136.0078 111.7281 175.4053 124.4299 159.7091 249.1304 116.6018
 [9] 248.0866 271.0258
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 169.2738 136.0078 111.7281 175.4053 124.4299 159.7091 249.1304 116.6018
 [9] 248.0866 271.0258
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -5.684342e-14 -1.136868e-13  5.684342e-14  5.684342e-14 -5.684342e-14
 [6]  0.000000e+00 -1.136868e-13  0.000000e+00  0.000000e+00  5.684342e-14
[11] -2.842171e-13  8.526513e-14  0.000000e+00 -1.705303e-13 -8.526513e-14
[16]  1.136868e-13  1.136868e-13  5.684342e-14 -1.136868e-13  6.394885e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
8   20 
10   10 
7   5 
10   13 
6   8 
5   9 
9   2 
9   7 
7   16 
9   19 
9   7 
4   13 
7   2 
9   5 
8   5 
6   13 
10   9 
1   19 
5   15 
6   8 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.321952
> Min(tmp)
[1] -2.374874
> mean(tmp)
[1] -0.0284471
> Sum(tmp)
[1] -2.84471
> Var(tmp)
[1] 1.14622
> 
> rowMeans(tmp)
[1] -0.0284471
> rowSums(tmp)
[1] -2.84471
> rowVars(tmp)
[1] 1.14622
> rowSd(tmp)
[1] 1.070617
> rowMax(tmp)
[1] 2.321952
> rowMin(tmp)
[1] -2.374874
> 
> colMeans(tmp)
  [1]  0.488327909  1.809075757  0.502131333 -2.080455377 -0.402487452
  [6] -0.763466630  0.678738818 -1.883183564 -1.444882454  0.403600885
 [11] -0.171818226 -0.463104918 -1.292100096 -0.903220249 -1.298924988
 [16]  1.179357773 -1.989594127  0.151993410  1.051852689  0.430268190
 [21] -2.038076607 -1.589470690  1.025279223  0.882115898  0.109217326
 [26]  1.617014134  1.384028945 -1.128694446  0.312621485 -0.673670734
 [31]  1.808087430  0.075940096 -1.302130194  0.124071230  1.771586759
 [36]  0.858966457  1.079339869  1.579590398 -0.519575395 -1.401497286
 [41]  0.286697636  0.458495551  0.705569326 -1.134437814  0.388301178
 [46]  0.550579853 -1.529233562  1.095672360 -0.405931023  0.253274754
 [51] -0.250470175  1.177971782 -0.531891611 -0.430115172  0.912553259
 [56] -1.705985447  0.769897316 -0.789571114 -0.804030424 -0.168922666
 [61]  0.224964432 -0.187192182 -1.126238175  0.806789532  0.157070099
 [66]  0.600244851  0.558459778  1.262219066 -1.646461601  0.120047124
 [71]  0.982481998  0.652021513  1.441312883 -1.300500247 -2.292701460
 [76]  0.138833987  0.264266871  0.733370278 -0.015091662 -2.374873696
 [81] -0.009218994  2.321952381  0.617460777 -1.063587996 -0.702480860
 [86] -0.108550173  1.781460533  1.201111945 -0.726483429 -0.603328118
 [91] -0.437027716 -0.023304659  0.308282099  0.907619388 -1.800698096
 [96]  1.341899693 -0.836067335 -0.268143455  0.022859623 -0.592766008
> colSums(tmp)
  [1]  0.488327909  1.809075757  0.502131333 -2.080455377 -0.402487452
  [6] -0.763466630  0.678738818 -1.883183564 -1.444882454  0.403600885
 [11] -0.171818226 -0.463104918 -1.292100096 -0.903220249 -1.298924988
 [16]  1.179357773 -1.989594127  0.151993410  1.051852689  0.430268190
 [21] -2.038076607 -1.589470690  1.025279223  0.882115898  0.109217326
 [26]  1.617014134  1.384028945 -1.128694446  0.312621485 -0.673670734
 [31]  1.808087430  0.075940096 -1.302130194  0.124071230  1.771586759
 [36]  0.858966457  1.079339869  1.579590398 -0.519575395 -1.401497286
 [41]  0.286697636  0.458495551  0.705569326 -1.134437814  0.388301178
 [46]  0.550579853 -1.529233562  1.095672360 -0.405931023  0.253274754
 [51] -0.250470175  1.177971782 -0.531891611 -0.430115172  0.912553259
 [56] -1.705985447  0.769897316 -0.789571114 -0.804030424 -0.168922666
 [61]  0.224964432 -0.187192182 -1.126238175  0.806789532  0.157070099
 [66]  0.600244851  0.558459778  1.262219066 -1.646461601  0.120047124
 [71]  0.982481998  0.652021513  1.441312883 -1.300500247 -2.292701460
 [76]  0.138833987  0.264266871  0.733370278 -0.015091662 -2.374873696
 [81] -0.009218994  2.321952381  0.617460777 -1.063587996 -0.702480860
 [86] -0.108550173  1.781460533  1.201111945 -0.726483429 -0.603328118
 [91] -0.437027716 -0.023304659  0.308282099  0.907619388 -1.800698096
 [96]  1.341899693 -0.836067335 -0.268143455  0.022859623 -0.592766008
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.488327909  1.809075757  0.502131333 -2.080455377 -0.402487452
  [6] -0.763466630  0.678738818 -1.883183564 -1.444882454  0.403600885
 [11] -0.171818226 -0.463104918 -1.292100096 -0.903220249 -1.298924988
 [16]  1.179357773 -1.989594127  0.151993410  1.051852689  0.430268190
 [21] -2.038076607 -1.589470690  1.025279223  0.882115898  0.109217326
 [26]  1.617014134  1.384028945 -1.128694446  0.312621485 -0.673670734
 [31]  1.808087430  0.075940096 -1.302130194  0.124071230  1.771586759
 [36]  0.858966457  1.079339869  1.579590398 -0.519575395 -1.401497286
 [41]  0.286697636  0.458495551  0.705569326 -1.134437814  0.388301178
 [46]  0.550579853 -1.529233562  1.095672360 -0.405931023  0.253274754
 [51] -0.250470175  1.177971782 -0.531891611 -0.430115172  0.912553259
 [56] -1.705985447  0.769897316 -0.789571114 -0.804030424 -0.168922666
 [61]  0.224964432 -0.187192182 -1.126238175  0.806789532  0.157070099
 [66]  0.600244851  0.558459778  1.262219066 -1.646461601  0.120047124
 [71]  0.982481998  0.652021513  1.441312883 -1.300500247 -2.292701460
 [76]  0.138833987  0.264266871  0.733370278 -0.015091662 -2.374873696
 [81] -0.009218994  2.321952381  0.617460777 -1.063587996 -0.702480860
 [86] -0.108550173  1.781460533  1.201111945 -0.726483429 -0.603328118
 [91] -0.437027716 -0.023304659  0.308282099  0.907619388 -1.800698096
 [96]  1.341899693 -0.836067335 -0.268143455  0.022859623 -0.592766008
> colMin(tmp)
  [1]  0.488327909  1.809075757  0.502131333 -2.080455377 -0.402487452
  [6] -0.763466630  0.678738818 -1.883183564 -1.444882454  0.403600885
 [11] -0.171818226 -0.463104918 -1.292100096 -0.903220249 -1.298924988
 [16]  1.179357773 -1.989594127  0.151993410  1.051852689  0.430268190
 [21] -2.038076607 -1.589470690  1.025279223  0.882115898  0.109217326
 [26]  1.617014134  1.384028945 -1.128694446  0.312621485 -0.673670734
 [31]  1.808087430  0.075940096 -1.302130194  0.124071230  1.771586759
 [36]  0.858966457  1.079339869  1.579590398 -0.519575395 -1.401497286
 [41]  0.286697636  0.458495551  0.705569326 -1.134437814  0.388301178
 [46]  0.550579853 -1.529233562  1.095672360 -0.405931023  0.253274754
 [51] -0.250470175  1.177971782 -0.531891611 -0.430115172  0.912553259
 [56] -1.705985447  0.769897316 -0.789571114 -0.804030424 -0.168922666
 [61]  0.224964432 -0.187192182 -1.126238175  0.806789532  0.157070099
 [66]  0.600244851  0.558459778  1.262219066 -1.646461601  0.120047124
 [71]  0.982481998  0.652021513  1.441312883 -1.300500247 -2.292701460
 [76]  0.138833987  0.264266871  0.733370278 -0.015091662 -2.374873696
 [81] -0.009218994  2.321952381  0.617460777 -1.063587996 -0.702480860
 [86] -0.108550173  1.781460533  1.201111945 -0.726483429 -0.603328118
 [91] -0.437027716 -0.023304659  0.308282099  0.907619388 -1.800698096
 [96]  1.341899693 -0.836067335 -0.268143455  0.022859623 -0.592766008
> colMedians(tmp)
  [1]  0.488327909  1.809075757  0.502131333 -2.080455377 -0.402487452
  [6] -0.763466630  0.678738818 -1.883183564 -1.444882454  0.403600885
 [11] -0.171818226 -0.463104918 -1.292100096 -0.903220249 -1.298924988
 [16]  1.179357773 -1.989594127  0.151993410  1.051852689  0.430268190
 [21] -2.038076607 -1.589470690  1.025279223  0.882115898  0.109217326
 [26]  1.617014134  1.384028945 -1.128694446  0.312621485 -0.673670734
 [31]  1.808087430  0.075940096 -1.302130194  0.124071230  1.771586759
 [36]  0.858966457  1.079339869  1.579590398 -0.519575395 -1.401497286
 [41]  0.286697636  0.458495551  0.705569326 -1.134437814  0.388301178
 [46]  0.550579853 -1.529233562  1.095672360 -0.405931023  0.253274754
 [51] -0.250470175  1.177971782 -0.531891611 -0.430115172  0.912553259
 [56] -1.705985447  0.769897316 -0.789571114 -0.804030424 -0.168922666
 [61]  0.224964432 -0.187192182 -1.126238175  0.806789532  0.157070099
 [66]  0.600244851  0.558459778  1.262219066 -1.646461601  0.120047124
 [71]  0.982481998  0.652021513  1.441312883 -1.300500247 -2.292701460
 [76]  0.138833987  0.264266871  0.733370278 -0.015091662 -2.374873696
 [81] -0.009218994  2.321952381  0.617460777 -1.063587996 -0.702480860
 [86] -0.108550173  1.781460533  1.201111945 -0.726483429 -0.603328118
 [91] -0.437027716 -0.023304659  0.308282099  0.907619388 -1.800698096
 [96]  1.341899693 -0.836067335 -0.268143455  0.022859623 -0.592766008
> colRanges(tmp)
          [,1]     [,2]      [,3]      [,4]       [,5]       [,6]      [,7]
[1,] 0.4883279 1.809076 0.5021313 -2.080455 -0.4024875 -0.7634666 0.6787388
[2,] 0.4883279 1.809076 0.5021313 -2.080455 -0.4024875 -0.7634666 0.6787388
          [,8]      [,9]     [,10]      [,11]      [,12]   [,13]      [,14]
[1,] -1.883184 -1.444882 0.4036009 -0.1718182 -0.4631049 -1.2921 -0.9032202
[2,] -1.883184 -1.444882 0.4036009 -0.1718182 -0.4631049 -1.2921 -0.9032202
         [,15]    [,16]     [,17]     [,18]    [,19]     [,20]     [,21]
[1,] -1.298925 1.179358 -1.989594 0.1519934 1.051853 0.4302682 -2.038077
[2,] -1.298925 1.179358 -1.989594 0.1519934 1.051853 0.4302682 -2.038077
         [,22]    [,23]     [,24]     [,25]    [,26]    [,27]     [,28]
[1,] -1.589471 1.025279 0.8821159 0.1092173 1.617014 1.384029 -1.128694
[2,] -1.589471 1.025279 0.8821159 0.1092173 1.617014 1.384029 -1.128694
         [,29]      [,30]    [,31]     [,32]    [,33]     [,34]    [,35]
[1,] 0.3126215 -0.6736707 1.808087 0.0759401 -1.30213 0.1240712 1.771587
[2,] 0.3126215 -0.6736707 1.808087 0.0759401 -1.30213 0.1240712 1.771587
         [,36]   [,37]   [,38]      [,39]     [,40]     [,41]     [,42]
[1,] 0.8589665 1.07934 1.57959 -0.5195754 -1.401497 0.2866976 0.4584956
[2,] 0.8589665 1.07934 1.57959 -0.5195754 -1.401497 0.2866976 0.4584956
         [,43]     [,44]     [,45]     [,46]     [,47]    [,48]     [,49]
[1,] 0.7055693 -1.134438 0.3883012 0.5505799 -1.529234 1.095672 -0.405931
[2,] 0.7055693 -1.134438 0.3883012 0.5505799 -1.529234 1.095672 -0.405931
         [,50]      [,51]    [,52]      [,53]      [,54]     [,55]     [,56]
[1,] 0.2532748 -0.2504702 1.177972 -0.5318916 -0.4301152 0.9125533 -1.705985
[2,] 0.2532748 -0.2504702 1.177972 -0.5318916 -0.4301152 0.9125533 -1.705985
         [,57]      [,58]      [,59]      [,60]     [,61]      [,62]     [,63]
[1,] 0.7698973 -0.7895711 -0.8040304 -0.1689227 0.2249644 -0.1871922 -1.126238
[2,] 0.7698973 -0.7895711 -0.8040304 -0.1689227 0.2249644 -0.1871922 -1.126238
         [,64]     [,65]     [,66]     [,67]    [,68]     [,69]     [,70]
[1,] 0.8067895 0.1570701 0.6002449 0.5584598 1.262219 -1.646462 0.1200471
[2,] 0.8067895 0.1570701 0.6002449 0.5584598 1.262219 -1.646462 0.1200471
        [,71]     [,72]    [,73]   [,74]     [,75]    [,76]     [,77]     [,78]
[1,] 0.982482 0.6520215 1.441313 -1.3005 -2.292701 0.138834 0.2642669 0.7333703
[2,] 0.982482 0.6520215 1.441313 -1.3005 -2.292701 0.138834 0.2642669 0.7333703
           [,79]     [,80]        [,81]    [,82]     [,83]     [,84]      [,85]
[1,] -0.01509166 -2.374874 -0.009218994 2.321952 0.6174608 -1.063588 -0.7024809
[2,] -0.01509166 -2.374874 -0.009218994 2.321952 0.6174608 -1.063588 -0.7024809
          [,86]    [,87]    [,88]      [,89]      [,90]      [,91]       [,92]
[1,] -0.1085502 1.781461 1.201112 -0.7264834 -0.6033281 -0.4370277 -0.02330466
[2,] -0.1085502 1.781461 1.201112 -0.7264834 -0.6033281 -0.4370277 -0.02330466
         [,93]     [,94]     [,95]  [,96]      [,97]      [,98]      [,99]
[1,] 0.3082821 0.9076194 -1.800698 1.3419 -0.8360673 -0.2681435 0.02285962
[2,] 0.3082821 0.9076194 -1.800698 1.3419 -0.8360673 -0.2681435 0.02285962
        [,100]
[1,] -0.592766
[2,] -0.592766
> 
> 
> Max(tmp2)
[1] 2.238368
> Min(tmp2)
[1] -2.771329
> mean(tmp2)
[1] 0.1921313
> Sum(tmp2)
[1] 19.21313
> Var(tmp2)
[1] 1.108054
> 
> rowMeans(tmp2)
  [1] -1.83780304  0.87135109  1.12605184  0.18486031  0.08111970  0.64590239
  [7] -0.46932032 -0.14553926 -1.14954586  1.55822070  1.22970712  1.29964459
 [13] -1.06184018  1.70259031  0.21748151  0.21348258 -1.25816548 -0.01149147
 [19] -0.01387469 -0.09404580  1.21434200  1.08894762  1.18519246  0.95270131
 [25]  2.08301383  1.80005912  0.11797296 -0.17231903  0.58953601  0.31178878
 [31]  0.51100295  0.30078680  1.15001390 -1.35287651  1.37619233 -1.98736829
 [37]  0.17771518  1.59020749  1.52091560 -0.01098138  0.44202096  0.62653594
 [43] -0.89655940  1.96541400 -0.28003498  1.95802142 -1.70393816  0.69715727
 [49] -2.77132858  0.61891100 -1.57828387 -0.74778741  1.41859584  0.59830223
 [55] -0.74062251  0.75723976  2.23836760  0.65344455  0.97326812  0.48669331
 [61]  0.66633284  0.78422760 -0.49818836  0.91889291 -0.46109724  0.54924763
 [67] -0.88321510 -0.22649157  0.06931831 -1.47686510 -0.25884352  0.10312924
 [73]  1.03200398  0.58281346 -0.82790878  2.04738039 -0.29616655  1.03051222
 [79] -0.36788184 -0.15824586 -0.30137439 -1.38653219  0.91327313 -0.42924111
 [85] -0.78935742 -1.15577745 -1.21344496 -0.38369175 -0.22841734 -0.39481263
 [91]  0.25865454  1.84216143  0.03524046  0.06497248  0.92193201 -0.96462176
 [97] -1.47746031 -1.18691873  0.41115290  2.09739023
> rowSums(tmp2)
  [1] -1.83780304  0.87135109  1.12605184  0.18486031  0.08111970  0.64590239
  [7] -0.46932032 -0.14553926 -1.14954586  1.55822070  1.22970712  1.29964459
 [13] -1.06184018  1.70259031  0.21748151  0.21348258 -1.25816548 -0.01149147
 [19] -0.01387469 -0.09404580  1.21434200  1.08894762  1.18519246  0.95270131
 [25]  2.08301383  1.80005912  0.11797296 -0.17231903  0.58953601  0.31178878
 [31]  0.51100295  0.30078680  1.15001390 -1.35287651  1.37619233 -1.98736829
 [37]  0.17771518  1.59020749  1.52091560 -0.01098138  0.44202096  0.62653594
 [43] -0.89655940  1.96541400 -0.28003498  1.95802142 -1.70393816  0.69715727
 [49] -2.77132858  0.61891100 -1.57828387 -0.74778741  1.41859584  0.59830223
 [55] -0.74062251  0.75723976  2.23836760  0.65344455  0.97326812  0.48669331
 [61]  0.66633284  0.78422760 -0.49818836  0.91889291 -0.46109724  0.54924763
 [67] -0.88321510 -0.22649157  0.06931831 -1.47686510 -0.25884352  0.10312924
 [73]  1.03200398  0.58281346 -0.82790878  2.04738039 -0.29616655  1.03051222
 [79] -0.36788184 -0.15824586 -0.30137439 -1.38653219  0.91327313 -0.42924111
 [85] -0.78935742 -1.15577745 -1.21344496 -0.38369175 -0.22841734 -0.39481263
 [91]  0.25865454  1.84216143  0.03524046  0.06497248  0.92193201 -0.96462176
 [97] -1.47746031 -1.18691873  0.41115290  2.09739023
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -1.83780304  0.87135109  1.12605184  0.18486031  0.08111970  0.64590239
  [7] -0.46932032 -0.14553926 -1.14954586  1.55822070  1.22970712  1.29964459
 [13] -1.06184018  1.70259031  0.21748151  0.21348258 -1.25816548 -0.01149147
 [19] -0.01387469 -0.09404580  1.21434200  1.08894762  1.18519246  0.95270131
 [25]  2.08301383  1.80005912  0.11797296 -0.17231903  0.58953601  0.31178878
 [31]  0.51100295  0.30078680  1.15001390 -1.35287651  1.37619233 -1.98736829
 [37]  0.17771518  1.59020749  1.52091560 -0.01098138  0.44202096  0.62653594
 [43] -0.89655940  1.96541400 -0.28003498  1.95802142 -1.70393816  0.69715727
 [49] -2.77132858  0.61891100 -1.57828387 -0.74778741  1.41859584  0.59830223
 [55] -0.74062251  0.75723976  2.23836760  0.65344455  0.97326812  0.48669331
 [61]  0.66633284  0.78422760 -0.49818836  0.91889291 -0.46109724  0.54924763
 [67] -0.88321510 -0.22649157  0.06931831 -1.47686510 -0.25884352  0.10312924
 [73]  1.03200398  0.58281346 -0.82790878  2.04738039 -0.29616655  1.03051222
 [79] -0.36788184 -0.15824586 -0.30137439 -1.38653219  0.91327313 -0.42924111
 [85] -0.78935742 -1.15577745 -1.21344496 -0.38369175 -0.22841734 -0.39481263
 [91]  0.25865454  1.84216143  0.03524046  0.06497248  0.92193201 -0.96462176
 [97] -1.47746031 -1.18691873  0.41115290  2.09739023
> rowMin(tmp2)
  [1] -1.83780304  0.87135109  1.12605184  0.18486031  0.08111970  0.64590239
  [7] -0.46932032 -0.14553926 -1.14954586  1.55822070  1.22970712  1.29964459
 [13] -1.06184018  1.70259031  0.21748151  0.21348258 -1.25816548 -0.01149147
 [19] -0.01387469 -0.09404580  1.21434200  1.08894762  1.18519246  0.95270131
 [25]  2.08301383  1.80005912  0.11797296 -0.17231903  0.58953601  0.31178878
 [31]  0.51100295  0.30078680  1.15001390 -1.35287651  1.37619233 -1.98736829
 [37]  0.17771518  1.59020749  1.52091560 -0.01098138  0.44202096  0.62653594
 [43] -0.89655940  1.96541400 -0.28003498  1.95802142 -1.70393816  0.69715727
 [49] -2.77132858  0.61891100 -1.57828387 -0.74778741  1.41859584  0.59830223
 [55] -0.74062251  0.75723976  2.23836760  0.65344455  0.97326812  0.48669331
 [61]  0.66633284  0.78422760 -0.49818836  0.91889291 -0.46109724  0.54924763
 [67] -0.88321510 -0.22649157  0.06931831 -1.47686510 -0.25884352  0.10312924
 [73]  1.03200398  0.58281346 -0.82790878  2.04738039 -0.29616655  1.03051222
 [79] -0.36788184 -0.15824586 -0.30137439 -1.38653219  0.91327313 -0.42924111
 [85] -0.78935742 -1.15577745 -1.21344496 -0.38369175 -0.22841734 -0.39481263
 [91]  0.25865454  1.84216143  0.03524046  0.06497248  0.92193201 -0.96462176
 [97] -1.47746031 -1.18691873  0.41115290  2.09739023
> 
> colMeans(tmp2)
[1] 0.1921313
> colSums(tmp2)
[1] 19.21313
> colVars(tmp2)
[1] 1.108054
> colSd(tmp2)
[1] 1.052641
> colMax(tmp2)
[1] 2.238368
> colMin(tmp2)
[1] -2.771329
> colMedians(tmp2)
[1] 0.1991714
> colRanges(tmp2)
          [,1]
[1,] -2.771329
[2,]  2.238368
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.38715992 -0.15686874 -0.03982981  2.35838755 -0.80636269 -0.46636022
 [7]  1.99053011 -2.35360911 -0.16903855  1.13005656
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.84509902
[2,] -0.26525116
[3,] -0.08595524
[4,]  0.40098901
[5,]  0.75224954
> 
> rowApply(tmp,sum)
 [1]  0.9794139  6.3192536  1.8718650  0.7261508 -1.1004006 -6.2092667
 [7] -0.6007421  2.6796807 -2.9304837 -0.6357256
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    6    1    6    6    9    4    4    2    6     6
 [2,]    2    4    8    7   10    8    2    3    8     1
 [3,]    7    5    4   10    6    1    8    7    1     7
 [4,]    9    6    9    9    1    3    6    6    3     8
 [5,]   10    3    2    2    2   10    1    1    7    10
 [6,]    4    2    3    5    7    2    5    9    9     5
 [7,]    8    7    1    4    8    7   10   10    5     4
 [8,]    5   10    5    1    5    5    9    5    2     2
 [9,]    3    8    7    3    4    9    3    4    4     9
[10,]    1    9   10    8    3    6    7    8   10     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.0599025 -0.5416105  2.9551738 -3.5098536  1.1576871  6.1698807
 [7] -5.3284697 -2.2323767 -0.2459294 -0.8906864 -2.8445465  3.3137894
[13]  0.2820881  1.0676738  2.7433079  1.0245447 -3.2596833  0.3067358
[19]  2.6346119  2.2339195
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.43519642
[2,] -0.25132468
[3,]  0.09990544
[4,]  0.78473361
[5,]  0.86178457
> 
> rowApply(tmp,sum)
[1] -3.748920  1.063018  6.345379  1.305600  1.131081
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   16   13   15    8    8
[2,]   14   15   10    3    9
[3,]   20    3   20    7    6
[4,]    2   10    4    5    5
[5,]   19   19    6    6    4
> 
> 
> as.matrix(tmp)
            [,1]         [,2]       [,3]        [,4]       [,5]       [,6]
[1,]  0.78473361  0.324354185  2.8194592 -1.68686711  1.0899837  1.0672177
[2,]  0.09990544  0.579034872 -0.9128609 -0.04903025  1.6767788 -0.2691046
[3,]  0.86178457 -0.002613424  2.1359528 -0.21936568 -0.1254804  0.9970275
[4,] -0.43519642 -1.224593577 -0.5200464 -0.96061607 -0.8149375  1.4575969
[5,] -0.25132468 -0.217792590 -0.5673309 -0.59397452 -0.6686574  2.9171432
           [,7]       [,8]       [,9]      [,10]       [,11]       [,12]
[1,] -1.5542220 -0.4021798 -2.3912235  0.4007357 -1.12260000 -0.78159677
[2,] -1.2816292 -0.7910121 -0.7682709 -0.6541254 -0.95886291  1.74957718
[3,] -0.9968676  0.6790730 -0.9337852 -0.5871441 -0.05318371  1.46698897
[4,] -1.3230813 -1.0315913  1.7939137  0.7139932  0.99258874  0.86131224
[5,] -0.1726695 -0.6866664  2.0534365 -0.7641459 -1.70248865  0.01750778
           [,13]      [,14]      [,15]       [,16]      [,17]       [,18]
[1,] -1.21279316 -0.6811273 0.24008875 -0.39628285 -0.6262557 -0.68420803
[2,]  1.33555138  0.8207734 0.05809189 -0.21186169 -0.8924595  1.30078120
[3,]  0.40759866 -0.1248628 0.99344122  0.74190105 -0.1109404 -0.12782865
[4,]  0.05710059  0.8779826 0.84087386 -0.04380934 -1.7454290 -0.01761223
[5,] -0.30536935  0.1749079 0.61081215  0.93459749  0.1154013 -0.16439653
          [,19]      [,20]
[1,] 1.02411090 0.03975273
[2,] 0.05886573 0.17287577
[3,] 0.35009725 0.99358661
[4,] 1.16823754 0.65891368
[5,] 0.03330052 0.36879067
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1      col2       col3      col4       col5     col6     col7
row1 0.1538546 0.6637241 0.04989766 0.6080832 -0.8384087 1.097001 1.071549
           col8     col9      col10      col11     col12      col13      col14
row1 -0.9800426 1.973422 -0.2080905 -0.1276292 -2.069097 -0.3804635 0.04919374
          col15      col16    col17    col18      col19     col20
row1 -0.5582073 -0.8922653 0.756644 0.325366 -0.7005341 -0.526146
> tmp[,"col10"]
          col10
row1 -0.2080905
row2  1.9583440
row3 -2.1249841
row4 -0.9152880
row5  0.1307031
> tmp[c("row1","row5"),]
           col1        col2        col3      col4        col5      col6
row1  0.1538546  0.66372414  0.04989766 0.6080832 -0.83840874  1.097001
row5 -0.2847185 -0.02814066 -0.30462469 0.4217574  0.09886416 -1.083263
          col7       col8       col9      col10      col11       col12
row1  1.071549 -0.9800426  1.9734216 -0.2080905 -0.1276292 -2.06909692
row5 -0.529065 -0.5716625 -0.7897243  0.1307031 -1.2807878 -0.01920682
          col13       col14      col15      col16      col17      col18
row1 -0.3804635  0.04919374 -0.5582073 -0.8922653 0.75664404  0.3253660
row5  0.5775191 -0.15450391 -0.2193094  0.1230437 0.04916828 -0.8224359
          col19      col20
row1 -0.7005341 -0.5261460
row5  1.5211966  0.9755898
> tmp[,c("col6","col20")]
           col6      col20
row1  1.0970012 -0.5261460
row2  0.6595849 -0.8803137
row3  0.9742947 -1.5013008
row4  1.1910951  1.4373841
row5 -1.0832625  0.9755898
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1  1.097001 -0.5261460
row5 -1.083263  0.9755898
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4   col5     col6     col7     col8
row1 51.30839 48.46605 51.17083 49.83552 50.551 105.2205 50.85138 50.68565
         col9    col10    col11    col12    col13   col14    col15    col16
row1 49.64259 50.56219 50.59773 48.35105 51.03756 48.9293 51.38324 50.56353
        col17    col18    col19    col20
row1 51.04344 49.54652 50.44325 105.3138
> tmp[,"col10"]
        col10
row1 50.56219
row2 31.48248
row3 30.03153
row4 31.27300
row5 49.19870
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.30839 48.46605 51.17083 49.83552 50.55100 105.2205 50.85138 50.68565
row5 51.86496 50.75247 50.22010 51.36993 50.60642 105.0162 50.66497 50.96288
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.64259 50.56219 50.59773 48.35105 51.03756 48.92930 51.38324 50.56353
row5 51.22197 49.19870 51.60475 49.40038 50.70188 49.10874 49.69175 50.70732
        col17    col18    col19    col20
row1 51.04344 49.54652 50.44325 105.3138
row5 51.30844 49.16897 48.93893 104.5354
> tmp[,c("col6","col20")]
          col6     col20
row1 105.22048 105.31376
row2  75.40804  74.07699
row3  74.68847  75.13714
row4  74.44865  75.13500
row5 105.01619 104.53541
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.2205 105.3138
row5 105.0162 104.5354
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.2205 105.3138
row5 105.0162 104.5354
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  1.9240411
[2,] -1.0509652
[3,]  1.3896430
[4,]  1.1003549
[5,]  0.2638223
> tmp[,c("col17","col7")]
          col17       col7
[1,]  1.1205105 -0.8402770
[2,] -0.6702770  0.9387972
[3,] -0.8070007 -1.8015912
[4,] -0.5619066 -0.4357997
[5,]  0.2560137  2.0144120
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.7331367  0.1240415
[2,] -0.5213857  0.3070194
[3,]  0.6345120  1.3308567
[4,] -1.1025941  0.5861380
[5,] -0.4450331 -0.6326132
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.7331367
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.7331367
[2,] -0.5213857
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]      [,2]       [,3]       [,4]      [,5]       [,6]        [,7]
row3 0.3344128 0.7642340  0.9270942  0.2900849 0.4364125 -0.1572117 -0.02424175
row1 0.8785511 0.5038041 -0.4636167 -0.2502032 0.4248308 -0.5920821  0.55129937
          [,8]       [,9]      [,10]       [,11]      [,12]     [,13]
row3 0.1844822 -0.9807811 -0.2968712 -0.04303987 -1.5549157 -0.689219
row1 0.3166577  2.2494378 -0.5523391  1.13903944  0.4714729  1.101346
          [,14]      [,15]     [,16]     [,17]      [,18]      [,19]      [,20]
row3 -1.1534114  0.7107453 -3.120343 0.5914327 -1.1766392  0.8453900 -0.6782336
row1 -0.2292919 -1.0056848 -0.124943 1.4284574  0.1499747 -0.4037506  0.2554339
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]       [,3]      [,4]      [,5]      [,6]      [,7]
row2 0.1613204 -1.022116 -0.6286366 0.1200308 0.4499774 -1.788752 -1.239425
           [,8]       [,9]      [,10]
row2 -0.2738917 0.06195044 -0.8251617
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]      [,2]       [,3]      [,4]     [,5]      [,6]      [,7]
row5 0.00500288 -2.364159 -0.1644791 0.6246597 1.116751 0.8896319 0.4802917
           [,8]      [,9]    [,10]      [,11]      [,12]     [,13]      [,14]
row5 -0.1497351 0.3558847 1.165988 -0.4147861 -0.6355502 0.5417907 -0.6722696
         [,15]      [,16]      [,17]     [,18]     [,19]      [,20]
row5 -0.838789 -0.2411983 0.07463863 0.3103274 0.7580904 -0.3054571
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> colnames(tmp) <- NULL
> rownames(tmp) <- NULL
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> dimnames(tmp)
[[1]]
[1] "row1" "row2" "row3" "row4" "row5"

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> dimnames(tmp) <- NULL
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> dimnames(tmp)
[[1]]
NULL

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> 
> dimnames(tmp) <- NULL
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> dimnames(tmp)
[[1]]
[1] "row1" "row2" "row3" "row4" "row5"

[[2]]
NULL

> 
> dimnames(tmp) <- list(NULL,c(colnames(tmp,do.NULL=FALSE)))
> dimnames(tmp)
[[1]]
NULL

[[2]]
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"

> 
> 
> 
> ###
> ### Testing logical indexing
> ###
> ###
> 
> tmp <- createBufferedMatrix(230,15)
> tmp[1:230,1:15] <- rnorm(230*15)
> x <-tmp[1:230,1:15]  
> 
> for (rep in 1:10){
+   which.cols <- sample(c(TRUE,FALSE),15,replace=T)
+   which.rows <- sample(c(TRUE,FALSE),230,replace=T)
+   
+   if (!all(tmp[which.rows,which.cols] == x[which.rows,which.cols])){
+     stop("No agreement when logical indexing\n")
+   }
+   
+   if (!all(subBufferedMatrix(tmp,,which.cols)[,1:sum(which.cols)] ==  x[,which.cols])){
+     stop("No agreement when logical indexing in subBufferedMatrix cols\n")
+   }
+   if (!all(subBufferedMatrix(tmp,which.rows,)[1:sum(which.rows),] ==  x[which.rows,])){
+     stop("No agreement when logical indexing in subBufferedMatrix rows\n")
+   }
+   
+   
+   if (!all(subBufferedMatrix(tmp,which.rows,which.cols)[1:sum(which.rows),1:sum(which.cols)]==  x[which.rows,which.cols])){
+     stop("No agreement when logical indexing in subBufferedMatrix rows and columns\n")
+   }
+ }
> 
> 
> ##
> ## Test the ReadOnlyMode
> ##
> 
> ReadOnlyMode(tmp)
<pointer: 0xeef69e0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d153e90233"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d165d9c3a6"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d11ec3e0"  
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d17e0dfba5"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d17d574ca2"
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d193a2f63" 
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d161115992"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d14480d57d"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d14a5950fa"
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d1554df371"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d12ea11b70"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d14aa979ae"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d11e4d2e0" 
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d13c59fe88"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2232d1548b3462"
> 
> 
> ### testing coercion functions
> ###
> 
> tmp <- as(tmp,"matrix")
> tmp <- as(tmp,"BufferedMatrix")
> 
> 
> 
> ### testing whether can move storage from one location to another
> 
> MoveStorageDirectory(tmp,"NewDirectory",full.path=FALSE)
<pointer: 0xe95aa90>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xe95aa90>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xe95aa90>
> rowMedians(tmp)
  [1]  0.166252610 -0.385228586  0.184926290  0.217262197  0.051406655
  [6]  0.365469760 -0.104646224  0.114672190 -0.356015710 -0.047164766
 [11] -0.245243395 -0.191922128  0.557463276  0.276971901  0.166688651
 [16]  0.121015095  0.584252130 -0.217452827 -0.279348357 -0.010673369
 [21] -0.192052643  0.838198808  0.180816346  0.070551728  0.473486786
 [26]  0.285695341 -0.251211328 -0.344472946 -0.439306581 -0.300369883
 [31]  0.479876872 -0.123133376 -0.315058031  0.617558352 -0.390288423
 [36] -0.413617095  0.135372940 -0.359235891  0.226487480 -0.162527089
 [41]  0.454690488  0.441487371  0.082175259  0.030790974 -0.011110426
 [46] -0.041195747  0.358383004 -0.089410288 -0.156385653  0.259305485
 [51] -0.182104969  0.123921947  0.201731143  0.173741689  0.421797799
 [56] -0.386614472 -0.110868350 -0.015240143  0.226569777  0.043587219
 [61] -0.321035915  0.242398353 -0.060650522  0.517303745  0.356550652
 [66] -0.242017261 -0.172401706 -0.017649298 -0.009564372 -0.126165005
 [71] -0.472414296  0.158037368  0.162824000 -0.324846941 -0.051785310
 [76] -0.288886191  0.144776310 -0.246368442 -0.512162297 -0.015272208
 [81]  0.107399564  0.003365034 -0.115954976  0.320943370  0.217463728
 [86] -0.051838610 -0.034739400  0.142504391 -0.072888468 -0.211991607
 [91] -0.178862610  0.260274986 -0.043874482 -0.425040373  0.242043773
 [96] -0.090187342  0.129335077 -0.446184533 -0.080701189  0.650274615
[101] -0.389446803  0.431922992 -0.396907985  0.254167507  0.432636687
[106] -0.027532066  0.211059977  0.443758181 -0.475517610  0.016641124
[111] -0.323158621  0.206686746  0.560254850  0.195429482 -0.079306276
[116]  0.051481910  0.229643517 -0.520510035  0.121997384 -0.177783099
[121]  0.508536568 -0.378367719 -0.389117042 -0.078929943  0.759255027
[126] -0.208422610  0.413904901  0.003388959  0.796893868 -0.588916869
[131]  0.027575713  0.466182691 -0.513492819 -0.736012948  0.071871900
[136] -0.285277570 -0.240143691 -0.099409797  0.316586300  0.064109144
[141] -0.062733580 -0.319265286  0.355452434 -0.370883056  0.506873371
[146] -0.425952103  0.345383865  0.412935430  0.341076561 -0.124564726
[151]  0.126932811  0.236168324 -0.263265980 -0.598825932  0.057640131
[156]  0.241437432 -0.099650659  0.036934760 -0.035043383  0.098705121
[161]  0.696760754  0.050599707 -0.143796734  0.100609556 -0.340236921
[166] -0.035994421 -0.120046926 -0.452874452 -0.059038817  0.490319381
[171]  0.063139963 -0.042037964  0.681568680  0.389627065 -0.188715253
[176] -0.631601224 -0.399526657  0.132611298  0.031965905  0.147652661
[181]  0.386481451 -0.033937348 -0.836236052 -0.422979311  0.015022547
[186] -0.110964927 -0.018735765  0.624565724 -0.298750751  0.058642347
[191]  0.420375709 -0.273462326  0.525356045  0.420690214  0.315775001
[196] -0.332892504 -0.653878223  0.243781314 -0.245060418  0.298880501
[201] -0.297750371 -0.490720186  0.668095892  0.408515414  0.574506509
[206] -0.251268600 -0.170270267  0.343630227 -0.055693724 -0.130459351
[211]  0.323468883  0.108768481 -0.382356941 -0.100012897  0.055806663
[216] -0.177351541  0.238139072 -0.124409557  0.266085580 -0.077760279
[221]  0.452102033 -0.662325626  0.420464959  0.213371452 -0.036339062
[226]  0.291975660 -0.390352483  0.253247206 -0.768866431 -0.249058006
> 
> proc.time()
   user  system elapsed 
  1.977   0.839   2.841 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> prefix <- "dbmtest"
> directory <- getwd()
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x3ffa0ff0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x3ffa0ff0>
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 10
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x3ffa0ff0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 10
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 0.000000 0.000000 0.000000 0.000000 

<pointer: 0x3ffa0ff0>
> rm(P)
> 
> #P <- .Call("R_bm_Destroy",P)
> #.Call("R_bm_Destroy",P)
> #.Call("R_bm_Test_C",P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,5)
[1] TRUE
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 0
Buffer Rows: 1
Buffer Cols: 1

Printing Values






<pointer: 0x3fe860e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3fe860e0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 1
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 
0.000000 
0.000000 
0.000000 
0.000000 

<pointer: 0x3fe860e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3fe860e0>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x3fe860e0>
> rm(P)
> 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,5)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x3ee0d520>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3ee0d520>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x3ee0d520>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x3ee0d520>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x3ee0d520>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x3ee0d520>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x3ee0d520>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x3ee0d520>
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 2
Buffer Rows: 5
Buffer Cols: 5

Printing Values
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 
0.000000 0.000000 

<pointer: 0x3ee0d520>
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x3e811720>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x3e811720>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3e811720>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3e811720>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile22332538dad415" "BufferedMatrixFile223325c963028" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile22332538dad415" "BufferedMatrixFile223325c963028" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x3f7017d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3f7017d0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x3f7017d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x3f7017d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x3f7017d0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x3f7017d0>
> .Call("R_bm_isRowMode",P)
[1] FALSE
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x3f808c90>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3f808c90>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x3f808c90>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x3f808c90>
> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x40ab1110>
> .Call("R_bm_getValue",P,3,3)
[1] 6
> 
> .Call("R_bm_getValue",P,100000,10000)
[1] NA
> .Call("R_bm_setValue",P,3,3,12345.0)
[1] TRUE
> .Call("R_bm_Test_C2",P)
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Printing Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 12345.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x40ab1110>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.336   0.038   0.359 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu

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(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.312   0.055   0.352 

Example timings