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

This page was generated on 2026-05-19 12:54 -0400 (Tue, 19 May 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.4 LTS)x86_644.6.0 RC (2026-04-17 r89917) -- "Because it was There" 4898
kjohnson3macOS 13.7.7 Venturaarm644.6.0 Patched (2026-05-01 r89994) -- "Because it was There" 4617
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 259/2377HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.77.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-05-18 13:45 -0400 (Mon, 18 May 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: 2d99771
git_last_commit_date: 2026-04-28 08:32:08 -0400 (Tue, 28 Apr 2026)
nebbiolo2Linux (Ubuntu 24.04.4 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.7.7 Ventura / arm64  OK    OK    WARNINGS  YES
See other builds for BufferedMatrix in R Universe.


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.77.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.77.0.tar.gz
StartedAt: 2026-05-18 20:36:51 -0400 (Mon, 18 May 2026)
EndedAt: 2026-05-18 20:37:14 -0400 (Mon, 18 May 2026)
EllapsedTime: 22.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.77.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.6.0 Patched (2026-05-01 r89994)
* using platform: aarch64-apple-darwin23
* R was compiled by
    Apple clang version 17.0.0 (clang-1700.3.19.1)
    GNU Fortran (GCC) 14.2.0
* running under: macOS Tahoe 26.3.1
* using session charset: UTF-8
* current time: 2026-05-19 00:36:52 UTC
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.77.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.24-bioc/meat/BufferedMatrix.Rcheck/00install.out’ for details.
* used C compiler: ‘Apple clang version 17.0.0 (clang-1700.6.4.2)’
* used SDK: ‘MacOSX26.2.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.24-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/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.77.0’
** using staged installation
** libs
using C compiler: ‘Apple clang version 17.0.0 (clang-1700.6.4.2)’
using SDK: ‘MacOSX26.2.sdk’
clang -arch arm64 -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 -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]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^                   ~
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^                            
      |        (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^
      |       (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
2 warnings generated.
clang -arch arm64 -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 -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 -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/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 version 4.6.0 Patched (2026-05-01 r89994) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin23

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.129   0.063   0.202 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.6.0 Patched (2026-05-01 r89994) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin23

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.24-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 482663 25.8    1063038 56.8         NA   631997 33.8
Vcells 893071  6.9    8388608 64.0     196608  2112627 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] "Mon May 18 20:37:03 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon May 18 20:37:03 2026"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x104020520>
> 
> 
> 
> 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] "Mon May 18 20:37:05 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon May 18 20:37:06 2026"
> 
> ColMode(tmp2)
<pointer: 0x104020520>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
             [,1]       [,2]        [,3]       [,4]
[1,] 101.36955767 -0.2641950 -0.52576199 -1.1278200
[2,]   1.17256624  0.9092827 -0.01260344  0.4246186
[3,]   0.03457339  0.2310199 -0.18010937 -0.5680618
[4,]   1.83615591  0.2932824  0.63991013  0.2518390
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.24-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,] 101.36955767 0.2641950 0.52576199 1.1278200
[2,]   1.17256624 0.9092827 0.01260344 0.4246186
[3,]   0.03457339 0.2310199 0.18010937 0.5680618
[4,]   1.83615591 0.2932824 0.63991013 0.2518390
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.24-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.0682450 0.5139990 0.7250945 1.0619887
[2,]  1.0828510 0.9535632 0.1122650 0.6516277
[3,]  0.1859392 0.4806453 0.4243929 0.7536987
[4,]  1.3550483 0.5415555 0.7999438 0.5018356
> 
> 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.24-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,] 227.05201 30.40419 32.77671 36.74771
[2,]  37.00108 35.44491 26.13525 31.94090
[3,]  26.89397 30.03747 29.42404 33.10505
[4,]  40.38664 30.70884 33.63935 30.27020
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x104020580>
> exp(tmp5)
<pointer: 0x104020580>
> log(tmp5,2)
<pointer: 0x104020580>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 472.579
> Min(tmp5)
[1] 54.39711
> mean(tmp5)
[1] 72.2129
> Sum(tmp5)
[1] 14442.58
> Var(tmp5)
[1] 880.3733
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.24758 67.91707 69.41665 70.01158 67.83594 69.56750 74.30065 70.22921
 [9] 71.60216 71.00064
> rowSums(tmp5)
 [1] 1804.952 1358.341 1388.333 1400.232 1356.719 1391.350 1486.013 1404.584
 [9] 1432.043 1420.013
> rowVars(tmp5)
 [1] 8177.43841   47.36570   86.69538   90.57826   38.66258   77.05289
 [7]   82.69210   50.78631   60.65818   95.49533
> rowSd(tmp5)
 [1] 90.429190  6.882274  9.311035  9.517261  6.217924  8.777977  9.093519
 [8]  7.126452  7.788336  9.772171
> rowMax(tmp5)
 [1] 472.57901  84.67107  91.10507  93.19726  77.49140  85.32485  97.64824
 [8]  78.88459  84.03434  94.55084
> rowMin(tmp5)
 [1] 57.45397 54.39711 55.97627 57.32334 58.58327 56.05957 59.32130 54.78983
 [9] 56.09759 58.76062
> 
> colMeans(tmp5)
 [1] 110.75978  67.77317  66.79069  68.94663  65.72192  68.59993  68.65969
 [8]  67.90895  69.07703  73.99076  67.85645  70.71044  71.61403  74.62136
[15]  70.80333  67.00965  75.10161  72.85345  70.92223  74.53689
> colSums(tmp5)
 [1] 1107.5978  677.7317  667.9069  689.4663  657.2192  685.9993  686.5969
 [8]  679.0895  690.7703  739.9076  678.5645  707.1044  716.1403  746.2136
[15]  708.0333  670.0965  751.0161  728.5345  709.2223  745.3689
> colVars(tmp5)
 [1] 16233.05334    42.10396    60.24045    47.57041    68.70798    32.15588
 [7]    75.76868    77.59820    60.17238   125.01062    85.65652    38.79575
[13]    64.01614   109.58287    64.11190    38.84194   186.72536    70.90433
[19]    61.80698    15.15398
> colSd(tmp5)
 [1] 127.409000   6.488757   7.761472   6.897130   8.289028   5.670616
 [7]   8.704521   8.808984   7.757086  11.180815   9.255081   6.228624
[13]   8.001008  10.468184   8.006991   6.232330  13.664749   8.420471
[19]   7.861741   3.892811
> colMax(tmp5)
 [1] 472.57901  80.74954  79.17297  79.15139  78.44573  75.42704  82.43473
 [8]  85.32485  79.72561  91.10507  84.46353  77.80013  84.67107  97.64824
[15]  84.03434  79.75607  94.55084  84.72434  83.38817  79.24199
> colMin(tmp5)
 [1] 55.97627 58.94893 54.39711 58.58327 56.05957 58.32190 54.78983 57.32334
 [9] 59.17885 58.61104 55.97792 61.29800 60.93641 56.90794 59.70269 59.65429
[17] 59.04781 58.76062 60.32079 65.66794
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 90.24758 67.91707 69.41665       NA 67.83594 69.56750 74.30065 70.22921
 [9] 71.60216 71.00064
> rowSums(tmp5)
 [1] 1804.952 1358.341 1388.333       NA 1356.719 1391.350 1486.013 1404.584
 [9] 1432.043 1420.013
> rowVars(tmp5)
 [1] 8177.43841   47.36570   86.69538   64.17321   38.66258   77.05289
 [7]   82.69210   50.78631   60.65818   95.49533
> rowSd(tmp5)
 [1] 90.429190  6.882274  9.311035  8.010818  6.217924  8.777977  9.093519
 [8]  7.126452  7.788336  9.772171
> rowMax(tmp5)
 [1] 472.57901  84.67107  91.10507        NA  77.49140  85.32485  97.64824
 [8]  78.88459  84.03434  94.55084
> rowMin(tmp5)
 [1] 57.45397 54.39711 55.97627       NA 58.58327 56.05957 59.32130 54.78983
 [9] 56.09759 58.76062
> 
> colMeans(tmp5)
 [1] 110.75978  67.77317  66.79069  68.94663  65.72192  68.59993  68.65969
 [8]  67.90895  69.07703  73.99076  67.85645  70.71044  71.61403  74.62136
[15]  70.80333  67.00965        NA  72.85345  70.92223  74.53689
> colSums(tmp5)
 [1] 1107.5978  677.7317  667.9069  689.4663  657.2192  685.9993  686.5969
 [8]  679.0895  690.7703  739.9076  678.5645  707.1044  716.1403  746.2136
[15]  708.0333  670.0965        NA  728.5345  709.2223  745.3689
> colVars(tmp5)
 [1] 16233.05334    42.10396    60.24045    47.57041    68.70798    32.15588
 [7]    75.76868    77.59820    60.17238   125.01062    85.65652    38.79575
[13]    64.01614   109.58287    64.11190    38.84194          NA    70.90433
[19]    61.80698    15.15398
> colSd(tmp5)
 [1] 127.409000   6.488757   7.761472   6.897130   8.289028   5.670616
 [7]   8.704521   8.808984   7.757086  11.180815   9.255081   6.228624
[13]   8.001008  10.468184   8.006991   6.232330         NA   8.420471
[19]   7.861741   3.892811
> colMax(tmp5)
 [1] 472.57901  80.74954  79.17297  79.15139  78.44573  75.42704  82.43473
 [8]  85.32485  79.72561  91.10507  84.46353  77.80013  84.67107  97.64824
[15]  84.03434  79.75607        NA  84.72434  83.38817  79.24199
> colMin(tmp5)
 [1] 55.97627 58.94893 54.39711 58.58327 56.05957 58.32190 54.78983 57.32334
 [9] 59.17885 58.61104 55.97792 61.29800 60.93641 56.90794 59.70269 59.65429
[17]       NA 58.76062 60.32079 65.66794
> 
> Max(tmp5,na.rm=TRUE)
[1] 472.579
> Min(tmp5,na.rm=TRUE)
[1] 54.39711
> mean(tmp5,na.rm=TRUE)
[1] 72.10745
> Sum(tmp5,na.rm=TRUE)
[1] 14349.38
> Var(tmp5,na.rm=TRUE)
[1] 882.5845
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.24758 67.91707 69.41665 68.79129 67.83594 69.56750 74.30065 70.22921
 [9] 71.60216 71.00064
> rowSums(tmp5,na.rm=TRUE)
 [1] 1804.952 1358.341 1388.333 1307.034 1356.719 1391.350 1486.013 1404.584
 [9] 1432.043 1420.013
> rowVars(tmp5,na.rm=TRUE)
 [1] 8177.43841   47.36570   86.69538   64.17321   38.66258   77.05289
 [7]   82.69210   50.78631   60.65818   95.49533
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.429190  6.882274  9.311035  8.010818  6.217924  8.777977  9.093519
 [8]  7.126452  7.788336  9.772171
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.57901  84.67107  91.10507  84.05950  77.49140  85.32485  97.64824
 [8]  78.88459  84.03434  94.55084
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.45397 54.39711 55.97627 57.32334 58.58327 56.05957 59.32130 54.78983
 [9] 56.09759 58.76062
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.75978  67.77317  66.79069  68.94663  65.72192  68.59993  68.65969
 [8]  67.90895  69.07703  73.99076  67.85645  70.71044  71.61403  74.62136
[15]  70.80333  67.00965  73.09099  72.85345  70.92223  74.53689
> colSums(tmp5,na.rm=TRUE)
 [1] 1107.5978  677.7317  667.9069  689.4663  657.2192  685.9993  686.5969
 [8]  679.0895  690.7703  739.9076  678.5645  707.1044  716.1403  746.2136
[15]  708.0333  670.0965  657.8189  728.5345  709.2223  745.3689
> colVars(tmp5,na.rm=TRUE)
 [1] 16233.05334    42.10396    60.24045    47.57041    68.70798    32.15588
 [7]    75.76868    77.59820    60.17238   125.01062    85.65652    38.79575
[13]    64.01614   109.58287    64.11190    38.84194   164.58651    70.90433
[19]    61.80698    15.15398
> colSd(tmp5,na.rm=TRUE)
 [1] 127.409000   6.488757   7.761472   6.897130   8.289028   5.670616
 [7]   8.704521   8.808984   7.757086  11.180815   9.255081   6.228624
[13]   8.001008  10.468184   8.006991   6.232330  12.829127   8.420471
[19]   7.861741   3.892811
> colMax(tmp5,na.rm=TRUE)
 [1] 472.57901  80.74954  79.17297  79.15139  78.44573  75.42704  82.43473
 [8]  85.32485  79.72561  91.10507  84.46353  77.80013  84.67107  97.64824
[15]  84.03434  79.75607  94.55084  84.72434  83.38817  79.24199
> colMin(tmp5,na.rm=TRUE)
 [1] 55.97627 58.94893 54.39711 58.58327 56.05957 58.32190 54.78983 57.32334
 [9] 59.17885 58.61104 55.97792 61.29800 60.93641 56.90794 59.70269 59.65429
[17] 59.04781 58.76062 60.32079 65.66794
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.24758 67.91707 69.41665      NaN 67.83594 69.56750 74.30065 70.22921
 [9] 71.60216 71.00064
> rowSums(tmp5,na.rm=TRUE)
 [1] 1804.952 1358.341 1388.333    0.000 1356.719 1391.350 1486.013 1404.584
 [9] 1432.043 1420.013
> rowVars(tmp5,na.rm=TRUE)
 [1] 8177.43841   47.36570   86.69538         NA   38.66258   77.05289
 [7]   82.69210   50.78631   60.65818   95.49533
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.429190  6.882274  9.311035        NA  6.217924  8.777977  9.093519
 [8]  7.126452  7.788336  9.772171
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.57901  84.67107  91.10507        NA  77.49140  85.32485  97.64824
 [8]  78.88459  84.03434  94.55084
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.45397 54.39711 55.97627       NA 58.58327 56.05957 59.32130 54.78983
 [9] 56.09759 58.76062
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.72647  68.20170  66.43234  69.60698  64.30816  69.45915  69.55096
 [8]  69.08513  69.92215  74.81010  68.32519  69.92270  72.80043  74.20259
[15]  70.61824  67.56142       NaN  72.32138  70.55756  74.64617
> colSums(tmp5,na.rm=TRUE)
 [1] 1023.5383  613.8153  597.8910  626.4628  578.7735  625.1324  625.9587
 [8]  621.7662  629.2993  673.2909  614.9267  629.3043  655.2039  667.8233
[15]  635.5642  608.0528    0.0000  650.8924  635.0180  671.8156
> colVars(tmp5,na.rm=TRUE)
 [1] 18163.17044    45.30105    66.32579    48.61095    54.81101    27.86993
 [7]    76.30307    71.73477    59.65882   133.08465    93.89181    36.66415
[13]    56.18321   121.30783    71.74050    40.27208          NA    76.58246
[19]    68.03672    16.91388
> colSd(tmp5,na.rm=TRUE)
 [1] 134.770807   6.730606   8.144065   6.972156   7.403446   5.279198
 [7]   8.735163   8.469638   7.723912  11.536232   9.689779   6.055093
[13]   7.495546  11.013983   8.469976   6.346028         NA   8.751140
[19]   8.248438   4.112649
> colMax(tmp5,na.rm=TRUE)
 [1] 472.57901  80.74954  79.17297  79.15139  77.02034  75.42704  82.43473
 [8]  85.32485  79.72561  91.10507  84.46353  77.72369  84.67107  97.64824
[15]  84.03434  79.75607      -Inf  84.72434  83.38817  79.24199
> colMin(tmp5,na.rm=TRUE)
 [1] 55.97627 58.94893 54.39711 58.58327 56.05957 58.32190 54.78983 57.45397
 [9] 59.17885 58.61104 55.97792 61.29800 61.64435 56.90794 59.70269 59.65429
[17]      Inf 58.76062 60.32079 65.66794
> 
> 
> 
> 
> 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] 259.6184 306.2412 223.3827 194.1081 393.1094 269.0389 247.9555 280.7552
 [9] 173.8705 256.1694
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 259.6184 306.2412 223.3827 194.1081 393.1094 269.0389 247.9555 280.7552
 [9] 173.8705 256.1694
> 
> 
> 
> 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] -2.842171e-14  5.684342e-14 -1.136868e-13  4.263256e-14 -1.278977e-13
 [6]  0.000000e+00  1.136868e-13 -1.136868e-13 -4.263256e-14  7.105427e-14
[11]  0.000000e+00 -1.136868e-13 -1.136868e-13  5.684342e-14  1.136868e-13
[16] -8.526513e-14 -1.705303e-13  1.989520e-13 -4.263256e-14 -4.263256e-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)
+ }
3   18 
10   2 
8   4 
2   15 
5   4 
6   12 
6   12 
9   5 
1   4 
6   20 
1   20 
6   4 
6   8 
7   10 
8   1 
6   6 
5   14 
10   6 
7   11 
7   17 
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.017271
> Min(tmp)
[1] -2.51759
> mean(tmp)
[1] 0.02560579
> Sum(tmp)
[1] 2.560579
> Var(tmp)
[1] 0.8754805
> 
> rowMeans(tmp)
[1] 0.02560579
> rowSums(tmp)
[1] 2.560579
> rowVars(tmp)
[1] 0.8754805
> rowSd(tmp)
[1] 0.9356712
> rowMax(tmp)
[1] 2.017271
> rowMin(tmp)
[1] -2.51759
> 
> colMeans(tmp)
  [1] -1.99069443 -0.85639710  0.77292734 -0.40396657  1.58439930  0.30188032
  [7]  0.54837798 -0.38889969  0.24423243  0.99246735  0.29918591 -0.63043870
 [13]  1.50599342  0.67319845 -0.86071849 -0.62379229  0.17979396  0.17457436
 [19]  0.44428806  0.71106877 -1.21708690  0.96604064  1.13208355  0.40201156
 [25]  1.05445541 -0.48121674  1.12816083 -0.56444698  0.55096629 -0.49898501
 [31]  1.11139243 -0.21689423  0.39584853  0.64971767  0.05384694  0.81153245
 [37]  0.93258173  1.90586516 -1.16759461 -0.04041542  0.73639467 -1.06016531
 [43]  1.32559957  0.58626106 -1.08054559 -0.91105631 -2.51758966  0.63017761
 [49]  0.40332044 -0.52482468  1.11799835 -0.93903289 -1.16804993 -0.13678857
 [55] -0.28538345 -1.78469485 -0.39475291  0.36424592 -0.22546043 -0.87910366
 [61]  0.02947778 -0.09909499  0.49633784  0.94544689 -0.57287074  1.03210802
 [67]  0.84502807 -0.27103489  0.10405584 -0.66561298 -1.00603387 -1.85917019
 [73]  0.04353870 -0.68877324  0.26310201  0.03144759 -1.33396815  1.67640635
 [79] -1.25548060  2.01727128 -0.82537745  0.52296044  1.11363307 -0.36053962
 [85] -0.56672843 -0.21982248 -1.27892746 -0.19488446 -0.10523089  0.43444475
 [91]  0.23243233  1.89902962 -1.36560453 -0.20698951  0.56354205  0.10325965
 [97]  0.80974016 -1.93874859  1.25924968  0.11106736
> colSums(tmp)
  [1] -1.99069443 -0.85639710  0.77292734 -0.40396657  1.58439930  0.30188032
  [7]  0.54837798 -0.38889969  0.24423243  0.99246735  0.29918591 -0.63043870
 [13]  1.50599342  0.67319845 -0.86071849 -0.62379229  0.17979396  0.17457436
 [19]  0.44428806  0.71106877 -1.21708690  0.96604064  1.13208355  0.40201156
 [25]  1.05445541 -0.48121674  1.12816083 -0.56444698  0.55096629 -0.49898501
 [31]  1.11139243 -0.21689423  0.39584853  0.64971767  0.05384694  0.81153245
 [37]  0.93258173  1.90586516 -1.16759461 -0.04041542  0.73639467 -1.06016531
 [43]  1.32559957  0.58626106 -1.08054559 -0.91105631 -2.51758966  0.63017761
 [49]  0.40332044 -0.52482468  1.11799835 -0.93903289 -1.16804993 -0.13678857
 [55] -0.28538345 -1.78469485 -0.39475291  0.36424592 -0.22546043 -0.87910366
 [61]  0.02947778 -0.09909499  0.49633784  0.94544689 -0.57287074  1.03210802
 [67]  0.84502807 -0.27103489  0.10405584 -0.66561298 -1.00603387 -1.85917019
 [73]  0.04353870 -0.68877324  0.26310201  0.03144759 -1.33396815  1.67640635
 [79] -1.25548060  2.01727128 -0.82537745  0.52296044  1.11363307 -0.36053962
 [85] -0.56672843 -0.21982248 -1.27892746 -0.19488446 -0.10523089  0.43444475
 [91]  0.23243233  1.89902962 -1.36560453 -0.20698951  0.56354205  0.10325965
 [97]  0.80974016 -1.93874859  1.25924968  0.11106736
> 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.99069443 -0.85639710  0.77292734 -0.40396657  1.58439930  0.30188032
  [7]  0.54837798 -0.38889969  0.24423243  0.99246735  0.29918591 -0.63043870
 [13]  1.50599342  0.67319845 -0.86071849 -0.62379229  0.17979396  0.17457436
 [19]  0.44428806  0.71106877 -1.21708690  0.96604064  1.13208355  0.40201156
 [25]  1.05445541 -0.48121674  1.12816083 -0.56444698  0.55096629 -0.49898501
 [31]  1.11139243 -0.21689423  0.39584853  0.64971767  0.05384694  0.81153245
 [37]  0.93258173  1.90586516 -1.16759461 -0.04041542  0.73639467 -1.06016531
 [43]  1.32559957  0.58626106 -1.08054559 -0.91105631 -2.51758966  0.63017761
 [49]  0.40332044 -0.52482468  1.11799835 -0.93903289 -1.16804993 -0.13678857
 [55] -0.28538345 -1.78469485 -0.39475291  0.36424592 -0.22546043 -0.87910366
 [61]  0.02947778 -0.09909499  0.49633784  0.94544689 -0.57287074  1.03210802
 [67]  0.84502807 -0.27103489  0.10405584 -0.66561298 -1.00603387 -1.85917019
 [73]  0.04353870 -0.68877324  0.26310201  0.03144759 -1.33396815  1.67640635
 [79] -1.25548060  2.01727128 -0.82537745  0.52296044  1.11363307 -0.36053962
 [85] -0.56672843 -0.21982248 -1.27892746 -0.19488446 -0.10523089  0.43444475
 [91]  0.23243233  1.89902962 -1.36560453 -0.20698951  0.56354205  0.10325965
 [97]  0.80974016 -1.93874859  1.25924968  0.11106736
> colMin(tmp)
  [1] -1.99069443 -0.85639710  0.77292734 -0.40396657  1.58439930  0.30188032
  [7]  0.54837798 -0.38889969  0.24423243  0.99246735  0.29918591 -0.63043870
 [13]  1.50599342  0.67319845 -0.86071849 -0.62379229  0.17979396  0.17457436
 [19]  0.44428806  0.71106877 -1.21708690  0.96604064  1.13208355  0.40201156
 [25]  1.05445541 -0.48121674  1.12816083 -0.56444698  0.55096629 -0.49898501
 [31]  1.11139243 -0.21689423  0.39584853  0.64971767  0.05384694  0.81153245
 [37]  0.93258173  1.90586516 -1.16759461 -0.04041542  0.73639467 -1.06016531
 [43]  1.32559957  0.58626106 -1.08054559 -0.91105631 -2.51758966  0.63017761
 [49]  0.40332044 -0.52482468  1.11799835 -0.93903289 -1.16804993 -0.13678857
 [55] -0.28538345 -1.78469485 -0.39475291  0.36424592 -0.22546043 -0.87910366
 [61]  0.02947778 -0.09909499  0.49633784  0.94544689 -0.57287074  1.03210802
 [67]  0.84502807 -0.27103489  0.10405584 -0.66561298 -1.00603387 -1.85917019
 [73]  0.04353870 -0.68877324  0.26310201  0.03144759 -1.33396815  1.67640635
 [79] -1.25548060  2.01727128 -0.82537745  0.52296044  1.11363307 -0.36053962
 [85] -0.56672843 -0.21982248 -1.27892746 -0.19488446 -0.10523089  0.43444475
 [91]  0.23243233  1.89902962 -1.36560453 -0.20698951  0.56354205  0.10325965
 [97]  0.80974016 -1.93874859  1.25924968  0.11106736
> colMedians(tmp)
  [1] -1.99069443 -0.85639710  0.77292734 -0.40396657  1.58439930  0.30188032
  [7]  0.54837798 -0.38889969  0.24423243  0.99246735  0.29918591 -0.63043870
 [13]  1.50599342  0.67319845 -0.86071849 -0.62379229  0.17979396  0.17457436
 [19]  0.44428806  0.71106877 -1.21708690  0.96604064  1.13208355  0.40201156
 [25]  1.05445541 -0.48121674  1.12816083 -0.56444698  0.55096629 -0.49898501
 [31]  1.11139243 -0.21689423  0.39584853  0.64971767  0.05384694  0.81153245
 [37]  0.93258173  1.90586516 -1.16759461 -0.04041542  0.73639467 -1.06016531
 [43]  1.32559957  0.58626106 -1.08054559 -0.91105631 -2.51758966  0.63017761
 [49]  0.40332044 -0.52482468  1.11799835 -0.93903289 -1.16804993 -0.13678857
 [55] -0.28538345 -1.78469485 -0.39475291  0.36424592 -0.22546043 -0.87910366
 [61]  0.02947778 -0.09909499  0.49633784  0.94544689 -0.57287074  1.03210802
 [67]  0.84502807 -0.27103489  0.10405584 -0.66561298 -1.00603387 -1.85917019
 [73]  0.04353870 -0.68877324  0.26310201  0.03144759 -1.33396815  1.67640635
 [79] -1.25548060  2.01727128 -0.82537745  0.52296044  1.11363307 -0.36053962
 [85] -0.56672843 -0.21982248 -1.27892746 -0.19488446 -0.10523089  0.43444475
 [91]  0.23243233  1.89902962 -1.36560453 -0.20698951  0.56354205  0.10325965
 [97]  0.80974016 -1.93874859  1.25924968  0.11106736
> colRanges(tmp)
          [,1]       [,2]      [,3]       [,4]     [,5]      [,6]     [,7]
[1,] -1.990694 -0.8563971 0.7729273 -0.4039666 1.584399 0.3018803 0.548378
[2,] -1.990694 -0.8563971 0.7729273 -0.4039666 1.584399 0.3018803 0.548378
           [,8]      [,9]     [,10]     [,11]      [,12]    [,13]     [,14]
[1,] -0.3888997 0.2442324 0.9924674 0.2991859 -0.6304387 1.505993 0.6731984
[2,] -0.3888997 0.2442324 0.9924674 0.2991859 -0.6304387 1.505993 0.6731984
          [,15]      [,16]    [,17]     [,18]     [,19]     [,20]     [,21]
[1,] -0.8607185 -0.6237923 0.179794 0.1745744 0.4442881 0.7110688 -1.217087
[2,] -0.8607185 -0.6237923 0.179794 0.1745744 0.4442881 0.7110688 -1.217087
         [,22]    [,23]     [,24]    [,25]      [,26]    [,27]     [,28]
[1,] 0.9660406 1.132084 0.4020116 1.054455 -0.4812167 1.128161 -0.564447
[2,] 0.9660406 1.132084 0.4020116 1.054455 -0.4812167 1.128161 -0.564447
         [,29]     [,30]    [,31]      [,32]     [,33]     [,34]      [,35]
[1,] 0.5509663 -0.498985 1.111392 -0.2168942 0.3958485 0.6497177 0.05384694
[2,] 0.5509663 -0.498985 1.111392 -0.2168942 0.3958485 0.6497177 0.05384694
         [,36]     [,37]    [,38]     [,39]       [,40]     [,41]     [,42]
[1,] 0.8115324 0.9325817 1.905865 -1.167595 -0.04041542 0.7363947 -1.060165
[2,] 0.8115324 0.9325817 1.905865 -1.167595 -0.04041542 0.7363947 -1.060165
      [,43]     [,44]     [,45]      [,46]    [,47]     [,48]     [,49]
[1,] 1.3256 0.5862611 -1.080546 -0.9110563 -2.51759 0.6301776 0.4033204
[2,] 1.3256 0.5862611 -1.080546 -0.9110563 -2.51759 0.6301776 0.4033204
          [,50]    [,51]      [,52]    [,53]      [,54]      [,55]     [,56]
[1,] -0.5248247 1.117998 -0.9390329 -1.16805 -0.1367886 -0.2853835 -1.784695
[2,] -0.5248247 1.117998 -0.9390329 -1.16805 -0.1367886 -0.2853835 -1.784695
          [,57]     [,58]      [,59]      [,60]      [,61]       [,62]
[1,] -0.3947529 0.3642459 -0.2254604 -0.8791037 0.02947778 -0.09909499
[2,] -0.3947529 0.3642459 -0.2254604 -0.8791037 0.02947778 -0.09909499
         [,63]     [,64]      [,65]    [,66]     [,67]      [,68]     [,69]
[1,] 0.4963378 0.9454469 -0.5728707 1.032108 0.8450281 -0.2710349 0.1040558
[2,] 0.4963378 0.9454469 -0.5728707 1.032108 0.8450281 -0.2710349 0.1040558
         [,70]     [,71]    [,72]     [,73]      [,74]    [,75]      [,76]
[1,] -0.665613 -1.006034 -1.85917 0.0435387 -0.6887732 0.263102 0.03144759
[2,] -0.665613 -1.006034 -1.85917 0.0435387 -0.6887732 0.263102 0.03144759
         [,77]    [,78]     [,79]    [,80]      [,81]     [,82]    [,83]
[1,] -1.333968 1.676406 -1.255481 2.017271 -0.8253774 0.5229604 1.113633
[2,] -1.333968 1.676406 -1.255481 2.017271 -0.8253774 0.5229604 1.113633
          [,84]      [,85]      [,86]     [,87]      [,88]      [,89]     [,90]
[1,] -0.3605396 -0.5667284 -0.2198225 -1.278927 -0.1948845 -0.1052309 0.4344448
[2,] -0.3605396 -0.5667284 -0.2198225 -1.278927 -0.1948845 -0.1052309 0.4344448
         [,91]   [,92]     [,93]      [,94]     [,95]     [,96]     [,97]
[1,] 0.2324323 1.89903 -1.365605 -0.2069895 0.5635421 0.1032596 0.8097402
[2,] 0.2324323 1.89903 -1.365605 -0.2069895 0.5635421 0.1032596 0.8097402
         [,98]   [,99]    [,100]
[1,] -1.938749 1.25925 0.1110674
[2,] -1.938749 1.25925 0.1110674
> 
> 
> Max(tmp2)
[1] 2.069117
> Min(tmp2)
[1] -2.594384
> mean(tmp2)
[1] 0.04223258
> Sum(tmp2)
[1] 4.223258
> Var(tmp2)
[1] 1.261666
> 
> rowMeans(tmp2)
  [1]  0.38957002 -0.96373905 -0.42335914  0.32129371  0.57917750  0.75289734
  [7] -0.79703508  0.78070834  1.09676058 -1.09107656  0.87436011  0.14498478
 [13] -0.37146513  0.46212496 -2.23260782 -1.35990767 -2.04560193  0.26165312
 [19] -0.45254021 -0.15343160  1.55515826 -0.44743565  1.26977069 -0.15477243
 [25]  0.80791266  0.29540175 -1.35103067  0.65295922 -0.41625071  1.39381091
 [31]  0.96186055  0.25430379  0.83210519 -1.59074060 -0.90575853  0.82177632
 [37]  1.05506015  1.11492988  1.88428236 -1.51019666 -1.04568519  0.60859777
 [43] -0.80304454  1.60363393  1.15537898 -0.06779979 -1.83051380 -0.91241986
 [49] -0.82872419  2.06911748 -0.48391516 -1.44002570  0.40897287  1.08144160
 [55]  0.05979990  1.57549465  1.84048924  0.23474382 -0.80697530 -0.66321682
 [61]  0.02887832  1.08049225  0.88775428  0.48108595 -0.66289411  0.98917825
 [67] -2.59438357  1.37486200 -0.23894966  1.72272269 -0.68546008 -0.32235302
 [73]  0.56240946  1.29402661 -0.41586454  0.27343094 -1.92442985  0.15073378
 [79] -1.41504721 -0.99211850 -1.44318883 -1.03874479  1.30035214 -0.12287880
 [85] -0.41643218 -1.36540152  1.83699253  1.00577513  0.74010046  0.63815406
 [91] -1.98911480  1.69687831  0.43711970 -1.21249475  0.48718131  1.92819848
 [97]  0.76912009 -1.55260904  0.94404409 -2.06513062
> rowSums(tmp2)
  [1]  0.38957002 -0.96373905 -0.42335914  0.32129371  0.57917750  0.75289734
  [7] -0.79703508  0.78070834  1.09676058 -1.09107656  0.87436011  0.14498478
 [13] -0.37146513  0.46212496 -2.23260782 -1.35990767 -2.04560193  0.26165312
 [19] -0.45254021 -0.15343160  1.55515826 -0.44743565  1.26977069 -0.15477243
 [25]  0.80791266  0.29540175 -1.35103067  0.65295922 -0.41625071  1.39381091
 [31]  0.96186055  0.25430379  0.83210519 -1.59074060 -0.90575853  0.82177632
 [37]  1.05506015  1.11492988  1.88428236 -1.51019666 -1.04568519  0.60859777
 [43] -0.80304454  1.60363393  1.15537898 -0.06779979 -1.83051380 -0.91241986
 [49] -0.82872419  2.06911748 -0.48391516 -1.44002570  0.40897287  1.08144160
 [55]  0.05979990  1.57549465  1.84048924  0.23474382 -0.80697530 -0.66321682
 [61]  0.02887832  1.08049225  0.88775428  0.48108595 -0.66289411  0.98917825
 [67] -2.59438357  1.37486200 -0.23894966  1.72272269 -0.68546008 -0.32235302
 [73]  0.56240946  1.29402661 -0.41586454  0.27343094 -1.92442985  0.15073378
 [79] -1.41504721 -0.99211850 -1.44318883 -1.03874479  1.30035214 -0.12287880
 [85] -0.41643218 -1.36540152  1.83699253  1.00577513  0.74010046  0.63815406
 [91] -1.98911480  1.69687831  0.43711970 -1.21249475  0.48718131  1.92819848
 [97]  0.76912009 -1.55260904  0.94404409 -2.06513062
> 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.38957002 -0.96373905 -0.42335914  0.32129371  0.57917750  0.75289734
  [7] -0.79703508  0.78070834  1.09676058 -1.09107656  0.87436011  0.14498478
 [13] -0.37146513  0.46212496 -2.23260782 -1.35990767 -2.04560193  0.26165312
 [19] -0.45254021 -0.15343160  1.55515826 -0.44743565  1.26977069 -0.15477243
 [25]  0.80791266  0.29540175 -1.35103067  0.65295922 -0.41625071  1.39381091
 [31]  0.96186055  0.25430379  0.83210519 -1.59074060 -0.90575853  0.82177632
 [37]  1.05506015  1.11492988  1.88428236 -1.51019666 -1.04568519  0.60859777
 [43] -0.80304454  1.60363393  1.15537898 -0.06779979 -1.83051380 -0.91241986
 [49] -0.82872419  2.06911748 -0.48391516 -1.44002570  0.40897287  1.08144160
 [55]  0.05979990  1.57549465  1.84048924  0.23474382 -0.80697530 -0.66321682
 [61]  0.02887832  1.08049225  0.88775428  0.48108595 -0.66289411  0.98917825
 [67] -2.59438357  1.37486200 -0.23894966  1.72272269 -0.68546008 -0.32235302
 [73]  0.56240946  1.29402661 -0.41586454  0.27343094 -1.92442985  0.15073378
 [79] -1.41504721 -0.99211850 -1.44318883 -1.03874479  1.30035214 -0.12287880
 [85] -0.41643218 -1.36540152  1.83699253  1.00577513  0.74010046  0.63815406
 [91] -1.98911480  1.69687831  0.43711970 -1.21249475  0.48718131  1.92819848
 [97]  0.76912009 -1.55260904  0.94404409 -2.06513062
> rowMin(tmp2)
  [1]  0.38957002 -0.96373905 -0.42335914  0.32129371  0.57917750  0.75289734
  [7] -0.79703508  0.78070834  1.09676058 -1.09107656  0.87436011  0.14498478
 [13] -0.37146513  0.46212496 -2.23260782 -1.35990767 -2.04560193  0.26165312
 [19] -0.45254021 -0.15343160  1.55515826 -0.44743565  1.26977069 -0.15477243
 [25]  0.80791266  0.29540175 -1.35103067  0.65295922 -0.41625071  1.39381091
 [31]  0.96186055  0.25430379  0.83210519 -1.59074060 -0.90575853  0.82177632
 [37]  1.05506015  1.11492988  1.88428236 -1.51019666 -1.04568519  0.60859777
 [43] -0.80304454  1.60363393  1.15537898 -0.06779979 -1.83051380 -0.91241986
 [49] -0.82872419  2.06911748 -0.48391516 -1.44002570  0.40897287  1.08144160
 [55]  0.05979990  1.57549465  1.84048924  0.23474382 -0.80697530 -0.66321682
 [61]  0.02887832  1.08049225  0.88775428  0.48108595 -0.66289411  0.98917825
 [67] -2.59438357  1.37486200 -0.23894966  1.72272269 -0.68546008 -0.32235302
 [73]  0.56240946  1.29402661 -0.41586454  0.27343094 -1.92442985  0.15073378
 [79] -1.41504721 -0.99211850 -1.44318883 -1.03874479  1.30035214 -0.12287880
 [85] -0.41643218 -1.36540152  1.83699253  1.00577513  0.74010046  0.63815406
 [91] -1.98911480  1.69687831  0.43711970 -1.21249475  0.48718131  1.92819848
 [97]  0.76912009 -1.55260904  0.94404409 -2.06513062
> 
> colMeans(tmp2)
[1] 0.04223258
> colSums(tmp2)
[1] 4.223258
> colVars(tmp2)
[1] 1.261666
> colSd(tmp2)
[1] 1.123239
> colMax(tmp2)
[1] 2.069117
> colMin(tmp2)
[1] -2.594384
> colMedians(tmp2)
[1] 0.2445238
> colRanges(tmp2)
          [,1]
[1,] -2.594384
[2,]  2.069117
> 
> 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]  5.0888402 -0.2475871  1.9379115  3.2797854 -1.4601792  3.2966602
 [7] -0.3070988 -2.6500210 -0.2687558 -9.6373604
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.2044996
[2,] -0.1747411
[3,]  0.3653905
[4,]  1.0693041
[5,]  2.3457904
> 
> rowApply(tmp,sum)
 [1] -2.2525940 -5.9683006  3.3122641 -2.9853932  0.7071448  6.4622365
 [7]  0.7774826 -0.8617765  0.8951566 -1.0540256
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    6    8    6    6   10    3    5   10     2
 [2,]   10    3    3    2    7    2    9    4    4    10
 [3,]    2    9    7    8    4    1   10    8    9     4
 [4,]    5   10    9    3    2    9    7    7    6     9
 [5,]    8    4    6    4    8    5    1    3    3     8
 [6,]    4    7   10    7   10    7    2    9    5     7
 [7,]    6    2    5    9    3    3    6    2    8     6
 [8,]    7    5    1    5    1    6    8    6    7     5
 [9,]    1    1    4   10    5    8    5   10    2     3
[10,]    3    8    2    1    9    4    4    1    1     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.04036640  3.79715327  3.77619257  2.61628016  0.10323393  1.35286971
 [7] -1.04220068 -0.14981453  1.07688306 -1.44077039  2.12546952  2.55365083
[13] -2.01264634 -0.06183172 -3.58407768 -0.16311993 -2.46817245 -3.62441894
[19] -0.82219416  4.44549640
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8668752
[2,] -0.1399322
[3,]  0.5120290
[4,]  0.5530554
[5,]  0.9013566
> 
> rowApply(tmp,sum)
[1]  0.9979268  2.3851966 -0.2446800  2.8143617  0.4848112
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   13   10   10    1   18
[2,]   16   16   20    4    9
[3,]   17   13   11   17   20
[4,]   10   11   19    9    8
[5,]    8   20    3    7   19
> 
> 
> as.matrix(tmp)
           [,1]        [,2]         [,3]       [,4]       [,5]          [,6]
[1,]  0.5530554  0.69520237  1.018982042  0.1549739 -0.3965941 -1.3254730823
[2,]  0.5120290  0.79955439  0.683136478  0.6335553  1.3696637  0.0026300372
[3,] -0.1399322  3.01940647 -0.008215538  2.2220085 -1.2639745 -0.0002133857
[4,] -1.8668752 -0.63439642  1.141464791 -0.1823741 -0.5174456  2.0625928879
[5,]  0.9013566 -0.08261354  0.940824798 -0.2118835  0.9115844  0.6133332566
            [,7]       [,8]        [,9]      [,10]      [,11]      [,12]
[1,]  0.39097013 -0.5089147  1.86764143 -0.7229657  1.6475507  0.2879028
[2,] -0.35621170 -1.3038264 -0.85567106 -1.8122756  0.6640753  1.3062640
[3,]  0.06675165  0.3063005 -0.26894085  1.1540238 -0.2519095 -0.1895448
[4,] -0.54710709  0.8405472  0.24010397 -0.3864693 -0.7480752  0.6607098
[5,] -0.59660367  0.5160788  0.09374957  0.3269163  0.8138282  0.4883190
          [,13]      [,14]       [,15]       [,16]       [,17]      [,18]
[1,] -1.5788468 -1.0280414 -1.37224293  0.56130484 -0.16510109 -1.0072705
[2,]  0.7232516 -0.5569968  1.12253797 -0.35782017 -1.59629054 -0.6452914
[3,] -1.7704833 -0.3411809 -1.92533621  0.19007982  0.04379165 -0.8723800
[4,]  1.5213984  1.7314072 -0.02802982  0.09329791  0.05260493 -0.6240048
[5,] -0.9079662  0.1329800 -1.38100669 -0.64998233 -0.80317741 -0.4754722
          [,19]     [,20]
[1,]  0.6342945 1.2914989
[2,]  0.7584170 1.2944655
[3,] -0.5469365 0.3320053
[4,] -0.9056872 0.9106992
[5,] -0.7622818 0.6168274
> 
> 
> 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.24-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.24-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  649  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  562  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.24-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.131013 -0.7089889 -1.011342 0.04179484 -0.4845706 0.02125273 -0.343251
          col8       col9     col10     col11     col12      col13      col14
row1 0.7212458 -0.4202652 0.3323228 -1.043831 0.8409191 -0.4672757 -0.2694922
         col15      col16     col17     col18     col19     col20
row1 0.2583312 -0.5701957 0.1452515 0.1318724 0.6971007 0.3418814
> tmp[,"col10"]
          col10
row1  0.3323228
row2  0.3474417
row3  0.3343771
row4 -0.6086892
row5  0.5788286
> tmp[c("row1","row5"),]
          col1        col2      col3        col4       col5       col6
row1 0.1310130 -0.70898886 -1.011342  0.04179484 -0.4845706 0.02125273
row5 0.5286597  0.05179294  1.334367 -0.74127687 -0.6726164 0.30975289
          col7       col8        col9     col10      col11     col12      col13
row1 -0.343251  0.7212458 -0.42026522 0.3323228 -1.0438313 0.8409191 -0.4672757
row5 -1.292842 -0.7694878 -0.05637617 0.5788286  0.8264759 0.4376534  1.1053714
          col14       col15      col16     col17     col18      col19     col20
row1 -0.2694922  0.25833118 -0.5701957 0.1452515 0.1318724  0.6971007 0.3418814
row5  1.7138815 -0.05967385 -0.8564859 1.0972729 1.4202606 -0.1184148 0.5215724
> tmp[,c("col6","col20")]
            col6       col20
row1  0.02125273  0.34188141
row2  1.37734006  0.02088081
row3  1.09280155 -2.30847878
row4 -1.59675571  0.52636146
row5  0.30975289  0.52157238
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1 0.02125273 0.3418814
row5 0.30975289 0.5215724
> 
> 
> 
> 
> 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.69286 50.39058 48.66078 49.82706 50.58805 105.692 50.91655 50.62612
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.52924 51.51546 49.10883 51.25713 51.36833 49.41596 49.11728 50.13842
        col17    col18    col19    col20
row1 51.10479 51.73365 49.48057 105.0157
> tmp[,"col10"]
        col10
row1 51.51546
row2 28.25951
row3 28.49705
row4 30.25759
row5 50.17493
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.69286 50.39058 48.66078 49.82706 50.58805 105.6920 50.91655 50.62612
row5 49.17890 49.94161 50.99684 49.16676 50.05325 105.7168 49.04573 49.71135
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.52924 51.51546 49.10883 51.25713 51.36833 49.41596 49.11728 50.13842
row5 49.67320 50.17493 50.88132 49.55927 49.49397 51.65526 49.49791 49.27510
        col17    col18    col19    col20
row1 51.10479 51.73365 49.48057 105.0157
row5 51.30389 50.95553 51.58355 105.5782
> tmp[,c("col6","col20")]
          col6     col20
row1 105.69203 105.01567
row2  76.46158  75.70653
row3  75.89478  74.00193
row4  75.75237  74.36517
row5 105.71683 105.57820
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.6920 105.0157
row5 105.7168 105.5782
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.6920 105.0157
row5 105.7168 105.5782
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.6595423
[2,] -1.2818314
[3,] -0.2374679
[4,]  1.5325632
[5,] -1.3374565
> tmp[,c("col17","col7")]
           col17        col7
[1,] -0.03704157 -1.57549797
[2,] -0.35161307 -0.45520781
[3,] -0.64384374 -0.06179345
[4,]  0.81941354 -0.40556796
[5,] -1.03105114 -0.69025229
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,]  0.82659664 -0.4699062
[2,]  0.16992346  0.5560809
[3,]  0.04547354 -0.7805996
[4,]  1.64085018 -2.2434198
[5,] -0.97365348 -0.1341124
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.8265966
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.8265966
[2,] 0.1699235
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]       [,4]       [,5]        [,6]
row3 -0.9573757 -1.4112507  0.2199787  0.6342753 -0.1006501  0.62741298
row1  0.8673816  0.9980178 -0.8740795 -1.2332324 -0.2943374 -0.03056096
           [,7]       [,8]       [,9]       [,10]       [,11]      [,12]
row3 -0.3285245 -0.4632638  0.7547826 -0.08044853 -1.86150667 -1.4833208
row1  0.2443481 -1.6117827 -1.2685470 -0.10083448  0.01061935  0.4681738
          [,13]      [,14]      [,15]     [,16]    [,17]     [,18]      [,19]
row3 -0.1652918  0.5387079 -0.8853212 -1.001073 1.314815 -0.737524  0.7274779
row1 -0.6054079 -0.8236419  0.5476194 -2.538618 2.217762 -1.601221 -1.1354748
          [,20]
row3  0.4517088
row1 -2.1507035
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]       [,3]      [,4]       [,5]       [,6]      [,7]
row2 -2.206788 1.474358 -0.6165399 0.5281299 -0.4700424 -0.5483481 0.6701398
          [,8]       [,9]    [,10]
row2 0.8677771 -0.1597464 1.213885
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
            [,1]      [,2]       [,3]     [,4]       [,5]       [,6]      [,7]
row5 -0.04082559 -1.290257 -0.3554383 1.345116 -0.2234076 -0.7752285 0.6919475
          [,8]       [,9]     [,10]     [,11]     [,12]     [,13]      [,14]
row5 -1.084365 -0.3925321 0.2089078 -1.056749 -1.358902 0.8336051 -0.2825883
        [,15]     [,16]      [,17]      [,18]      [,19]     [,20]
row5 1.663379 -1.129786 0.04569878 -0.2714041 -0.3528865 0.4218278
> 
> 
> 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: 0xc02a685a0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a42b926802"
 [2] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a418ea71a7"
 [3] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a447cb97b8"
 [4] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a4755d5db" 
 [5] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a4144b20a0"
 [6] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a4504af2c8"
 [7] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a4688951a6"
 [8] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a4f4f9ee8" 
 [9] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a434499932"
[10] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a44be8bc6f"
[11] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a41cab4258"
[12] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a42f90ae1c"
[13] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a44396c8a9"
[14] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a4604ff1e9"
[15] "/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM36a420932965"
> 
> 
> ### 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: 0xc02a691a0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xc02a691a0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xc02a691a0>
> rowMedians(tmp)
  [1]  0.168827118  0.220056810 -0.051608542 -0.284055965 -0.008822409
  [6] -0.537363080 -0.246740910 -0.442586039  0.110917729 -0.079035273
 [11]  0.504107918  0.807447952 -0.258772980  0.115623162  0.416082981
 [16]  0.007301472  0.204112974 -0.053631101  0.095601506 -0.089684304
 [21] -0.115776406  0.253473205  0.020944023  0.269986057  0.413093131
 [26] -0.137040872  0.394241395  0.116821406 -0.106837521 -0.317543805
 [31] -0.113481535 -0.400432126 -0.247200734  0.111968851  0.513474028
 [36]  0.047747929  0.493553726 -0.579610667 -0.200055401  0.221709215
 [41]  0.029540972 -0.010747023 -0.395433421  0.094327100 -0.038031525
 [46] -0.084492649 -0.213499434 -0.017643400 -0.718741770 -0.360685288
 [51]  0.373262432  0.024945892 -0.019850550  0.149969821  0.141499050
 [56] -0.850359912  0.050767862 -0.499256219 -0.089697067  0.296776044
 [61]  0.125115318 -0.246445236 -0.223455643  0.418775342 -0.339902061
 [66] -0.482925417  0.327156492  0.014534986  0.101885473 -0.332119384
 [71] -0.218006233  0.067374665 -0.092379096 -0.413109602  0.017154636
 [76]  0.597639354 -0.121742860  0.154594875  0.519361535  0.501710366
 [81]  0.260947378  0.502237665  0.479446376  0.068972822  0.276407468
 [86]  0.052920905  0.060840595 -0.019187898  0.588081562  0.185963368
 [91] -0.177460566  0.282340442  0.149427151 -0.141479516 -0.189123210
 [96]  0.188098136 -0.125394453 -0.398540953 -0.196734783  0.124613310
[101]  0.212413939  0.005183642  0.147315615 -0.011033885 -0.432802756
[106]  0.340237524  0.120663161 -0.812879533 -0.149111664  0.342697187
[111] -0.109443313  0.391712755 -0.356731957  0.468333468 -0.136438078
[116] -0.052092691 -0.321961709 -0.548921049  0.460970844 -0.003988234
[121]  0.347323506  0.186803178  0.406238827 -0.188668515 -0.327034751
[126] -0.114020710 -0.501698646  0.381633528 -0.120909006  0.359565167
[131]  0.018707082 -0.135837063 -0.560033933 -0.600404697 -0.373428073
[136]  0.096676102  0.499126648  0.186047192  0.091916354  0.048445446
[141]  0.308656931 -0.021552429  0.006472402 -0.037316620  0.324468829
[146] -0.125627915 -0.107550478 -0.888794951  0.051398171 -0.445486189
[151] -0.209863495 -0.093398762 -0.197377888  0.147149090  0.064082808
[156] -0.391627475  0.232835740 -0.592443956  0.779148049 -0.581302245
[161] -0.068029083 -0.231256061 -0.112615299  0.514256222 -0.478199027
[166] -0.107844045 -0.047434282  0.011355040 -0.571582938 -0.311701532
[171] -0.162947869 -0.078669567  0.477900210 -0.071458995  0.233739075
[176]  0.265902134  0.461737543 -0.072496287 -0.126253104  0.082406648
[181] -0.065834976  0.374227323 -0.016241026  0.461749285 -0.155650480
[186]  0.213878898 -0.181563711  0.416568185 -0.318311479  0.147243709
[191] -0.142216138 -0.328393634 -0.258312397 -0.238760331 -0.241930379
[196]  0.223228980 -0.132057141  0.253838064 -0.281331516 -0.293886030
[201] -0.380437570 -0.105356314  0.335579914  0.084053057 -0.287125041
[206] -0.149394482 -0.275104362  0.074835622  0.112232441 -0.126860688
[211] -0.136870146 -0.354276820 -0.459104415  0.163596627 -0.262082684
[216]  0.052254379  0.334951004 -0.043713131  0.261562237 -0.300762791
[221] -0.353695392 -0.190651736  0.289776657  0.213847311  0.339153130
[226] -0.187163901  0.235868312  0.339973675 -0.093105759 -0.267799278
> 
> proc.time()
   user  system elapsed 
  0.807   6.462   7.904 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.6.0 Patched (2026-05-01 r89994) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin23

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: 0x105548da0>
> .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: 0x105548da0>
> .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: 0x105548da0>
> .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: 0x105548da0>
> 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: 0xa733b0060>
> .Call("R_bm_AddColumn",P)
<pointer: 0xa733b0060>
> .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: 0xa733b0060>
> .Call("R_bm_AddColumn",P)
<pointer: 0xa733b0060>
> .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: 0xa733b0060>
> 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: 0xa733b0360>
> .Call("R_bm_AddColumn",P)
<pointer: 0xa733b0360>
> .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: 0xa733b0360>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xa733b0360>
> .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: 0xa733b0360>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0xa733b0360>
> .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: 0xa733b0360>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0xa733b0360>
> .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: 0xa733b0360>
> 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: 0xa733b0480>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0xa733b0480>
> .Call("R_bm_AddColumn",P)
<pointer: 0xa733b0480>
> .Call("R_bm_AddColumn",P)
<pointer: 0xa733b0480>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3b7b10ef9c97" "BufferedMatrixFile3b7b63118630"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3b7b10ef9c97" "BufferedMatrixFile3b7b63118630"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0xa733b05a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xa733b05a0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xa733b05a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xa733b05a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0xa733b05a0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0xa733b05a0>
> .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: 0xa733b0720>
> .Call("R_bm_AddColumn",P)
<pointer: 0xa733b0720>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xa733b0720>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0xa733b0720>
> 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: 0xa733b0840>
> .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: 0xa733b0840>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.118   0.047   0.160 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.6.0 Patched (2026-05-01 r89994) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin23

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.131   0.038   0.169 

Example timings