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

This page was generated on 2026-03-25 11:57 -0400 (Wed, 25 Mar 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4893
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-24 13:45 -0400 (Tue, 24 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 -0400 (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-24 21:31:02 -0400 (Tue, 24 Mar 2026)
EndedAt: 2026-03-24 21:31:27 -0400 (Tue, 24 Mar 2026)
EllapsedTime: 24.1 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.4 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.1) 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.1) 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.240   0.047   0.277 

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] "Tue Mar 24 21:31:17 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Mar 24 21:31:17 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: 0x6189610e8370>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Mar 24 21:31:17 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Mar 24 21:31:18 2026"
> 
> ColMode(tmp2)
<pointer: 0x6189610e8370>
> 
> 
> 
> ### 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,] 97.8034111 1.2881626  0.04657506  0.2791457
[2,] -0.4894736 1.5542927 -0.53096511 -0.4879666
[3,]  0.3435990 0.2807863  0.10780140 -1.2515783
[4,] -0.8402863 0.1705307 -0.69342457  1.3872088
> 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,] 97.8034111 1.2881626 0.04657506 0.2791457
[2,]  0.4894736 1.5542927 0.53096511 0.4879666
[3,]  0.3435990 0.2807863 0.10780140 1.2515783
[4,]  0.8402863 0.1705307 0.69342457 1.3872088
> 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,] 9.8895607 1.1349725 0.2158126 0.5283424
[2,] 0.6996239 1.2467128 0.7286735 0.6985461
[3,] 0.5861732 0.5298927 0.3283312 1.1187396
[4,] 0.9166713 0.4129536 0.8327212 1.1777983
> 
> 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,] 221.69902 37.63789 27.20470 30.56257
[2,]  32.48571 39.02142 32.81770 32.47343
[3,]  31.20533 30.57971 28.39111 37.43897
[4,]  35.00700 29.30007 34.02064 38.16519
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x6189620e49b0>
> exp(tmp5)
<pointer: 0x6189620e49b0>
> log(tmp5,2)
<pointer: 0x6189620e49b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 461.4375
> Min(tmp5)
[1] 53.35009
> mean(tmp5)
[1] 72.68664
> Sum(tmp5)
[1] 14537.33
> Var(tmp5)
[1] 829.9633
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.18036 71.72484 70.68496 70.53472 69.61524 69.09960 70.51346 69.72001
 [9] 70.97423 73.81901
> rowSums(tmp5)
 [1] 1803.607 1434.497 1413.699 1410.694 1392.305 1381.992 1410.269 1394.400
 [9] 1419.485 1476.380
> rowVars(tmp5)
 [1] 7697.99398   98.64944   63.21072   77.11149   65.82938   78.80197
 [7]   56.31932   71.48940   51.25815   57.76056
> rowSd(tmp5)
 [1] 87.738213  9.932242  7.950517  8.781315  8.113531  8.877048  7.504620
 [8]  8.455141  7.159480  7.600037
> rowMax(tmp5)
 [1] 461.43746  88.05993  85.10991  94.20509  84.14668  93.68608  80.58276
 [8]  83.30421  80.78779  85.01736
> rowMin(tmp5)
 [1] 56.62302 55.32647 57.07309 54.50268 55.43843 58.91513 58.63501 53.35009
 [9] 55.00435 55.62530
> 
> colMeans(tmp5)
 [1] 104.78355  69.51637  67.33707  72.28334  75.73371  70.77021  76.24260
 [8]  75.88662  71.18014  67.57355  71.21569  72.33106  66.21847  70.88378
[15]  71.23791  71.83231  70.67266  68.58662  71.43671  68.01050
> colSums(tmp5)
 [1] 1047.8355  695.1637  673.3707  722.8334  757.3371  707.7021  762.4260
 [8]  758.8662  711.8014  675.7355  712.1569  723.3106  662.1847  708.8378
[15]  712.3791  718.3231  706.7266  685.8662  714.3671  680.1050
> colVars(tmp5)
 [1] 15754.13051    71.52130    43.75623    42.27898    48.98847   102.08974
 [7]    56.35256   103.44471    77.93155    71.10971    34.71235    48.05643
[13]    21.41744    35.53121    58.11228   123.30989    23.83122    50.98575
[19]   135.39006    84.23872
> colSd(tmp5)
 [1] 125.515459   8.457026   6.614849   6.502229   6.999177  10.103947
 [7]   7.506834  10.170777   8.827885   8.432657   5.891718   6.932275
[13]   4.627898   5.960806   7.623141  11.104499   4.881723   7.140430
[19]  11.635723   9.178165
> colMax(tmp5)
 [1] 461.43746  81.21797  77.69279  79.43585  82.47785  83.30421  88.05993
 [8]  93.68608  80.85543  80.78779  83.19829  86.02894  73.12469  78.95220
[15]  83.58329  94.20509  77.60300  76.05610  88.54962  86.21986
> colMin(tmp5)
 [1] 55.00435 60.98425 56.62302 63.59065 61.23110 54.50268 66.65917 62.47207
 [9] 56.27212 55.32647 63.31654 62.70780 60.08351 60.98446 60.61172 55.62530
[17] 63.77377 58.78620 53.35009 59.69345
> 
> 
> ### 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] 90.18036 71.72484 70.68496 70.53472 69.61524       NA 70.51346 69.72001
 [9] 70.97423 73.81901
> rowSums(tmp5)
 [1] 1803.607 1434.497 1413.699 1410.694 1392.305       NA 1410.269 1394.400
 [9] 1419.485 1476.380
> rowVars(tmp5)
 [1] 7697.99398   98.64944   63.21072   77.11149   65.82938   47.82926
 [7]   56.31932   71.48940   51.25815   57.76056
> rowSd(tmp5)
 [1] 87.738213  9.932242  7.950517  8.781315  8.113531  6.915870  7.504620
 [8]  8.455141  7.159480  7.600037
> rowMax(tmp5)
 [1] 461.43746  88.05993  85.10991  94.20509  84.14668        NA  80.58276
 [8]  83.30421  80.78779  85.01736
> rowMin(tmp5)
 [1] 56.62302 55.32647 57.07309 54.50268 55.43843       NA 58.63501 53.35009
 [9] 55.00435 55.62530
> 
> colMeans(tmp5)
 [1] 104.78355  69.51637  67.33707  72.28334  75.73371  70.77021  76.24260
 [8]        NA  71.18014  67.57355  71.21569  72.33106  66.21847  70.88378
[15]  71.23791  71.83231  70.67266  68.58662  71.43671  68.01050
> colSums(tmp5)
 [1] 1047.8355  695.1637  673.3707  722.8334  757.3371  707.7021  762.4260
 [8]        NA  711.8014  675.7355  712.1569  723.3106  662.1847  708.8378
[15]  712.3791  718.3231  706.7266  685.8662  714.3671  680.1050
> colVars(tmp5)
 [1] 15754.13051    71.52130    43.75623    42.27898    48.98847   102.08974
 [7]    56.35256          NA    77.93155    71.10971    34.71235    48.05643
[13]    21.41744    35.53121    58.11228   123.30989    23.83122    50.98575
[19]   135.39006    84.23872
> colSd(tmp5)
 [1] 125.515459   8.457026   6.614849   6.502229   6.999177  10.103947
 [7]   7.506834         NA   8.827885   8.432657   5.891718   6.932275
[13]   4.627898   5.960806   7.623141  11.104499   4.881723   7.140430
[19]  11.635723   9.178165
> colMax(tmp5)
 [1] 461.43746  81.21797  77.69279  79.43585  82.47785  83.30421  88.05993
 [8]        NA  80.85543  80.78779  83.19829  86.02894  73.12469  78.95220
[15]  83.58329  94.20509  77.60300  76.05610  88.54962  86.21986
> colMin(tmp5)
 [1] 55.00435 60.98425 56.62302 63.59065 61.23110 54.50268 66.65917       NA
 [9] 56.27212 55.32647 63.31654 62.70780 60.08351 60.98446 60.61172 55.62530
[17] 63.77377 58.78620 53.35009 59.69345
> 
> Max(tmp5,na.rm=TRUE)
[1] 461.4375
> Min(tmp5,na.rm=TRUE)
[1] 53.35009
> mean(tmp5,na.rm=TRUE)
[1] 72.58112
> Sum(tmp5,na.rm=TRUE)
[1] 14443.64
> Var(tmp5,na.rm=TRUE)
[1] 831.9167
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.18036 71.72484 70.68496 70.53472 69.61524 67.80557 70.51346 69.72001
 [9] 70.97423 73.81901
> rowSums(tmp5,na.rm=TRUE)
 [1] 1803.607 1434.497 1413.699 1410.694 1392.305 1288.306 1410.269 1394.400
 [9] 1419.485 1476.380
> rowVars(tmp5,na.rm=TRUE)
 [1] 7697.99398   98.64944   63.21072   77.11149   65.82938   47.82926
 [7]   56.31932   71.48940   51.25815   57.76056
> rowSd(tmp5,na.rm=TRUE)
 [1] 87.738213  9.932242  7.950517  8.781315  8.113531  6.915870  7.504620
 [8]  8.455141  7.159480  7.600037
> rowMax(tmp5,na.rm=TRUE)
 [1] 461.43746  88.05993  85.10991  94.20509  84.14668  88.54962  80.58276
 [8]  83.30421  80.78779  85.01736
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.62302 55.32647 57.07309 54.50268 55.43843 58.91513 58.63501 53.35009
 [9] 55.00435 55.62530
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 104.78355  69.51637  67.33707  72.28334  75.73371  70.77021  76.24260
 [8]  73.90890  71.18014  67.57355  71.21569  72.33106  66.21847  70.88378
[15]  71.23791  71.83231  70.67266  68.58662  71.43671  68.01050
> colSums(tmp5,na.rm=TRUE)
 [1] 1047.8355  695.1637  673.3707  722.8334  757.3371  707.7021  762.4260
 [8]  665.1801  711.8014  675.7355  712.1569  723.3106  662.1847  708.8378
[15]  712.3791  718.3231  706.7266  685.8662  714.3671  680.1050
> colVars(tmp5,na.rm=TRUE)
 [1] 15754.13051    71.52130    43.75623    42.27898    48.98847   102.08974
 [7]    56.35256    72.37240    77.93155    71.10971    34.71235    48.05643
[13]    21.41744    35.53121    58.11228   123.30989    23.83122    50.98575
[19]   135.39006    84.23872
> colSd(tmp5,na.rm=TRUE)
 [1] 125.515459   8.457026   6.614849   6.502229   6.999177  10.103947
 [7]   7.506834   8.507197   8.827885   8.432657   5.891718   6.932275
[13]   4.627898   5.960806   7.623141  11.104499   4.881723   7.140430
[19]  11.635723   9.178165
> colMax(tmp5,na.rm=TRUE)
 [1] 461.43746  81.21797  77.69279  79.43585  82.47785  83.30421  88.05993
 [8]  89.16579  80.85543  80.78779  83.19829  86.02894  73.12469  78.95220
[15]  83.58329  94.20509  77.60300  76.05610  88.54962  86.21986
> colMin(tmp5,na.rm=TRUE)
 [1] 55.00435 60.98425 56.62302 63.59065 61.23110 54.50268 66.65917 62.47207
 [9] 56.27212 55.32647 63.31654 62.70780 60.08351 60.98446 60.61172 55.62530
[17] 63.77377 58.78620 53.35009 59.69345
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.18036 71.72484 70.68496 70.53472 69.61524      NaN 70.51346 69.72001
 [9] 70.97423 73.81901
> rowSums(tmp5,na.rm=TRUE)
 [1] 1803.607 1434.497 1413.699 1410.694 1392.305    0.000 1410.269 1394.400
 [9] 1419.485 1476.380
> rowVars(tmp5,na.rm=TRUE)
 [1] 7697.99398   98.64944   63.21072   77.11149   65.82938         NA
 [7]   56.31932   71.48940   51.25815   57.76056
> rowSd(tmp5,na.rm=TRUE)
 [1] 87.738213  9.932242  7.950517  8.781315  8.113531        NA  7.504620
 [8]  8.455141  7.159480  7.600037
> rowMax(tmp5,na.rm=TRUE)
 [1] 461.43746  88.05993  85.10991  94.20509  84.14668        NA  80.58276
 [8]  83.30421  80.78779  85.01736
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.62302 55.32647 57.07309 54.50268 55.43843       NA 58.63501 53.35009
 [9] 55.00435 55.62530
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 108.34000  70.23607  67.68397  73.05127  76.65196  72.01400  77.16535
 [8]       NaN  71.30303  67.99800  72.09337  72.46985  65.45111  70.57979
[15]  71.21715  73.26755  71.43921  68.36360  69.53528  68.93462
> colSums(tmp5,na.rm=TRUE)
 [1] 975.0600 632.1246 609.1557 657.4614 689.8677 648.1260 694.4882   0.0000
 [9] 641.7273 611.9820 648.8403 652.2286 589.0600 635.2181 640.9543 659.4080
[17] 642.9529 615.2724 625.8175 620.4116
> colVars(tmp5,na.rm=TRUE)
 [1] 17581.10250    74.63444    47.87193    40.92955    45.62619    97.44712
 [7]    53.81746          NA    87.50308    77.97166    30.38520    53.84680
[13]    17.47018    38.93297    65.37147   115.54953    20.19974    56.79941
[19]   111.63998    85.16115
> colSd(tmp5,na.rm=TRUE)
 [1] 132.593750   8.639123   6.918955   6.397621   6.754716   9.871531
 [7]   7.336039         NA   9.354308   8.830156   5.512277   7.338038
[13]   4.179735   6.239629   8.085262  10.749397   4.494412   7.536539
[19]  10.565982   9.228280
> colMax(tmp5,na.rm=TRUE)
 [1] 461.43746  81.21797  77.69279  79.43585  82.47785  83.30421  88.05993
 [8]      -Inf  80.85543  80.78779  83.19829  86.02894  70.44767  78.95220
[15]  83.58329  94.20509  77.60300  76.05610  85.01736  86.21986
> colMin(tmp5,na.rm=TRUE)
 [1] 55.00435 60.98425 56.62302 63.59065 61.23110 54.50268 66.65917      Inf
 [9] 56.27212 55.32647 64.54846 62.70780 60.08351 60.98446 60.61172 55.62530
[17] 64.82928 58.78620 53.35009 60.67876
> 
> 
> 
> 
> 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] 214.6986 441.5531 233.7404 242.8120 381.5763 223.7354 147.8907 259.3255
 [9] 163.4824 300.4168
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 214.6986 441.5531 233.7404 242.8120 381.5763 223.7354 147.8907 259.3255
 [9] 163.4824 300.4168
> 
> 
> 
> 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]  0.000000e+00 -1.421085e-13  0.000000e+00  0.000000e+00  2.842171e-13
 [6] -2.273737e-13  5.684342e-14  1.136868e-13  5.684342e-14 -1.136868e-13
[11] -8.526513e-14  1.136868e-13  0.000000e+00  1.705303e-13 -1.989520e-13
[16]  2.273737e-13  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## 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)
+ }
5   11 
2   16 
4   13 
2   12 
6   18 
7   9 
5   2 
4   18 
1   15 
3   7 
10   6 
2   1 
6   17 
2   15 
2   10 
10   11 
3   9 
4   9 
8   10 
9   20 
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] 3.117615
> Min(tmp)
[1] -3.713633
> mean(tmp)
[1] -0.19932
> Sum(tmp)
[1] -19.932
> Var(tmp)
[1] 1.490932
> 
> rowMeans(tmp)
[1] -0.19932
> rowSums(tmp)
[1] -19.932
> rowVars(tmp)
[1] 1.490932
> rowSd(tmp)
[1] 1.221037
> rowMax(tmp)
[1] 3.117615
> rowMin(tmp)
[1] -3.713633
> 
> colMeans(tmp)
  [1]  0.316036764  1.883240241  1.293713983  0.928871450 -3.116362739
  [6]  0.261088929  0.924329809 -1.328320009  0.226154401 -0.333275930
 [11]  0.430674381  0.109207459  2.138973649 -1.211297553 -1.472928125
 [16] -0.615580256 -1.221185903 -2.103130150 -0.006521739 -1.065841429
 [21] -0.343149665 -1.731226567  0.196641135  0.677089070  1.119039862
 [26]  0.925116501  0.230253313  0.622430009 -2.478482683 -1.106182282
 [31] -0.385763830  0.227997221 -0.196461798 -0.645999760 -1.195245416
 [36]  0.151150386  0.504811370 -2.499513856 -1.049679368 -0.315736456
 [41] -0.190823382  1.189206796 -0.058506692  0.586415208 -2.083957171
 [46] -0.866472555 -2.828476930 -1.182349380  1.104825673  1.343649046
 [51]  0.978911276 -0.320105158  1.572532818  0.391963560 -0.664874879
 [56] -3.713632540 -0.109582469 -1.186563957  0.540241735  0.287283279
 [61] -1.732323551  2.718279910  1.485459107 -1.783904971 -1.074703055
 [66]  0.661700428  1.426149738  0.098800051 -0.961646189 -2.493086405
 [71]  3.117614517  0.571347073 -1.990064306 -0.566615285 -1.272535352
 [76] -0.334267695  0.931877888  0.291214317  0.068332830 -0.813141098
 [81] -0.320345283  0.434617215 -1.248115456 -1.141878126 -0.493125820
 [86]  0.220901804 -0.603253803 -0.180208512  0.787074209  0.350169222
 [91]  0.876444345  0.369484379 -0.375141845 -1.656901328  0.140867635
 [96] -0.676550800  0.077911520  1.168813299  0.403563210  0.050570643
> colSums(tmp)
  [1]  0.316036764  1.883240241  1.293713983  0.928871450 -3.116362739
  [6]  0.261088929  0.924329809 -1.328320009  0.226154401 -0.333275930
 [11]  0.430674381  0.109207459  2.138973649 -1.211297553 -1.472928125
 [16] -0.615580256 -1.221185903 -2.103130150 -0.006521739 -1.065841429
 [21] -0.343149665 -1.731226567  0.196641135  0.677089070  1.119039862
 [26]  0.925116501  0.230253313  0.622430009 -2.478482683 -1.106182282
 [31] -0.385763830  0.227997221 -0.196461798 -0.645999760 -1.195245416
 [36]  0.151150386  0.504811370 -2.499513856 -1.049679368 -0.315736456
 [41] -0.190823382  1.189206796 -0.058506692  0.586415208 -2.083957171
 [46] -0.866472555 -2.828476930 -1.182349380  1.104825673  1.343649046
 [51]  0.978911276 -0.320105158  1.572532818  0.391963560 -0.664874879
 [56] -3.713632540 -0.109582469 -1.186563957  0.540241735  0.287283279
 [61] -1.732323551  2.718279910  1.485459107 -1.783904971 -1.074703055
 [66]  0.661700428  1.426149738  0.098800051 -0.961646189 -2.493086405
 [71]  3.117614517  0.571347073 -1.990064306 -0.566615285 -1.272535352
 [76] -0.334267695  0.931877888  0.291214317  0.068332830 -0.813141098
 [81] -0.320345283  0.434617215 -1.248115456 -1.141878126 -0.493125820
 [86]  0.220901804 -0.603253803 -0.180208512  0.787074209  0.350169222
 [91]  0.876444345  0.369484379 -0.375141845 -1.656901328  0.140867635
 [96] -0.676550800  0.077911520  1.168813299  0.403563210  0.050570643
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.316036764  1.883240241  1.293713983  0.928871450 -3.116362739
  [6]  0.261088929  0.924329809 -1.328320009  0.226154401 -0.333275930
 [11]  0.430674381  0.109207459  2.138973649 -1.211297553 -1.472928125
 [16] -0.615580256 -1.221185903 -2.103130150 -0.006521739 -1.065841429
 [21] -0.343149665 -1.731226567  0.196641135  0.677089070  1.119039862
 [26]  0.925116501  0.230253313  0.622430009 -2.478482683 -1.106182282
 [31] -0.385763830  0.227997221 -0.196461798 -0.645999760 -1.195245416
 [36]  0.151150386  0.504811370 -2.499513856 -1.049679368 -0.315736456
 [41] -0.190823382  1.189206796 -0.058506692  0.586415208 -2.083957171
 [46] -0.866472555 -2.828476930 -1.182349380  1.104825673  1.343649046
 [51]  0.978911276 -0.320105158  1.572532818  0.391963560 -0.664874879
 [56] -3.713632540 -0.109582469 -1.186563957  0.540241735  0.287283279
 [61] -1.732323551  2.718279910  1.485459107 -1.783904971 -1.074703055
 [66]  0.661700428  1.426149738  0.098800051 -0.961646189 -2.493086405
 [71]  3.117614517  0.571347073 -1.990064306 -0.566615285 -1.272535352
 [76] -0.334267695  0.931877888  0.291214317  0.068332830 -0.813141098
 [81] -0.320345283  0.434617215 -1.248115456 -1.141878126 -0.493125820
 [86]  0.220901804 -0.603253803 -0.180208512  0.787074209  0.350169222
 [91]  0.876444345  0.369484379 -0.375141845 -1.656901328  0.140867635
 [96] -0.676550800  0.077911520  1.168813299  0.403563210  0.050570643
> colMin(tmp)
  [1]  0.316036764  1.883240241  1.293713983  0.928871450 -3.116362739
  [6]  0.261088929  0.924329809 -1.328320009  0.226154401 -0.333275930
 [11]  0.430674381  0.109207459  2.138973649 -1.211297553 -1.472928125
 [16] -0.615580256 -1.221185903 -2.103130150 -0.006521739 -1.065841429
 [21] -0.343149665 -1.731226567  0.196641135  0.677089070  1.119039862
 [26]  0.925116501  0.230253313  0.622430009 -2.478482683 -1.106182282
 [31] -0.385763830  0.227997221 -0.196461798 -0.645999760 -1.195245416
 [36]  0.151150386  0.504811370 -2.499513856 -1.049679368 -0.315736456
 [41] -0.190823382  1.189206796 -0.058506692  0.586415208 -2.083957171
 [46] -0.866472555 -2.828476930 -1.182349380  1.104825673  1.343649046
 [51]  0.978911276 -0.320105158  1.572532818  0.391963560 -0.664874879
 [56] -3.713632540 -0.109582469 -1.186563957  0.540241735  0.287283279
 [61] -1.732323551  2.718279910  1.485459107 -1.783904971 -1.074703055
 [66]  0.661700428  1.426149738  0.098800051 -0.961646189 -2.493086405
 [71]  3.117614517  0.571347073 -1.990064306 -0.566615285 -1.272535352
 [76] -0.334267695  0.931877888  0.291214317  0.068332830 -0.813141098
 [81] -0.320345283  0.434617215 -1.248115456 -1.141878126 -0.493125820
 [86]  0.220901804 -0.603253803 -0.180208512  0.787074209  0.350169222
 [91]  0.876444345  0.369484379 -0.375141845 -1.656901328  0.140867635
 [96] -0.676550800  0.077911520  1.168813299  0.403563210  0.050570643
> colMedians(tmp)
  [1]  0.316036764  1.883240241  1.293713983  0.928871450 -3.116362739
  [6]  0.261088929  0.924329809 -1.328320009  0.226154401 -0.333275930
 [11]  0.430674381  0.109207459  2.138973649 -1.211297553 -1.472928125
 [16] -0.615580256 -1.221185903 -2.103130150 -0.006521739 -1.065841429
 [21] -0.343149665 -1.731226567  0.196641135  0.677089070  1.119039862
 [26]  0.925116501  0.230253313  0.622430009 -2.478482683 -1.106182282
 [31] -0.385763830  0.227997221 -0.196461798 -0.645999760 -1.195245416
 [36]  0.151150386  0.504811370 -2.499513856 -1.049679368 -0.315736456
 [41] -0.190823382  1.189206796 -0.058506692  0.586415208 -2.083957171
 [46] -0.866472555 -2.828476930 -1.182349380  1.104825673  1.343649046
 [51]  0.978911276 -0.320105158  1.572532818  0.391963560 -0.664874879
 [56] -3.713632540 -0.109582469 -1.186563957  0.540241735  0.287283279
 [61] -1.732323551  2.718279910  1.485459107 -1.783904971 -1.074703055
 [66]  0.661700428  1.426149738  0.098800051 -0.961646189 -2.493086405
 [71]  3.117614517  0.571347073 -1.990064306 -0.566615285 -1.272535352
 [76] -0.334267695  0.931877888  0.291214317  0.068332830 -0.813141098
 [81] -0.320345283  0.434617215 -1.248115456 -1.141878126 -0.493125820
 [86]  0.220901804 -0.603253803 -0.180208512  0.787074209  0.350169222
 [91]  0.876444345  0.369484379 -0.375141845 -1.656901328  0.140867635
 [96] -0.676550800  0.077911520  1.168813299  0.403563210  0.050570643
> colRanges(tmp)
          [,1]    [,2]     [,3]      [,4]      [,5]      [,6]      [,7]
[1,] 0.3160368 1.88324 1.293714 0.9288714 -3.116363 0.2610889 0.9243298
[2,] 0.3160368 1.88324 1.293714 0.9288714 -3.116363 0.2610889 0.9243298
         [,8]      [,9]      [,10]     [,11]     [,12]    [,13]     [,14]
[1,] -1.32832 0.2261544 -0.3332759 0.4306744 0.1092075 2.138974 -1.211298
[2,] -1.32832 0.2261544 -0.3332759 0.4306744 0.1092075 2.138974 -1.211298
         [,15]      [,16]     [,17]    [,18]        [,19]     [,20]      [,21]
[1,] -1.472928 -0.6155803 -1.221186 -2.10313 -0.006521739 -1.065841 -0.3431497
[2,] -1.472928 -0.6155803 -1.221186 -2.10313 -0.006521739 -1.065841 -0.3431497
         [,22]     [,23]     [,24]   [,25]     [,26]     [,27]   [,28]
[1,] -1.731227 0.1966411 0.6770891 1.11904 0.9251165 0.2302533 0.62243
[2,] -1.731227 0.1966411 0.6770891 1.11904 0.9251165 0.2302533 0.62243
         [,29]     [,30]      [,31]     [,32]      [,33]      [,34]     [,35]
[1,] -2.478483 -1.106182 -0.3857638 0.2279972 -0.1964618 -0.6459998 -1.195245
[2,] -2.478483 -1.106182 -0.3857638 0.2279972 -0.1964618 -0.6459998 -1.195245
         [,36]     [,37]     [,38]     [,39]      [,40]      [,41]    [,42]
[1,] 0.1511504 0.5048114 -2.499514 -1.049679 -0.3157365 -0.1908234 1.189207
[2,] 0.1511504 0.5048114 -2.499514 -1.049679 -0.3157365 -0.1908234 1.189207
           [,43]     [,44]     [,45]      [,46]     [,47]     [,48]    [,49]
[1,] -0.05850669 0.5864152 -2.083957 -0.8664726 -2.828477 -1.182349 1.104826
[2,] -0.05850669 0.5864152 -2.083957 -0.8664726 -2.828477 -1.182349 1.104826
        [,50]     [,51]      [,52]    [,53]     [,54]      [,55]     [,56]
[1,] 1.343649 0.9789113 -0.3201052 1.572533 0.3919636 -0.6648749 -3.713633
[2,] 1.343649 0.9789113 -0.3201052 1.572533 0.3919636 -0.6648749 -3.713633
          [,57]     [,58]     [,59]     [,60]     [,61]   [,62]    [,63]
[1,] -0.1095825 -1.186564 0.5402417 0.2872833 -1.732324 2.71828 1.485459
[2,] -0.1095825 -1.186564 0.5402417 0.2872833 -1.732324 2.71828 1.485459
         [,64]     [,65]     [,66]   [,67]      [,68]      [,69]     [,70]
[1,] -1.783905 -1.074703 0.6617004 1.42615 0.09880005 -0.9616462 -2.493086
[2,] -1.783905 -1.074703 0.6617004 1.42615 0.09880005 -0.9616462 -2.493086
        [,71]     [,72]     [,73]      [,74]     [,75]      [,76]     [,77]
[1,] 3.117615 0.5713471 -1.990064 -0.5666153 -1.272535 -0.3342677 0.9318779
[2,] 3.117615 0.5713471 -1.990064 -0.5666153 -1.272535 -0.3342677 0.9318779
         [,78]      [,79]      [,80]      [,81]     [,82]     [,83]     [,84]
[1,] 0.2912143 0.06833283 -0.8131411 -0.3203453 0.4346172 -1.248115 -1.141878
[2,] 0.2912143 0.06833283 -0.8131411 -0.3203453 0.4346172 -1.248115 -1.141878
          [,85]     [,86]      [,87]      [,88]     [,89]     [,90]     [,91]
[1,] -0.4931258 0.2209018 -0.6032538 -0.1802085 0.7870742 0.3501692 0.8764443
[2,] -0.4931258 0.2209018 -0.6032538 -0.1802085 0.7870742 0.3501692 0.8764443
         [,92]      [,93]     [,94]     [,95]      [,96]      [,97]    [,98]
[1,] 0.3694844 -0.3751418 -1.656901 0.1408676 -0.6765508 0.07791152 1.168813
[2,] 0.3694844 -0.3751418 -1.656901 0.1408676 -0.6765508 0.07791152 1.168813
         [,99]     [,100]
[1,] 0.4035632 0.05057064
[2,] 0.4035632 0.05057064
> 
> 
> Max(tmp2)
[1] 2.696745
> Min(tmp2)
[1] -3.677736
> mean(tmp2)
[1] 0.02287255
> Sum(tmp2)
[1] 2.287255
> Var(tmp2)
[1] 0.9893844
> 
> rowMeans(tmp2)
  [1] -1.183034389 -1.880228610  1.051249226  0.569373245 -0.441098511
  [6]  1.380674961 -1.178489465  0.404350638 -0.669081045 -0.256555141
 [11] -0.583208469  2.052003635  0.652455492  1.208383690 -0.768284073
 [16]  0.344364676 -0.508027654 -0.443555816  0.643713480 -0.533159690
 [21]  0.069154864 -1.067112355  1.346277599 -0.669527186 -0.187613553
 [26]  0.062146419 -0.131762031  0.325231659  0.012461235  0.150478688
 [31] -1.278602175 -1.091835324  1.015357247 -0.816408214  0.999655279
 [36] -0.894243128  0.573874045 -0.043108847  0.391507160  0.329388220
 [41]  0.066797678  0.513966875 -0.445482117  0.336369596 -0.890995190
 [46]  1.008441899 -0.928550359  0.275092889 -0.878114615 -0.766180088
 [51]  0.167956434  1.036391794 -0.475764537 -0.337955293 -1.167641951
 [56] -1.456232050  1.119253758 -1.543255432  0.559674322  0.866522867
 [61]  0.933489623  0.495719173 -0.235569747 -0.198986137  1.666604706
 [66] -1.247463327 -1.092932146  1.282251588 -0.162181040 -1.520219622
 [71]  2.696745257  0.227924761 -1.471520989  0.757254041 -0.350334759
 [76]  1.986359375  1.236582920 -0.676719101  0.608182045 -0.201714331
 [81] -0.381061980  0.890059252  0.401532053  1.038549001  0.218719535
 [86]  1.485286638 -1.588019637  0.248827584 -0.700744560  0.720861077
 [91] -0.021777486  1.275481584 -3.677736429  0.551833739 -0.144597804
 [96]  0.690735616 -0.004894583  1.149187688 -1.205410211  0.589489316
> rowSums(tmp2)
  [1] -1.183034389 -1.880228610  1.051249226  0.569373245 -0.441098511
  [6]  1.380674961 -1.178489465  0.404350638 -0.669081045 -0.256555141
 [11] -0.583208469  2.052003635  0.652455492  1.208383690 -0.768284073
 [16]  0.344364676 -0.508027654 -0.443555816  0.643713480 -0.533159690
 [21]  0.069154864 -1.067112355  1.346277599 -0.669527186 -0.187613553
 [26]  0.062146419 -0.131762031  0.325231659  0.012461235  0.150478688
 [31] -1.278602175 -1.091835324  1.015357247 -0.816408214  0.999655279
 [36] -0.894243128  0.573874045 -0.043108847  0.391507160  0.329388220
 [41]  0.066797678  0.513966875 -0.445482117  0.336369596 -0.890995190
 [46]  1.008441899 -0.928550359  0.275092889 -0.878114615 -0.766180088
 [51]  0.167956434  1.036391794 -0.475764537 -0.337955293 -1.167641951
 [56] -1.456232050  1.119253758 -1.543255432  0.559674322  0.866522867
 [61]  0.933489623  0.495719173 -0.235569747 -0.198986137  1.666604706
 [66] -1.247463327 -1.092932146  1.282251588 -0.162181040 -1.520219622
 [71]  2.696745257  0.227924761 -1.471520989  0.757254041 -0.350334759
 [76]  1.986359375  1.236582920 -0.676719101  0.608182045 -0.201714331
 [81] -0.381061980  0.890059252  0.401532053  1.038549001  0.218719535
 [86]  1.485286638 -1.588019637  0.248827584 -0.700744560  0.720861077
 [91] -0.021777486  1.275481584 -3.677736429  0.551833739 -0.144597804
 [96]  0.690735616 -0.004894583  1.149187688 -1.205410211  0.589489316
> 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.183034389 -1.880228610  1.051249226  0.569373245 -0.441098511
  [6]  1.380674961 -1.178489465  0.404350638 -0.669081045 -0.256555141
 [11] -0.583208469  2.052003635  0.652455492  1.208383690 -0.768284073
 [16]  0.344364676 -0.508027654 -0.443555816  0.643713480 -0.533159690
 [21]  0.069154864 -1.067112355  1.346277599 -0.669527186 -0.187613553
 [26]  0.062146419 -0.131762031  0.325231659  0.012461235  0.150478688
 [31] -1.278602175 -1.091835324  1.015357247 -0.816408214  0.999655279
 [36] -0.894243128  0.573874045 -0.043108847  0.391507160  0.329388220
 [41]  0.066797678  0.513966875 -0.445482117  0.336369596 -0.890995190
 [46]  1.008441899 -0.928550359  0.275092889 -0.878114615 -0.766180088
 [51]  0.167956434  1.036391794 -0.475764537 -0.337955293 -1.167641951
 [56] -1.456232050  1.119253758 -1.543255432  0.559674322  0.866522867
 [61]  0.933489623  0.495719173 -0.235569747 -0.198986137  1.666604706
 [66] -1.247463327 -1.092932146  1.282251588 -0.162181040 -1.520219622
 [71]  2.696745257  0.227924761 -1.471520989  0.757254041 -0.350334759
 [76]  1.986359375  1.236582920 -0.676719101  0.608182045 -0.201714331
 [81] -0.381061980  0.890059252  0.401532053  1.038549001  0.218719535
 [86]  1.485286638 -1.588019637  0.248827584 -0.700744560  0.720861077
 [91] -0.021777486  1.275481584 -3.677736429  0.551833739 -0.144597804
 [96]  0.690735616 -0.004894583  1.149187688 -1.205410211  0.589489316
> rowMin(tmp2)
  [1] -1.183034389 -1.880228610  1.051249226  0.569373245 -0.441098511
  [6]  1.380674961 -1.178489465  0.404350638 -0.669081045 -0.256555141
 [11] -0.583208469  2.052003635  0.652455492  1.208383690 -0.768284073
 [16]  0.344364676 -0.508027654 -0.443555816  0.643713480 -0.533159690
 [21]  0.069154864 -1.067112355  1.346277599 -0.669527186 -0.187613553
 [26]  0.062146419 -0.131762031  0.325231659  0.012461235  0.150478688
 [31] -1.278602175 -1.091835324  1.015357247 -0.816408214  0.999655279
 [36] -0.894243128  0.573874045 -0.043108847  0.391507160  0.329388220
 [41]  0.066797678  0.513966875 -0.445482117  0.336369596 -0.890995190
 [46]  1.008441899 -0.928550359  0.275092889 -0.878114615 -0.766180088
 [51]  0.167956434  1.036391794 -0.475764537 -0.337955293 -1.167641951
 [56] -1.456232050  1.119253758 -1.543255432  0.559674322  0.866522867
 [61]  0.933489623  0.495719173 -0.235569747 -0.198986137  1.666604706
 [66] -1.247463327 -1.092932146  1.282251588 -0.162181040 -1.520219622
 [71]  2.696745257  0.227924761 -1.471520989  0.757254041 -0.350334759
 [76]  1.986359375  1.236582920 -0.676719101  0.608182045 -0.201714331
 [81] -0.381061980  0.890059252  0.401532053  1.038549001  0.218719535
 [86]  1.485286638 -1.588019637  0.248827584 -0.700744560  0.720861077
 [91] -0.021777486  1.275481584 -3.677736429  0.551833739 -0.144597804
 [96]  0.690735616 -0.004894583  1.149187688 -1.205410211  0.589489316
> 
> colMeans(tmp2)
[1] 0.02287255
> colSums(tmp2)
[1] 2.287255
> colVars(tmp2)
[1] 0.9893844
> colSd(tmp2)
[1] 0.994678
> colMax(tmp2)
[1] 2.696745
> colMin(tmp2)
[1] -3.677736
> colMedians(tmp2)
[1] 0.06447205
> colRanges(tmp2)
          [,1]
[1,] -3.677736
[2,]  2.696745
> 
> 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] -2.8995159  0.6650059  5.2232437  1.5972328 -0.2614368 -6.8086459
 [7] -1.4234771  5.2886617  0.3918920  1.4688550
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.3382085
[2,] -1.0396877
[3,] -0.6301094
[4,]  0.3892783
[5,]  1.1683904
> 
> rowApply(tmp,sum)
 [1]  3.4940447  5.5239693 -0.9204739 -5.0128249  0.9042780 -5.0676575
 [7]  5.4811449 -0.1682996 -3.3032802  2.3109146
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    3    6    2    5    4   10    5    7    3     1
 [2,]    2    8    7    8    8    5    4    4   10     2
 [3,]   10    7    4   10    6    1    6   10    8     8
 [4,]    7    4    6    4    7    9    1    6    5     7
 [5,]    6    5    5    6    1    6    7    8    1    10
 [6,]    4    2    1    1    9    2    2    1    6     3
 [7,]    5    3    9    2    5    4    8    3    7     6
 [8,]    9   10   10    3   10    8    3    5    2     9
 [9,]    1    9    8    7    2    3    9    9    4     4
[10,]    8    1    3    9    3    7   10    2    9     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.4152669  1.4709072  3.3530551  1.2195784 -1.1819831  2.2589827
 [7] -1.3918401  0.7697653 -2.2586616 -1.4040265  2.8491639  0.7694653
[13]  0.4219500 -1.2728439  1.2138260 -1.4603095 -1.7271103  1.6606298
[19] -0.1186446  2.0915200
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.49712238
[2,]  0.07191767
[3,]  0.09900663
[4,]  0.13654560
[5,]  1.60491937
> 
> rowApply(tmp,sum)
[1]  1.7655574  4.9861655 -0.7497904  1.5521678  1.1245909
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   10    9    7    9   20
[2,]    2   15   13   13   15
[3,]   17   12   18    8   16
[4,]    3    4   19    7   19
[5,]    7    5    2   19   10
> 
> 
> as.matrix(tmp)
            [,1]       [,2]        [,3]       [,4]       [,5]        [,6]
[1,]  0.07191767 -1.0671541  0.78982467 -0.6447088 -0.1485345 0.245481508
[2,]  0.13654560  1.0233608  0.49837632 -0.6035765 -0.5631137 1.036575456
[3,] -0.49712238  0.2533194  1.30846987  1.5011991 -1.3830120 0.406220630
[4,]  0.09900663  0.5160396 -0.02868343 -0.1670266  1.1177548 0.564525624
[5,]  1.60491937  0.7453414  0.78506769  1.1336913 -0.2050776 0.006179495
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -1.2976384  1.6762175  0.3176343 -0.5404507 0.93947936  0.8700740
[2,]  0.5795330  1.2057369  1.0320012  0.3989353 0.02077604 -0.6370724
[3,]  0.2401877 -1.0876369 -0.7712984 -2.5826230 0.46795956  1.7183164
[4,] -0.4758789 -0.7200097 -2.1671788  0.3723004 1.07696032 -0.4757768
[5,] -0.4380435 -0.3045425 -0.6698199  0.9478115 0.34398862 -0.7060759
          [,13]      [,14]      [,15]       [,16]      [,17]       [,18]
[1,]  0.1974947 -0.6145480  0.5341975  0.04237927 -0.6162232  0.04642736
[2,] -0.1312512 -1.1470475  1.3485812  0.14972454 -0.8297560  1.10863483
[3,] -0.4771392  0.1531756 -0.5640332 -1.00434131  0.8694539  0.76932108
[4,]  0.6450453  0.5477163 -1.1279639  0.35199652 -0.6008719  0.52904796
[5,]  0.1878004 -0.2121403  1.0230445 -1.00006849 -0.5497131 -0.79280141
           [,19]       [,20]
[1,]  0.60881005  0.35487723
[2,] -0.22502728  0.58422890
[3,] -0.04336356 -0.02684366
[4,]  0.33380299  1.16136133
[5,] -0.79286681  0.01789624
> 
> 
> 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.5747489 1.396297 0.564528 1.831638 -0.1172354 -0.3417916 1.712568
          col8      col9    col10     col11    col12     col13     col14
row1 0.6319314 0.4720538 -2.28236 0.3983027 1.029921 -1.591349 -2.496218
         col15     col16     col17      col18     col19      col20
row1 0.2695184 -1.405935 0.6330266 -0.6868307 0.2735756 -0.1706008
> tmp[,"col10"]
          col10
row1 -2.2823598
row2 -1.1188858
row3  1.1424093
row4  0.6431758
row5 -1.4704353
> tmp[c("row1","row5"),]
           col1       col2       col3      col4       col5       col6
row1  0.5747489  1.3962971  0.5645280 1.8316378 -0.1172354 -0.3417916
row5 -0.7611302 -0.1291203 -0.2249333 0.8664564  0.8505494  1.6048665
           col7      col8         col9     col10      col11     col12     col13
row1  1.7125683 0.6319314  0.472053831 -2.282360 0.39830269  1.029921 -1.591349
row5 -0.5018058 0.4186284 -0.002926187 -1.470435 0.04388613 -1.045607  0.960067
         col14     col15      col16      col17      col18       col19
row1 -2.496218 0.2695184 -1.4059346  0.6330266 -0.6868307  0.27357559
row5  1.537016 0.1873494  0.1619864 -0.4366525  1.1091324 -0.07921675
          col20
row1 -0.1706008
row5  0.6666293
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.3417916 -0.1706008
row2 -0.4974301  0.6933254
row3 -0.6519809 -1.4978080
row4 -0.6133431  0.4768426
row5  1.6048665  0.6666293
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.3417916 -0.1706008
row5  1.6048665  0.6666293
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7    col8
row1 51.18761 49.64498 49.14033 49.16942 48.66002 104.4495 49.65264 49.3659
         col9    col10 col11    col12    col13    col14    col15    col16
row1 50.33918 51.30681 51.59 49.81637 49.95847 50.35442 50.72481 49.68026
        col17    col18    col19   col20
row1 49.39146 51.44749 49.42359 104.932
> tmp[,"col10"]
        col10
row1 51.30681
row2 29.03472
row3 29.76731
row4 30.75401
row5 49.73577
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.18761 49.64498 49.14033 49.16942 48.66002 104.4495 49.65264 49.36590
row5 47.24641 49.36349 50.45000 50.87489 48.54159 105.7155 49.33189 49.07115
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.33918 51.30681 51.59000 49.81637 49.95847 50.35442 50.72481 49.68026
row5 50.17052 49.73577 48.45328 50.36196 52.97222 49.21557 49.58822 51.14023
        col17    col18    col19    col20
row1 49.39146 51.44749 49.42359 104.9320
row5 50.05365 49.63550 50.29756 104.4318
> tmp[,c("col6","col20")]
          col6     col20
row1 104.44946 104.93198
row2  75.60088  75.26968
row3  75.63572  75.34729
row4  75.21537  76.21852
row5 105.71549 104.43179
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.4495 104.9320
row5 105.7155 104.4318
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.4495 104.9320
row5 105.7155 104.4318
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.7987841
[2,]  1.4291924
[3,]  0.9578570
[4,] -1.0525941
[5,] -0.9543497
> tmp[,c("col17","col7")]
           col17       col7
[1,]  1.37598844 -0.7618312
[2,] -0.45266860 -1.2870213
[3,]  0.08601536  2.3535276
[4,] -0.79504103  0.3957885
[5,] -1.32365053  0.5276792
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.3712317 -0.1749676
[2,]  0.2797962  1.7077267
[3,]  2.1815054  0.9839427
[4,] -0.6602560  0.8335026
[5,]  0.6001646  1.5009145
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.3712317
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.3712317
[2,] 0.2797962
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
            [,1]       [,2]      [,3]     [,4]       [,5]       [,6]       [,7]
row3 -0.14234095 -1.6039206  0.169875  0.53579 -0.4477732  0.9319960 -0.3449282
row1  0.04801073 -0.6084431 -1.244094 -1.08033  0.6046920 -0.2776777 -1.8496205
           [,8]        [,9]      [,10]     [,11]      [,12]      [,13]
row3 -0.3099385 -0.99494961  1.3890662 0.8161846  0.6369375 -0.6794703
row1 -0.3781968 -0.06447619 -0.8546881 1.2280529 -0.9253382 -2.3801591
          [,14]      [,15]     [,16]      [,17]     [,18]      [,19]     [,20]
row3  0.8402945 -0.2505784 0.1597793 -1.9004195 0.1722902  1.9957175 0.2154881
row1 -0.6383354 -0.6611162 1.2350034  0.9341827 0.2252876 -0.2889196 1.6919516
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]        [,2]       [,3]    [,4]       [,5]    [,6]      [,7]
row2 -1.24793 -0.04379206 -0.9262503 1.49331 -0.8179079 1.61603 0.0532483
          [,8]       [,9]      [,10]
row2 -1.536584 -0.3817394 -0.2331654
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]      [,3]      [,4]      [,5]       [,6]      [,7]
row5 0.1675864 0.3267241 0.6206062 -1.118017 0.5514612 -0.6544769 0.1099508
           [,8]      [,9]     [,10]   [,11]      [,12]      [,13]     [,14]
row5 -0.5398518 -2.491217 0.5317679 1.17893 -0.2737777 -0.1401561 0.2373613
         [,15]      [,16]    [,17]      [,18]     [,19]      [,20]
row5 -1.175047 0.06392717 1.804218 -0.5613185 -1.811452 0.05843792
> 
> 
> 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: 0x618961d8dca0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed150b5114"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed1e2095af"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed1ffec580"
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed51ad7f14"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed44f3cf97"
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed6dd20654"
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed230cae27"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed45103dec"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694eda7bcd92" 
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed580771da"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed4d4659ac"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed2ca99eb0"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed311b454d"
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed3248190f"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM3694ed5892f912"
> 
> 
> ### 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: 0x61896206afe0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x61896206afe0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x61896206afe0>
> rowMedians(tmp)
  [1] -0.141916737  0.413924298 -0.389761128 -0.444671822  0.876238142
  [6] -0.274095290 -0.306077746  0.291821161 -0.116804378 -0.198327979
 [11] -0.344549329  0.260670056 -0.026338893 -0.114355859 -0.027449996
 [16]  0.068209421  0.475043273 -0.282442536 -0.100689903  0.066807118
 [21]  0.242252948 -0.372234285  0.056982557 -0.053267217  0.368861120
 [26]  0.425084129 -0.116004153 -0.175246714  0.087966649 -0.136300493
 [31]  0.293408274  0.041430923  0.676789071  0.520668437 -0.236746272
 [36] -0.741379071  0.378916190  0.435469207 -0.059896169  0.058798854
 [41] -0.098688558  0.031324437  0.074016346  0.767997930 -0.138948558
 [46]  0.211993347 -0.020497295 -0.049596524 -0.104745483 -0.002752440
 [51]  0.256258643 -0.069605724 -0.070949852  0.480086289 -0.087988533
 [56] -0.278083460  0.385471414  0.332471252 -0.451785278 -0.927608666
 [61]  0.543840262  0.121452417  0.230373612  0.048911647 -0.572414733
 [66]  0.152095755  0.418865433  0.062546589 -0.071384335  0.548995792
 [71]  0.371227647  0.037281245  0.290562800  0.122764946 -0.201184890
 [76]  0.103979506  0.073512359  0.095638212 -0.349406325 -0.262151566
 [81] -0.322108644 -0.058885933  1.156871997 -0.094860398 -0.399008013
 [86]  0.767242339  0.828999160 -0.152434773  0.407577913  0.419452369
 [91] -0.192963670  0.265379851  0.028960866  0.118415536  0.310037056
 [96]  0.261621157  0.353100484  0.380119550  0.237406266 -0.501752662
[101] -0.510637942  0.261658128 -0.189144554 -0.031126126 -0.386183567
[106]  0.237485106 -0.547499550 -0.105706548 -0.041686156 -0.324660752
[111]  0.338943228  0.294560418 -0.881127500 -0.033161543  0.276714001
[116]  0.120268590  0.122397242 -0.125069552 -0.028520781 -0.072978457
[121] -0.393822850  0.516291473  0.004310044 -0.114671632 -0.737421123
[126] -0.319469706  0.112471771 -0.181054632 -0.134097959 -0.396620860
[131] -0.334004762  0.123085611 -0.083736334  0.683832002  0.130511393
[136]  0.240430577  0.069137812 -0.117130994 -0.559370749 -0.270395180
[141] -0.639305606  0.193891564 -0.010985836 -0.040420527 -0.263917444
[146]  0.423187901  0.281803056  0.428385501 -0.223010302  0.241554296
[151] -0.625384795 -0.051478466  0.118622042  0.055548067 -0.151735847
[156]  0.094256575  0.211515636 -0.042573175 -0.552896409 -0.013933163
[161] -0.246336229  0.184889302  0.357792340  0.148563139  0.275866142
[166] -0.107847663  0.314696327 -0.221314607 -0.131716581 -0.363552310
[171]  0.194058759 -0.134018156 -0.275969519  0.412598853  0.301580214
[176]  0.083403930  0.132955655  0.563808969  0.102829572 -0.561348811
[181] -0.472519016 -0.015943504  0.303633803 -0.380676769 -0.059615106
[186] -0.167925737  0.490202106  0.224308182  0.154261879 -0.110787636
[191] -0.186399486  0.340669856  0.001640992 -0.123253425 -0.098717177
[196] -0.101763164  0.144196505 -0.268077346 -0.308914430  0.605318486
[201]  0.067744504 -0.054684365 -0.484750950  0.143263004  0.188301904
[206] -0.158679937 -0.168375192  0.020180945 -0.604600776 -0.061599428
[211] -0.048253957 -0.716526253  0.275926590  0.078593938 -0.067858903
[216]  0.209902585 -0.162037056 -0.543637500  0.258980706 -0.004988111
[221] -0.027407014 -0.187878058 -0.135886342  0.810416818 -0.177471953
[226] -0.371603380 -0.332755217 -0.282592665 -0.022909023 -0.255449869
> 
> proc.time()
   user  system elapsed 
  1.261   0.693   1.941 

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: 0x588641107370>
> .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: 0x588641107370>
> .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: 0x588641107370>
> .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: 0x588641107370>
> 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: 0x5886410ef1c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5886410ef1c0>
> .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: 0x5886410ef1c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5886410ef1c0>
> .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: 0x5886410ef1c0>
> 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: 0x5886413d2120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5886413d2120>
> .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: 0x5886413d2120>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5886413d2120>
> .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: 0x5886413d2120>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5886413d2120>
> .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: 0x5886413d2120>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5886413d2120>
> .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: 0x5886413d2120>
> 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: 0x588640122390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x588640122390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x588640122390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x588640122390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3695ce34a938c1" "BufferedMatrixFile3695ce6ad35ee3"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3695ce34a938c1" "BufferedMatrixFile3695ce6ad35ee3"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5886400193d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5886400193d0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5886400193d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5886400193d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5886400193d0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5886400193d0>
> .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: 0x588641b4efa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x588641b4efa0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x588641b4efa0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x588641b4efa0>
> 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: 0x588640326ff0>
> .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: 0x588640326ff0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.253   0.053   0.293 

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.251   0.037   0.276 

Example timings