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

This page was generated on 2026-05-26 11:32 -0400 (Tue, 26 May 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.4 LTS)x86_644.6.0 RC (2026-04-17 r89917) -- "Because it was There" 4995
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 262/2418HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.76.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-05-25 13:40 -0400 (Mon, 25 May 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_23
git_last_commit: 9d72964
git_last_commit_date: 2026-04-28 08:32:08 -0400 (Tue, 28 Apr 2026)
nebbiolo1Linux (Ubuntu 24.04.4 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
See other builds for BufferedMatrix in R Universe.


CHECK results for BufferedMatrix on nebbiolo1

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.76.0
Command: /home/biocbuild/bbs-3.23-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.23-bioc/R/site-library --timings BufferedMatrix_1.76.0.tar.gz
StartedAt: 2026-05-25 22:07:36 -0400 (Mon, 25 May 2026)
EndedAt: 2026-05-25 22:08:01 -0400 (Mon, 25 May 2026)
EllapsedTime: 25.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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


Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.23-bioc/R/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.6.0 RC (2026-04-17 r89917) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix", "BufferedMatrix", .libPaths());.C("dbm_c_tester",integer(1))

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.260   0.032   0.283 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.6.0 RC (2026-04-17 r89917) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 480233 25.7    1053308 56.3   637571 34.1
Vcells 887253  6.8    8388608 64.0  2083896 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon May 25 22:07:52 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 25 22:07:52 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: 0x5816aa081690>
> 
> 
> 
> 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 25 22:07:52 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 25 22:07:53 2026"
> 
> ColMode(tmp2)
<pointer: 0x5816aa081690>
> 
> 
> 
> ### 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.0100929 -0.48337166 -0.5670537 -0.3692696
[2,]  -0.3711654 -0.21867160 -0.6807460 -0.4879294
[3,]   0.4996616  0.12233690 -0.4258464 -1.8825596
[4,]   0.8517514 -0.01286822 -1.9877705 -1.2868381
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]       [,2]      [,3]      [,4]
[1,] 101.0100929 0.48337166 0.5670537 0.3692696
[2,]   0.3711654 0.21867160 0.6807460 0.4879294
[3,]   0.4996616 0.12233690 0.4258464 1.8825596
[4,]   0.8517514 0.01286822 1.9877705 1.2868381
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0503778 0.6952493 0.7530297 0.6076755
[2,]  0.6092335 0.4676233 0.8250733 0.6985195
[3,]  0.7068674 0.3497669 0.6525691 1.3720640
[4,]  0.9229038 0.1134382 1.4098832 1.1343889
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 226.51387 32.43587 33.09735 31.44602
[2,]  31.46350 29.89491 33.93148 32.47312
[3,]  32.56834 28.62001 31.95154 40.60320
[4,]  35.08079 26.14725 41.08660 37.63073
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5816ab4350c0>
> exp(tmp5)
<pointer: 0x5816ab4350c0>
> log(tmp5,2)
<pointer: 0x5816ab4350c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.4589
> Min(tmp5)
[1] 53.42922
> mean(tmp5)
[1] 73.63149
> Sum(tmp5)
[1] 14726.3
> Var(tmp5)
[1] 861.6986
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 94.66710 69.44817 71.25975 69.93805 74.47360 70.54674 71.60224 71.09891
 [9] 73.53288 69.74745
> rowSums(tmp5)
 [1] 1893.342 1388.963 1425.195 1398.761 1489.472 1410.935 1432.045 1421.978
 [9] 1470.658 1394.949
> rowVars(tmp5)
 [1] 7900.81719   43.83450   63.50688   71.65429   87.47725   47.66134
 [7]   69.38666   62.24471   82.49073   53.85850
> rowSd(tmp5)
 [1] 88.886541  6.620763  7.969120  8.464885  9.352928  6.903719  8.329866
 [8]  7.889531  9.082441  7.338835
> rowMax(tmp5)
 [1] 471.45894  79.69637  86.26080  85.51638  94.82502  85.99702  84.40761
 [8]  86.03586  90.69704  82.29858
> rowMin(tmp5)
 [1] 63.13828 57.68539 55.97209 54.42207 58.83759 59.28632 53.42922 58.13448
 [9] 57.50979 58.38122
> 
> colMeans(tmp5)
 [1] 110.44369  70.37367  71.74004  76.67932  71.80493  66.25901  68.62152
 [8]  69.65073  73.95173  67.49087  76.36686  74.03177  72.64197  76.06023
[15]  73.15343  69.82111  67.82849  77.73744  69.83956  68.13340
> colSums(tmp5)
 [1] 1104.4369  703.7367  717.4004  766.7932  718.0493  662.5901  686.2152
 [8]  696.5073  739.5173  674.9087  763.6686  740.3177  726.4197  760.6023
[15]  731.5343  698.2111  678.2849  777.3744  698.3956  681.3340
> colVars(tmp5)
 [1] 16150.23122   110.64717    36.70513    86.65566    42.08010    66.35135
 [7]    44.17402    67.18417   106.24079    60.35196    39.42533    26.60860
[13]    84.07220    17.30645    57.70144    49.21970    65.27209    36.06609
[19]    44.34648    40.83653
> colSd(tmp5)
 [1] 127.083560  10.518896   6.058476   9.308902   6.486918   8.145634
 [7]   6.646354   8.196595  10.307317   7.768652   6.278960   5.158352
[13]   9.169090   4.160102   7.596146   7.015675   8.079114   6.005505
[19]   6.659316   6.390347
> colMax(tmp5)
 [1] 471.45894  86.30713  85.51638  94.82502  82.29858  78.86992  79.60766
 [8]  82.83004  90.69704  86.26080  82.84716  84.23101  86.44557  82.45938
[15]  80.23573  82.64304  80.83466  86.03586  81.62059  78.74462
> colMin(tmp5)
 [1] 58.13448 54.42207 66.22940 65.45078 60.34073 53.42922 57.50979 58.66320
 [9] 58.83759 59.08575 60.82322 69.07830 59.87416 69.52195 59.28632 59.75772
[17] 55.56812 68.42292 59.48617 57.68539
> 
> 
> ### 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] 94.66710 69.44817 71.25975 69.93805 74.47360 70.54674 71.60224       NA
 [9] 73.53288 69.74745
> rowSums(tmp5)
 [1] 1893.342 1388.963 1425.195 1398.761 1489.472 1410.935 1432.045       NA
 [9] 1470.658 1394.949
> rowVars(tmp5)
 [1] 7900.81719   43.83450   63.50688   71.65429   87.47725   47.66134
 [7]   69.38666   65.69943   82.49073   53.85850
> rowSd(tmp5)
 [1] 88.886541  6.620763  7.969120  8.464885  9.352928  6.903719  8.329866
 [8]  8.105519  9.082441  7.338835
> rowMax(tmp5)
 [1] 471.45894  79.69637  86.26080  85.51638  94.82502  85.99702  84.40761
 [8]        NA  90.69704  82.29858
> rowMin(tmp5)
 [1] 63.13828 57.68539 55.97209 54.42207 58.83759 59.28632 53.42922       NA
 [9] 57.50979 58.38122
> 
> colMeans(tmp5)
 [1] 110.44369  70.37367  71.74004        NA  71.80493  66.25901  68.62152
 [8]  69.65073  73.95173  67.49087  76.36686  74.03177  72.64197  76.06023
[15]  73.15343  69.82111  67.82849  77.73744  69.83956  68.13340
> colSums(tmp5)
 [1] 1104.4369  703.7367  717.4004        NA  718.0493  662.5901  686.2152
 [8]  696.5073  739.5173  674.9087  763.6686  740.3177  726.4197  760.6023
[15]  731.5343  698.2111  678.2849  777.3744  698.3956  681.3340
> colVars(tmp5)
 [1] 16150.23122   110.64717    36.70513          NA    42.08010    66.35135
 [7]    44.17402    67.18417   106.24079    60.35196    39.42533    26.60860
[13]    84.07220    17.30645    57.70144    49.21970    65.27209    36.06609
[19]    44.34648    40.83653
> colSd(tmp5)
 [1] 127.083560  10.518896   6.058476         NA   6.486918   8.145634
 [7]   6.646354   8.196595  10.307317   7.768652   6.278960   5.158352
[13]   9.169090   4.160102   7.596146   7.015675   8.079114   6.005505
[19]   6.659316   6.390347
> colMax(tmp5)
 [1] 471.45894  86.30713  85.51638        NA  82.29858  78.86992  79.60766
 [8]  82.83004  90.69704  86.26080  82.84716  84.23101  86.44557  82.45938
[15]  80.23573  82.64304  80.83466  86.03586  81.62059  78.74462
> colMin(tmp5)
 [1] 58.13448 54.42207 66.22940       NA 60.34073 53.42922 57.50979 58.66320
 [9] 58.83759 59.08575 60.82322 69.07830 59.87416 69.52195 59.28632 59.75772
[17] 55.56812 68.42292 59.48617 57.68539
> 
> Max(tmp5,na.rm=TRUE)
[1] 471.4589
> Min(tmp5,na.rm=TRUE)
[1] 53.42922
> mean(tmp5,na.rm=TRUE)
[1] 73.64302
> Sum(tmp5,na.rm=TRUE)
[1] 14654.96
> Var(tmp5,na.rm=TRUE)
[1] 866.0239
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 94.66710 69.44817 71.25975 69.93805 74.47360 70.54674 71.60224 71.08638
 [9] 73.53288 69.74745
> rowSums(tmp5,na.rm=TRUE)
 [1] 1893.342 1388.963 1425.195 1398.761 1489.472 1410.935 1432.045 1350.641
 [9] 1470.658 1394.949
> rowVars(tmp5,na.rm=TRUE)
 [1] 7900.81719   43.83450   63.50688   71.65429   87.47725   47.66134
 [7]   69.38666   65.69943   82.49073   53.85850
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.886541  6.620763  7.969120  8.464885  9.352928  6.903719  8.329866
 [8]  8.105519  9.082441  7.338835
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.45894  79.69637  86.26080  85.51638  94.82502  85.99702  84.40761
 [8]  86.03586  90.69704  82.29858
> rowMin(tmp5,na.rm=TRUE)
 [1] 63.13828 57.68539 55.97209 54.42207 58.83759 59.28632 53.42922 58.13448
 [9] 57.50979 58.38122
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.44369  70.37367  71.74004  77.27291  71.80493  66.25901  68.62152
 [8]  69.65073  73.95173  67.49087  76.36686  74.03177  72.64197  76.06023
[15]  73.15343  69.82111  67.82849  77.73744  69.83956  68.13340
> colSums(tmp5,na.rm=TRUE)
 [1] 1104.4369  703.7367  717.4004  695.4562  718.0493  662.5901  686.2152
 [8]  696.5073  739.5173  674.9087  763.6686  740.3177  726.4197  760.6023
[15]  731.5343  698.2111  678.2849  777.3744  698.3956  681.3340
> colVars(tmp5,na.rm=TRUE)
 [1] 16150.23122   110.64717    36.70513    93.52363    42.08010    66.35135
 [7]    44.17402    67.18417   106.24079    60.35196    39.42533    26.60860
[13]    84.07220    17.30645    57.70144    49.21970    65.27209    36.06609
[19]    44.34648    40.83653
> colSd(tmp5,na.rm=TRUE)
 [1] 127.083560  10.518896   6.058476   9.670762   6.486918   8.145634
 [7]   6.646354   8.196595  10.307317   7.768652   6.278960   5.158352
[13]   9.169090   4.160102   7.596146   7.015675   8.079114   6.005505
[19]   6.659316   6.390347
> colMax(tmp5,na.rm=TRUE)
 [1] 471.45894  86.30713  85.51638  94.82502  82.29858  78.86992  79.60766
 [8]  82.83004  90.69704  86.26080  82.84716  84.23101  86.44557  82.45938
[15]  80.23573  82.64304  80.83466  86.03586  81.62059  78.74462
> colMin(tmp5,na.rm=TRUE)
 [1] 58.13448 54.42207 66.22940 65.45078 60.34073 53.42922 57.50979 58.66320
 [9] 58.83759 59.08575 60.82322 69.07830 59.87416 69.52195 59.28632 59.75772
[17] 55.56812 68.42292 59.48617 57.68539
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 94.66710 69.44817 71.25975 69.93805 74.47360 70.54674 71.60224      NaN
 [9] 73.53288 69.74745
> rowSums(tmp5,na.rm=TRUE)
 [1] 1893.342 1388.963 1425.195 1398.761 1489.472 1410.935 1432.045    0.000
 [9] 1470.658 1394.949
> rowVars(tmp5,na.rm=TRUE)
 [1] 7900.81719   43.83450   63.50688   71.65429   87.47725   47.66134
 [7]   69.38666         NA   82.49073   53.85850
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.886541  6.620763  7.969120  8.464885  9.352928  6.903719  8.329866
 [8]        NA  9.082441  7.338835
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.45894  79.69637  86.26080  85.51638  94.82502  85.99702  84.40761
 [8]        NA  90.69704  82.29858
> rowMin(tmp5,na.rm=TRUE)
 [1] 63.13828 57.68539 55.97209 54.42207 58.83759 59.28632 53.42922       NA
 [9] 57.50979 58.38122
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.25582  69.49719  72.07057       NaN  71.84055  66.76986  68.09028
 [8]  70.87156  74.40202  67.59468  75.94487  73.62170  71.90265  76.22650
[15]  72.36651  70.32620  67.35039  76.81540  70.98994  68.04814
> colSums(tmp5,na.rm=TRUE)
 [1] 1046.3024  625.4747  648.6351    0.0000  646.5649  600.9287  612.8125
 [8]  637.8441  669.6182  608.3522  683.5038  662.5953  647.1239  686.0385
[15]  651.2986  632.9358  606.1535  691.3386  638.9094  612.4333
> colVars(tmp5,na.rm=TRUE)
 [1] 17788.97496   115.83560    40.06424          NA    47.32584    71.70936
 [7]    46.52085    58.81472   117.23981    67.77470    42.35015    28.04284
[13]    88.43215    19.15876    57.94760    52.50213    70.85953    31.00995
[19]    35.00193    45.85932
> colSd(tmp5,na.rm=TRUE)
 [1] 133.375316  10.762695   6.329632         NA   6.879378   8.468138
 [7]   6.820619   7.669076  10.827733   8.232539   6.507700   5.295549
[13]   9.403837   4.377072   7.612332   7.245835   8.417810   5.568658
[19]   5.916243   6.771951
> colMax(tmp5,na.rm=TRUE)
 [1] 471.45894  86.30713  85.51638      -Inf  82.29858  78.86992  79.60766
 [8]  82.83004  90.69704  86.26080  82.84716  84.23101  86.44557  82.45938
[15]  79.85169  82.64304  80.83466  84.77797  81.62059  78.74462
> colMin(tmp5,na.rm=TRUE)
 [1] 60.00308 54.42207 66.22940      Inf 60.34073 53.42922 57.50979 59.52086
 [9] 58.83759 59.08575 60.82322 69.07830 59.87416 69.52195 59.28632 59.75772
[17] 55.56812 68.42292 63.13828 57.68539
> 
> 
> 
> 
> 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] 311.7204 268.4406 222.9136 192.5925 151.8502 129.6303 287.9043 169.5808
 [9] 188.8083 186.7212
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 311.7204 268.4406 222.9136 192.5925 151.8502 129.6303 287.9043 169.5808
 [9] 188.8083 186.7212
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -5.684342e-14  1.421085e-14  1.136868e-13 -5.684342e-14 -5.684342e-14
 [6]  2.842171e-13  4.263256e-14 -1.136868e-13 -5.684342e-14  0.000000e+00
[11] -8.526513e-14  8.526513e-14 -2.842171e-14  1.705303e-13 -2.273737e-13
[16] -5.684342e-14  2.557954e-13 -3.410605e-13  1.989520e-13  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
7   14 
2   11 
4   2 
10   9 
4   17 
6   6 
8   17 
1   4 
6   16 
6   20 
1   1 
8   1 
9   9 
7   7 
9   20 
2   13 
2   15 
9   15 
7   20 
6   15 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 3.189976
> Min(tmp)
[1] -2.196979
> mean(tmp)
[1] 0.2586959
> Sum(tmp)
[1] 25.86959
> Var(tmp)
[1] 0.9886535
> 
> rowMeans(tmp)
[1] 0.2586959
> rowSums(tmp)
[1] 25.86959
> rowVars(tmp)
[1] 0.9886535
> rowSd(tmp)
[1] 0.9943106
> rowMax(tmp)
[1] 3.189976
> rowMin(tmp)
[1] -2.196979
> 
> colMeans(tmp)
  [1] -0.029569253 -0.455893959 -0.912238300  2.030428553  1.224819981
  [6]  0.625973391 -0.493234012  0.201082653  1.575461399 -0.375206173
 [11] -0.623138120  0.154108909  0.365052760 -1.032278860 -1.347545787
 [16]  3.189975846 -1.138193312  0.986702383 -2.196979489  0.355505743
 [21]  1.716610508 -0.527850024 -0.147098747  0.512935731 -0.771844977
 [26]  0.718883603  0.452948050  1.659936994  0.934143415  0.562965691
 [31]  1.061297862  0.583404359 -1.330257806 -0.903246104  0.545889966
 [36]  0.671288399  1.595755976  0.376760919 -1.643041130  0.963625247
 [41]  1.655336026 -0.960297797  0.668094860 -0.320270708  0.635927325
 [46]  0.314866348 -0.396259982  0.264557477 -1.074885909  0.174385353
 [51]  0.055591941  1.288138677  0.794117417  0.869098487 -0.470878788
 [56] -0.270979002  0.249125854  0.236288970  0.494885010  0.746430323
 [61] -1.375718452  0.702513001  0.961848988  0.008218281  0.846459448
 [66]  0.570249601  1.206156350  0.539742743 -0.035273770 -0.221343121
 [71]  2.064022223 -0.223729411  0.385658425  0.334225746 -0.573454095
 [76]  1.745283146  1.234005193  1.047301603  0.039672661  2.014898039
 [81] -1.943840541 -0.662198182 -0.015978531 -0.523450004 -1.285554926
 [86]  1.044646520  1.485137045  0.506525990 -1.719657900  1.374694331
 [91]  0.575192025 -0.043405404 -2.013608685  0.564385727  0.568201853
 [96]  1.204391013 -0.540394201  0.850014494  0.316852466  0.765689295
> colSums(tmp)
  [1] -0.029569253 -0.455893959 -0.912238300  2.030428553  1.224819981
  [6]  0.625973391 -0.493234012  0.201082653  1.575461399 -0.375206173
 [11] -0.623138120  0.154108909  0.365052760 -1.032278860 -1.347545787
 [16]  3.189975846 -1.138193312  0.986702383 -2.196979489  0.355505743
 [21]  1.716610508 -0.527850024 -0.147098747  0.512935731 -0.771844977
 [26]  0.718883603  0.452948050  1.659936994  0.934143415  0.562965691
 [31]  1.061297862  0.583404359 -1.330257806 -0.903246104  0.545889966
 [36]  0.671288399  1.595755976  0.376760919 -1.643041130  0.963625247
 [41]  1.655336026 -0.960297797  0.668094860 -0.320270708  0.635927325
 [46]  0.314866348 -0.396259982  0.264557477 -1.074885909  0.174385353
 [51]  0.055591941  1.288138677  0.794117417  0.869098487 -0.470878788
 [56] -0.270979002  0.249125854  0.236288970  0.494885010  0.746430323
 [61] -1.375718452  0.702513001  0.961848988  0.008218281  0.846459448
 [66]  0.570249601  1.206156350  0.539742743 -0.035273770 -0.221343121
 [71]  2.064022223 -0.223729411  0.385658425  0.334225746 -0.573454095
 [76]  1.745283146  1.234005193  1.047301603  0.039672661  2.014898039
 [81] -1.943840541 -0.662198182 -0.015978531 -0.523450004 -1.285554926
 [86]  1.044646520  1.485137045  0.506525990 -1.719657900  1.374694331
 [91]  0.575192025 -0.043405404 -2.013608685  0.564385727  0.568201853
 [96]  1.204391013 -0.540394201  0.850014494  0.316852466  0.765689295
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -0.029569253 -0.455893959 -0.912238300  2.030428553  1.224819981
  [6]  0.625973391 -0.493234012  0.201082653  1.575461399 -0.375206173
 [11] -0.623138120  0.154108909  0.365052760 -1.032278860 -1.347545787
 [16]  3.189975846 -1.138193312  0.986702383 -2.196979489  0.355505743
 [21]  1.716610508 -0.527850024 -0.147098747  0.512935731 -0.771844977
 [26]  0.718883603  0.452948050  1.659936994  0.934143415  0.562965691
 [31]  1.061297862  0.583404359 -1.330257806 -0.903246104  0.545889966
 [36]  0.671288399  1.595755976  0.376760919 -1.643041130  0.963625247
 [41]  1.655336026 -0.960297797  0.668094860 -0.320270708  0.635927325
 [46]  0.314866348 -0.396259982  0.264557477 -1.074885909  0.174385353
 [51]  0.055591941  1.288138677  0.794117417  0.869098487 -0.470878788
 [56] -0.270979002  0.249125854  0.236288970  0.494885010  0.746430323
 [61] -1.375718452  0.702513001  0.961848988  0.008218281  0.846459448
 [66]  0.570249601  1.206156350  0.539742743 -0.035273770 -0.221343121
 [71]  2.064022223 -0.223729411  0.385658425  0.334225746 -0.573454095
 [76]  1.745283146  1.234005193  1.047301603  0.039672661  2.014898039
 [81] -1.943840541 -0.662198182 -0.015978531 -0.523450004 -1.285554926
 [86]  1.044646520  1.485137045  0.506525990 -1.719657900  1.374694331
 [91]  0.575192025 -0.043405404 -2.013608685  0.564385727  0.568201853
 [96]  1.204391013 -0.540394201  0.850014494  0.316852466  0.765689295
> colMin(tmp)
  [1] -0.029569253 -0.455893959 -0.912238300  2.030428553  1.224819981
  [6]  0.625973391 -0.493234012  0.201082653  1.575461399 -0.375206173
 [11] -0.623138120  0.154108909  0.365052760 -1.032278860 -1.347545787
 [16]  3.189975846 -1.138193312  0.986702383 -2.196979489  0.355505743
 [21]  1.716610508 -0.527850024 -0.147098747  0.512935731 -0.771844977
 [26]  0.718883603  0.452948050  1.659936994  0.934143415  0.562965691
 [31]  1.061297862  0.583404359 -1.330257806 -0.903246104  0.545889966
 [36]  0.671288399  1.595755976  0.376760919 -1.643041130  0.963625247
 [41]  1.655336026 -0.960297797  0.668094860 -0.320270708  0.635927325
 [46]  0.314866348 -0.396259982  0.264557477 -1.074885909  0.174385353
 [51]  0.055591941  1.288138677  0.794117417  0.869098487 -0.470878788
 [56] -0.270979002  0.249125854  0.236288970  0.494885010  0.746430323
 [61] -1.375718452  0.702513001  0.961848988  0.008218281  0.846459448
 [66]  0.570249601  1.206156350  0.539742743 -0.035273770 -0.221343121
 [71]  2.064022223 -0.223729411  0.385658425  0.334225746 -0.573454095
 [76]  1.745283146  1.234005193  1.047301603  0.039672661  2.014898039
 [81] -1.943840541 -0.662198182 -0.015978531 -0.523450004 -1.285554926
 [86]  1.044646520  1.485137045  0.506525990 -1.719657900  1.374694331
 [91]  0.575192025 -0.043405404 -2.013608685  0.564385727  0.568201853
 [96]  1.204391013 -0.540394201  0.850014494  0.316852466  0.765689295
> colMedians(tmp)
  [1] -0.029569253 -0.455893959 -0.912238300  2.030428553  1.224819981
  [6]  0.625973391 -0.493234012  0.201082653  1.575461399 -0.375206173
 [11] -0.623138120  0.154108909  0.365052760 -1.032278860 -1.347545787
 [16]  3.189975846 -1.138193312  0.986702383 -2.196979489  0.355505743
 [21]  1.716610508 -0.527850024 -0.147098747  0.512935731 -0.771844977
 [26]  0.718883603  0.452948050  1.659936994  0.934143415  0.562965691
 [31]  1.061297862  0.583404359 -1.330257806 -0.903246104  0.545889966
 [36]  0.671288399  1.595755976  0.376760919 -1.643041130  0.963625247
 [41]  1.655336026 -0.960297797  0.668094860 -0.320270708  0.635927325
 [46]  0.314866348 -0.396259982  0.264557477 -1.074885909  0.174385353
 [51]  0.055591941  1.288138677  0.794117417  0.869098487 -0.470878788
 [56] -0.270979002  0.249125854  0.236288970  0.494885010  0.746430323
 [61] -1.375718452  0.702513001  0.961848988  0.008218281  0.846459448
 [66]  0.570249601  1.206156350  0.539742743 -0.035273770 -0.221343121
 [71]  2.064022223 -0.223729411  0.385658425  0.334225746 -0.573454095
 [76]  1.745283146  1.234005193  1.047301603  0.039672661  2.014898039
 [81] -1.943840541 -0.662198182 -0.015978531 -0.523450004 -1.285554926
 [86]  1.044646520  1.485137045  0.506525990 -1.719657900  1.374694331
 [91]  0.575192025 -0.043405404 -2.013608685  0.564385727  0.568201853
 [96]  1.204391013 -0.540394201  0.850014494  0.316852466  0.765689295
> colRanges(tmp)
            [,1]      [,2]       [,3]     [,4]    [,5]      [,6]      [,7]
[1,] -0.02956925 -0.455894 -0.9122383 2.030429 1.22482 0.6259734 -0.493234
[2,] -0.02956925 -0.455894 -0.9122383 2.030429 1.22482 0.6259734 -0.493234
          [,8]     [,9]      [,10]      [,11]     [,12]     [,13]     [,14]
[1,] 0.2010827 1.575461 -0.3752062 -0.6231381 0.1541089 0.3650528 -1.032279
[2,] 0.2010827 1.575461 -0.3752062 -0.6231381 0.1541089 0.3650528 -1.032279
         [,15]    [,16]     [,17]     [,18]     [,19]     [,20]    [,21]
[1,] -1.347546 3.189976 -1.138193 0.9867024 -2.196979 0.3555057 1.716611
[2,] -1.347546 3.189976 -1.138193 0.9867024 -2.196979 0.3555057 1.716611
        [,22]      [,23]     [,24]     [,25]     [,26]    [,27]    [,28]
[1,] -0.52785 -0.1470987 0.5129357 -0.771845 0.7188836 0.452948 1.659937
[2,] -0.52785 -0.1470987 0.5129357 -0.771845 0.7188836 0.452948 1.659937
         [,29]     [,30]    [,31]     [,32]     [,33]      [,34]   [,35]
[1,] 0.9341434 0.5629657 1.061298 0.5834044 -1.330258 -0.9032461 0.54589
[2,] 0.9341434 0.5629657 1.061298 0.5834044 -1.330258 -0.9032461 0.54589
         [,36]    [,37]     [,38]     [,39]     [,40]    [,41]      [,42]
[1,] 0.6712884 1.595756 0.3767609 -1.643041 0.9636252 1.655336 -0.9602978
[2,] 0.6712884 1.595756 0.3767609 -1.643041 0.9636252 1.655336 -0.9602978
         [,43]      [,44]     [,45]     [,46]    [,47]     [,48]     [,49]
[1,] 0.6680949 -0.3202707 0.6359273 0.3148663 -0.39626 0.2645575 -1.074886
[2,] 0.6680949 -0.3202707 0.6359273 0.3148663 -0.39626 0.2645575 -1.074886
         [,50]      [,51]    [,52]     [,53]     [,54]      [,55]     [,56]
[1,] 0.1743854 0.05559194 1.288139 0.7941174 0.8690985 -0.4708788 -0.270979
[2,] 0.1743854 0.05559194 1.288139 0.7941174 0.8690985 -0.4708788 -0.270979
         [,57]    [,58]    [,59]     [,60]     [,61]    [,62]    [,63]
[1,] 0.2491259 0.236289 0.494885 0.7464303 -1.375718 0.702513 0.961849
[2,] 0.2491259 0.236289 0.494885 0.7464303 -1.375718 0.702513 0.961849
           [,64]     [,65]     [,66]    [,67]     [,68]       [,69]      [,70]
[1,] 0.008218281 0.8464594 0.5702496 1.206156 0.5397427 -0.03527377 -0.2213431
[2,] 0.008218281 0.8464594 0.5702496 1.206156 0.5397427 -0.03527377 -0.2213431
        [,71]      [,72]     [,73]     [,74]      [,75]    [,76]    [,77]
[1,] 2.064022 -0.2237294 0.3856584 0.3342257 -0.5734541 1.745283 1.234005
[2,] 2.064022 -0.2237294 0.3856584 0.3342257 -0.5734541 1.745283 1.234005
        [,78]      [,79]    [,80]     [,81]      [,82]       [,83]    [,84]
[1,] 1.047302 0.03967266 2.014898 -1.943841 -0.6621982 -0.01597853 -0.52345
[2,] 1.047302 0.03967266 2.014898 -1.943841 -0.6621982 -0.01597853 -0.52345
         [,85]    [,86]    [,87]    [,88]     [,89]    [,90]    [,91]
[1,] -1.285555 1.044647 1.485137 0.506526 -1.719658 1.374694 0.575192
[2,] -1.285555 1.044647 1.485137 0.506526 -1.719658 1.374694 0.575192
          [,92]     [,93]     [,94]     [,95]    [,96]      [,97]     [,98]
[1,] -0.0434054 -2.013609 0.5643857 0.5682019 1.204391 -0.5403942 0.8500145
[2,] -0.0434054 -2.013609 0.5643857 0.5682019 1.204391 -0.5403942 0.8500145
         [,99]    [,100]
[1,] 0.3168525 0.7656893
[2,] 0.3168525 0.7656893
> 
> 
> Max(tmp2)
[1] 3.410111
> Min(tmp2)
[1] -2.000276
> mean(tmp2)
[1] -0.01341615
> Sum(tmp2)
[1] -1.341615
> Var(tmp2)
[1] 1.212185
> 
> rowMeans(tmp2)
  [1]  0.70184703 -0.73693318  0.41777846  0.94997425  0.29571466  1.26842335
  [7]  1.94467196 -0.32500656 -1.46378360  0.01965425  0.78831077  1.63757381
 [13] -1.15133591 -1.03511329 -0.24619010  2.23662451  3.41011130  0.86193011
 [19]  2.08733866 -0.11941915 -1.40555736  2.08505161 -0.48970511  1.04642628
 [25] -0.92809606 -1.99925476  0.36670488  0.27892429  0.26184424 -0.57515990
 [31] -0.93934664 -0.87711259  0.67398074  0.94193013 -0.41354148 -1.85399010
 [37] -0.92753080  0.32558408  0.15765991 -1.34777330  2.01824232 -1.72547305
 [43] -0.96699780 -0.52712640 -0.25190196 -0.43969489  0.68049823  0.83282433
 [49]  0.29505389  1.01506477  0.27944229  0.58825252 -0.03071199 -0.57851061
 [55]  1.56402181  0.24086236 -0.05612880  2.58775104 -0.02271461 -1.34606256
 [61] -0.56127926 -1.27620018 -0.94698540  1.42737158  0.22406337  0.66264812
 [67] -1.49414080  1.38433100 -0.31060119 -0.14415892  0.81736820 -1.81599644
 [73] -0.34020210 -0.79603337  0.03718241 -0.03176025  0.49202742 -1.60210461
 [79]  0.99651929 -2.00027593 -0.30546421 -0.38272476  0.08641284 -1.27799314
 [85]  0.88013769 -1.20904203  0.85121820 -1.65673531 -0.67852985 -0.68159917
 [91] -0.79948735 -1.11333058 -0.97988815 -0.97170536  0.76437096  0.89097596
 [97]  0.07535716  0.95434655  0.27730795 -0.86691555
> rowSums(tmp2)
  [1]  0.70184703 -0.73693318  0.41777846  0.94997425  0.29571466  1.26842335
  [7]  1.94467196 -0.32500656 -1.46378360  0.01965425  0.78831077  1.63757381
 [13] -1.15133591 -1.03511329 -0.24619010  2.23662451  3.41011130  0.86193011
 [19]  2.08733866 -0.11941915 -1.40555736  2.08505161 -0.48970511  1.04642628
 [25] -0.92809606 -1.99925476  0.36670488  0.27892429  0.26184424 -0.57515990
 [31] -0.93934664 -0.87711259  0.67398074  0.94193013 -0.41354148 -1.85399010
 [37] -0.92753080  0.32558408  0.15765991 -1.34777330  2.01824232 -1.72547305
 [43] -0.96699780 -0.52712640 -0.25190196 -0.43969489  0.68049823  0.83282433
 [49]  0.29505389  1.01506477  0.27944229  0.58825252 -0.03071199 -0.57851061
 [55]  1.56402181  0.24086236 -0.05612880  2.58775104 -0.02271461 -1.34606256
 [61] -0.56127926 -1.27620018 -0.94698540  1.42737158  0.22406337  0.66264812
 [67] -1.49414080  1.38433100 -0.31060119 -0.14415892  0.81736820 -1.81599644
 [73] -0.34020210 -0.79603337  0.03718241 -0.03176025  0.49202742 -1.60210461
 [79]  0.99651929 -2.00027593 -0.30546421 -0.38272476  0.08641284 -1.27799314
 [85]  0.88013769 -1.20904203  0.85121820 -1.65673531 -0.67852985 -0.68159917
 [91] -0.79948735 -1.11333058 -0.97988815 -0.97170536  0.76437096  0.89097596
 [97]  0.07535716  0.95434655  0.27730795 -0.86691555
> 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.70184703 -0.73693318  0.41777846  0.94997425  0.29571466  1.26842335
  [7]  1.94467196 -0.32500656 -1.46378360  0.01965425  0.78831077  1.63757381
 [13] -1.15133591 -1.03511329 -0.24619010  2.23662451  3.41011130  0.86193011
 [19]  2.08733866 -0.11941915 -1.40555736  2.08505161 -0.48970511  1.04642628
 [25] -0.92809606 -1.99925476  0.36670488  0.27892429  0.26184424 -0.57515990
 [31] -0.93934664 -0.87711259  0.67398074  0.94193013 -0.41354148 -1.85399010
 [37] -0.92753080  0.32558408  0.15765991 -1.34777330  2.01824232 -1.72547305
 [43] -0.96699780 -0.52712640 -0.25190196 -0.43969489  0.68049823  0.83282433
 [49]  0.29505389  1.01506477  0.27944229  0.58825252 -0.03071199 -0.57851061
 [55]  1.56402181  0.24086236 -0.05612880  2.58775104 -0.02271461 -1.34606256
 [61] -0.56127926 -1.27620018 -0.94698540  1.42737158  0.22406337  0.66264812
 [67] -1.49414080  1.38433100 -0.31060119 -0.14415892  0.81736820 -1.81599644
 [73] -0.34020210 -0.79603337  0.03718241 -0.03176025  0.49202742 -1.60210461
 [79]  0.99651929 -2.00027593 -0.30546421 -0.38272476  0.08641284 -1.27799314
 [85]  0.88013769 -1.20904203  0.85121820 -1.65673531 -0.67852985 -0.68159917
 [91] -0.79948735 -1.11333058 -0.97988815 -0.97170536  0.76437096  0.89097596
 [97]  0.07535716  0.95434655  0.27730795 -0.86691555
> rowMin(tmp2)
  [1]  0.70184703 -0.73693318  0.41777846  0.94997425  0.29571466  1.26842335
  [7]  1.94467196 -0.32500656 -1.46378360  0.01965425  0.78831077  1.63757381
 [13] -1.15133591 -1.03511329 -0.24619010  2.23662451  3.41011130  0.86193011
 [19]  2.08733866 -0.11941915 -1.40555736  2.08505161 -0.48970511  1.04642628
 [25] -0.92809606 -1.99925476  0.36670488  0.27892429  0.26184424 -0.57515990
 [31] -0.93934664 -0.87711259  0.67398074  0.94193013 -0.41354148 -1.85399010
 [37] -0.92753080  0.32558408  0.15765991 -1.34777330  2.01824232 -1.72547305
 [43] -0.96699780 -0.52712640 -0.25190196 -0.43969489  0.68049823  0.83282433
 [49]  0.29505389  1.01506477  0.27944229  0.58825252 -0.03071199 -0.57851061
 [55]  1.56402181  0.24086236 -0.05612880  2.58775104 -0.02271461 -1.34606256
 [61] -0.56127926 -1.27620018 -0.94698540  1.42737158  0.22406337  0.66264812
 [67] -1.49414080  1.38433100 -0.31060119 -0.14415892  0.81736820 -1.81599644
 [73] -0.34020210 -0.79603337  0.03718241 -0.03176025  0.49202742 -1.60210461
 [79]  0.99651929 -2.00027593 -0.30546421 -0.38272476  0.08641284 -1.27799314
 [85]  0.88013769 -1.20904203  0.85121820 -1.65673531 -0.67852985 -0.68159917
 [91] -0.79948735 -1.11333058 -0.97988815 -0.97170536  0.76437096  0.89097596
 [97]  0.07535716  0.95434655  0.27730795 -0.86691555
> 
> colMeans(tmp2)
[1] -0.01341615
> colSums(tmp2)
[1] -1.341615
> colVars(tmp2)
[1] 1.212185
> colSd(tmp2)
[1] 1.100993
> colMax(tmp2)
[1] 3.410111
> colMin(tmp2)
[1] -2.000276
> colMedians(tmp2)
[1] -0.03123612
> colRanges(tmp2)
          [,1]
[1,] -2.000276
[2,]  3.410111
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.71055964  2.28045565  0.03521655  3.86762902  0.73903713 -2.48691540
 [7] -0.90263251  1.39421151  3.29651679 -3.13839510
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.6780228
[2,] -0.5169769
[3,]  0.4644579
[4,]  0.6680420
[5,]  0.7252694
> 
> rowApply(tmp,sum)
 [1] -0.006090805  2.174063522 -0.198807634  4.517091487 -7.255277806
 [6]  3.862048195  3.208944630 -5.106525834  0.160962120  4.439275420
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    8    8    7    3    5    6    9    7     1
 [2,]   10    2    5    9    2    6    3    4    8     9
 [3,]    6   10    1   10    4    2    5    5    3     5
 [4,]    8    1    3    4    9    9    7    8    9     8
 [5,]    7    6    6    8    5    4    4    6    6     3
 [6,]    9    3    4    3   10   10    2    2    2     4
 [7,]    5    5    7    6    7    1    9    1    4     2
 [8,]    4    7   10    2    1    8   10    7    1     7
 [9,]    2    9    2    5    6    3    8   10   10    10
[10,]    3    4    9    1    8    7    1    3    5     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.3621895  1.4557453 -0.2077139  2.6505826 -1.5242001 -1.2028307
 [7] -1.1076806 -2.7551582  4.7047741  1.0920064  1.4893398 -0.2377362
[13] -4.8678240 -2.3953733 -2.3139056  3.1638102 -0.5997575 -3.4509311
[19]  2.6246896  3.3498041
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.7167417
[2,] -0.6256092
[3,] -0.5076424
[4,]  0.2180236
[5,]  1.2697802
> 
> rowApply(tmp,sum)
[1] -4.22652986 -5.75499866  0.03365988  4.09294485  3.36037502
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6    7   19    1   11
[2,]   13    8   17   12   15
[3,]   19    3   10   13    3
[4,]   17   13   16   17   18
[5,]   10   12   15    8    1
> 
> 
> as.matrix(tmp)
           [,1]        [,2]        [,3]       [,4]        [,5]       [,6]
[1,] -0.6256092  0.03957423  1.58895310  0.4504289 -0.26284558 -0.6449499
[2,] -0.5076424 -0.47855915 -1.50165624 -0.0268760 -0.16502120  0.4695756
[3,]  1.2697802  0.68808748  0.01329984  0.3692051  0.23666166 -0.7026272
[4,] -2.7167417  0.52698538  0.53732235  0.8958484  0.05145828  0.3706442
[5,]  0.2180236  0.67965733 -0.84563297  0.9619762 -1.38445328 -0.6954734
           [,7]       [,8]       [,9]      [,10]      [,11]       [,12]
[1,] -0.3470676 -0.8269463 -0.5734891  1.7043569  0.1458745 -0.03533090
[2,] -1.8801231 -0.3896092  0.1969968 -1.1815798 -0.3630763  0.02798236
[3,]  0.1279190 -0.6444345  1.4396268 -0.0918375 -0.7775723 -0.16522822
[4,] -0.4195015 -0.6959735  2.6879491  0.9091330 -0.5935508 -0.56374285
[5,]  1.4110925 -0.1981948  0.9536905 -0.2480661  3.0776648  0.49858340
          [,13]      [,14]      [,15]       [,16]      [,17]       [,18]
[1,] -2.7205231 -2.0147204 -0.2921463  0.90635649  0.3967763 -1.18913727
[2,] -1.6092811 -0.3965588 -0.8436372  1.63048508  0.1391618 -1.21001374
[3,] -1.4955370 -0.1598392 -1.0274439  0.15411812  0.1152037  0.07013001
[4,]  0.1734867  0.7027098  0.2850670  0.55184064 -0.1492205 -0.32105867
[5,]  0.7840304 -0.5269648 -0.4357453 -0.07899009 -1.1016789 -0.80085142
          [,19]      [,20]
[1,] -0.1560375  0.2299529
[2,]  0.3679537  1.9664802
[3,]  0.9334640 -0.3193163
[4,]  0.8139357  1.0463536
[5,]  0.6653738  0.4263336
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1       col2     col3     col4    col5        col6      col7
row1 -0.206714 -0.3154795 2.443762 1.247449 2.12329 -0.09096546 -1.172678
           col8     col9      col10      col11      col12     col13     col14
row1 -0.5165748 3.213379 -0.8108569 -0.7549488 -0.3956142 -1.015855 -1.589886
         col15    col16      col17      col18       col19     col20
row1 -1.482087 1.280585 -0.2977507 -0.3720588 -0.05649995 -1.386998
> tmp[,"col10"]
          col10
row1 -0.8108569
row2  0.6549282
row3 -2.3706401
row4 -0.2126308
row5 -0.9927899
> tmp[c("row1","row5"),]
           col1       col2      col3     col4      col5        col6      col7
row1 -0.2067140 -0.3154795 2.4437624 1.247449  2.123290 -0.09096546 -1.172678
row5 -0.9693648  1.6031306 0.3426948 1.649600 -1.261596  0.97378407 -1.905228
           col8       col9      col10      col11      col12       col13
row1 -0.5165748  3.2133786 -0.8108569 -0.7549488 -0.3956142 -1.01585491
row5 -0.1007948 -0.7383055 -0.9927899 -0.7497374 -0.2691522  0.09408999
         col14     col15     col16      col17      col18       col19      col20
row1 -1.589886 -1.482087  1.280585 -0.2977507 -0.3720588 -0.05649995 -1.3869981
row5 -1.269281 -1.105310 -2.019006 -0.4314419 -0.6207416 -0.90415965  0.5147915
> tmp[,c("col6","col20")]
            col6       col20
row1 -0.09096546 -1.38699809
row2 -0.52881165  0.11340232
row3  0.72608738  0.04832108
row4  0.71671518 -0.98155748
row5  0.97378407  0.51479152
> tmp[c("row1","row5"),c("col6","col20")]
            col6      col20
row1 -0.09096546 -1.3869981
row5  0.97378407  0.5147915
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4    col5     col6     col7     col8
row1 49.40811 50.20756 50.21541 51.28991 51.0662 105.3223 51.42976 48.40832
         col9    col10    col11   col12    col13    col14    col15    col16
row1 49.49957 48.98434 50.10154 48.5066 50.89875 50.27546 52.05377 50.07721
        col17    col18    col19   col20
row1 49.17705 48.77168 50.04304 105.644
> tmp[,"col10"]
        col10
row1 48.98434
row2 29.16126
row3 28.68147
row4 30.53546
row5 48.55225
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.40811 50.20756 50.21541 51.28991 51.06620 105.3223 51.42976 48.40832
row5 50.86132 48.86777 51.36799 50.30220 50.13002 105.6246 48.47251 50.91866
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.49957 48.98434 50.10154 48.50660 50.89875 50.27546 52.05377 50.07721
row5 49.95475 48.55225 49.51146 51.43066 49.62887 51.25247 51.75084 48.95228
        col17    col18    col19    col20
row1 49.17705 48.77168 50.04304 105.6440
row5 50.09392 50.31694 52.41983 104.7315
> tmp[,c("col6","col20")]
          col6     col20
row1 105.32231 105.64400
row2  74.29006  74.93292
row3  74.37353  76.41941
row4  74.88273  75.28012
row5 105.62455 104.73154
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.3223 105.6440
row5 105.6246 104.7315
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.3223 105.6440
row5 105.6246 104.7315
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -1.6044842
[2,]  1.5400040
[3,]  0.1005510
[4,] -0.8832935
[5,]  0.7904798
> tmp[,c("col17","col7")]
          col17       col7
[1,] -1.3854400 -0.3339761
[2,] -1.8479490 -1.7877874
[3,]  1.7622810 -1.0912771
[4,] -0.2852653  0.5965981
[5,] -0.1011070 -1.2574223
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,]  0.57516525  0.6310187
[2,] -0.44411563 -0.3943040
[3,] -0.59793217  1.4974853
[4,] -1.14630989 -2.3170553
[5,]  0.07293914  0.2977567
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.5751653
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.5751653
[2,] -0.4441156
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]       [,3]     [,4]      [,5]       [,6]       [,7]
row3 0.4407186  1.1765775  0.8463819 1.108301 0.8426087  0.1895338  0.9059064
row1 0.3395091 -0.9265519 -2.1902201 2.773096 2.1615854 -0.7522474 -0.4650126
          [,8]       [,9]     [,10]      [,11]       [,12]       [,13]
row3 -1.558430 -1.8188164 -1.900682 -0.4233594  0.05700549 -1.35991802
row1  0.239231 -0.3769705  2.026245  0.7265858 -1.86184360 -0.05511561
         [,14]      [,15]     [,16]      [,17]      [,18]     [,19]       [,20]
row3 1.3178442 -0.7926605 0.8781632  0.6242719 -1.0335112 0.3006278  0.00914531
row1 0.2786169  0.6664010 1.1255890 -0.8849211  0.4218345 1.1044149 -0.86141310
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]       [,2]      [,3]      [,4]     [,5]     [,6]      [,7]
row2 -0.5895116 -0.3783585 -1.160863 -1.727408 1.099079 1.836511 0.4038392
          [,8]    [,9]     [,10]
row2 -1.151158 1.01808 -1.416558
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]      [,3]     [,4]       [,5]       [,6]      [,7]
row5 0.2619603 0.1690183 0.9731282 -1.18952 -0.2552008 -0.3648472 -1.630606
          [,8]      [,9]     [,10]      [,11]     [,12]      [,13]       [,14]
row5 0.4389644 -1.060287 0.3856071 -0.9597516 0.5972192 -0.4905124 -0.05905566
        [,15]       [,16]     [,17]      [,18]      [,19]    [,20]
row5 1.385877 -0.07363006 0.1899459 -0.3865157 -0.5280757 1.068827
> 
> 
> 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: 0x5816ab7dd650>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae5464a2b074"
 [2] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae547766dfee"
 [3] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae5472e49ce2"
 [4] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae543998459d"
 [5] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae5459e9720f"
 [6] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae54508dad25"
 [7] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae5474514fca"
 [8] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae54440734a4"
 [9] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae5486d868"  
[10] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae54713e800e"
[11] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae5423a1e49a"
[12] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae5477a2314b"
[13] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae54698f3ad5"
[14] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae543e74d1fd"
[15] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM23ae543c08e78b"
> 
> 
> ### 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: 0x5816abcc49b0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5816abcc49b0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5816abcc49b0>
> rowMedians(tmp)
  [1]  0.148947783 -0.094728893  0.176698746  0.378901330 -0.402722536
  [6] -0.241233666 -0.166479270  0.195455912 -0.161534893  0.366627733
 [11] -0.110757845  0.220109087 -0.052054708 -0.158564111 -0.373754627
 [16]  0.719289865  0.042849815  0.258607779 -0.140989829  0.145830873
 [21]  0.342759477 -0.394112087 -0.189588334  0.442152548 -0.501678156
 [26] -0.434607031 -0.336783514 -0.618397083  0.014944571 -0.030319226
 [31]  0.107455857 -0.146850567  0.035751048 -0.214977355  0.237474140
 [36]  0.814180278 -0.507951604  0.080503002 -0.269471938 -0.023984020
 [41]  0.111785863 -0.151496976 -0.466270301  0.361047751 -0.057122758
 [46]  0.007843848 -0.507603626  0.264346035 -0.147651869 -0.034270082
 [51]  0.428960521  0.154209002  0.182143934  0.006724675 -0.202305617
 [56] -0.199036722 -0.065080393 -0.284336702 -0.501386615 -0.178557337
 [61] -0.288727800  0.153999288 -0.427555249 -0.029074491 -0.672343131
 [66] -0.057946630 -0.220281959  0.274800277  0.338352726  0.510901995
 [71] -0.394398098  0.063216387 -0.314597133  0.260035438 -0.625067361
 [76]  0.358548889  0.104088956 -0.689150704 -0.369790230 -0.619780928
 [81]  0.051591297 -0.776019575 -0.080020246  0.468158132 -0.136152364
 [86]  0.476457667  0.678828170 -0.286054257  0.251028045 -0.423736283
 [91] -0.212059951 -0.152408278 -0.513788674  0.085958669 -0.140651351
 [96] -0.009570516 -0.072331247 -0.410571145  0.064744442  0.325178501
[101]  0.241585141  0.310498079 -0.301412394  0.095428513 -0.216288045
[106]  0.005391549 -0.130425599  0.143532064 -0.059822872 -0.073666558
[111]  0.514835967 -0.221161465 -0.043716095  0.498389491 -0.437655568
[116]  0.388492272  0.184088512  0.274895083 -0.544321567  0.283208828
[121]  0.449635608  0.062840300 -0.412219170 -0.156648380  0.223979953
[126]  0.387402002 -0.070068612  0.001462694  0.595069976  0.003277919
[131]  0.457757226  0.388839075 -0.382056850 -0.055829948  0.027836637
[136]  0.011478539  0.082441565  0.175150885 -0.033462912 -0.127232314
[141]  0.267518472  0.466331716  0.190987204  0.532876182  0.199615221
[146]  0.560676471 -0.232191483 -0.324352891 -0.173733579 -0.019990195
[151] -0.795407922 -0.083215418 -0.117161625  0.294367861  0.060477757
[156]  0.558562210  0.100130248  0.256256031  0.130983084  0.404716636
[161]  0.131184798  0.102435110  0.269966227 -0.145091690  0.285947180
[166] -0.445609800  0.006800940  0.019803402  0.040522437 -0.108047957
[171] -0.318183409 -0.615582986 -0.219947293 -0.752607143  0.188342628
[176]  0.006095643 -0.217507199 -0.274350294 -0.126085376 -0.291710676
[181]  0.142220168  0.493943353  0.373669225 -0.402843764  0.226116619
[186] -0.329992797  0.297964761  0.221015349  0.315228131  0.052692824
[191] -0.176378374 -0.222831614 -0.327155033  0.416390374  0.604575566
[196]  0.329372988 -0.052856078 -0.100207995  0.388325648  0.298337560
[201] -0.492065796 -0.034663758 -0.426151147  0.136707426  0.279436040
[206]  0.262017288  0.004219002  0.801155199 -0.141615427  0.339372580
[211] -0.034935507  0.214017158  0.053919216 -0.020882808  0.333898024
[216]  0.755183673 -0.265741426 -0.554862505  0.151529261  0.041488480
[221] -0.311361043  0.309030181  0.524901855 -0.521603930  0.498036453
[226] -0.079345703  0.048714454  0.062933192  0.144467569  0.173328816
> 
> proc.time()
   user  system elapsed 
  1.316   1.553   2.859 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.6.0 RC (2026-04-17 r89917) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x571a452d00f0>
> .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: 0x571a452d00f0>
> .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: 0x571a452d00f0>
> .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: 0x571a452d00f0>
> 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: 0x571a4611e690>
> .Call("R_bm_AddColumn",P)
<pointer: 0x571a4611e690>
> .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: 0x571a4611e690>
> .Call("R_bm_AddColumn",P)
<pointer: 0x571a4611e690>
> .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: 0x571a4611e690>
> 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: 0x571a47b58010>
> .Call("R_bm_AddColumn",P)
<pointer: 0x571a47b58010>
> .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: 0x571a47b58010>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x571a47b58010>
> .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: 0x571a47b58010>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x571a47b58010>
> .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: 0x571a47b58010>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x571a47b58010>
> .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: 0x571a47b58010>
> 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: 0x571a47ba8070>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x571a47ba8070>
> .Call("R_bm_AddColumn",P)
<pointer: 0x571a47ba8070>
> .Call("R_bm_AddColumn",P)
<pointer: 0x571a47ba8070>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile23b06741cd23ba" "BufferedMatrixFile23b0676f2c3f49"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile23b06741cd23ba" "BufferedMatrixFile23b0676f2c3f49"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x571a458627e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x571a458627e0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x571a458627e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x571a458627e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x571a458627e0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x571a458627e0>
> .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: 0x571a477fe3b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x571a477fe3b0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x571a477fe3b0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x571a477fe3b0>
> 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: 0x571a459c4520>
> .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: 0x571a459c4520>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.239   0.057   0.285 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.6.0 RC (2026-04-17 r89917) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.236   0.049   0.273 

Example timings