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

This page was generated on 2026-03-07 11:57 -0500 (Sat, 07 Mar 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4892
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-03-06 13:45 -0500 (Fri, 06 Mar 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
See other builds for BufferedMatrix in R Universe.


CHECK results for BufferedMatrix on nebbiolo2

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.

raw results


Summary

Package: BufferedMatrix
Version: 1.74.0
Command: /home/biocbuild/bbs-3.22-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.22-bioc/R/site-library --timings BufferedMatrix_1.74.0.tar.gz
StartedAt: 2026-03-06 21:55:32 -0500 (Fri, 06 Mar 2026)
EndedAt: 2026-03-06 21:55:55 -0500 (Fri, 06 Mar 2026)
EllapsedTime: 23.2 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.5.2 (2025-10-31)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
    gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
    GNU Fortran (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
* running under: Ubuntu 24.04.3 LTS
* using session charset: UTF-8
* 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: ‘gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.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 re-building of vignette outputs ... OK
* 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/bbs-3.22-bioc/R/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/home/biocbuild/bbs-3.22-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.74.0’
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0’
gcc -std=gnu2x -I"/home/biocbuild/bbs-3.22-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -Werror=format-security -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -std=gnu2x -I"/home/biocbuild/bbs-3.22-bioc/R/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){
      |            ^~~~~~~~~~~
gcc -std=gnu2x -I"/home/biocbuild/bbs-3.22-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -Werror=format-security -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -std=gnu2x -I"/home/biocbuild/bbs-3.22-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -Werror=format-security -c init_package.c -o init_package.o
gcc -std=gnu2x -shared -L/home/biocbuild/bbs-3.22-bioc/R/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/bbs-3.22-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.22-bioc/R/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.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-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.289   0.044   0.322 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-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 478284 25.6    1046725   56   639600 34.2
Vcells 884773  6.8    8388608   64  2081613 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] "Fri Mar  6 21:55:46 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] "Fri Mar  6 21:55:46 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: 0x64025fd6c370>
> 
> 
> 
> 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] "Fri Mar  6 21:55:47 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] "Fri Mar  6 21:55:47 2026"
> 
> ColMode(tmp2)
<pointer: 0x64025fd6c370>
> 
> 
> 
> ### 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,] 101.1005502  0.81689606 -0.31615977  0.9477056
[2,]  -0.3910712  1.40308318 -0.75203686 -0.9805217
[3,]   0.4327614 -0.01799499 -0.06246976 -0.6030938
[4,]  -0.0433761  1.44459048 -1.36442224 -0.9118296
> 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,] 101.1005502 0.81689606 0.31615977 0.9477056
[2,]   0.3910712 1.40308318 0.75203686 0.9805217
[3,]   0.4327614 0.01799499 0.06246976 0.6030938
[4,]   0.0433761 1.44459048 1.36442224 0.9118296
> 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.0548769 0.9038230 0.5622809 0.9735017
[2,]  0.6253569 1.1845181 0.8672006 0.9902129
[3,]  0.6578460 0.1341454 0.2499395 0.7765911
[4,]  0.2082693 1.2019112 1.1680849 0.9548977
> 
> 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,] 226.64932 34.85513 30.93897 35.68272
[2,]  31.64464 38.24826 34.42404 35.88265
[3,]  32.01122 26.35945 27.56186 33.36900
[4,]  27.12607 38.46370 38.04527 35.46081
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x640260d689b0>
> exp(tmp5)
<pointer: 0x640260d689b0>
> log(tmp5,2)
<pointer: 0x640260d689b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.7409
> Min(tmp5)
[1] 54.54831
> mean(tmp5)
[1] 72.54959
> Sum(tmp5)
[1] 14509.92
> Var(tmp5)
[1] 883.6873
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.13814 69.74225 68.25353 73.15555 69.43249 74.20836 67.22987 71.31537
 [9] 69.03496 70.98536
> rowSums(tmp5)
 [1] 1842.763 1394.845 1365.071 1463.111 1388.650 1484.167 1344.597 1426.307
 [9] 1380.699 1419.707
> rowVars(tmp5)
 [1] 8031.11087  106.65024   68.19730   81.19765   80.87063   97.31811
 [7]   42.26722   59.03621  101.42110   95.28134
> rowSd(tmp5)
 [1] 89.616465 10.327160  8.258166  9.010974  8.992810  9.864994  6.501324
 [8]  7.683503 10.070805  9.761216
> rowMax(tmp5)
 [1] 471.74086  91.84656  86.06215  86.62495  84.60339  95.39702  81.97893
 [8]  87.88222  96.58558  95.90029
> rowMin(tmp5)
 [1] 55.00744 56.76804 54.86374 56.45936 54.54831 58.13032 56.93759 59.61017
 [9] 55.05809 56.67624
> 
> colMeans(tmp5)
 [1] 107.40798  73.40866  66.21046  72.23869  70.40319  69.10179  75.00079
 [8]  69.15162  70.19777  69.35102  71.21000  69.96509  69.84593  69.58064
[15]  67.61033  71.05893  74.99414  75.76046  67.42292  71.07135
> colSums(tmp5)
 [1] 1074.0798  734.0866  662.1046  722.3869  704.0319  691.0179  750.0079
 [8]  691.5162  701.9777  693.5102  712.1000  699.6509  698.4593  695.8064
[15]  676.1033  710.5893  749.9414  757.6046  674.2292  710.7135
> colVars(tmp5)
 [1] 16447.51436    92.72091    51.40330    38.01716    85.50297    87.29132
 [7]    21.62426    89.63291    84.17874    58.68970    66.66799   117.13459
[13]   102.73396    68.23101    89.83767   150.73808   127.01484    93.64156
[19]    47.27792    61.78025
> colSd(tmp5)
 [1] 128.247863   9.629169   7.169609   6.165806   9.246781   9.342982
 [7]   4.650189   9.467466   9.174898   7.660920   8.165047  10.822873
[13]  10.135776   8.260207   9.478274  12.277544  11.270086   9.676857
[19]   6.875894   7.860041
> colMax(tmp5)
 [1] 471.74086  84.46119  79.18625  84.60339  82.72018  91.84656  80.95485
 [8]  81.97893  84.63612  82.19071  85.45727  95.90029  86.46975  79.78396
[15]  86.06215  94.52272  96.58558  95.39702  76.83493  83.17498
> colMin(tmp5)
 [1] 56.45936 54.86374 56.67624 65.10837 57.02440 61.14367 64.53479 56.79470
 [9] 56.93759 56.76804 59.91781 58.29397 58.13032 55.05809 54.54831 55.00744
[17] 61.58584 63.51348 55.22908 59.40598
> 
> 
> ### 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] 92.13814 69.74225       NA 73.15555 69.43249 74.20836 67.22987 71.31537
 [9] 69.03496 70.98536
> rowSums(tmp5)
 [1] 1842.763 1394.845       NA 1463.111 1388.650 1484.167 1344.597 1426.307
 [9] 1380.699 1419.707
> rowVars(tmp5)
 [1] 8031.11087  106.65024   71.14828   81.19765   80.87063   97.31811
 [7]   42.26722   59.03621  101.42110   95.28134
> rowSd(tmp5)
 [1] 89.616465 10.327160  8.434944  9.010974  8.992810  9.864994  6.501324
 [8]  7.683503 10.070805  9.761216
> rowMax(tmp5)
 [1] 471.74086  91.84656        NA  86.62495  84.60339  95.39702  81.97893
 [8]  87.88222  96.58558  95.90029
> rowMin(tmp5)
 [1] 55.00744 56.76804       NA 56.45936 54.54831 58.13032 56.93759 59.61017
 [9] 55.05809 56.67624
> 
> colMeans(tmp5)
 [1] 107.40798  73.40866  66.21046  72.23869  70.40319        NA  75.00079
 [8]  69.15162  70.19777  69.35102  71.21000  69.96509  69.84593  69.58064
[15]  67.61033  71.05893  74.99414  75.76046  67.42292  71.07135
> colSums(tmp5)
 [1] 1074.0798  734.0866  662.1046  722.3869  704.0319        NA  750.0079
 [8]  691.5162  701.9777  693.5102  712.1000  699.6509  698.4593  695.8064
[15]  676.1033  710.5893  749.9414  757.6046  674.2292  710.7135
> colVars(tmp5)
 [1] 16447.51436    92.72091    51.40330    38.01716    85.50297          NA
 [7]    21.62426    89.63291    84.17874    58.68970    66.66799   117.13459
[13]   102.73396    68.23101    89.83767   150.73808   127.01484    93.64156
[19]    47.27792    61.78025
> colSd(tmp5)
 [1] 128.247863   9.629169   7.169609   6.165806   9.246781         NA
 [7]   4.650189   9.467466   9.174898   7.660920   8.165047  10.822873
[13]  10.135776   8.260207   9.478274  12.277544  11.270086   9.676857
[19]   6.875894   7.860041
> colMax(tmp5)
 [1] 471.74086  84.46119  79.18625  84.60339  82.72018        NA  80.95485
 [8]  81.97893  84.63612  82.19071  85.45727  95.90029  86.46975  79.78396
[15]  86.06215  94.52272  96.58558  95.39702  76.83493  83.17498
> colMin(tmp5)
 [1] 56.45936 54.86374 56.67624 65.10837 57.02440       NA 64.53479 56.79470
 [9] 56.93759 56.76804 59.91781 58.29397 58.13032 55.05809 54.54831 55.00744
[17] 61.58584 63.51348 55.22908 59.40598
> 
> Max(tmp5,na.rm=TRUE)
[1] 471.7409
> Min(tmp5,na.rm=TRUE)
[1] 54.54831
> mean(tmp5,na.rm=TRUE)
[1] 72.5902
> Sum(tmp5,na.rm=TRUE)
[1] 14445.45
> Var(tmp5,na.rm=TRUE)
[1] 887.8189
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.13814 69.74225 68.45273 73.15555 69.43249 74.20836 67.22987 71.31537
 [9] 69.03496 70.98536
> rowSums(tmp5,na.rm=TRUE)
 [1] 1842.763 1394.845 1300.602 1463.111 1388.650 1484.167 1344.597 1426.307
 [9] 1380.699 1419.707
> rowVars(tmp5,na.rm=TRUE)
 [1] 8031.11087  106.65024   71.14828   81.19765   80.87063   97.31811
 [7]   42.26722   59.03621  101.42110   95.28134
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.616465 10.327160  8.434944  9.010974  8.992810  9.864994  6.501324
 [8]  7.683503 10.070805  9.761216
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.74086  91.84656  86.06215  86.62495  84.60339  95.39702  81.97893
 [8]  87.88222  96.58558  95.90029
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.00744 56.76804 54.86374 56.45936 54.54831 58.13032 56.93759 59.61017
 [9] 55.05809 56.67624
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 107.40798  73.40866  66.21046  72.23869  70.40319  69.61659  75.00079
 [8]  69.15162  70.19777  69.35102  71.21000  69.96509  69.84593  69.58064
[15]  67.61033  71.05893  74.99414  75.76046  67.42292  71.07135
> colSums(tmp5,na.rm=TRUE)
 [1] 1074.0798  734.0866  662.1046  722.3869  704.0319  626.5493  750.0079
 [8]  691.5162  701.9777  693.5102  712.1000  699.6509  698.4593  695.8064
[15]  676.1033  710.5893  749.9414  757.6046  674.2292  710.7135
> colVars(tmp5,na.rm=TRUE)
 [1] 16447.51436    92.72091    51.40330    38.01716    85.50297    95.22127
 [7]    21.62426    89.63291    84.17874    58.68970    66.66799   117.13459
[13]   102.73396    68.23101    89.83767   150.73808   127.01484    93.64156
[19]    47.27792    61.78025
> colSd(tmp5,na.rm=TRUE)
 [1] 128.247863   9.629169   7.169609   6.165806   9.246781   9.758138
 [7]   4.650189   9.467466   9.174898   7.660920   8.165047  10.822873
[13]  10.135776   8.260207   9.478274  12.277544  11.270086   9.676857
[19]   6.875894   7.860041
> colMax(tmp5,na.rm=TRUE)
 [1] 471.74086  84.46119  79.18625  84.60339  82.72018  91.84656  80.95485
 [8]  81.97893  84.63612  82.19071  85.45727  95.90029  86.46975  79.78396
[15]  86.06215  94.52272  96.58558  95.39702  76.83493  83.17498
> colMin(tmp5,na.rm=TRUE)
 [1] 56.45936 54.86374 56.67624 65.10837 57.02440 61.14367 64.53479 56.79470
 [9] 56.93759 56.76804 59.91781 58.29397 58.13032 55.05809 54.54831 55.00744
[17] 61.58584 63.51348 55.22908 59.40598
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.13814 69.74225      NaN 73.15555 69.43249 74.20836 67.22987 71.31537
 [9] 69.03496 70.98536
> rowSums(tmp5,na.rm=TRUE)
 [1] 1842.763 1394.845    0.000 1463.111 1388.650 1484.167 1344.597 1426.307
 [9] 1380.699 1419.707
> rowVars(tmp5,na.rm=TRUE)
 [1] 8031.11087  106.65024         NA   81.19765   80.87063   97.31811
 [7]   42.26722   59.03621  101.42110   95.28134
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.616465 10.327160        NA  9.010974  8.992810  9.864994  6.501324
 [8]  7.683503 10.070805  9.761216
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.74086  91.84656        NA  86.62495  84.60339  95.39702  81.97893
 [8]  87.88222  96.58558  95.90029
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.00744 56.76804       NA 56.45936 54.54831 58.13032 56.93759 59.61017
 [9] 55.05809 56.67624
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.93918  75.46920  67.19313  72.54819  71.88972       NaN  76.16368
 [8]  69.22990  68.59351  68.92529  70.69239  70.71644  70.26496  69.23916
[15]  65.56013  71.86091  74.85287  77.12123  66.99104  71.67103
> colSums(tmp5,na.rm=TRUE)
 [1] 1007.4527  679.2228  604.7382  652.9337  647.0075    0.0000  685.4731
 [8]  623.0691  617.3416  620.3277  636.2315  636.4480  632.3847  623.1524
[15]  590.0412  646.7482  673.6758  694.0911  602.9194  645.0392
> colVars(tmp5,na.rm=TRUE)
 [1] 18272.470986    56.545197    46.965204    41.691682    71.330851
 [6]           NA     9.113792   100.768106    65.747468    63.986941
[11]    71.987458   125.425445   113.600293    75.448039    53.779923
[16]   162.344677   142.667165    84.515012    51.089309    65.457199
> colSd(tmp5,na.rm=TRUE)
 [1] 135.175704   7.519654   6.853116   6.456910   8.445759         NA
 [7]   3.018906  10.038332   8.108481   7.999184   8.484542  11.199350
[13]  10.658344   8.686083   7.333480  12.741455  11.944336   9.193205
[19]   7.147679   8.090562
> colMax(tmp5,na.rm=TRUE)
 [1] 471.74086  84.46119  79.18625  84.60339  82.72018      -Inf  80.95485
 [8]  81.97893  78.60229  82.19071  85.45727  95.90029  86.46975  79.78396
[15]  76.95059  94.52272  96.58558  95.39702  76.83493  83.17498
> colMin(tmp5,na.rm=TRUE)
 [1] 56.45936 60.86009 56.67624 65.10837 59.30688      Inf 70.94380 56.79470
 [9] 56.93759 56.76804 59.91781 58.29397 58.13032 55.05809 54.54831 55.00744
[17] 61.58584 67.95183 55.22908 59.40598
> 
> 
> 
> 
> 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] 180.7039 235.7028 151.9621 196.2845 224.8231 169.0797 293.5258 302.1475
 [9] 256.5967 221.9728
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 180.7039 235.7028 151.9621 196.2845 224.8231 169.0797 293.5258 302.1475
 [9] 256.5967 221.9728
> 
> 
> 
> 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] -1.136868e-13  2.842171e-14 -5.115908e-13  1.136868e-13 -5.684342e-14
 [6] -1.705303e-13 -4.547474e-13 -5.684342e-14  0.000000e+00 -8.526513e-14
[11] -5.684342e-14  2.842171e-14  4.263256e-14  7.105427e-15 -5.684342e-14
[16] -2.842171e-14  5.684342e-14  2.842171e-14 -2.842171e-14 -9.947598e-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)
+ }
10   9 
5   8 
1   7 
10   9 
9   8 
3   15 
8   13 
10   20 
10   16 
1   15 
10   19 
9   7 
3   18 
7   8 
2   20 
2   6 
2   1 
9   2 
5   10 
4   2 
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.347689
> Min(tmp)
[1] -2.282142
> mean(tmp)
[1] -0.01644119
> Sum(tmp)
[1] -1.644119
> Var(tmp)
[1] 0.9627047
> 
> rowMeans(tmp)
[1] -0.01644119
> rowSums(tmp)
[1] -1.644119
> rowVars(tmp)
[1] 0.9627047
> rowSd(tmp)
[1] 0.9811751
> rowMax(tmp)
[1] 2.347689
> rowMin(tmp)
[1] -2.282142
> 
> colMeans(tmp)
  [1]  1.029100147  1.206004594  1.126915564  1.113811914 -0.723559714
  [6] -1.708866786 -1.314986765  0.143574620  0.982927738 -0.807858304
 [11] -0.878159090  0.682904832 -0.554650123  2.257289075 -0.245359837
 [16] -0.017595230  0.710087564  0.261570001 -0.216107687 -2.282142263
 [21] -0.374928266 -0.374015080  0.913788752 -0.089690595  0.237598990
 [26]  1.000138154 -0.671066694 -0.758531719  0.712343665 -1.673212652
 [31]  1.335289135 -0.356196354  0.230035346  1.274076553 -0.954363830
 [36] -0.940528852  0.389668378  0.096064372  0.217882218 -1.109067490
 [41] -1.489860285 -0.292876782  1.777552278 -1.371448858  1.790567421
 [46] -0.519900458  0.752889698 -0.766103016  0.838650283  0.424190362
 [51]  1.761418143 -0.695608532  2.347689266  1.038757440 -1.912649547
 [56] -0.322552583  0.540240225 -0.752279277 -0.129996656  0.593285652
 [61] -0.389980510 -0.380980089  1.751192461  2.044884565  0.779734694
 [66] -0.337104736 -0.360316853  0.008972667  0.485031987 -1.102277393
 [71] -0.416822477 -0.018733984  0.426315326 -1.064797223  0.276475739
 [76] -1.046786722 -1.134699787 -1.588253162 -0.766637325  0.400204450
 [81]  1.158310733 -0.545892247  0.012478310 -0.604559315  0.957864972
 [86] -0.533542139  0.496434021 -0.587651760 -1.736093822 -0.480348536
 [91]  0.531367748 -0.545244303 -0.123652444 -0.778895114 -1.171674140
 [96]  1.026973319 -0.272370516 -0.892762482  0.590966204  0.806601990
> colSums(tmp)
  [1]  1.029100147  1.206004594  1.126915564  1.113811914 -0.723559714
  [6] -1.708866786 -1.314986765  0.143574620  0.982927738 -0.807858304
 [11] -0.878159090  0.682904832 -0.554650123  2.257289075 -0.245359837
 [16] -0.017595230  0.710087564  0.261570001 -0.216107687 -2.282142263
 [21] -0.374928266 -0.374015080  0.913788752 -0.089690595  0.237598990
 [26]  1.000138154 -0.671066694 -0.758531719  0.712343665 -1.673212652
 [31]  1.335289135 -0.356196354  0.230035346  1.274076553 -0.954363830
 [36] -0.940528852  0.389668378  0.096064372  0.217882218 -1.109067490
 [41] -1.489860285 -0.292876782  1.777552278 -1.371448858  1.790567421
 [46] -0.519900458  0.752889698 -0.766103016  0.838650283  0.424190362
 [51]  1.761418143 -0.695608532  2.347689266  1.038757440 -1.912649547
 [56] -0.322552583  0.540240225 -0.752279277 -0.129996656  0.593285652
 [61] -0.389980510 -0.380980089  1.751192461  2.044884565  0.779734694
 [66] -0.337104736 -0.360316853  0.008972667  0.485031987 -1.102277393
 [71] -0.416822477 -0.018733984  0.426315326 -1.064797223  0.276475739
 [76] -1.046786722 -1.134699787 -1.588253162 -0.766637325  0.400204450
 [81]  1.158310733 -0.545892247  0.012478310 -0.604559315  0.957864972
 [86] -0.533542139  0.496434021 -0.587651760 -1.736093822 -0.480348536
 [91]  0.531367748 -0.545244303 -0.123652444 -0.778895114 -1.171674140
 [96]  1.026973319 -0.272370516 -0.892762482  0.590966204  0.806601990
> 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]  1.029100147  1.206004594  1.126915564  1.113811914 -0.723559714
  [6] -1.708866786 -1.314986765  0.143574620  0.982927738 -0.807858304
 [11] -0.878159090  0.682904832 -0.554650123  2.257289075 -0.245359837
 [16] -0.017595230  0.710087564  0.261570001 -0.216107687 -2.282142263
 [21] -0.374928266 -0.374015080  0.913788752 -0.089690595  0.237598990
 [26]  1.000138154 -0.671066694 -0.758531719  0.712343665 -1.673212652
 [31]  1.335289135 -0.356196354  0.230035346  1.274076553 -0.954363830
 [36] -0.940528852  0.389668378  0.096064372  0.217882218 -1.109067490
 [41] -1.489860285 -0.292876782  1.777552278 -1.371448858  1.790567421
 [46] -0.519900458  0.752889698 -0.766103016  0.838650283  0.424190362
 [51]  1.761418143 -0.695608532  2.347689266  1.038757440 -1.912649547
 [56] -0.322552583  0.540240225 -0.752279277 -0.129996656  0.593285652
 [61] -0.389980510 -0.380980089  1.751192461  2.044884565  0.779734694
 [66] -0.337104736 -0.360316853  0.008972667  0.485031987 -1.102277393
 [71] -0.416822477 -0.018733984  0.426315326 -1.064797223  0.276475739
 [76] -1.046786722 -1.134699787 -1.588253162 -0.766637325  0.400204450
 [81]  1.158310733 -0.545892247  0.012478310 -0.604559315  0.957864972
 [86] -0.533542139  0.496434021 -0.587651760 -1.736093822 -0.480348536
 [91]  0.531367748 -0.545244303 -0.123652444 -0.778895114 -1.171674140
 [96]  1.026973319 -0.272370516 -0.892762482  0.590966204  0.806601990
> colMin(tmp)
  [1]  1.029100147  1.206004594  1.126915564  1.113811914 -0.723559714
  [6] -1.708866786 -1.314986765  0.143574620  0.982927738 -0.807858304
 [11] -0.878159090  0.682904832 -0.554650123  2.257289075 -0.245359837
 [16] -0.017595230  0.710087564  0.261570001 -0.216107687 -2.282142263
 [21] -0.374928266 -0.374015080  0.913788752 -0.089690595  0.237598990
 [26]  1.000138154 -0.671066694 -0.758531719  0.712343665 -1.673212652
 [31]  1.335289135 -0.356196354  0.230035346  1.274076553 -0.954363830
 [36] -0.940528852  0.389668378  0.096064372  0.217882218 -1.109067490
 [41] -1.489860285 -0.292876782  1.777552278 -1.371448858  1.790567421
 [46] -0.519900458  0.752889698 -0.766103016  0.838650283  0.424190362
 [51]  1.761418143 -0.695608532  2.347689266  1.038757440 -1.912649547
 [56] -0.322552583  0.540240225 -0.752279277 -0.129996656  0.593285652
 [61] -0.389980510 -0.380980089  1.751192461  2.044884565  0.779734694
 [66] -0.337104736 -0.360316853  0.008972667  0.485031987 -1.102277393
 [71] -0.416822477 -0.018733984  0.426315326 -1.064797223  0.276475739
 [76] -1.046786722 -1.134699787 -1.588253162 -0.766637325  0.400204450
 [81]  1.158310733 -0.545892247  0.012478310 -0.604559315  0.957864972
 [86] -0.533542139  0.496434021 -0.587651760 -1.736093822 -0.480348536
 [91]  0.531367748 -0.545244303 -0.123652444 -0.778895114 -1.171674140
 [96]  1.026973319 -0.272370516 -0.892762482  0.590966204  0.806601990
> colMedians(tmp)
  [1]  1.029100147  1.206004594  1.126915564  1.113811914 -0.723559714
  [6] -1.708866786 -1.314986765  0.143574620  0.982927738 -0.807858304
 [11] -0.878159090  0.682904832 -0.554650123  2.257289075 -0.245359837
 [16] -0.017595230  0.710087564  0.261570001 -0.216107687 -2.282142263
 [21] -0.374928266 -0.374015080  0.913788752 -0.089690595  0.237598990
 [26]  1.000138154 -0.671066694 -0.758531719  0.712343665 -1.673212652
 [31]  1.335289135 -0.356196354  0.230035346  1.274076553 -0.954363830
 [36] -0.940528852  0.389668378  0.096064372  0.217882218 -1.109067490
 [41] -1.489860285 -0.292876782  1.777552278 -1.371448858  1.790567421
 [46] -0.519900458  0.752889698 -0.766103016  0.838650283  0.424190362
 [51]  1.761418143 -0.695608532  2.347689266  1.038757440 -1.912649547
 [56] -0.322552583  0.540240225 -0.752279277 -0.129996656  0.593285652
 [61] -0.389980510 -0.380980089  1.751192461  2.044884565  0.779734694
 [66] -0.337104736 -0.360316853  0.008972667  0.485031987 -1.102277393
 [71] -0.416822477 -0.018733984  0.426315326 -1.064797223  0.276475739
 [76] -1.046786722 -1.134699787 -1.588253162 -0.766637325  0.400204450
 [81]  1.158310733 -0.545892247  0.012478310 -0.604559315  0.957864972
 [86] -0.533542139  0.496434021 -0.587651760 -1.736093822 -0.480348536
 [91]  0.531367748 -0.545244303 -0.123652444 -0.778895114 -1.171674140
 [96]  1.026973319 -0.272370516 -0.892762482  0.590966204  0.806601990
> colRanges(tmp)
       [,1]     [,2]     [,3]     [,4]       [,5]      [,6]      [,7]      [,8]
[1,] 1.0291 1.206005 1.126916 1.113812 -0.7235597 -1.708867 -1.314987 0.1435746
[2,] 1.0291 1.206005 1.126916 1.113812 -0.7235597 -1.708867 -1.314987 0.1435746
          [,9]      [,10]      [,11]     [,12]      [,13]    [,14]      [,15]
[1,] 0.9829277 -0.8078583 -0.8781591 0.6829048 -0.5546501 2.257289 -0.2453598
[2,] 0.9829277 -0.8078583 -0.8781591 0.6829048 -0.5546501 2.257289 -0.2453598
           [,16]     [,17]   [,18]      [,19]     [,20]      [,21]      [,22]
[1,] -0.01759523 0.7100876 0.26157 -0.2161077 -2.282142 -0.3749283 -0.3740151
[2,] -0.01759523 0.7100876 0.26157 -0.2161077 -2.282142 -0.3749283 -0.3740151
         [,23]       [,24]    [,25]    [,26]      [,27]      [,28]     [,29]
[1,] 0.9137888 -0.08969059 0.237599 1.000138 -0.6710667 -0.7585317 0.7123437
[2,] 0.9137888 -0.08969059 0.237599 1.000138 -0.6710667 -0.7585317 0.7123437
         [,30]    [,31]      [,32]     [,33]    [,34]      [,35]      [,36]
[1,] -1.673213 1.335289 -0.3561964 0.2300353 1.274077 -0.9543638 -0.9405289
[2,] -1.673213 1.335289 -0.3561964 0.2300353 1.274077 -0.9543638 -0.9405289
         [,37]      [,38]     [,39]     [,40]    [,41]      [,42]    [,43]
[1,] 0.3896684 0.09606437 0.2178822 -1.109067 -1.48986 -0.2928768 1.777552
[2,] 0.3896684 0.09606437 0.2178822 -1.109067 -1.48986 -0.2928768 1.777552
         [,44]    [,45]      [,46]     [,47]     [,48]     [,49]     [,50]
[1,] -1.371449 1.790567 -0.5199005 0.7528897 -0.766103 0.8386503 0.4241904
[2,] -1.371449 1.790567 -0.5199005 0.7528897 -0.766103 0.8386503 0.4241904
        [,51]      [,52]    [,53]    [,54]    [,55]      [,56]     [,57]
[1,] 1.761418 -0.6956085 2.347689 1.038757 -1.91265 -0.3225526 0.5402402
[2,] 1.761418 -0.6956085 2.347689 1.038757 -1.91265 -0.3225526 0.5402402
          [,58]      [,59]     [,60]      [,61]      [,62]    [,63]    [,64]
[1,] -0.7522793 -0.1299967 0.5932857 -0.3899805 -0.3809801 1.751192 2.044885
[2,] -0.7522793 -0.1299967 0.5932857 -0.3899805 -0.3809801 1.751192 2.044885
         [,65]      [,66]      [,67]       [,68]    [,69]     [,70]      [,71]
[1,] 0.7797347 -0.3371047 -0.3603169 0.008972667 0.485032 -1.102277 -0.4168225
[2,] 0.7797347 -0.3371047 -0.3603169 0.008972667 0.485032 -1.102277 -0.4168225
           [,72]     [,73]     [,74]     [,75]     [,76]   [,77]     [,78]
[1,] -0.01873398 0.4263153 -1.064797 0.2764757 -1.046787 -1.1347 -1.588253
[2,] -0.01873398 0.4263153 -1.064797 0.2764757 -1.046787 -1.1347 -1.588253
          [,79]     [,80]    [,81]      [,82]      [,83]      [,84]    [,85]
[1,] -0.7666373 0.4002044 1.158311 -0.5458922 0.01247831 -0.6045593 0.957865
[2,] -0.7666373 0.4002044 1.158311 -0.5458922 0.01247831 -0.6045593 0.957865
          [,86]    [,87]      [,88]     [,89]      [,90]     [,91]      [,92]
[1,] -0.5335421 0.496434 -0.5876518 -1.736094 -0.4803485 0.5313677 -0.5452443
[2,] -0.5335421 0.496434 -0.5876518 -1.736094 -0.4803485 0.5313677 -0.5452443
          [,93]      [,94]     [,95]    [,96]      [,97]      [,98]     [,99]
[1,] -0.1236524 -0.7788951 -1.171674 1.026973 -0.2723705 -0.8927625 0.5909662
[2,] -0.1236524 -0.7788951 -1.171674 1.026973 -0.2723705 -0.8927625 0.5909662
       [,100]
[1,] 0.806602
[2,] 0.806602
> 
> 
> Max(tmp2)
[1] 2.865757
> Min(tmp2)
[1] -2.301543
> mean(tmp2)
[1] 0.02235029
> Sum(tmp2)
[1] 2.235029
> Var(tmp2)
[1] 0.9134918
> 
> rowMeans(tmp2)
  [1] -1.03558403  0.20596522  1.53492538 -0.45012848  1.25071805 -0.09102488
  [7] -0.30658450  0.63744786  0.66306402  0.36340235 -0.25102660  0.67190891
 [13]  2.74734774 -1.46199726  0.08237453  0.77510986 -0.19328548 -0.31976731
 [19]  0.62557109  0.10405138  1.11319164  0.30762991 -0.37099154  0.01140859
 [25]  0.31547041  1.06271705  0.23765935 -0.09339717 -0.51450445 -1.33117244
 [31] -0.12033649 -0.14276461  0.49005122  1.17126356  0.68674730 -0.69913177
 [37] -0.16085823 -0.84874701 -0.96060538 -1.61453006 -0.19566262 -0.58151785
 [43] -0.80134354  0.42849957  2.86575660 -0.31261514  0.28286212  0.99960923
 [49] -1.10982641 -0.01640704 -0.54935963 -0.95813781  0.56226036  1.12039817
 [55]  1.30176690  2.02994399 -0.89671306  0.54642237 -1.09796482  0.11454065
 [61]  0.47680068  0.24993652 -2.30154292 -0.25704254  0.64540739 -0.04081941
 [67]  0.08458503 -1.40174586  0.32197642  0.19731249  0.11485793  1.24475468
 [73] -1.38749454 -0.61219939 -0.02722584  1.67465607  0.10813114 -0.38530964
 [79] -0.61700928 -0.27448646 -0.50371244 -0.42111588  0.08454661 -0.88398963
 [85]  0.03925099  1.09015780 -0.87287624 -1.39839690  1.21681754  1.60486148
 [91] -0.92507358 -1.75992602 -0.45016355  0.40073900  0.36193351 -0.25780759
 [97]  1.14968674 -2.13288506 -1.15897859  1.41431887
> rowSums(tmp2)
  [1] -1.03558403  0.20596522  1.53492538 -0.45012848  1.25071805 -0.09102488
  [7] -0.30658450  0.63744786  0.66306402  0.36340235 -0.25102660  0.67190891
 [13]  2.74734774 -1.46199726  0.08237453  0.77510986 -0.19328548 -0.31976731
 [19]  0.62557109  0.10405138  1.11319164  0.30762991 -0.37099154  0.01140859
 [25]  0.31547041  1.06271705  0.23765935 -0.09339717 -0.51450445 -1.33117244
 [31] -0.12033649 -0.14276461  0.49005122  1.17126356  0.68674730 -0.69913177
 [37] -0.16085823 -0.84874701 -0.96060538 -1.61453006 -0.19566262 -0.58151785
 [43] -0.80134354  0.42849957  2.86575660 -0.31261514  0.28286212  0.99960923
 [49] -1.10982641 -0.01640704 -0.54935963 -0.95813781  0.56226036  1.12039817
 [55]  1.30176690  2.02994399 -0.89671306  0.54642237 -1.09796482  0.11454065
 [61]  0.47680068  0.24993652 -2.30154292 -0.25704254  0.64540739 -0.04081941
 [67]  0.08458503 -1.40174586  0.32197642  0.19731249  0.11485793  1.24475468
 [73] -1.38749454 -0.61219939 -0.02722584  1.67465607  0.10813114 -0.38530964
 [79] -0.61700928 -0.27448646 -0.50371244 -0.42111588  0.08454661 -0.88398963
 [85]  0.03925099  1.09015780 -0.87287624 -1.39839690  1.21681754  1.60486148
 [91] -0.92507358 -1.75992602 -0.45016355  0.40073900  0.36193351 -0.25780759
 [97]  1.14968674 -2.13288506 -1.15897859  1.41431887
> 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.03558403  0.20596522  1.53492538 -0.45012848  1.25071805 -0.09102488
  [7] -0.30658450  0.63744786  0.66306402  0.36340235 -0.25102660  0.67190891
 [13]  2.74734774 -1.46199726  0.08237453  0.77510986 -0.19328548 -0.31976731
 [19]  0.62557109  0.10405138  1.11319164  0.30762991 -0.37099154  0.01140859
 [25]  0.31547041  1.06271705  0.23765935 -0.09339717 -0.51450445 -1.33117244
 [31] -0.12033649 -0.14276461  0.49005122  1.17126356  0.68674730 -0.69913177
 [37] -0.16085823 -0.84874701 -0.96060538 -1.61453006 -0.19566262 -0.58151785
 [43] -0.80134354  0.42849957  2.86575660 -0.31261514  0.28286212  0.99960923
 [49] -1.10982641 -0.01640704 -0.54935963 -0.95813781  0.56226036  1.12039817
 [55]  1.30176690  2.02994399 -0.89671306  0.54642237 -1.09796482  0.11454065
 [61]  0.47680068  0.24993652 -2.30154292 -0.25704254  0.64540739 -0.04081941
 [67]  0.08458503 -1.40174586  0.32197642  0.19731249  0.11485793  1.24475468
 [73] -1.38749454 -0.61219939 -0.02722584  1.67465607  0.10813114 -0.38530964
 [79] -0.61700928 -0.27448646 -0.50371244 -0.42111588  0.08454661 -0.88398963
 [85]  0.03925099  1.09015780 -0.87287624 -1.39839690  1.21681754  1.60486148
 [91] -0.92507358 -1.75992602 -0.45016355  0.40073900  0.36193351 -0.25780759
 [97]  1.14968674 -2.13288506 -1.15897859  1.41431887
> rowMin(tmp2)
  [1] -1.03558403  0.20596522  1.53492538 -0.45012848  1.25071805 -0.09102488
  [7] -0.30658450  0.63744786  0.66306402  0.36340235 -0.25102660  0.67190891
 [13]  2.74734774 -1.46199726  0.08237453  0.77510986 -0.19328548 -0.31976731
 [19]  0.62557109  0.10405138  1.11319164  0.30762991 -0.37099154  0.01140859
 [25]  0.31547041  1.06271705  0.23765935 -0.09339717 -0.51450445 -1.33117244
 [31] -0.12033649 -0.14276461  0.49005122  1.17126356  0.68674730 -0.69913177
 [37] -0.16085823 -0.84874701 -0.96060538 -1.61453006 -0.19566262 -0.58151785
 [43] -0.80134354  0.42849957  2.86575660 -0.31261514  0.28286212  0.99960923
 [49] -1.10982641 -0.01640704 -0.54935963 -0.95813781  0.56226036  1.12039817
 [55]  1.30176690  2.02994399 -0.89671306  0.54642237 -1.09796482  0.11454065
 [61]  0.47680068  0.24993652 -2.30154292 -0.25704254  0.64540739 -0.04081941
 [67]  0.08458503 -1.40174586  0.32197642  0.19731249  0.11485793  1.24475468
 [73] -1.38749454 -0.61219939 -0.02722584  1.67465607  0.10813114 -0.38530964
 [79] -0.61700928 -0.27448646 -0.50371244 -0.42111588  0.08454661 -0.88398963
 [85]  0.03925099  1.09015780 -0.87287624 -1.39839690  1.21681754  1.60486148
 [91] -0.92507358 -1.75992602 -0.45016355  0.40073900  0.36193351 -0.25780759
 [97]  1.14968674 -2.13288506 -1.15897859  1.41431887
> 
> colMeans(tmp2)
[1] 0.02235029
> colSums(tmp2)
[1] 2.235029
> colVars(tmp2)
[1] 0.9134918
> colSd(tmp2)
[1] 0.9557677
> colMax(tmp2)
[1] 2.865757
> colMin(tmp2)
[1] -2.301543
> colMedians(tmp2)
[1] -0.002499222
> colRanges(tmp2)
          [,1]
[1,] -2.301543
[2,]  2.865757
> 
> 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.008702694 -3.318735722 -2.755055083  0.647838191 -1.286399630
 [6] -1.846142087  5.955649137  3.361755003  1.460780942 -1.720254140
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.9971734
[2,] -0.6386204
[3,] -0.1808481
[4,]  0.6914220
[5,]  2.1765150
> 
> rowApply(tmp,sum)
 [1]  1.444981125  1.336809954  1.420699872  2.525316728  3.177296833
 [6] -1.529877128 -3.262065665  0.002156091 -5.153056285  0.545877781
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    2    4    3    7    7   10    9   10    1     3
 [2,]    5    1    7    8    1    3    3    1    7     5
 [3,]    6    7    2    2    3    7    4    3    3    10
 [4,]    1    6    9    5    9    2    5    5   10     1
 [5,]    3    8    4    3    4    9    7    8    6     2
 [6,]   10    2    6    4    2    5    8    7    2     6
 [7,]    7    9    8   10    5    1   10    9    5     9
 [8,]    9    5   10    9    8    4    2    4    8     7
 [9,]    8    3    5    6   10    8    6    6    4     8
[10,]    4   10    1    1    6    6    1    2    9     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.0949205 -0.9861118 -0.9529640  1.2672992 -5.1348263 -1.3971228
 [7] -3.2252256  1.9130964  2.9553357 -1.7270841  0.8002593  2.1404711
[13]  2.5334580 -0.5320115 -1.0472503  1.2026761 -6.1105330 -0.8586222
[19]  1.9534709 -0.6406070
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.2455096
[2,]  0.4342762
[3,]  0.6902848
[4,]  1.3602720
[5,]  1.8555972
> 
> rowApply(tmp,sum)
[1] -4.9446588 -0.3194314 -1.6147972  1.1254258  1.0020901
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    2   19   15   18   15
[2,]   15    6   19    6    6
[3,]   19    8   10    5   13
[4,]    6   20   17    7   12
[5,]   16    1    2    2    5
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -1.2455096  0.1500106  0.6435281 -0.5909837  0.2230699 -0.4678923
[2,]  1.8555972 -0.8475642 -0.7826155  1.9280204 -2.3246981 -0.6603544
[3,]  0.4342762  0.9732571 -0.1646095  0.7396696 -1.1070100 -1.3791507
[4,]  1.3602720 -0.7209947 -0.8655559 -0.6489965 -1.2179951  1.9249197
[5,]  0.6902848 -0.5408207  0.2162888 -0.1604107 -0.7081930 -0.8146450
           [,7]        [,8]       [,9]      [,10]       [,11]       [,12]
[1,] -0.4529500 -0.06175271 -0.1869275 -1.0092697 -0.87146121  0.08439741
[2,] -1.4543481 -0.92239481  1.2237735  0.3188559  0.99042510  0.68484835
[3,]  0.1241003 -0.99191537 -0.4058879 -0.3269486  1.27982082  0.95463757
[4,] -1.1100591  1.43027139  1.0887330  0.1643946 -0.08503835 -0.33357658
[5,] -0.3319689  2.45888793  1.2356446 -0.8741162 -0.51348708  0.75016432
          [,13]       [,14]      [,15]      [,16]       [,17]      [,18]
[1,]  0.1245317  0.28240053 -0.1750563 -0.8640775 -2.54582674  0.5596818
[2,]  1.3853100 -0.41017244 -1.4529582  1.2361054 -1.30359856  0.4050608
[3,] -0.8266578  0.08617982  0.6265652 -1.0132974 -0.05875888 -0.6889474
[4,]  1.1356420 -0.11579246 -0.5958081  0.6763128 -1.33506324 -0.8813273
[5,]  0.7146320 -0.37462694  0.5500071  1.1676328 -0.86728553 -0.2530900
            [,19]      [,20]
[1,]  0.005379413  1.4540489
[2,]  0.640550199 -0.8292740
[3,]  0.403853433 -0.2739737
[4,]  1.069654080  0.1854337
[5,] -0.165966192 -1.1768419
> 
> 
> 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.1789235 2.212946 -0.5389274 -0.2541402 -1.528169 -0.4246237 -0.3162535
           col8       col9       col10    col11     col12     col13      col14
row1 -0.2101173 -0.2017926 -0.04152432 1.921044 0.5233035 0.9422542 -0.7579342
        col15     col16     col17    col18      col19     col20
row1 1.516494 0.2790274 0.4840719 -0.37677 -0.4710194 -1.107585
> tmp[,"col10"]
            col10
row1 -0.041524319
row2 -0.008814091
row3 -0.105544567
row4  0.054047948
row5  1.029360115
> tmp[c("row1","row5"),]
           col1      col2       col3       col4      col5       col6       col7
row1 -0.1789235 2.2129464 -0.5389274 -0.2541402 -1.528169 -0.4246237 -0.3162535
row5 -1.4146737 0.2936669  1.7446788  1.6490549  1.649333  0.9358355  2.4523483
           col8       col9       col10     col11     col12     col13      col14
row1 -0.2101173 -0.2017926 -0.04152432 1.9210437 0.5233035 0.9422542 -0.7579342
row5 -1.0611681 -0.2662734  1.02936011 0.2674379 0.5346530 0.1937207 -0.7357845
         col15     col16     col17      col18      col19      col20
row1 1.5164939 0.2790274 0.4840719 -0.3767700 -0.4710194 -1.1075854
row5 0.6037376 1.4610031 0.5851351  0.6430044 -1.1067184  0.4943234
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.4246237 -1.1075854
row2  0.8697776  2.5762897
row3 -2.0317085 -0.6608429
row4  1.8777694 -0.8041603
row5  0.9358355  0.4943234
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.4246237 -1.1075854
row5  0.9358355  0.4943234
> 
> 
> 
> 
> 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 49.85814 51.18613 48.32309 51.15126 50.44426 104.9249 49.66283 48.24967
         col9   col10   col11    col12    col13    col14    col15   col16
row1 49.56264 49.9988 50.8038 51.03135 48.49098 51.63333 49.90631 48.1687
        col17    col18    col19    col20
row1 49.08301 51.32946 51.77614 105.4764
> tmp[,"col10"]
        col10
row1 49.99880
row2 30.03577
row3 30.31442
row4 30.88143
row5 48.87341
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.85814 51.18613 48.32309 51.15126 50.44426 104.9249 49.66283 48.24967
row5 49.94086 49.29555 49.44871 49.06960 48.43162 105.7035 50.94724 49.43549
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.56264 49.99880 50.80380 51.03135 48.49098 51.63333 49.90631 48.16870
row5 46.06681 48.87341 48.72956 49.82995 50.44587 49.53988 49.21371 50.14748
        col17    col18    col19    col20
row1 49.08301 51.32946 51.77614 105.4764
row5 48.73365 52.13800 49.07587 105.0798
> tmp[,c("col6","col20")]
          col6     col20
row1 104.92487 105.47640
row2  77.55360  74.36938
row3  75.18914  74.45824
row4  75.17026  75.82354
row5 105.70352 105.07978
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.9249 105.4764
row5 105.7035 105.0798
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.9249 105.4764
row5 105.7035 105.0798
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  1.11157639
[2,]  0.67564557
[3,]  1.15985803
[4,] -0.05474541
[5,] -0.85292182
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.5950998 -2.2025887
[2,] -0.1813552 -0.6556627
[3,]  0.7884217  0.3404709
[4,] -0.3102787 -0.3618552
[5,] -0.9244021 -1.1968648
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.2539444 -0.1935172
[2,] -0.6532572  0.1696251
[3,] -1.0087317  0.2730454
[4,] -1.5919698 -0.1542890
[5,]  0.7187234  0.5640201
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.2539444
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.2539444
[2,] -0.6532572
> 
> 
> 
> 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]
row3 0.3557772 -3.2488332 -1.8606487  0.5303121  0.9893872 -0.6361222
row1 1.1040385  0.6472939 -0.5076686 -0.4090557 -1.3477808 -1.0126701
           [,7]        [,8]       [,9]      [,10]     [,11]      [,12]
row3  0.5357493 -0.07727854 -0.2735377 -2.5452606 0.2995434  0.1498301
row1 -1.1986606  0.21038442 -0.5918738  0.6412233 1.4902154 -0.6350544
          [,13]      [,14]      [,15]      [,16]      [,17]     [,18]     [,19]
row3 0.79156314 -0.6921589  0.2762742 -0.9653936 -0.4617592 -1.186426 0.7038837
row1 0.09396183  0.1203837 -1.0881514 -1.7822163  0.7289607  1.212941 0.6094237
         [,20]
row3 2.2199805
row1 0.3931711
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]      [,3]       [,4]      [,5]      [,6]     [,7]
row2 -1.615302 1.369232 0.3269146 -0.8400764 -1.251736 0.4472758 1.233577
           [,8]     [,9]     [,10]
row2 -0.1911981 1.135517 0.8977976
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]       [,2]         [,3]      [,4]        [,5]      [,6]
row5 -0.6119451 -0.1332143 -0.009352267 0.5025394 -0.02479248 0.6190556
          [,7]       [,8]       [,9]    [,10]    [,11]     [,12]      [,13]
row5 0.3016655 -0.5966292 -0.3249371 0.664261 1.064151 0.4665376 -0.1375478
         [,14]     [,15]     [,16]     [,17]     [,18]     [,19]     [,20]
row5 -1.983498 0.8447154 -0.784947 -1.474001 0.1261001 -1.191851 0.7449394
> 
> 
> 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: 0x6402609a4b70>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f8258a72c3f"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f82163c314b"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f823c4a6959"
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f8243d8897f"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f82a83655a" 
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f8257b2f20f"
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f8213c691a2"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f82680d3a79"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f824d557edc"
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f82470e5d98"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f826d8c2fc9"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f82292049e9"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f825453756f"
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f8244fac3fa"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM1c6f822215ee16"
> 
> 
> ### 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: 0x6402612bdd00>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x6402612bdd00>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x6402612bdd00>
> rowMedians(tmp)
  [1]  0.257406123 -0.248467262  0.434446232  0.252855116  0.048861575
  [6]  0.262956718 -0.099574662 -0.357654407 -0.198867912 -0.062476880
 [11] -0.206573075  0.222229912 -0.275967425  0.783386486  0.203202038
 [16] -0.404035747 -0.033497406 -0.196115980 -0.021229097 -0.303344566
 [21]  0.271247574 -0.741423622  0.046028486  0.326336715 -0.076099066
 [26] -0.604106148 -0.322718770 -0.230961007 -0.225737280 -0.285736759
 [31]  0.169445556 -0.531879622 -0.398157256  0.072628543  0.366898614
 [36]  0.023281384 -0.195526575  0.058430249  0.051607777 -0.145364088
 [41] -0.062110646 -0.214772492  0.417684197  0.029171249  0.106976484
 [46] -0.045345804 -0.430696124  0.023262285 -0.108348137  0.428654265
 [51]  0.295276453  0.227449310 -0.179256399 -0.088296670 -0.272917610
 [56] -0.140487808 -0.108372202  0.426315535 -0.045616530 -0.432965354
 [61] -0.421165531 -0.290990055 -0.558994695 -0.318082222 -0.398771997
 [66] -0.089056472 -0.172779130 -0.370119803  0.185407104 -0.163606342
 [71]  0.179790856  0.550281471 -0.146560625 -0.179040931  0.094068245
 [76]  0.172286852 -0.202794766 -0.061130131 -0.516667297 -0.032128866
 [81]  0.338340440  0.129160926 -0.099633000  0.428078469 -0.097860528
 [86]  0.126904499  0.260622677  0.225660385 -0.141775341  0.227762377
 [91]  0.019322506 -0.272279103  0.195559740 -0.149703013  0.004746327
 [96]  0.068157353 -0.170526125  0.304902884 -0.297143525  0.348272252
[101]  0.034791224  0.308262972  0.051391366  0.226803133 -0.008161678
[106] -0.190268886  0.441379341  0.660443556 -0.438309333 -0.227670791
[111] -0.314692112  0.156857930 -0.702115118 -0.181403127 -0.380428001
[116] -0.118185927 -0.206623690 -0.082598673  1.023408790  0.119161918
[121]  0.529273841  0.014242246  0.047931047  1.059607542  0.053981428
[126] -0.199429197 -0.075172962  0.024929573  0.251483279  0.294319204
[131] -0.162619070  0.147572653 -0.107538004  0.007618277 -0.387613188
[136] -0.107479682  0.061208448 -0.465698110 -0.363371214 -0.477380911
[141] -0.003088290  0.115138728 -0.031087219 -0.239329320 -0.070391474
[146] -0.205201291 -0.176775581  0.208472525 -0.450605710  0.683307794
[151] -0.359005798 -0.017628892 -0.183239002 -0.237527359  0.219783894
[156]  0.255265386  0.113402045  0.334400558 -0.452613899  0.203292655
[161]  0.063525694 -0.097954876 -0.127488385 -0.028399450 -0.004561943
[166] -0.066924166  0.670876238  0.413225595  0.520076820  0.242430349
[171]  0.017665361 -0.199765863  0.163881648  0.078446611 -0.084085142
[176] -0.132858417  0.367730446  0.038927364  0.157758054  0.330578308
[181]  0.296219724  0.004709964 -0.139719123  0.409055543 -0.337748776
[186] -0.244783095 -0.585574720 -0.047502417 -0.191821314  0.005840437
[191] -0.303080940 -0.233435151 -0.855657356  0.119818718 -0.210765603
[196]  0.607636180 -0.142198581  0.435523723  0.365657073  0.205944303
[201]  0.025332773  0.175502555 -0.622509684 -0.144494329  0.167289469
[206] -0.632963999  0.394738966 -0.140800095 -0.033457593  0.426458010
[211]  0.119773441  0.266435553  0.099786020 -0.369180387 -0.264160459
[216]  0.051304010 -0.414600824 -0.660642485 -0.359879493 -0.534812933
[221] -0.308914118  0.125856631 -0.408348277 -0.025358281 -0.136190233
[226] -0.565682366  0.069136555 -0.366700529  0.079021912 -0.477087911
> 
> proc.time()
   user  system elapsed 
  1.222   0.656   1.866 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-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: 0x58d4851dd370>
> .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: 0x58d4851dd370>
> .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: 0x58d4851dd370>
> .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: 0x58d4851dd370>
> 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: 0x58d4851c51c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58d4851c51c0>
> .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: 0x58d4851c51c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58d4851c51c0>
> .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: 0x58d4851c51c0>
> 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: 0x58d4854a8120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58d4854a8120>
> .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: 0x58d4854a8120>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x58d4854a8120>
> .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: 0x58d4854a8120>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x58d4854a8120>
> .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: 0x58d4854a8120>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x58d4854a8120>
> .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: 0x58d4854a8120>
> 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: 0x58d4841f8390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x58d4841f8390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58d4841f8390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58d4841f8390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1c735b289fbd46" "BufferedMatrixFile1c735b2a1ae68c"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1c735b289fbd46" "BufferedMatrixFile1c735b2a1ae68c"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x58d4840ef3d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58d4840ef3d0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x58d4840ef3d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x58d4840ef3d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x58d4840ef3d0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x58d4840ef3d0>
> .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: 0x58d485c24fa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58d485c24fa0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x58d485c24fa0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x58d485c24fa0>
> 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: 0x58d4843fcff0>
> .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: 0x58d4843fcff0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.253   0.040   0.280 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-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.252   0.046   0.285 

Example timings