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

This page was generated on 2025-12-11 11:35 -0500 (Thu, 11 Dec 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.3 LTS)x86_64R Under development (unstable) (2025-10-20 r88955) -- "Unsuffered Consequences" 4872
kjohnson3macOS 13.7.7 Venturaarm64R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences" 4580
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 253/2331HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.75.0  (landing page)
Ben Bolstad
Snapshot Date: 2025-12-10 13:40 -0500 (Wed, 10 Dec 2025)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: ecdbf23
git_last_commit_date: 2025-10-29 09:58:55 -0500 (Wed, 29 Oct 2025)
nebbiolo1Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.7.7 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published


CHECK results for BufferedMatrix on kjohnson3

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.75.0
Command: /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings BufferedMatrix_1.75.0.tar.gz
StartedAt: 2025-12-10 19:03:18 -0500 (Wed, 10 Dec 2025)
EndedAt: 2025-12-10 19:03:39 -0500 (Wed, 10 Dec 2025)
EllapsedTime: 21.3 seconds
RetCode: 0
Status:   WARNINGS  
CheckDir: BufferedMatrix.Rcheck
Warnings: 1

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings BufferedMatrix_1.75.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2025-11-04 r88984)
* using platform: aarch64-apple-darwin20
* R was compiled by
    Apple clang version 16.0.0 (clang-1600.0.26.6)
    GNU Fortran (GCC) 14.2.0
* running under: macOS Ventura 13.7.8
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.75.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 ... WARNING
Found the following significant warnings:
  doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
See ‘/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/00install.out’ for details.
* used C compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
* used SDK: ‘MacOSX11.3.1.sdk’
* 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 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 ... INFO
Note: information on .o files is not available
* checking sizes of PDF files under ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 1 WARNING, 1 NOTE
See
  ‘/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/Library/Frameworks/R.framework/Versions/4.6-arm64/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.75.0’
** using staged installation
** libs
using C compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
using SDK: ‘MacOSX11.3.1.sdk’
clang -arch arm64 -std=gnu2x -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -arch arm64 -std=gnu2x -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ~
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -arch arm64 -std=gnu2x -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -arch arm64 -std=gnu2x -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c init_package.c -o init_package.o
clang -arch arm64 -std=gnu2x -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R
installing to /Library/Frameworks/R.framework/Versions/4.6-arm64/Resources/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 Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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.131   0.047   0.178 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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] "/Users/biocbuild/bbs-3.23-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) limit (Mb) max used (Mb)
Ncells 481248 25.8    1058085 56.6         NA   633817 33.9
Vcells 891449  6.9    8388608 64.0     196608  2110969 16.2
> 
> 
> 
> 
> ##
> ## 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] "Wed Dec 10 19:03:30 2025"
> 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] "Wed Dec 10 19:03:30 2025"
> 
> 
> 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: 0x6000012c8000>
> 
> 
> 
> 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] "Wed Dec 10 19:03:32 2025"
> 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] "Wed Dec 10 19:03:32 2025"
> 
> ColMode(tmp2)
<pointer: 0x6000012c8000>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]        [,3]       [,4]
[1,] 100.8185700 -0.0727743 -0.05708602  0.8933339
[2,]   0.1603520  0.4517772  1.29965636  0.5072287
[3,]   0.8652339 -1.8037324 -0.98904791 -0.4761152
[4,]   1.0785185 -0.5302684 -1.16177162  0.7266936
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]       [,3]      [,4]
[1,] 100.8185700 0.0727743 0.05708602 0.8933339
[2,]   0.1603520 0.4517772 1.29965636 0.5072287
[3,]   0.8652339 1.8037324 0.98904791 0.4761152
[4,]   1.0785185 0.5302684 1.16177162 0.7266936
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0408451 0.2697671 0.2389268 0.9451634
[2,]  0.4004397 0.6721437 1.1400247 0.7121999
[3,]  0.9301795 1.3430311 0.9945089 0.6900110
[4,]  1.0385174 0.7281953 1.0778551 0.8524633
> 
> 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:    /Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 226.22702 27.77045 27.44635 35.34497
[2,]  29.16475 32.17321 37.69990 32.62923
[3,]  35.16703 40.23404 35.93414 32.37623
[4,]  36.46369 32.81222 36.94032 34.25133
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x6000012c8060>
> exp(tmp5)
<pointer: 0x6000012c8060>
> log(tmp5,2)
<pointer: 0x6000012c8060>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.8619
> Min(tmp5)
[1] 52.514
> mean(tmp5)
[1] 71.71923
> Sum(tmp5)
[1] 14343.85
> Var(tmp5)
[1] 877.8199
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.48594 66.89651 73.54740 71.61687 70.91084 65.40736 66.78255 67.90211
 [9] 74.07636 67.56638
> rowSums(tmp5)
 [1] 1849.719 1337.930 1470.948 1432.337 1418.217 1308.147 1335.651 1358.042
 [9] 1481.527 1351.328
> rowVars(tmp5)
 [1] 8054.98896   42.60644   52.96787   78.75690   87.75881   74.08852
 [7]   39.76310   67.03135   63.21084   43.25231
> rowSd(tmp5)
 [1] 89.749590  6.527361  7.277903  8.874509  9.367967  8.607469  6.305799
 [8]  8.187267  7.950524  6.576649
> rowMax(tmp5)
 [1] 470.86190  79.49944  89.92112  88.19035  82.30466  80.19044  77.14591
 [8]  86.64750  86.69794  79.40339
> rowMin(tmp5)
 [1] 56.37672 57.91141 62.28510 54.55573 55.92553 53.85824 52.51400 57.41018
 [9] 57.76989 57.94010
> 
> colMeans(tmp5)
 [1] 108.89389  67.02507  74.24967  69.26592  69.54369  67.33350  69.11647
 [8]  72.73955  69.19876  70.02981  68.85469  70.68238  66.89460  71.52492
[15]  70.58678  70.97640  65.69654  71.74613  72.16008  67.86580
> colSums(tmp5)
 [1] 1088.9389  670.2507  742.4967  692.6592  695.4369  673.3350  691.1647
 [8]  727.3955  691.9876  700.2981  688.5469  706.8238  668.9460  715.2492
[15]  705.8678  709.7640  656.9654  717.4613  721.6008  678.6580
> colVars(tmp5)
 [1] 16237.48939    89.21341    54.73976    17.92113    20.62740   114.84216
 [7]    45.25744   122.87789    95.52859    56.88500   112.62160    65.79964
[13]   121.98529    59.44846   121.32935    41.99117   103.25154    57.42703
[19]    50.46397   105.26304
> colSd(tmp5)
 [1] 127.426408   9.445285   7.398632   4.233335   4.541740  10.716443
 [7]   6.727365  11.085030   9.773873   7.542215  10.612333   8.111698
[13]  11.044695   7.710283  11.014960   6.480060  10.161277   7.578063
[19]   7.103800  10.259778
> colMax(tmp5)
 [1] 470.86190  83.74189  83.14833  77.14591  79.28481  89.92112  82.07164
 [8]  94.06866  86.69794  82.30466  86.64750  80.19044  93.72018  83.85682
[15]  85.04740  83.67828  80.09987  82.66117  82.45901  88.19035
> colMin(tmp5)
 [1] 57.21993 55.81298 57.12599 62.09338 63.54003 54.28911 61.90566 58.86806
 [9] 55.92553 59.62639 54.55573 56.97269 57.51751 57.76989 53.85824 61.67087
[17] 52.51400 56.37672 60.16098 56.81998
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 92.48594 66.89651 73.54740 71.61687 70.91084 65.40736 66.78255 67.90211
 [9]       NA 67.56638
> rowSums(tmp5)
 [1] 1849.719 1337.930 1470.948 1432.337 1418.217 1308.147 1335.651 1358.042
 [9]       NA 1351.328
> rowVars(tmp5)
 [1] 8054.98896   42.60644   52.96787   78.75690   87.75881   74.08852
 [7]   39.76310   67.03135   66.33302   43.25231
> rowSd(tmp5)
 [1] 89.749590  6.527361  7.277903  8.874509  9.367967  8.607469  6.305799
 [8]  8.187267  8.144508  6.576649
> rowMax(tmp5)
 [1] 470.86190  79.49944  89.92112  88.19035  82.30466  80.19044  77.14591
 [8]  86.64750        NA  79.40339
> rowMin(tmp5)
 [1] 56.37672 57.91141 62.28510 54.55573 55.92553 53.85824 52.51400 57.41018
 [9]       NA 57.94010
> 
> colMeans(tmp5)
 [1] 108.89389  67.02507  74.24967  69.26592  69.54369        NA  69.11647
 [8]  72.73955  69.19876  70.02981  68.85469  70.68238  66.89460  71.52492
[15]  70.58678  70.97640  65.69654  71.74613  72.16008  67.86580
> colSums(tmp5)
 [1] 1088.9389  670.2507  742.4967  692.6592  695.4369        NA  691.1647
 [8]  727.3955  691.9876  700.2981  688.5469  706.8238  668.9460  715.2492
[15]  705.8678  709.7640  656.9654  717.4613  721.6008  678.6580
> colVars(tmp5)
 [1] 16237.48939    89.21341    54.73976    17.92113    20.62740          NA
 [7]    45.25744   122.87789    95.52859    56.88500   112.62160    65.79964
[13]   121.98529    59.44846   121.32935    41.99117   103.25154    57.42703
[19]    50.46397   105.26304
> colSd(tmp5)
 [1] 127.426408   9.445285   7.398632   4.233335   4.541740         NA
 [7]   6.727365  11.085030   9.773873   7.542215  10.612333   8.111698
[13]  11.044695   7.710283  11.014960   6.480060  10.161277   7.578063
[19]   7.103800  10.259778
> colMax(tmp5)
 [1] 470.86190  83.74189  83.14833  77.14591  79.28481        NA  82.07164
 [8]  94.06866  86.69794  82.30466  86.64750  80.19044  93.72018  83.85682
[15]  85.04740  83.67828  80.09987  82.66117  82.45901  88.19035
> colMin(tmp5)
 [1] 57.21993 55.81298 57.12599 62.09338 63.54003       NA 61.90566 58.86806
 [9] 55.92553 59.62639 54.55573 56.97269 57.51751 57.76989 53.85824 61.67087
[17] 52.51400 56.37672 60.16098 56.81998
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.8619
> Min(tmp5,na.rm=TRUE)
[1] 52.514
> mean(tmp5,na.rm=TRUE)
[1] 71.69442
> Sum(tmp5,na.rm=TRUE)
[1] 14267.19
> Var(tmp5,na.rm=TRUE)
[1] 882.1296
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.48594 66.89651 73.54740 71.61687 70.91084 65.40736 66.78255 67.90211
 [9] 73.94053 67.56638
> rowSums(tmp5,na.rm=TRUE)
 [1] 1849.719 1337.930 1470.948 1432.337 1418.217 1308.147 1335.651 1358.042
 [9] 1404.870 1351.328
> rowVars(tmp5,na.rm=TRUE)
 [1] 8054.98896   42.60644   52.96787   78.75690   87.75881   74.08852
 [7]   39.76310   67.03135   66.33302   43.25231
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.749590  6.527361  7.277903  8.874509  9.367967  8.607469  6.305799
 [8]  8.187267  8.144508  6.576649
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.86190  79.49944  89.92112  88.19035  82.30466  80.19044  77.14591
 [8]  86.64750  86.69794  79.40339
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.37672 57.91141 62.28510 54.55573 55.92553 53.85824 52.51400 57.41018
 [9] 57.76989 57.94010
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 108.89389  67.02507  74.24967  69.26592  69.54369  66.29753  69.11647
 [8]  72.73955  69.19876  70.02981  68.85469  70.68238  66.89460  71.52492
[15]  70.58678  70.97640  65.69654  71.74613  72.16008  67.86580
> colSums(tmp5,na.rm=TRUE)
 [1] 1088.9389  670.2507  742.4967  692.6592  695.4369  596.6778  691.1647
 [8]  727.3955  691.9876  700.2981  688.5469  706.8238  668.9460  715.2492
[15]  705.8678  709.7640  656.9654  717.4613  721.6008  678.6580
> colVars(tmp5,na.rm=TRUE)
 [1] 16237.48939    89.21341    54.73976    17.92113    20.62740   117.12346
 [7]    45.25744   122.87789    95.52859    56.88500   112.62160    65.79964
[13]   121.98529    59.44846   121.32935    41.99117   103.25154    57.42703
[19]    50.46397   105.26304
> colSd(tmp5,na.rm=TRUE)
 [1] 127.426408   9.445285   7.398632   4.233335   4.541740  10.822359
 [7]   6.727365  11.085030   9.773873   7.542215  10.612333   8.111698
[13]  11.044695   7.710283  11.014960   6.480060  10.161277   7.578063
[19]   7.103800  10.259778
> colMax(tmp5,na.rm=TRUE)
 [1] 470.86190  83.74189  83.14833  77.14591  79.28481  89.92112  82.07164
 [8]  94.06866  86.69794  82.30466  86.64750  80.19044  93.72018  83.85682
[15]  85.04740  83.67828  80.09987  82.66117  82.45901  88.19035
> colMin(tmp5,na.rm=TRUE)
 [1] 57.21993 55.81298 57.12599 62.09338 63.54003 54.28911 61.90566 58.86806
 [9] 55.92553 59.62639 54.55573 56.97269 57.51751 57.76989 53.85824 61.67087
[17] 52.51400 56.37672 60.16098 56.81998
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.48594 66.89651 73.54740 71.61687 70.91084 65.40736 66.78255 67.90211
 [9]      NaN 67.56638
> rowSums(tmp5,na.rm=TRUE)
 [1] 1849.719 1337.930 1470.948 1432.337 1418.217 1308.147 1335.651 1358.042
 [9]    0.000 1351.328
> rowVars(tmp5,na.rm=TRUE)
 [1] 8054.98896   42.60644   52.96787   78.75690   87.75881   74.08852
 [7]   39.76310   67.03135         NA   43.25231
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.749590  6.527361  7.277903  8.874509  9.367967  8.607469  6.305799
 [8]  8.187267        NA  6.576649
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.86190  79.49944  89.92112  88.19035  82.30466  80.19044  77.14591
 [8]  86.64750        NA  79.40339
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.37672 57.91141 62.28510 54.55573 55.92553 53.85824 52.51400 57.41018
 [9]       NA 57.94010
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.28592  66.54956  73.26093  70.06287  69.51180       NaN  69.43518
 [8]  71.48227  67.25441  69.69876  67.36639  70.78144  66.94624  73.05325
[15]  69.12543  70.83684  64.32348  70.53335  72.15258  67.18835
> colSums(tmp5,na.rm=TRUE)
 [1] 1019.5733  598.9460  659.3483  630.5659  625.6062    0.0000  624.9167
 [8]  643.3405  605.2897  627.2888  606.2975  637.0330  602.5161  657.4793
[15]  622.1288  637.5315  578.9113  634.8001  649.3733  604.6952
> colVars(tmp5,na.rm=TRUE)
 [1] 18050.16401    97.82130    50.58415    13.01607    23.19439          NA
 [7]    49.77187   120.45414    64.93895    62.76269   101.78017    73.91419
[13]   137.20346    40.60161   112.47040    47.02095    94.94847    48.05845
[19]    56.77133   113.25788
> colSd(tmp5,na.rm=TRUE)
 [1] 134.350899   9.890465   7.112253   3.607780   4.816056         NA
 [7]   7.054918  10.975160   8.058471   7.922291  10.088616   8.597336
[13]  11.713388   6.371940  10.605206   6.857183   9.744151   6.932420
[19]   7.534675  10.642269
> colMax(tmp5,na.rm=TRUE)
 [1] 470.86190  83.74189  79.40339  77.14591  79.28481      -Inf  82.07164
 [8]  94.06866  78.61033  82.30466  86.64750  80.19044  93.72018  83.85682
[15]  85.04740  83.67828  80.09987  81.44229  82.45901  88.19035
> colMin(tmp5,na.rm=TRUE)
 [1] 57.21993 55.81298 57.12599 65.51019 63.54003      Inf 61.90566 58.86806
 [9] 55.92553 59.62639 54.55573 56.97269 57.51751 63.33873 53.85824 61.67087
[17] 52.51400 56.37672 60.16098 56.81998
> 
> 
> 
> 
> 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] 185.1173 189.3582 288.9459 305.3949 250.6351 176.0725 176.1396 125.7088
 [9] 337.0212 196.3884
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 185.1173 189.3582 288.9459 305.3949 250.6351 176.0725 176.1396 125.7088
 [9] 337.0212 196.3884
> 
> 
> 
> 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.705303e-13  0.000000e+00 -2.842171e-13 -8.526513e-14
 [6]  0.000000e+00 -1.136868e-13  2.842171e-13 -2.273737e-13 -4.547474e-13
[11] -2.842171e-14  5.684342e-14 -5.684342e-14  1.136868e-13  0.000000e+00
[16] -1.136868e-13  2.842171e-14  1.705303e-13  0.000000e+00 -2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
6   19 
3   16 
2   16 
8   8 
10   16 
3   10 
1   9 
2   20 
4   14 
3   10 
3   7 
7   10 
10   17 
10   13 
6   7 
1   18 
10   16 
7   11 
3   13 
5   12 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.709649
> Min(tmp)
[1] -3.001734
> mean(tmp)
[1] -0.01804431
> Sum(tmp)
[1] -1.804431
> Var(tmp)
[1] 0.8952866
> 
> rowMeans(tmp)
[1] -0.01804431
> rowSums(tmp)
[1] -1.804431
> rowVars(tmp)
[1] 0.8952866
> rowSd(tmp)
[1] 0.9461959
> rowMax(tmp)
[1] 2.709649
> rowMin(tmp)
[1] -3.001734
> 
> colMeans(tmp)
  [1] -1.07833023  0.60225431  0.84016311 -0.84114717  1.23340641 -0.77813648
  [7] -0.38081020 -0.12667482 -1.45470913 -0.59846846  0.86278333  1.31591468
 [13] -0.13065838  0.55653953 -1.56692096  0.35079680 -0.09151312 -0.06998115
 [19]  0.13994883  0.59980574 -0.48331109 -0.35360263 -0.20004488 -0.83400555
 [25]  0.18194234  1.30326300 -1.58645448 -0.34926438 -0.35973591 -0.95821805
 [31] -0.41969490 -0.63813690  0.63352484 -1.54140006  0.54640699  0.87335288
 [37] -0.77865369 -1.22683544 -1.37884139 -0.32178670 -1.07440292  0.66300319
 [43] -0.25620907  2.70964855 -0.85875384 -0.74998224 -0.49109686  0.64650816
 [49]  0.72121342 -0.98473373 -1.18562195  0.40267341 -0.77945570  0.37257090
 [55]  1.66294901  0.51624484  0.80068746  1.41426823  0.47225962 -1.12788777
 [61] -0.50143853  1.30075456 -0.20046987 -0.16183472 -0.49393522 -0.86153348
 [67]  1.21794123  0.29460923  1.10986789 -0.45252433  0.09435502 -1.19048056
 [73]  0.31976928 -3.00173381 -1.32058700  0.77866205  0.62683133  2.46843986
 [79] -0.30974777 -0.66427070 -0.03234638  1.06779115 -1.87279775 -0.26124367
 [85] -0.36630117  0.03001056  0.66590675  0.70989057 -0.51665479  0.47280989
 [91] -0.31513742  0.41976081  1.19121607  0.33647972  0.44275316  0.39734170
 [97]  1.15801324 -0.72857674  1.07304197  0.90428803
> colSums(tmp)
  [1] -1.07833023  0.60225431  0.84016311 -0.84114717  1.23340641 -0.77813648
  [7] -0.38081020 -0.12667482 -1.45470913 -0.59846846  0.86278333  1.31591468
 [13] -0.13065838  0.55653953 -1.56692096  0.35079680 -0.09151312 -0.06998115
 [19]  0.13994883  0.59980574 -0.48331109 -0.35360263 -0.20004488 -0.83400555
 [25]  0.18194234  1.30326300 -1.58645448 -0.34926438 -0.35973591 -0.95821805
 [31] -0.41969490 -0.63813690  0.63352484 -1.54140006  0.54640699  0.87335288
 [37] -0.77865369 -1.22683544 -1.37884139 -0.32178670 -1.07440292  0.66300319
 [43] -0.25620907  2.70964855 -0.85875384 -0.74998224 -0.49109686  0.64650816
 [49]  0.72121342 -0.98473373 -1.18562195  0.40267341 -0.77945570  0.37257090
 [55]  1.66294901  0.51624484  0.80068746  1.41426823  0.47225962 -1.12788777
 [61] -0.50143853  1.30075456 -0.20046987 -0.16183472 -0.49393522 -0.86153348
 [67]  1.21794123  0.29460923  1.10986789 -0.45252433  0.09435502 -1.19048056
 [73]  0.31976928 -3.00173381 -1.32058700  0.77866205  0.62683133  2.46843986
 [79] -0.30974777 -0.66427070 -0.03234638  1.06779115 -1.87279775 -0.26124367
 [85] -0.36630117  0.03001056  0.66590675  0.70989057 -0.51665479  0.47280989
 [91] -0.31513742  0.41976081  1.19121607  0.33647972  0.44275316  0.39734170
 [97]  1.15801324 -0.72857674  1.07304197  0.90428803
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -1.07833023  0.60225431  0.84016311 -0.84114717  1.23340641 -0.77813648
  [7] -0.38081020 -0.12667482 -1.45470913 -0.59846846  0.86278333  1.31591468
 [13] -0.13065838  0.55653953 -1.56692096  0.35079680 -0.09151312 -0.06998115
 [19]  0.13994883  0.59980574 -0.48331109 -0.35360263 -0.20004488 -0.83400555
 [25]  0.18194234  1.30326300 -1.58645448 -0.34926438 -0.35973591 -0.95821805
 [31] -0.41969490 -0.63813690  0.63352484 -1.54140006  0.54640699  0.87335288
 [37] -0.77865369 -1.22683544 -1.37884139 -0.32178670 -1.07440292  0.66300319
 [43] -0.25620907  2.70964855 -0.85875384 -0.74998224 -0.49109686  0.64650816
 [49]  0.72121342 -0.98473373 -1.18562195  0.40267341 -0.77945570  0.37257090
 [55]  1.66294901  0.51624484  0.80068746  1.41426823  0.47225962 -1.12788777
 [61] -0.50143853  1.30075456 -0.20046987 -0.16183472 -0.49393522 -0.86153348
 [67]  1.21794123  0.29460923  1.10986789 -0.45252433  0.09435502 -1.19048056
 [73]  0.31976928 -3.00173381 -1.32058700  0.77866205  0.62683133  2.46843986
 [79] -0.30974777 -0.66427070 -0.03234638  1.06779115 -1.87279775 -0.26124367
 [85] -0.36630117  0.03001056  0.66590675  0.70989057 -0.51665479  0.47280989
 [91] -0.31513742  0.41976081  1.19121607  0.33647972  0.44275316  0.39734170
 [97]  1.15801324 -0.72857674  1.07304197  0.90428803
> colMin(tmp)
  [1] -1.07833023  0.60225431  0.84016311 -0.84114717  1.23340641 -0.77813648
  [7] -0.38081020 -0.12667482 -1.45470913 -0.59846846  0.86278333  1.31591468
 [13] -0.13065838  0.55653953 -1.56692096  0.35079680 -0.09151312 -0.06998115
 [19]  0.13994883  0.59980574 -0.48331109 -0.35360263 -0.20004488 -0.83400555
 [25]  0.18194234  1.30326300 -1.58645448 -0.34926438 -0.35973591 -0.95821805
 [31] -0.41969490 -0.63813690  0.63352484 -1.54140006  0.54640699  0.87335288
 [37] -0.77865369 -1.22683544 -1.37884139 -0.32178670 -1.07440292  0.66300319
 [43] -0.25620907  2.70964855 -0.85875384 -0.74998224 -0.49109686  0.64650816
 [49]  0.72121342 -0.98473373 -1.18562195  0.40267341 -0.77945570  0.37257090
 [55]  1.66294901  0.51624484  0.80068746  1.41426823  0.47225962 -1.12788777
 [61] -0.50143853  1.30075456 -0.20046987 -0.16183472 -0.49393522 -0.86153348
 [67]  1.21794123  0.29460923  1.10986789 -0.45252433  0.09435502 -1.19048056
 [73]  0.31976928 -3.00173381 -1.32058700  0.77866205  0.62683133  2.46843986
 [79] -0.30974777 -0.66427070 -0.03234638  1.06779115 -1.87279775 -0.26124367
 [85] -0.36630117  0.03001056  0.66590675  0.70989057 -0.51665479  0.47280989
 [91] -0.31513742  0.41976081  1.19121607  0.33647972  0.44275316  0.39734170
 [97]  1.15801324 -0.72857674  1.07304197  0.90428803
> colMedians(tmp)
  [1] -1.07833023  0.60225431  0.84016311 -0.84114717  1.23340641 -0.77813648
  [7] -0.38081020 -0.12667482 -1.45470913 -0.59846846  0.86278333  1.31591468
 [13] -0.13065838  0.55653953 -1.56692096  0.35079680 -0.09151312 -0.06998115
 [19]  0.13994883  0.59980574 -0.48331109 -0.35360263 -0.20004488 -0.83400555
 [25]  0.18194234  1.30326300 -1.58645448 -0.34926438 -0.35973591 -0.95821805
 [31] -0.41969490 -0.63813690  0.63352484 -1.54140006  0.54640699  0.87335288
 [37] -0.77865369 -1.22683544 -1.37884139 -0.32178670 -1.07440292  0.66300319
 [43] -0.25620907  2.70964855 -0.85875384 -0.74998224 -0.49109686  0.64650816
 [49]  0.72121342 -0.98473373 -1.18562195  0.40267341 -0.77945570  0.37257090
 [55]  1.66294901  0.51624484  0.80068746  1.41426823  0.47225962 -1.12788777
 [61] -0.50143853  1.30075456 -0.20046987 -0.16183472 -0.49393522 -0.86153348
 [67]  1.21794123  0.29460923  1.10986789 -0.45252433  0.09435502 -1.19048056
 [73]  0.31976928 -3.00173381 -1.32058700  0.77866205  0.62683133  2.46843986
 [79] -0.30974777 -0.66427070 -0.03234638  1.06779115 -1.87279775 -0.26124367
 [85] -0.36630117  0.03001056  0.66590675  0.70989057 -0.51665479  0.47280989
 [91] -0.31513742  0.41976081  1.19121607  0.33647972  0.44275316  0.39734170
 [97]  1.15801324 -0.72857674  1.07304197  0.90428803
> colRanges(tmp)
         [,1]      [,2]      [,3]       [,4]     [,5]       [,6]       [,7]
[1,] -1.07833 0.6022543 0.8401631 -0.8411472 1.233406 -0.7781365 -0.3808102
[2,] -1.07833 0.6022543 0.8401631 -0.8411472 1.233406 -0.7781365 -0.3808102
           [,8]      [,9]      [,10]     [,11]    [,12]      [,13]     [,14]
[1,] -0.1266748 -1.454709 -0.5984685 0.8627833 1.315915 -0.1306584 0.5565395
[2,] -0.1266748 -1.454709 -0.5984685 0.8627833 1.315915 -0.1306584 0.5565395
         [,15]     [,16]       [,17]       [,18]     [,19]     [,20]      [,21]
[1,] -1.566921 0.3507968 -0.09151312 -0.06998115 0.1399488 0.5998057 -0.4833111
[2,] -1.566921 0.3507968 -0.09151312 -0.06998115 0.1399488 0.5998057 -0.4833111
          [,22]      [,23]      [,24]     [,25]    [,26]     [,27]      [,28]
[1,] -0.3536026 -0.2000449 -0.8340056 0.1819423 1.303263 -1.586454 -0.3492644
[2,] -0.3536026 -0.2000449 -0.8340056 0.1819423 1.303263 -1.586454 -0.3492644
          [,29]      [,30]      [,31]      [,32]     [,33]   [,34]    [,35]
[1,] -0.3597359 -0.9582181 -0.4196949 -0.6381369 0.6335248 -1.5414 0.546407
[2,] -0.3597359 -0.9582181 -0.4196949 -0.6381369 0.6335248 -1.5414 0.546407
         [,36]      [,37]     [,38]     [,39]      [,40]     [,41]     [,42]
[1,] 0.8733529 -0.7786537 -1.226835 -1.378841 -0.3217867 -1.074403 0.6630032
[2,] 0.8733529 -0.7786537 -1.226835 -1.378841 -0.3217867 -1.074403 0.6630032
          [,43]    [,44]      [,45]      [,46]      [,47]     [,48]     [,49]
[1,] -0.2562091 2.709649 -0.8587538 -0.7499822 -0.4910969 0.6465082 0.7212134
[2,] -0.2562091 2.709649 -0.8587538 -0.7499822 -0.4910969 0.6465082 0.7212134
          [,50]     [,51]     [,52]      [,53]     [,54]    [,55]     [,56]
[1,] -0.9847337 -1.185622 0.4026734 -0.7794557 0.3725709 1.662949 0.5162448
[2,] -0.9847337 -1.185622 0.4026734 -0.7794557 0.3725709 1.662949 0.5162448
         [,57]    [,58]     [,59]     [,60]      [,61]    [,62]      [,63]
[1,] 0.8006875 1.414268 0.4722596 -1.127888 -0.5014385 1.300755 -0.2004699
[2,] 0.8006875 1.414268 0.4722596 -1.127888 -0.5014385 1.300755 -0.2004699
          [,64]      [,65]      [,66]    [,67]     [,68]    [,69]      [,70]
[1,] -0.1618347 -0.4939352 -0.8615335 1.217941 0.2946092 1.109868 -0.4525243
[2,] -0.1618347 -0.4939352 -0.8615335 1.217941 0.2946092 1.109868 -0.4525243
          [,71]     [,72]     [,73]     [,74]     [,75]    [,76]     [,77]
[1,] 0.09435502 -1.190481 0.3197693 -3.001734 -1.320587 0.778662 0.6268313
[2,] 0.09435502 -1.190481 0.3197693 -3.001734 -1.320587 0.778662 0.6268313
       [,78]      [,79]      [,80]       [,81]    [,82]     [,83]      [,84]
[1,] 2.46844 -0.3097478 -0.6642707 -0.03234638 1.067791 -1.872798 -0.2612437
[2,] 2.46844 -0.3097478 -0.6642707 -0.03234638 1.067791 -1.872798 -0.2612437
          [,85]      [,86]     [,87]     [,88]      [,89]     [,90]      [,91]
[1,] -0.3663012 0.03001056 0.6659067 0.7098906 -0.5166548 0.4728099 -0.3151374
[2,] -0.3663012 0.03001056 0.6659067 0.7098906 -0.5166548 0.4728099 -0.3151374
         [,92]    [,93]     [,94]     [,95]     [,96]    [,97]      [,98]
[1,] 0.4197608 1.191216 0.3364797 0.4427532 0.3973417 1.158013 -0.7285767
[2,] 0.4197608 1.191216 0.3364797 0.4427532 0.3973417 1.158013 -0.7285767
        [,99]   [,100]
[1,] 1.073042 0.904288
[2,] 1.073042 0.904288
> 
> 
> Max(tmp2)
[1] 2.195168
> Min(tmp2)
[1] -2.307761
> mean(tmp2)
[1] 0.0817442
> Sum(tmp2)
[1] 8.17442
> Var(tmp2)
[1] 0.9534447
> 
> rowMeans(tmp2)
  [1]  0.55140833  0.87209791 -0.53123476 -0.90306815  1.04421397 -1.03286901
  [7] -0.23805494  1.51005111 -0.66268522 -2.30776068 -1.02571183  0.21146974
 [13]  0.64314837  0.75024471  0.85916340  0.17670617  0.69217769  1.18996063
 [19] -1.02740947  0.02835172  1.37418453 -1.00953238 -0.30342478  1.84564842
 [25] -1.20508257  0.35742925  0.81549113  1.41912923  1.68850571 -0.70007256
 [31] -0.27025662  0.49422766  0.02708544  1.32593740  1.05517013 -0.45285779
 [37] -0.12525551  1.19515756 -0.77633560 -0.36096928 -0.37295861 -0.91535758
 [43] -0.52013096  1.13653434 -0.14587883 -0.89794522  0.95060766  0.49551357
 [49]  0.20779864  0.60925800  0.31392910 -0.37413514  0.39745741 -1.38437528
 [55] -2.22375092  0.61360397 -0.78556535  1.10559833  0.73407845 -1.09464041
 [61]  1.49009925 -0.25860011  0.15977534  1.16864927  0.19738005 -0.69692099
 [67] -1.62739521 -1.37410263 -1.93897341 -0.29054152  1.91847397  0.50937365
 [73] -1.04155261 -0.48980460  1.02308581 -0.09228498  1.06141394  0.32082293
 [79]  1.69017059 -0.83385282  0.19156115 -0.18165421  0.10847611 -1.30857554
 [85]  0.18271383 -0.90584610  0.36191436 -0.26600490  1.43413494 -0.67220810
 [91] -0.22906204  2.19516792  0.75979212  0.35217009  1.04160266  0.17036373
 [97] -2.14777583  0.17477558  0.85895158  0.11468614
> rowSums(tmp2)
  [1]  0.55140833  0.87209791 -0.53123476 -0.90306815  1.04421397 -1.03286901
  [7] -0.23805494  1.51005111 -0.66268522 -2.30776068 -1.02571183  0.21146974
 [13]  0.64314837  0.75024471  0.85916340  0.17670617  0.69217769  1.18996063
 [19] -1.02740947  0.02835172  1.37418453 -1.00953238 -0.30342478  1.84564842
 [25] -1.20508257  0.35742925  0.81549113  1.41912923  1.68850571 -0.70007256
 [31] -0.27025662  0.49422766  0.02708544  1.32593740  1.05517013 -0.45285779
 [37] -0.12525551  1.19515756 -0.77633560 -0.36096928 -0.37295861 -0.91535758
 [43] -0.52013096  1.13653434 -0.14587883 -0.89794522  0.95060766  0.49551357
 [49]  0.20779864  0.60925800  0.31392910 -0.37413514  0.39745741 -1.38437528
 [55] -2.22375092  0.61360397 -0.78556535  1.10559833  0.73407845 -1.09464041
 [61]  1.49009925 -0.25860011  0.15977534  1.16864927  0.19738005 -0.69692099
 [67] -1.62739521 -1.37410263 -1.93897341 -0.29054152  1.91847397  0.50937365
 [73] -1.04155261 -0.48980460  1.02308581 -0.09228498  1.06141394  0.32082293
 [79]  1.69017059 -0.83385282  0.19156115 -0.18165421  0.10847611 -1.30857554
 [85]  0.18271383 -0.90584610  0.36191436 -0.26600490  1.43413494 -0.67220810
 [91] -0.22906204  2.19516792  0.75979212  0.35217009  1.04160266  0.17036373
 [97] -2.14777583  0.17477558  0.85895158  0.11468614
> 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]  0.55140833  0.87209791 -0.53123476 -0.90306815  1.04421397 -1.03286901
  [7] -0.23805494  1.51005111 -0.66268522 -2.30776068 -1.02571183  0.21146974
 [13]  0.64314837  0.75024471  0.85916340  0.17670617  0.69217769  1.18996063
 [19] -1.02740947  0.02835172  1.37418453 -1.00953238 -0.30342478  1.84564842
 [25] -1.20508257  0.35742925  0.81549113  1.41912923  1.68850571 -0.70007256
 [31] -0.27025662  0.49422766  0.02708544  1.32593740  1.05517013 -0.45285779
 [37] -0.12525551  1.19515756 -0.77633560 -0.36096928 -0.37295861 -0.91535758
 [43] -0.52013096  1.13653434 -0.14587883 -0.89794522  0.95060766  0.49551357
 [49]  0.20779864  0.60925800  0.31392910 -0.37413514  0.39745741 -1.38437528
 [55] -2.22375092  0.61360397 -0.78556535  1.10559833  0.73407845 -1.09464041
 [61]  1.49009925 -0.25860011  0.15977534  1.16864927  0.19738005 -0.69692099
 [67] -1.62739521 -1.37410263 -1.93897341 -0.29054152  1.91847397  0.50937365
 [73] -1.04155261 -0.48980460  1.02308581 -0.09228498  1.06141394  0.32082293
 [79]  1.69017059 -0.83385282  0.19156115 -0.18165421  0.10847611 -1.30857554
 [85]  0.18271383 -0.90584610  0.36191436 -0.26600490  1.43413494 -0.67220810
 [91] -0.22906204  2.19516792  0.75979212  0.35217009  1.04160266  0.17036373
 [97] -2.14777583  0.17477558  0.85895158  0.11468614
> rowMin(tmp2)
  [1]  0.55140833  0.87209791 -0.53123476 -0.90306815  1.04421397 -1.03286901
  [7] -0.23805494  1.51005111 -0.66268522 -2.30776068 -1.02571183  0.21146974
 [13]  0.64314837  0.75024471  0.85916340  0.17670617  0.69217769  1.18996063
 [19] -1.02740947  0.02835172  1.37418453 -1.00953238 -0.30342478  1.84564842
 [25] -1.20508257  0.35742925  0.81549113  1.41912923  1.68850571 -0.70007256
 [31] -0.27025662  0.49422766  0.02708544  1.32593740  1.05517013 -0.45285779
 [37] -0.12525551  1.19515756 -0.77633560 -0.36096928 -0.37295861 -0.91535758
 [43] -0.52013096  1.13653434 -0.14587883 -0.89794522  0.95060766  0.49551357
 [49]  0.20779864  0.60925800  0.31392910 -0.37413514  0.39745741 -1.38437528
 [55] -2.22375092  0.61360397 -0.78556535  1.10559833  0.73407845 -1.09464041
 [61]  1.49009925 -0.25860011  0.15977534  1.16864927  0.19738005 -0.69692099
 [67] -1.62739521 -1.37410263 -1.93897341 -0.29054152  1.91847397  0.50937365
 [73] -1.04155261 -0.48980460  1.02308581 -0.09228498  1.06141394  0.32082293
 [79]  1.69017059 -0.83385282  0.19156115 -0.18165421  0.10847611 -1.30857554
 [85]  0.18271383 -0.90584610  0.36191436 -0.26600490  1.43413494 -0.67220810
 [91] -0.22906204  2.19516792  0.75979212  0.35217009  1.04160266  0.17036373
 [97] -2.14777583  0.17477558  0.85895158  0.11468614
> 
> colMeans(tmp2)
[1] 0.0817442
> colSums(tmp2)
[1] 8.17442
> colVars(tmp2)
[1] 0.9534447
> colSd(tmp2)
[1] 0.9764449
> colMax(tmp2)
[1] 2.195168
> colMin(tmp2)
[1] -2.307761
> colMedians(tmp2)
[1] 0.1725697
> colRanges(tmp2)
          [,1]
[1,] -2.307761
[2,]  2.195168
> 
> 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.8231014 -1.0316292  2.9556553  3.3080057  5.7695714 -0.2309887
 [7]  1.2673110  1.2145381 -2.7889016 -0.4585090
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.2357950
[2,] -0.4811119
[3,] -0.4046884
[4,]  0.1056459
[5,]  0.5070947
> 
> rowApply(tmp,sum)
 [1] -2.53359673  2.21984055 -0.90288135  3.53496247  4.44368975 -0.30063803
 [7]  1.13294649  1.15063623 -1.51307753 -0.04993017
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    1    4    3    3    8    6    3    2     8
 [2,]    7    8    3    5    5    4    7    1    3     7
 [3,]    5    7    8    8    6    7    9    5    5     4
 [4,]    2    2    7    9    9   10    4    4    9     6
 [5,]   10    5    9    7    7    9    3    6    4    10
 [6,]    6    4    6    4    4    3    1   10    8     2
 [7,]    1   10   10    1    8    5    5    9    1     5
 [8,]    8    9    2    2   10    1    8    7    6     9
 [9,]    9    6    5   10    1    2    2    2    7     3
[10,]    3    3    1    6    2    6   10    8   10     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -3.73614609  6.72157215  0.14152018  2.26138406 -2.71004836 -2.16707291
 [7] -0.31253078  0.59437965  0.73802368 -0.06441043 -2.03925390 -1.57072434
[13]  0.33941521 -1.79256775  0.67572347 -0.69709419  1.90372600 -3.03411355
[19] -1.00809718  1.21920329
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.4286327
[2,] -1.5106619
[3,] -0.5707742
[4,]  0.1770228
[5,]  0.5969000
> 
> rowApply(tmp,sum)
[1]   3.512421 -13.961941   1.028797   6.322350  -1.438739
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    3    1   10    1   13
[2,]   17   20   12   15   20
[3,]   12   18    6   13   11
[4,]    8   19    7   18   18
[5,]    4   17    4    3    8
> 
> 
> as.matrix(tmp)
           [,1]      [,2]       [,3]        [,4]        [,5]       [,6]
[1,] -0.5707742 0.8096095  0.4164798 -0.07542714 -0.40521212 -0.2480829
[2,] -2.4286327 1.5435400  0.1378255  0.39141231 -0.01282759 -0.5351670
[3,]  0.1770228 0.3589544 -0.8335134 -0.74102828 -0.84369523 -0.5412347
[4,] -1.5106619 1.1056822  0.6621125  1.54866939 -0.97347886  0.3065129
[5,]  0.5969000 2.9037860 -0.2413843  1.13775778 -0.47483456 -1.1491012
           [,7]       [,8]        [,9]      [,10]       [,11]      [,12]
[1,]  1.3563977 -0.2413978  1.22392137  0.7158442 -0.07195554 -0.3590763
[2,] -0.5668268 -0.9952177 -1.03648043 -0.6116559 -1.61535710 -0.1490139
[3,]  1.4532315  0.2372519  1.01928268  1.0047179  0.40465096 -0.9498809
[4,] -1.2630958  0.4400828 -0.03043032  0.4493694  0.49492846  1.1725250
[5,] -1.2922375  1.1536604 -0.43826962 -1.6226860 -1.25152068 -1.2852782
           [,13]      [,14]      [,15]       [,16]      [,17]       [,18]
[1,] -0.02677266  0.6699939  0.5440395 -0.02559684  0.8423268 -0.58558808
[2,] -0.99828245 -1.2226457 -2.2922526 -1.13207252 -1.4464778 -0.09437329
[3,] -1.14523190  0.6987685  0.7916889  1.15006785 -0.1724928 -0.86362535
[4,]  1.75376109 -0.1012566  0.9658437 -0.56001569  1.5911356 -0.90327169
[5,]  0.75594114 -1.8374279  0.6664040 -0.12947700  1.0892342 -0.58725513
           [,19]      [,20]
[1,] -0.94589705  0.4895887
[2,] -0.03518116 -0.8622537
[3,]  0.66107352 -0.8372115
[4,] -0.34448786  1.5184259
[5,] -0.34360463  0.9106539
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.23-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:    /Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  648  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  563  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.23-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.4763468 -0.3001275 0.961219 0.05590927 -0.4471184 0.003398786 -0.356828
           col8      col9     col10     col11     col12     col13      col14
row1 0.03739334 0.2668823 0.0795118 0.7425063 0.7445444 -1.047003 -0.2191993
         col15      col16      col17      col18    col19    col20
row1 0.9162043 0.02641743 -0.1959491 -0.3068549 2.002695 1.363038
> tmp[,"col10"]
          col10
row1  0.0795118
row2 -2.7515800
row3  1.0045762
row4 -0.2313138
row5  0.5643649
> tmp[c("row1","row5"),]
           col1       col2     col3       col4       col5         col6
row1  0.4763468 -0.3001275 0.961219 0.05590927 -0.4471184  0.003398786
row5 -0.5016285  0.4913076 1.726050 1.21915120  0.3739865 -0.191468920
           col7       col8      col9     col10     col11     col12       col13
row1 -0.3568280 0.03739334 0.2668823 0.0795118 0.7425063 0.7445444 -1.04700310
row5 -0.8407669 0.77147002 0.9593082 0.5643649 1.2214275 0.8972680  0.06640444
           col14      col15       col16      col17      col18     col19
row1 -0.21919925  0.9162043  0.02641743 -0.1959491 -0.3068549 2.0026946
row5 -0.01833129 -0.1953124 -0.94110855  0.3783674  1.2240817 0.8911867
         col20
row1 1.3630383
row5 0.6983241
> tmp[,c("col6","col20")]
             col6      col20
row1  0.003398786  1.3630383
row2 -1.213873263  0.2579104
row3  0.230366107  0.9822931
row4  1.167192317 -1.4846687
row5 -0.191468920  0.6983241
> tmp[c("row1","row5"),c("col6","col20")]
             col6     col20
row1  0.003398786 1.3630383
row5 -0.191468920 0.6983241
> 
> 
> 
> 
> 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 50.16553 49.9831 49.75459 49.65029 51.01675 105.2299 50.28563 49.74611
        col9    col10    col11    col12    col13    col14    col15    col16
row1 51.0475 50.88851 51.60849 49.19841 49.41814 48.18127 50.57384 48.37296
        col17    col18    col19    col20
row1 50.90603 49.24613 49.28881 103.8471
> tmp[,"col10"]
        col10
row1 50.88851
row2 30.26237
row3 30.35812
row4 30.05587
row5 49.99578
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.16553 49.98310 49.75459 49.65029 51.01675 105.2299 50.28563 49.74611
row5 50.23841 49.43621 50.44946 50.28940 49.59817 103.3307 51.01076 50.03185
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.04750 50.88851 51.60849 49.19841 49.41814 48.18127 50.57384 48.37296
row5 50.96084 49.99578 52.16353 50.29154 50.35153 50.87948 50.29898 50.65113
        col17    col18    col19    col20
row1 50.90603 49.24613 49.28881 103.8471
row5 51.14746 49.38631 50.09672 103.6019
> tmp[,c("col6","col20")]
          col6     col20
row1 105.22990 103.84713
row2  74.39156  75.26261
row3  76.08466  74.74210
row4  76.39441  75.77828
row5 103.33066 103.60191
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.2299 103.8471
row5 103.3307 103.6019
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.2299 103.8471
row5 103.3307 103.6019
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.6080832
[2,] -0.8856191
[3,] -1.2456253
[4,] -0.9319761
[5,] -0.8317835
> tmp[,c("col17","col7")]
          col17       col7
[1,]  2.0333632  0.8059374
[2,] -0.7090319  0.2382866
[3,]  0.8077538  0.0286677
[4,]  1.1487619 -0.9199910
[5,]  1.2468648  0.3596234
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.9851349  0.1930849
[2,] -1.7948429 -0.1539100
[3,] -0.3214063 -0.7842242
[4,]  0.5156554  0.3286578
[5,]  0.3217517  1.1640398
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.9851349
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.9851349
[2,] -1.7948429
> 
> 
> 
> 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.9646254  0.4531242 2.0721490  0.8346934  0.5550051 -1.0375777 0.4578686
row1 -1.0205199 -2.1104088 0.2127466 -1.2316318 -1.4265492 -0.3113624 0.4902303
          [,8]       [,9]      [,10]      [,11]     [,12]     [,13]     [,14]
row3  1.237767  0.3118641 -1.0777583 0.03592992 0.4490677 0.2869205  1.069205
row1 -1.425827 -0.3152203  0.7504032 0.97609262 0.6146766 0.6451460 -1.370311
           [,15]      [,16]      [,17]      [,18]       [,19]      [,20]
row3 -0.06007157 -1.0011589  0.1381385 -0.3245696  0.05416476  0.7378202
row1 -0.41761146 -0.1590562 -0.6509354 -0.6064905 -0.31843714 -2.0468534
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
            [,1]       [,2]       [,3]     [,4]      [,5]      [,6]     [,7]
row2 -0.02010938 -0.4478126 -0.8474555 1.796239 0.7989674 0.1224228 1.982816
          [,8]      [,9]      [,10]
row2 -1.250571 -1.244363 -0.5455811
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]      [,4]       [,5]       [,6]       [,7]
row5 0.6157231 -1.008088 0.07241521 0.5052566 -0.2161431 -0.6295961 -0.1903785
          [,8]    [,9]   [,10]      [,11]    [,12]     [,13]      [,14]
row5 0.0195183 1.02568 0.56748 -0.4037421 1.347524 0.4139577 -0.1630531
          [,15]     [,16]     [,17]     [,18]     [,19]     [,20]
row5 -0.1080317 -1.767635 0.8530905 -1.866291 -1.157696 0.8658259
> 
> 
> 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: 0x6000012f0360>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d8369387ab"
 [2] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d8fb0078b" 
 [3] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d86dbf3eb8"
 [4] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d826aeda52"
 [5] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d8217f5155"
 [6] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d82db4b4a1"
 [7] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d832becd78"
 [8] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d8ca39b4f" 
 [9] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d849296604"
[10] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d83ce8b622"
[11] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d8520d916b"
[12] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d878c631e2"
[13] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d81bf52a60"
[14] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d87cb112f6"
[15] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BMb2d84d54146e"
> 
> 
> ### 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: 0x6000012c81e0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x6000012c81e0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x6000012c81e0>
> rowMedians(tmp)
  [1]  0.002199837  0.503267790  0.336804602  0.246172373 -0.045212704
  [6]  0.355713827  0.095281146  0.095647257 -0.201256784 -0.488367904
 [11] -0.311417995 -0.099970701  0.055324460 -0.111379216  0.096418472
 [16]  0.124482594 -0.595442620 -0.116996896  0.098496165  0.213360158
 [21]  0.148101966  0.102375138  0.190099767 -0.023039606 -0.249400306
 [26] -0.281703806 -0.416331312  0.130081044  0.139028507  0.022823663
 [31]  0.178263272  0.661142715  0.044510596  0.141187434 -0.225426155
 [36] -0.242569121  0.064568161 -0.396265878 -0.248190555  0.002177743
 [41]  0.196172678  0.021073615  0.257886032 -0.015527674 -0.152618742
 [46]  0.397035957  0.564376291  0.255877262  0.011809587  0.224365368
 [51]  0.258261929  0.022663637  0.102827306  0.011860878 -0.269437905
 [56] -0.060562189  0.169565908 -0.188537333  0.281040136 -0.163671135
 [61]  0.339786864  0.138600243  0.336222779 -0.111857321 -0.334020991
 [66] -0.557003481  0.047689729  0.002859483  0.079801661  0.353326792
 [71] -0.222839830  0.285950988  0.242273133  0.041106122 -0.243147022
 [76] -0.441562301 -0.063990850  0.883361478  0.198929822 -0.110574496
 [81]  0.231146987  0.024961747  0.313814433  0.056883747 -0.548829429
 [86] -0.193201221  0.154759577 -0.341063314 -0.418056318 -0.175215519
 [91]  0.710966521  0.169367336  0.357442462  0.246101193 -0.536680953
 [96]  0.013827555  0.216556365  0.007408599 -0.012701050 -0.621769246
[101]  0.198678124  0.214224300 -0.412070247 -0.367636125 -0.054787920
[106] -0.061603892  0.205182416  0.467106661 -0.053692769 -0.065975187
[111]  0.538778354  0.375438117 -0.586572062  0.024199914 -0.205477471
[116]  0.413095603  0.285844330 -0.657865824  0.271791494 -0.520861035
[121] -0.618883530 -0.036071505 -0.128173722 -0.127619076  0.063822680
[126] -0.060519532  0.417369672  0.131424837 -0.150114846 -0.254684273
[131] -0.355997819  0.097097663  0.041646776 -0.013704033 -0.258987017
[136] -0.032539898  0.602711785  0.112972664 -0.053517230 -0.135193240
[141] -0.497243485 -0.152718605 -0.321444252  0.106900771  0.178871820
[146]  0.186272688 -0.018172513  0.272603830  0.669844294 -0.303928889
[151] -0.491583920  0.129046249  0.263056044 -0.371539589  0.234149133
[156]  0.121831501  0.074147656  0.066703610  0.185490447 -0.495042794
[161]  0.089486438  0.108189431 -0.015083729  0.160482266 -0.198482186
[166]  0.210448725 -0.044257145 -0.264952526  0.116789382  0.335074064
[171]  0.016736249  0.391842003 -0.018381322  0.505819221  0.407235450
[176]  0.576470605  0.100367636  0.307601834  0.162934778 -0.053404942
[181] -0.120498100 -0.144865848 -0.286306540  0.104174157 -0.567818700
[186]  0.182802941  0.146477317 -0.285838923 -0.142913861 -0.175957926
[191]  0.048647248  0.073601810 -0.107618284 -0.391790693  0.532170158
[196] -0.062077676 -0.392605044 -0.210421827 -0.254346818  0.043656134
[201]  0.599880908 -0.302497342  0.071265847  0.507916452  0.173484740
[206]  0.023287505 -0.069925205 -0.288295002 -0.054933436 -0.454987228
[211] -0.393106051 -0.139788697  0.315955011  0.568198367  0.376430957
[216]  0.030057844 -0.369457422 -0.226893263 -0.073429370 -0.266537884
[221] -0.412752079  0.157597416  0.059278231  0.103383629 -0.050373255
[226]  0.472529475 -0.544730137  0.115232896  0.005362764 -0.244270304
> 
> proc.time()
   user  system elapsed 
  0.772   3.808   5.066 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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: 0x6000016740c0>
> .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: 0x6000016740c0>
> .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: 0x6000016740c0>
> .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: 0x6000016740c0>
> 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: 0x600001674840>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001674840>
> .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: 0x600001674840>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001674840>
> .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: 0x600001674840>
> 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: 0x600001674a20>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001674a20>
> .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: 0x600001674a20>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x600001674a20>
> .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: 0x600001674a20>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x600001674a20>
> .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: 0x600001674a20>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x600001674a20>
> .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: 0x600001674a20>
> 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: 0x600001674c00>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x600001674c00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001674c00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001674c00>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFileb83251bb2503" "BufferedMatrixFileb832557b11e0"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFileb83251bb2503" "BufferedMatrixFileb832557b11e0"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001674ea0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001674ea0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x600001674ea0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x600001674ea0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x600001674ea0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x600001674ea0>
> .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: 0x600001675080>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001675080>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x600001675080>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x600001675080>
> 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: 0x600001675260>
> .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: 0x600001675260>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.151   0.055   0.199 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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.143   0.041   0.175 

Example timings