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

This page was generated on 2026-02-05 11:57 -0500 (Thu, 05 Feb 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4888
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

Package 257/2361HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.74.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-02-02 13:45 -0500 (Mon, 02 Feb 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_22
git_last_commit: d2ce144
git_last_commit_date: 2025-10-29 09:58:55 -0500 (Wed, 29 Oct 2025)
nebbiolo2Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
See other builds for BufferedMatrix in R Universe.


CHECK results for BufferedMatrix on nebbiolo2

To the developers/maintainers of the BufferedMatrix package:
- Allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to reflect on this report. See Troubleshooting Build Report for more information.
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.

raw results


Summary

Package: BufferedMatrix
Version: 1.74.0
Command: /home/biocbuild/bbs-3.22-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.22-bioc/R/site-library --timings BufferedMatrix_1.74.0.tar.gz
StartedAt: 2026-02-03 21:28:13 -0500 (Tue, 03 Feb 2026)
EndedAt: 2026-02-03 21:28:37 -0500 (Tue, 03 Feb 2026)
EllapsedTime: 24.2 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

Status: 2 NOTEs
See
  ‘/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.243   0.041   0.273 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478284 25.6    1046725   56   639600 34.2
Vcells 884773  6.8    8388608   64  2081613 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Feb  3 21:28:28 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Feb  3 21:28:28 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: 0x582cda6393f0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Feb  3 21:28:29 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Feb  3 21:28:29 2026"
> 
> ColMode(tmp2)
<pointer: 0x582cda6393f0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]      [,3]      [,4]
[1,] 97.9938729  1.0104072 0.8194684 0.8630206
[2,] -0.1275642 -0.8313647 0.1011766 1.1203895
[3,]  0.4575111 -0.2418034 0.3687130 1.1484356
[4,] -1.3959713  0.2572355 0.1535377 0.3795355
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 97.9938729 1.0104072 0.8194684 0.8630206
[2,]  0.1275642 0.8313647 0.1011766 1.1203895
[3,]  0.4575111 0.2418034 0.3687130 1.1484356
[4,]  1.3959713 0.2572355 0.1535377 0.3795355
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.8991855 1.0051902 0.9052450 0.9289890
[2,] 0.3571613 0.9117920 0.3180828 1.0584845
[3,] 0.6763957 0.4917350 0.6072175 1.0716509
[4,] 1.1815123 0.5071839 0.3918389 0.6160645
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 221.98573 36.06231 34.87192 35.15291
[2,]  28.69918 34.94929 28.28200 36.70523
[3,]  32.22147 30.15915 31.44089 36.86494
[4,]  38.21109 30.32907 29.07193 31.54018
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x582cdb635a30>
> exp(tmp5)
<pointer: 0x582cdb635a30>
> log(tmp5,2)
<pointer: 0x582cdb635a30>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 462.0342
> Min(tmp5)
[1] 52.90287
> mean(tmp5)
[1] 72.89788
> Sum(tmp5)
[1] 14579.58
> Var(tmp5)
[1] 835.4384
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 94.86125 69.91915 69.71815 72.31898 67.25118 69.35258 71.96614 70.75305
 [9] 71.08794 71.75036
> rowSums(tmp5)
 [1] 1897.225 1398.383 1394.363 1446.380 1345.024 1387.052 1439.323 1415.061
 [9] 1421.759 1435.007
> rowVars(tmp5)
 [1] 7544.97486   79.76126   56.82458   69.84917   65.40783   51.81098
 [7]  103.40275   58.30024   74.02457   60.26286
> rowSd(tmp5)
 [1] 86.861815  8.930916  7.538208  8.357582  8.087511  7.197985 10.168714
 [8]  7.635460  8.603754  7.762916
> rowMax(tmp5)
 [1] 462.03421  85.07178  89.52156  88.87462  82.88535  86.07828  91.26941
 [8]  87.91710  89.18024  84.37893
> rowMin(tmp5)
 [1] 57.54953 55.04417 58.68063 58.24079 52.90287 57.73975 55.23807 56.61259
 [9] 58.43600 58.47754
> 
> colMeans(tmp5)
 [1] 109.99281  69.69496  68.39695  71.65441  74.62080  72.41322  66.81466
 [8]  69.86632  68.13493  70.22940  73.82335  70.82086  71.71823  72.20445
[15]  74.40888  72.90468  66.72706  72.54104  70.01965  70.97095
> colSums(tmp5)
 [1] 1099.9281  696.9496  683.9695  716.5441  746.2080  724.1322  668.1466
 [8]  698.6632  681.3493  702.2940  738.2335  708.2086  717.1823  722.0445
[15]  744.0888  729.0468  667.2706  725.4104  700.1965  709.7095
> colVars(tmp5)
 [1] 15403.55854    88.76233    79.14993    67.28308   103.81143    29.48575
 [7]    61.01743    21.88023    61.36413    74.58567    72.88886   103.75029
[13]    94.65131   131.45423    85.24918    44.17406    70.23292    32.58554
[19]    61.56559    66.31780
> colSd(tmp5)
 [1] 124.111073   9.421376   8.896625   8.202626  10.188790   5.430079
 [7]   7.811365   4.677631   7.833526   8.636299   8.537497  10.185789
[13]   9.728891  11.465349   9.233048   6.646357   8.380509   5.708375
[19]   7.846374   8.143574
> colMax(tmp5)
 [1] 462.03421  88.67063  87.55129  83.27171  89.52156  84.44305  80.84635
 [8]  79.74047  84.40389  86.15931  88.87462  89.18024  91.26941  87.91710
[15]  94.19511  82.40284  78.90839  82.03562  82.88535  84.13355
> colMin(tmp5)
 [1] 57.73975 60.63146 58.86529 59.29845 55.23807 63.39436 58.75165 65.77378
 [9] 57.99334 58.43600 61.68872 55.04417 61.35474 52.90287 57.74369 62.43645
[17] 56.61259 61.60943 58.68063 60.85587
> 
> 
> ### 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.86125 69.91915 69.71815 72.31898 67.25118       NA 71.96614 70.75305
 [9] 71.08794 71.75036
> rowSums(tmp5)
 [1] 1897.225 1398.383 1394.363 1446.380 1345.024       NA 1439.323 1415.061
 [9] 1421.759 1435.007
> rowVars(tmp5)
 [1] 7544.97486   79.76126   56.82458   69.84917   65.40783   53.62198
 [7]  103.40275   58.30024   74.02457   60.26286
> rowSd(tmp5)
 [1] 86.861815  8.930916  7.538208  8.357582  8.087511  7.322703 10.168714
 [8]  7.635460  8.603754  7.762916
> rowMax(tmp5)
 [1] 462.03421  85.07178  89.52156  88.87462  82.88535        NA  91.26941
 [8]  87.91710  89.18024  84.37893
> rowMin(tmp5)
 [1] 57.54953 55.04417 58.68063 58.24079 52.90287       NA 55.23807 56.61259
 [9] 58.43600 58.47754
> 
> colMeans(tmp5)
 [1] 109.99281        NA  68.39695  71.65441  74.62080  72.41322  66.81466
 [8]  69.86632  68.13493  70.22940  73.82335  70.82086  71.71823  72.20445
[15]  74.40888  72.90468  66.72706  72.54104  70.01965  70.97095
> colSums(tmp5)
 [1] 1099.9281        NA  683.9695  716.5441  746.2080  724.1322  668.1466
 [8]  698.6632  681.3493  702.2940  738.2335  708.2086  717.1823  722.0445
[15]  744.0888  729.0468  667.2706  725.4104  700.1965  709.7095
> colVars(tmp5)
 [1] 15403.55854          NA    79.14993    67.28308   103.81143    29.48575
 [7]    61.01743    21.88023    61.36413    74.58567    72.88886   103.75029
[13]    94.65131   131.45423    85.24918    44.17406    70.23292    32.58554
[19]    61.56559    66.31780
> colSd(tmp5)
 [1] 124.111073         NA   8.896625   8.202626  10.188790   5.430079
 [7]   7.811365   4.677631   7.833526   8.636299   8.537497  10.185789
[13]   9.728891  11.465349   9.233048   6.646357   8.380509   5.708375
[19]   7.846374   8.143574
> colMax(tmp5)
 [1] 462.03421        NA  87.55129  83.27171  89.52156  84.44305  80.84635
 [8]  79.74047  84.40389  86.15931  88.87462  89.18024  91.26941  87.91710
[15]  94.19511  82.40284  78.90839  82.03562  82.88535  84.13355
> colMin(tmp5)
 [1] 57.73975       NA 58.86529 59.29845 55.23807 63.39436 58.75165 65.77378
 [9] 57.99334 58.43600 61.68872 55.04417 61.35474 52.90287 57.74369 62.43645
[17] 56.61259 61.60943 58.68063 60.85587
> 
> Max(tmp5,na.rm=TRUE)
[1] 462.0342
> Min(tmp5,na.rm=TRUE)
[1] 52.90287
> mean(tmp5,na.rm=TRUE)
[1] 72.93716
> Sum(tmp5,na.rm=TRUE)
[1] 14514.5
> Var(tmp5,na.rm=TRUE)
[1] 839.3476
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 94.86125 69.91915 69.71815 72.31898 67.25118 69.57744 71.96614 70.75305
 [9] 71.08794 71.75036
> rowSums(tmp5,na.rm=TRUE)
 [1] 1897.225 1398.383 1394.363 1446.380 1345.024 1321.971 1439.323 1415.061
 [9] 1421.759 1435.007
> rowVars(tmp5,na.rm=TRUE)
 [1] 7544.97486   79.76126   56.82458   69.84917   65.40783   53.62198
 [7]  103.40275   58.30024   74.02457   60.26286
> rowSd(tmp5,na.rm=TRUE)
 [1] 86.861815  8.930916  7.538208  8.357582  8.087511  7.322703 10.168714
 [8]  7.635460  8.603754  7.762916
> rowMax(tmp5,na.rm=TRUE)
 [1] 462.03421  85.07178  89.52156  88.87462  82.88535  86.07828  91.26941
 [8]  87.91710  89.18024  84.37893
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.54953 55.04417 58.68063 58.24079 52.90287 57.73975 55.23807 56.61259
 [9] 58.43600 58.47754
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.99281  70.20770  68.39695  71.65441  74.62080  72.41322  66.81466
 [8]  69.86632  68.13493  70.22940  73.82335  70.82086  71.71823  72.20445
[15]  74.40888  72.90468  66.72706  72.54104  70.01965  70.97095
> colSums(tmp5,na.rm=TRUE)
 [1] 1099.9281  631.8693  683.9695  716.5441  746.2080  724.1322  668.1466
 [8]  698.6632  681.3493  702.2940  738.2335  708.2086  717.1823  722.0445
[15]  744.0888  729.0468  667.2706  725.4104  700.1965  709.7095
> colVars(tmp5,na.rm=TRUE)
 [1] 15403.55854    96.89996    79.14993    67.28308   103.81143    29.48575
 [7]    61.01743    21.88023    61.36413    74.58567    72.88886   103.75029
[13]    94.65131   131.45423    85.24918    44.17406    70.23292    32.58554
[19]    61.56559    66.31780
> colSd(tmp5,na.rm=TRUE)
 [1] 124.111073   9.843778   8.896625   8.202626  10.188790   5.430079
 [7]   7.811365   4.677631   7.833526   8.636299   8.537497  10.185789
[13]   9.728891  11.465349   9.233048   6.646357   8.380509   5.708375
[19]   7.846374   8.143574
> colMax(tmp5,na.rm=TRUE)
 [1] 462.03421  88.67063  87.55129  83.27171  89.52156  84.44305  80.84635
 [8]  79.74047  84.40389  86.15931  88.87462  89.18024  91.26941  87.91710
[15]  94.19511  82.40284  78.90839  82.03562  82.88535  84.13355
> colMin(tmp5,na.rm=TRUE)
 [1] 57.73975 60.63146 58.86529 59.29845 55.23807 63.39436 58.75165 65.77378
 [9] 57.99334 58.43600 61.68872 55.04417 61.35474 52.90287 57.74369 62.43645
[17] 56.61259 61.60943 58.68063 60.85587
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 94.86125 69.91915 69.71815 72.31898 67.25118      NaN 71.96614 70.75305
 [9] 71.08794 71.75036
> rowSums(tmp5,na.rm=TRUE)
 [1] 1897.225 1398.383 1394.363 1446.380 1345.024    0.000 1439.323 1415.061
 [9] 1421.759 1435.007
> rowVars(tmp5,na.rm=TRUE)
 [1] 7544.97486   79.76126   56.82458   69.84917   65.40783         NA
 [7]  103.40275   58.30024   74.02457   60.26286
> rowSd(tmp5,na.rm=TRUE)
 [1] 86.861815  8.930916  7.538208  8.357582  8.087511        NA 10.168714
 [8]  7.635460  8.603754  7.762916
> rowMax(tmp5,na.rm=TRUE)
 [1] 462.03421  85.07178  89.52156  88.87462  82.88535        NA  91.26941
 [8]  87.91710  89.18024  84.37893
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.54953 55.04417 58.68063 58.24079 52.90287       NA 55.23807 56.61259
 [9] 58.43600 58.47754
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.79870       NaN  68.48070  72.30094  74.53913  72.47990  67.70123
 [8]  69.99795  66.32727  70.17496  74.85318  70.70788  71.80475  70.66291
[15]  74.45907  73.97858  67.19656  72.89693  70.43361  70.83409
> colSums(tmp5,na.rm=TRUE)
 [1] 1042.1883    0.0000  616.3263  650.7085  670.8522  652.3191  609.3110
 [8]  629.9815  596.9455  631.5746  673.6786  636.3709  646.2427  635.9662
[15]  670.1316  665.8072  604.7690  656.0724  633.9025  637.5068
> colVars(tmp5,na.rm=TRUE)
 [1] 16949.78357          NA    88.96477    70.99088   116.71283    33.12145
 [7]    59.80204    24.42034    32.27369    83.87553    70.06891   116.57549
[13]   106.39852   121.15224    95.87699    36.72175    76.53224    35.23378
[19]    67.33340    74.39681
> colSd(tmp5,na.rm=TRUE)
 [1] 130.191334         NA   9.432114   8.425609  10.803371   5.755124
 [7]   7.733178   4.941694   5.680993   9.158359   8.370717  10.797013
[13]  10.314966  11.006918   9.791680   6.059847   8.748270   5.935805
[19]   8.205693   8.625359
> colMax(tmp5,na.rm=TRUE)
 [1] 462.03421      -Inf  87.55129  83.27171  89.52156  84.44305  80.84635
 [8]  79.74047  76.56802  86.15931  88.87462  89.18024  91.26941  87.91710
[15]  94.19511  82.40284  78.90839  82.03562  82.88535  84.13355
> colMin(tmp5,na.rm=TRUE)
 [1] 58.47754      Inf 58.86529 59.29845 55.23807 63.39436 58.75165 65.77378
 [9] 57.99334 58.43600 61.68872 55.04417 61.35474 52.90287 57.74369 62.43645
[17] 56.61259 61.60943 58.68063 60.85587
> 
> 
> 
> 
> 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] 176.9401 135.5348 244.2530 360.9964 177.3508 246.6369 222.8772 141.0445
 [9] 261.0766 319.5407
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 176.9401 135.5348 244.2530 360.9964 177.3508 246.6369 222.8772 141.0445
 [9] 261.0766 319.5407
> 
> 
> 
> 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 -2.273737e-13  2.842171e-14  0.000000e+00 -5.684342e-14
 [6]  1.136868e-13  1.705303e-13  4.263256e-14  0.000000e+00 -1.989520e-13
[11] -2.842171e-14  5.684342e-14  1.705303e-13  5.684342e-14  1.136868e-13
[16]  2.273737e-13  1.705303e-13 -5.684342e-14 -2.273737e-13  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
5   1 
2   1 
3   5 
7   1 
8   6 
3   2 
8   8 
1   7 
5   11 
4   6 
3   14 
10   4 
6   19 
7   2 
6   4 
4   19 
3   8 
10   18 
3   16 
1   6 
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.489019
> Min(tmp)
[1] -3.50362
> mean(tmp)
[1] -0.06303018
> Sum(tmp)
[1] -6.303018
> Var(tmp)
[1] 1.180993
> 
> rowMeans(tmp)
[1] -0.06303018
> rowSums(tmp)
[1] -6.303018
> rowVars(tmp)
[1] 1.180993
> rowSd(tmp)
[1] 1.086735
> rowMax(tmp)
[1] 3.489019
> rowMin(tmp)
[1] -3.50362
> 
> colMeans(tmp)
  [1] -0.151363754  0.397072376 -1.986409418  0.694904509 -1.922861131
  [6] -0.220922972 -3.503619673 -0.828460330 -0.383448197  0.450479523
 [11] -1.178395470 -1.689965141 -1.476841014  1.779496626 -0.883093139
 [16]  1.043820287 -0.816688002 -0.900176496  0.530042445 -0.156919344
 [21] -1.549591238 -1.176694897  0.541928829  0.035311610 -0.956511630
 [26] -0.740158007 -0.740852920  0.842291297  0.771506421  0.595729043
 [31]  0.003136609  0.565127753 -0.548606342 -1.442020028 -1.245579775
 [36] -1.266022340 -0.123740124  1.138586401  1.245948406 -0.821201027
 [41]  0.349868376  0.015662163  1.195519015 -0.508697117 -0.116436929
 [46]  0.058041840  0.967797138  0.101485273 -0.283970157 -0.080236906
 [51]  0.395140655 -0.132682821 -0.045086853  1.237328983 -0.379243384
 [56]  1.176844940 -1.647856915 -1.082208249  3.489018682 -0.224710405
 [61] -0.104537665 -0.617607306  2.334935709 -0.278047186  0.284724897
 [66]  0.371045743 -0.305421829 -1.059127966 -1.018115363  1.739793210
 [71] -0.494966975 -0.377951027 -0.076920191  2.289518218  1.893298220
 [76] -0.767003030 -0.564421436  0.282280033  0.267461740 -0.039767339
 [81] -0.055441421  1.521785929 -0.258473891  0.458951814  0.761968768
 [86] -0.762941786  1.268714362 -2.180158962  0.056929835 -0.360638281
 [91] -0.875184988  1.239748346 -0.600513436 -0.154802374  0.091183230
 [96]  1.622274576  1.990045571 -0.558735099 -1.051850090 -0.625867413
> colSums(tmp)
  [1] -0.151363754  0.397072376 -1.986409418  0.694904509 -1.922861131
  [6] -0.220922972 -3.503619673 -0.828460330 -0.383448197  0.450479523
 [11] -1.178395470 -1.689965141 -1.476841014  1.779496626 -0.883093139
 [16]  1.043820287 -0.816688002 -0.900176496  0.530042445 -0.156919344
 [21] -1.549591238 -1.176694897  0.541928829  0.035311610 -0.956511630
 [26] -0.740158007 -0.740852920  0.842291297  0.771506421  0.595729043
 [31]  0.003136609  0.565127753 -0.548606342 -1.442020028 -1.245579775
 [36] -1.266022340 -0.123740124  1.138586401  1.245948406 -0.821201027
 [41]  0.349868376  0.015662163  1.195519015 -0.508697117 -0.116436929
 [46]  0.058041840  0.967797138  0.101485273 -0.283970157 -0.080236906
 [51]  0.395140655 -0.132682821 -0.045086853  1.237328983 -0.379243384
 [56]  1.176844940 -1.647856915 -1.082208249  3.489018682 -0.224710405
 [61] -0.104537665 -0.617607306  2.334935709 -0.278047186  0.284724897
 [66]  0.371045743 -0.305421829 -1.059127966 -1.018115363  1.739793210
 [71] -0.494966975 -0.377951027 -0.076920191  2.289518218  1.893298220
 [76] -0.767003030 -0.564421436  0.282280033  0.267461740 -0.039767339
 [81] -0.055441421  1.521785929 -0.258473891  0.458951814  0.761968768
 [86] -0.762941786  1.268714362 -2.180158962  0.056929835 -0.360638281
 [91] -0.875184988  1.239748346 -0.600513436 -0.154802374  0.091183230
 [96]  1.622274576  1.990045571 -0.558735099 -1.051850090 -0.625867413
> 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.151363754  0.397072376 -1.986409418  0.694904509 -1.922861131
  [6] -0.220922972 -3.503619673 -0.828460330 -0.383448197  0.450479523
 [11] -1.178395470 -1.689965141 -1.476841014  1.779496626 -0.883093139
 [16]  1.043820287 -0.816688002 -0.900176496  0.530042445 -0.156919344
 [21] -1.549591238 -1.176694897  0.541928829  0.035311610 -0.956511630
 [26] -0.740158007 -0.740852920  0.842291297  0.771506421  0.595729043
 [31]  0.003136609  0.565127753 -0.548606342 -1.442020028 -1.245579775
 [36] -1.266022340 -0.123740124  1.138586401  1.245948406 -0.821201027
 [41]  0.349868376  0.015662163  1.195519015 -0.508697117 -0.116436929
 [46]  0.058041840  0.967797138  0.101485273 -0.283970157 -0.080236906
 [51]  0.395140655 -0.132682821 -0.045086853  1.237328983 -0.379243384
 [56]  1.176844940 -1.647856915 -1.082208249  3.489018682 -0.224710405
 [61] -0.104537665 -0.617607306  2.334935709 -0.278047186  0.284724897
 [66]  0.371045743 -0.305421829 -1.059127966 -1.018115363  1.739793210
 [71] -0.494966975 -0.377951027 -0.076920191  2.289518218  1.893298220
 [76] -0.767003030 -0.564421436  0.282280033  0.267461740 -0.039767339
 [81] -0.055441421  1.521785929 -0.258473891  0.458951814  0.761968768
 [86] -0.762941786  1.268714362 -2.180158962  0.056929835 -0.360638281
 [91] -0.875184988  1.239748346 -0.600513436 -0.154802374  0.091183230
 [96]  1.622274576  1.990045571 -0.558735099 -1.051850090 -0.625867413
> colMin(tmp)
  [1] -0.151363754  0.397072376 -1.986409418  0.694904509 -1.922861131
  [6] -0.220922972 -3.503619673 -0.828460330 -0.383448197  0.450479523
 [11] -1.178395470 -1.689965141 -1.476841014  1.779496626 -0.883093139
 [16]  1.043820287 -0.816688002 -0.900176496  0.530042445 -0.156919344
 [21] -1.549591238 -1.176694897  0.541928829  0.035311610 -0.956511630
 [26] -0.740158007 -0.740852920  0.842291297  0.771506421  0.595729043
 [31]  0.003136609  0.565127753 -0.548606342 -1.442020028 -1.245579775
 [36] -1.266022340 -0.123740124  1.138586401  1.245948406 -0.821201027
 [41]  0.349868376  0.015662163  1.195519015 -0.508697117 -0.116436929
 [46]  0.058041840  0.967797138  0.101485273 -0.283970157 -0.080236906
 [51]  0.395140655 -0.132682821 -0.045086853  1.237328983 -0.379243384
 [56]  1.176844940 -1.647856915 -1.082208249  3.489018682 -0.224710405
 [61] -0.104537665 -0.617607306  2.334935709 -0.278047186  0.284724897
 [66]  0.371045743 -0.305421829 -1.059127966 -1.018115363  1.739793210
 [71] -0.494966975 -0.377951027 -0.076920191  2.289518218  1.893298220
 [76] -0.767003030 -0.564421436  0.282280033  0.267461740 -0.039767339
 [81] -0.055441421  1.521785929 -0.258473891  0.458951814  0.761968768
 [86] -0.762941786  1.268714362 -2.180158962  0.056929835 -0.360638281
 [91] -0.875184988  1.239748346 -0.600513436 -0.154802374  0.091183230
 [96]  1.622274576  1.990045571 -0.558735099 -1.051850090 -0.625867413
> colMedians(tmp)
  [1] -0.151363754  0.397072376 -1.986409418  0.694904509 -1.922861131
  [6] -0.220922972 -3.503619673 -0.828460330 -0.383448197  0.450479523
 [11] -1.178395470 -1.689965141 -1.476841014  1.779496626 -0.883093139
 [16]  1.043820287 -0.816688002 -0.900176496  0.530042445 -0.156919344
 [21] -1.549591238 -1.176694897  0.541928829  0.035311610 -0.956511630
 [26] -0.740158007 -0.740852920  0.842291297  0.771506421  0.595729043
 [31]  0.003136609  0.565127753 -0.548606342 -1.442020028 -1.245579775
 [36] -1.266022340 -0.123740124  1.138586401  1.245948406 -0.821201027
 [41]  0.349868376  0.015662163  1.195519015 -0.508697117 -0.116436929
 [46]  0.058041840  0.967797138  0.101485273 -0.283970157 -0.080236906
 [51]  0.395140655 -0.132682821 -0.045086853  1.237328983 -0.379243384
 [56]  1.176844940 -1.647856915 -1.082208249  3.489018682 -0.224710405
 [61] -0.104537665 -0.617607306  2.334935709 -0.278047186  0.284724897
 [66]  0.371045743 -0.305421829 -1.059127966 -1.018115363  1.739793210
 [71] -0.494966975 -0.377951027 -0.076920191  2.289518218  1.893298220
 [76] -0.767003030 -0.564421436  0.282280033  0.267461740 -0.039767339
 [81] -0.055441421  1.521785929 -0.258473891  0.458951814  0.761968768
 [86] -0.762941786  1.268714362 -2.180158962  0.056929835 -0.360638281
 [91] -0.875184988  1.239748346 -0.600513436 -0.154802374  0.091183230
 [96]  1.622274576  1.990045571 -0.558735099 -1.051850090 -0.625867413
> colRanges(tmp)
           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]     [,7]
[1,] -0.1513638 0.3970724 -1.986409 0.6949045 -1.922861 -0.220923 -3.50362
[2,] -0.1513638 0.3970724 -1.986409 0.6949045 -1.922861 -0.220923 -3.50362
           [,8]       [,9]     [,10]     [,11]     [,12]     [,13]    [,14]
[1,] -0.8284603 -0.3834482 0.4504795 -1.178395 -1.689965 -1.476841 1.779497
[2,] -0.8284603 -0.3834482 0.4504795 -1.178395 -1.689965 -1.476841 1.779497
          [,15]   [,16]     [,17]      [,18]     [,19]      [,20]     [,21]
[1,] -0.8830931 1.04382 -0.816688 -0.9001765 0.5300424 -0.1569193 -1.549591
[2,] -0.8830931 1.04382 -0.816688 -0.9001765 0.5300424 -0.1569193 -1.549591
         [,22]     [,23]      [,24]      [,25]     [,26]      [,27]     [,28]
[1,] -1.176695 0.5419288 0.03531161 -0.9565116 -0.740158 -0.7408529 0.8422913
[2,] -1.176695 0.5419288 0.03531161 -0.9565116 -0.740158 -0.7408529 0.8422913
         [,29]    [,30]       [,31]     [,32]      [,33]    [,34]    [,35]
[1,] 0.7715064 0.595729 0.003136609 0.5651278 -0.5486063 -1.44202 -1.24558
[2,] 0.7715064 0.595729 0.003136609 0.5651278 -0.5486063 -1.44202 -1.24558
         [,36]      [,37]    [,38]    [,39]     [,40]     [,41]      [,42]
[1,] -1.266022 -0.1237401 1.138586 1.245948 -0.821201 0.3498684 0.01566216
[2,] -1.266022 -0.1237401 1.138586 1.245948 -0.821201 0.3498684 0.01566216
        [,43]      [,44]      [,45]      [,46]     [,47]     [,48]      [,49]
[1,] 1.195519 -0.5086971 -0.1164369 0.05804184 0.9677971 0.1014853 -0.2839702
[2,] 1.195519 -0.5086971 -0.1164369 0.05804184 0.9677971 0.1014853 -0.2839702
           [,50]     [,51]      [,52]       [,53]    [,54]      [,55]    [,56]
[1,] -0.08023691 0.3951407 -0.1326828 -0.04508685 1.237329 -0.3792434 1.176845
[2,] -0.08023691 0.3951407 -0.1326828 -0.04508685 1.237329 -0.3792434 1.176845
         [,57]     [,58]    [,59]      [,60]      [,61]      [,62]    [,63]
[1,] -1.647857 -1.082208 3.489019 -0.2247104 -0.1045377 -0.6176073 2.334936
[2,] -1.647857 -1.082208 3.489019 -0.2247104 -0.1045377 -0.6176073 2.334936
          [,64]     [,65]     [,66]      [,67]     [,68]     [,69]    [,70]
[1,] -0.2780472 0.2847249 0.3710457 -0.3054218 -1.059128 -1.018115 1.739793
[2,] -0.2780472 0.2847249 0.3710457 -0.3054218 -1.059128 -1.018115 1.739793
         [,71]     [,72]       [,73]    [,74]    [,75]     [,76]      [,77]
[1,] -0.494967 -0.377951 -0.07692019 2.289518 1.893298 -0.767003 -0.5644214
[2,] -0.494967 -0.377951 -0.07692019 2.289518 1.893298 -0.767003 -0.5644214
       [,78]     [,79]       [,80]       [,81]    [,82]      [,83]     [,84]
[1,] 0.28228 0.2674617 -0.03976734 -0.05544142 1.521786 -0.2584739 0.4589518
[2,] 0.28228 0.2674617 -0.03976734 -0.05544142 1.521786 -0.2584739 0.4589518
         [,85]      [,86]    [,87]     [,88]      [,89]      [,90]     [,91]
[1,] 0.7619688 -0.7629418 1.268714 -2.180159 0.05692984 -0.3606383 -0.875185
[2,] 0.7619688 -0.7629418 1.268714 -2.180159 0.05692984 -0.3606383 -0.875185
        [,92]      [,93]      [,94]      [,95]    [,96]    [,97]      [,98]
[1,] 1.239748 -0.6005134 -0.1548024 0.09118323 1.622275 1.990046 -0.5587351
[2,] 1.239748 -0.6005134 -0.1548024 0.09118323 1.622275 1.990046 -0.5587351
        [,99]     [,100]
[1,] -1.05185 -0.6258674
[2,] -1.05185 -0.6258674
> 
> 
> Max(tmp2)
[1] 2.293209
> Min(tmp2)
[1] -2.712897
> mean(tmp2)
[1] -0.09435708
> Sum(tmp2)
[1] -9.435708
> Var(tmp2)
[1] 1.042474
> 
> rowMeans(tmp2)
  [1] -0.56522109 -0.49195764  1.02991525 -0.70849254 -0.67136119  0.41581748
  [7]  0.53165212  1.35062530  0.74186165  0.09211541  1.33018381 -0.91436042
 [13]  1.07385498  2.29320901  0.06348128  1.75977928 -0.60973723 -1.44849266
 [19] -1.98479859  1.27752316 -0.71512134  0.69537453 -0.75891597  0.14812889
 [25]  0.40834650  1.32758010 -1.50903265 -1.07859180 -1.75454314 -0.64909747
 [31] -0.86258936  1.30436605  0.80180377  0.28132465  1.28661426  0.96975749
 [37] -0.39606438  0.38380288 -0.44228330  0.29932491 -0.22400771  0.56240887
 [43]  0.50287796 -2.71289737 -0.03257649  0.25280111 -1.30304789 -0.60273834
 [49]  1.60016734  0.30833838 -1.37216065  1.06678002 -0.49610873 -0.47792531
 [55]  0.92895822 -0.42785891  0.29272735  1.15681897 -1.47826951  0.53886046
 [61]  1.79806391 -0.79055570 -1.03637262 -0.07340417 -0.45229367 -1.31588109
 [67] -0.25994680  0.58348761  0.49562609 -0.98544233 -0.56573453  0.37509553
 [73] -1.15544388 -0.92254930 -1.08212624 -1.14390270 -1.12715608 -1.47396674
 [79] -1.88905382  0.52196566 -0.94281658 -1.18395828 -1.02298218  0.76747743
 [85]  0.15489490  1.73459323  0.49669450 -0.88681160  0.75370622 -0.20322475
 [91] -0.57799812 -1.24982483 -0.42892316  0.94007932 -1.39961820  0.26744857
 [97] -0.03121120  1.68254927  1.15733926 -1.35246039
> rowSums(tmp2)
  [1] -0.56522109 -0.49195764  1.02991525 -0.70849254 -0.67136119  0.41581748
  [7]  0.53165212  1.35062530  0.74186165  0.09211541  1.33018381 -0.91436042
 [13]  1.07385498  2.29320901  0.06348128  1.75977928 -0.60973723 -1.44849266
 [19] -1.98479859  1.27752316 -0.71512134  0.69537453 -0.75891597  0.14812889
 [25]  0.40834650  1.32758010 -1.50903265 -1.07859180 -1.75454314 -0.64909747
 [31] -0.86258936  1.30436605  0.80180377  0.28132465  1.28661426  0.96975749
 [37] -0.39606438  0.38380288 -0.44228330  0.29932491 -0.22400771  0.56240887
 [43]  0.50287796 -2.71289737 -0.03257649  0.25280111 -1.30304789 -0.60273834
 [49]  1.60016734  0.30833838 -1.37216065  1.06678002 -0.49610873 -0.47792531
 [55]  0.92895822 -0.42785891  0.29272735  1.15681897 -1.47826951  0.53886046
 [61]  1.79806391 -0.79055570 -1.03637262 -0.07340417 -0.45229367 -1.31588109
 [67] -0.25994680  0.58348761  0.49562609 -0.98544233 -0.56573453  0.37509553
 [73] -1.15544388 -0.92254930 -1.08212624 -1.14390270 -1.12715608 -1.47396674
 [79] -1.88905382  0.52196566 -0.94281658 -1.18395828 -1.02298218  0.76747743
 [85]  0.15489490  1.73459323  0.49669450 -0.88681160  0.75370622 -0.20322475
 [91] -0.57799812 -1.24982483 -0.42892316  0.94007932 -1.39961820  0.26744857
 [97] -0.03121120  1.68254927  1.15733926 -1.35246039
> 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.56522109 -0.49195764  1.02991525 -0.70849254 -0.67136119  0.41581748
  [7]  0.53165212  1.35062530  0.74186165  0.09211541  1.33018381 -0.91436042
 [13]  1.07385498  2.29320901  0.06348128  1.75977928 -0.60973723 -1.44849266
 [19] -1.98479859  1.27752316 -0.71512134  0.69537453 -0.75891597  0.14812889
 [25]  0.40834650  1.32758010 -1.50903265 -1.07859180 -1.75454314 -0.64909747
 [31] -0.86258936  1.30436605  0.80180377  0.28132465  1.28661426  0.96975749
 [37] -0.39606438  0.38380288 -0.44228330  0.29932491 -0.22400771  0.56240887
 [43]  0.50287796 -2.71289737 -0.03257649  0.25280111 -1.30304789 -0.60273834
 [49]  1.60016734  0.30833838 -1.37216065  1.06678002 -0.49610873 -0.47792531
 [55]  0.92895822 -0.42785891  0.29272735  1.15681897 -1.47826951  0.53886046
 [61]  1.79806391 -0.79055570 -1.03637262 -0.07340417 -0.45229367 -1.31588109
 [67] -0.25994680  0.58348761  0.49562609 -0.98544233 -0.56573453  0.37509553
 [73] -1.15544388 -0.92254930 -1.08212624 -1.14390270 -1.12715608 -1.47396674
 [79] -1.88905382  0.52196566 -0.94281658 -1.18395828 -1.02298218  0.76747743
 [85]  0.15489490  1.73459323  0.49669450 -0.88681160  0.75370622 -0.20322475
 [91] -0.57799812 -1.24982483 -0.42892316  0.94007932 -1.39961820  0.26744857
 [97] -0.03121120  1.68254927  1.15733926 -1.35246039
> rowMin(tmp2)
  [1] -0.56522109 -0.49195764  1.02991525 -0.70849254 -0.67136119  0.41581748
  [7]  0.53165212  1.35062530  0.74186165  0.09211541  1.33018381 -0.91436042
 [13]  1.07385498  2.29320901  0.06348128  1.75977928 -0.60973723 -1.44849266
 [19] -1.98479859  1.27752316 -0.71512134  0.69537453 -0.75891597  0.14812889
 [25]  0.40834650  1.32758010 -1.50903265 -1.07859180 -1.75454314 -0.64909747
 [31] -0.86258936  1.30436605  0.80180377  0.28132465  1.28661426  0.96975749
 [37] -0.39606438  0.38380288 -0.44228330  0.29932491 -0.22400771  0.56240887
 [43]  0.50287796 -2.71289737 -0.03257649  0.25280111 -1.30304789 -0.60273834
 [49]  1.60016734  0.30833838 -1.37216065  1.06678002 -0.49610873 -0.47792531
 [55]  0.92895822 -0.42785891  0.29272735  1.15681897 -1.47826951  0.53886046
 [61]  1.79806391 -0.79055570 -1.03637262 -0.07340417 -0.45229367 -1.31588109
 [67] -0.25994680  0.58348761  0.49562609 -0.98544233 -0.56573453  0.37509553
 [73] -1.15544388 -0.92254930 -1.08212624 -1.14390270 -1.12715608 -1.47396674
 [79] -1.88905382  0.52196566 -0.94281658 -1.18395828 -1.02298218  0.76747743
 [85]  0.15489490  1.73459323  0.49669450 -0.88681160  0.75370622 -0.20322475
 [91] -0.57799812 -1.24982483 -0.42892316  0.94007932 -1.39961820  0.26744857
 [97] -0.03121120  1.68254927  1.15733926 -1.35246039
> 
> colMeans(tmp2)
[1] -0.09435708
> colSums(tmp2)
[1] -9.435708
> colVars(tmp2)
[1] 1.042474
> colSd(tmp2)
[1] 1.021016
> colMax(tmp2)
[1] 2.293209
> colMin(tmp2)
[1] -2.712897
> colMedians(tmp2)
[1] -0.1383145
> colRanges(tmp2)
          [,1]
[1,] -2.712897
[2,]  2.293209
> 
> 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.3685318 -1.1236556  0.8066486 12.4997527  3.8333460  4.0699344
 [7]  0.3351187 -0.1481244  4.1140178 -2.9658505
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.3184356
[2,] -0.3599023
[3,]  0.1680886
[4,]  0.5122540
[5,]  1.4059498
> 
> rowApply(tmp,sum)
 [1] -2.537864  1.571260  3.714678  1.475250  4.623225  3.725655  6.840542
 [8] -4.399503  5.358709  1.417768
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    4    7    6    2    2    4    7    8     1
 [2,]    4    8    1    2    7    9    3    1    3     6
 [3,]    7    2    8    3    8    3    8    5    4     5
 [4,]    6    5   10    9   10   10    7    9   10     4
 [5,]    3    3    3    5    9    8    6   10    7     2
 [6,]    8    9    5    7    1    5    9    6    5     9
 [7,]    1    7    6   10    4    7    1    4    2     3
 [8,]    5    6    2    8    5    4    5    3    6     7
 [9,]   10    1    4    1    6    6   10    8    9    10
[10,]    2   10    9    4    3    1    2    2    1     8
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.19271339  0.51080914 -1.57424121 -0.69933535  0.50477490 -0.53463720
 [7]  1.47797807  1.52289353  0.83671900  0.36251202 -0.35626582 -2.73202853
[13] -0.07073027  1.41526966 -0.56531727 -0.36122546  0.11848569 -1.22576255
[19]  0.70006083  1.85358377
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.3954648
[2,]  0.6383417
[3,]  0.6992574
[4,]  1.1052903
[5,]  1.1452888
> 
> rowApply(tmp,sum)
[1] -3.6855449  0.6428498  1.3214265  1.1927104  4.9048146
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   10   19   17   18   14
[2,]   16    8   14   17    4
[3,]   19    4    4   12    2
[4,]   13    3   20   11    1
[5,]    4    2   10   20   10
> 
> 
> as.matrix(tmp)
           [,1]       [,2]        [,3]        [,4]         [,5]       [,6]
[1,] -0.3954648  0.2040478  1.35420760 -0.08681086 -0.855957431 -0.7363996
[2,]  1.1452888  0.0174480 -0.92423625 -1.30699006 -1.645624354  0.6602538
[3,]  0.6992574  0.3711123 -0.69915561  2.50387682  0.006170877 -0.7463046
[4,]  1.1052903  0.9030367  0.05395084 -0.01347595  2.712116387 -0.1591197
[5,]  0.6383417 -0.9848356 -1.35900780 -1.79593530  0.288069426  0.4469329
           [,7]       [,8]       [,9]       [,10]      [,11]      [,12]
[1,]  1.7448946 -1.3086992 -1.0251196 -0.56847979 -0.6828696 -0.5135643
[2,]  0.2227440  1.4553947  0.3859071  0.01568736  0.4588630 -0.7233186
[3,] -0.3305907  0.9050026 -2.1754312  1.19931074  0.2423737 -0.1368010
[4,]  0.2266578 -0.1739730  0.2678779 -0.86842864 -0.2651517 -1.0955184
[5,] -0.3857276  0.6451684  3.3834848  0.58442234 -0.1094812 -0.2628262
           [,13]      [,14]      [,15]       [,16]      [,17]       [,18]
[1,]  0.00254596 -0.2924332 -0.1986845  0.48427801 -1.0430834 -0.07505746
[2,]  0.42692732  0.6410541 -0.3389136  0.08948676  0.6440035 -1.85616029
[3,]  0.36090427  0.5881547 -1.5039097 -0.02560626  0.6777949 -0.05467116
[4,] -0.28959352 -1.2751161 -0.8382079  0.14392710 -0.7794046  1.71497923
[5,] -0.57151430  1.7536102  2.3143985 -1.05331108  0.6191753 -0.95485287
            [,19]      [,20]
[1,] -0.732310974  1.0394160
[2,]  0.296979664  0.9780550
[3,]  0.008138234 -0.5682000
[4,]  0.305703074 -0.4828392
[5,]  0.821550829  0.8871521
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  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.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1       col2       col3      col4      col5      col6     col7
row1 -0.6748211 -0.9749948 -0.5157668 -0.410907 0.8798257 -1.891193 0.164037
           col8      col9     col10    col11     col12     col13     col14
row1 0.09075949 0.4596869 0.9542089 2.058552 -1.409313 0.1644866 -2.255848
           col15     col16    col17    col18     col19     col20
row1 -0.09597466 -1.467157 1.150722 1.005586 0.3177731 0.7447162
> tmp[,"col10"]
           col10
row1  0.95420890
row2 -0.85948325
row3 -0.06412026
row4 -3.32083514
row5  0.25913083
> tmp[c("row1","row5"),]
           col1       col2       col3      col4      col5       col6       col7
row1 -0.6748211 -0.9749948 -0.5157668 -0.410907 0.8798257 -1.8911934  0.1640370
row5  1.1169973 -0.2164586 -1.0538474  1.463040 0.9903687  0.7260106 -0.2470562
            col8      col9     col10       col11      col12      col13
row1  0.09075949 0.4596869 0.9542089  2.05855207 -1.4093127  0.1644866
row5 -1.74020230 0.2252770 0.2591308 -0.04215266 -0.4889911 -1.1631897
          col14       col15      col16      col17     col18     col19
row1 -2.2558485 -0.09597466 -1.4671571  1.1507217 1.0055856 0.3177731
row5  0.1758384 -0.70267933  0.1401168 -0.5386682 0.5147072 1.1458534
          col20
row1  0.7447162
row5 -1.1041437
> tmp[,c("col6","col20")]
           col6       col20
row1 -1.8911934  0.74471619
row2 -1.4906929 -2.86554910
row3  0.6217329  1.04779552
row4 -0.4184642 -0.02319806
row5  0.7260106 -1.10414374
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -1.8911934  0.7447162
row5  0.7260106 -1.1041437
> 
> 
> 
> 
> 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 48.44502 49.73642 49.11928 50.06255 48.7497 105.3127 51.83364 50.85177
        col9    col10    col11   col12    col13    col14    col15    col16
row1 50.1561 51.50593 49.90812 49.9272 49.71857 48.95237 49.59702 50.60991
        col17    col18    col19    col20
row1 51.18056 49.39997 50.47881 105.1829
> tmp[,"col10"]
        col10
row1 51.50593
row2 30.73478
row3 29.90723
row4 30.59338
row5 49.91477
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.44502 49.73642 49.11928 50.06255 48.74970 105.3127 51.83364 50.85177
row5 51.45029 49.76895 51.18281 48.74577 50.40493 104.2247 50.65844 50.33878
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.15610 51.50593 49.90812 49.92720 49.71857 48.95237 49.59702 50.60991
row5 49.90892 49.91477 51.62403 49.71747 49.64585 50.30767 49.30928 49.48835
        col17    col18    col19    col20
row1 51.18056 49.39997 50.47881 105.1829
row5 49.19630 48.58394 51.49590 105.9025
> tmp[,c("col6","col20")]
          col6     col20
row1 105.31266 105.18291
row2  75.02539  74.15296
row3  74.26183  73.77202
row4  76.47854  75.13045
row5 104.22473 105.90245
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.3127 105.1829
row5 104.2247 105.9025
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.3127 105.1829
row5 104.2247 105.9025
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  0.87640908
[2,]  0.23461232
[3,] -0.01020076
[4,] -0.69762997
[5,] -0.42131975
> tmp[,c("col17","col7")]
           col17       col7
[1,]  0.25255080  2.1668371
[2,]  0.03181443  0.2467148
[3,]  1.05213376  1.1971379
[4,]  0.18875019 -0.5606209
[5,] -1.06802998 -0.2588410
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,] -1.6104188  0.07659118
[2,] -0.3928268  0.45588881
[3,]  0.8850570 -0.82810489
[4,]  0.3344727  0.01224836
[5,]  1.2086866  1.08660573
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -1.610419
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -1.6104188
[2,] -0.3928268
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]        [,2]       [,3]       [,4]       [,5]      [,6]
row3 -0.2182037  1.79604376 -1.2244660 -0.5535552  0.6590360 0.8099225
row1  0.4689165 -0.07050049  0.9468626  0.7307964 -0.4312359 0.0928274
           [,7]      [,8]       [,9]       [,10]     [,11]      [,12]
row3 -1.4082446 1.3096812 -0.3304453 -0.29245989 0.3199367 -0.4690436
row1  0.6551141 0.6039418  0.3470956 -0.01800375 0.5419562  0.2299342
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
row3  0.8123198 -0.9433522 -0.9069223 -0.4156846  0.8040020 -1.0293005
row1 -0.2889141 -0.9294960  1.7404020 -0.2091341 -0.9686447  0.1319751
           [,19]      [,20]
row3  0.07057849  0.7422459
row1 -1.17590581 -1.0220269
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]      [,3]     [,4]       [,5]      [,6]     [,7]
row2 -1.263018 -1.064354 -1.058344 1.193599 -0.8374301 0.2535082 1.421414
           [,8]      [,9]      [,10]
row2 -0.6727919 0.1732451 -0.2398131
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]       [,4]      [,5]      [,6]      [,7]
row5 0.4987766 -0.693763 -0.1923034 0.02569862 0.4311585 0.3033033 0.9383632
          [,8]       [,9]     [,10]     [,11]     [,12]    [,13]      [,14]
row5 0.4476301 -0.1628188 0.2747256 -0.633121 -1.756126 0.349532 0.08516391
         [,15]      [,16]      [,17]     [,18]     [,19]     [,20]
row5 0.4057856 0.07490376 -0.9699371 0.8551926 -1.124513 0.7462217
> 
> 
> 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: 0x582cd96789a0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a3968ffcb0a"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a393a4925c5"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a394cc4ce8c"
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a397018aa8e"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a39d78cc64" 
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a397dc25dfd"
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a39484e115a"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a391553511d"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a3941d14bbb"
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a395334ada4"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a39442ae3b7"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a393e0d38ff"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a391bbd2601"
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a395b917127"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM2b1a395a1d58b" 
> 
> 
> ### 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: 0x582cdb0e4ea0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x582cdb0e4ea0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x582cdb0e4ea0>
> rowMedians(tmp)
  [1] -0.255422547 -0.964938654  0.543668209  0.164263010 -0.065594948
  [6] -0.044057377  0.732622936  0.578771217  0.457171979  0.221580977
 [11] -0.178639810 -0.479843684  0.364664947 -0.236380242 -0.017869210
 [16]  0.296461848  0.149203935  0.214307263  0.481681969 -0.005349076
 [21] -0.226192785  0.043055348  0.540987505  0.128232498  0.307286987
 [26] -0.468214557 -0.554656153 -0.003364700 -0.029022460  0.063011348
 [31] -0.655334734  0.027264281 -0.221317461 -0.091544957  0.140628411
 [36] -0.052923262  0.023417985  0.130373397  0.373939567 -0.419220396
 [41]  0.482216033 -0.064577133  0.057742172  0.072975063 -0.183749361
 [46] -0.018558272 -0.212551693  0.272343579  0.136879887 -0.027545414
 [51]  0.399214453  0.183640146  0.184311833 -0.585370874 -0.506242411
 [56] -0.105514155 -0.657184417 -0.237104498  0.180346525  0.057853564
 [61] -0.259012757 -0.332980119 -0.295550110 -0.151808904 -0.556509613
 [66]  0.056191905 -0.684815018 -0.277689622  0.373316819  0.049347671
 [71] -0.198920334  0.138042419 -0.156305147  0.156596712  0.624384347
 [76]  0.798628433 -0.123437115 -0.330429034  0.003741677  0.288081803
 [81] -0.448382900 -0.303126942 -0.619566997  0.180952400 -0.494802326
 [86] -0.213292661  0.128077644 -0.308580157  0.412859010 -0.302515901
 [91] -0.203943107  0.084071671 -0.292035044  0.476771251  0.140284325
 [96]  0.061884867 -0.260936866  0.076169038 -0.540935109  0.334752026
[101]  0.208996970  0.055133720 -0.033466191 -0.098657167 -0.148852424
[106]  0.195000103 -0.252885084 -0.007292968  0.372904893  0.040382542
[111]  0.107766530 -0.254107939 -0.135084515  0.265170195 -0.240664435
[116]  0.442870262 -0.539121819 -0.134983153 -0.058856715  0.169836725
[121] -0.136681627  0.089648174 -0.010370883 -0.047382531  0.019286269
[126]  0.182859382  0.474702684  0.252516886 -0.053174139  0.762372780
[131]  0.052050955 -0.842075685 -0.073056387  0.115350130  0.754472089
[136] -0.448007271  0.151320600  0.494989348  0.585270717 -0.401592408
[141]  0.716339352 -0.002836796  0.137449155 -0.068186153 -0.276349186
[146]  0.164951102  0.286536336  0.197245440 -0.235839909 -0.270106290
[151] -0.143333798 -0.303422207 -0.072662861 -0.859939609 -0.134844205
[156]  0.742074017 -0.160386386 -0.172687191 -0.215972821  0.171090356
[161] -0.199051025 -0.143878404  0.202546731  0.123951211 -0.254654332
[166]  0.103240163  0.289612012  0.262608915 -0.229316659  0.049709871
[171]  0.298094786  0.428418317  0.070382306  0.171864530  0.200230075
[176] -0.315778825  0.226541328  0.309635555 -0.029502683 -0.598473083
[181]  0.092818758 -0.712706978 -0.158815234  0.154316390 -0.319748278
[186]  0.191989332  0.137613956  0.295425738 -0.377864558  0.886480573
[191]  0.400520817  0.682929228 -0.132298353  0.128758726 -0.049594635
[196] -0.628377965  0.022701840  0.073277218 -0.045206818 -0.207194773
[201]  0.208735421  0.139832647 -0.188097927 -0.417807788 -0.156318498
[206] -0.126992539 -0.135589646  0.033909679  0.077667743  0.333220193
[211]  0.020653952  0.153611363 -0.037456868  0.175308408  0.415892820
[216] -0.414311249  0.085360827  0.468147651  0.784210982  0.413837061
[221] -0.464239549  0.001763929 -0.238952463 -0.685690463  0.290494502
[226] -0.212712897  0.128270756 -0.256354273 -0.121349624 -0.251235158
> 
> proc.time()
   user  system elapsed 
  1.225   0.719   1.933 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x5b341e7733f0>
> .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: 0x5b341e7733f0>
> .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: 0x5b341e7733f0>
> .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: 0x5b341e7733f0>
> 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: 0x5b341e75b240>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b341e75b240>
> .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: 0x5b341e75b240>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b341e75b240>
> .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: 0x5b341e75b240>
> 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: 0x5b341ea3e1a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b341ea3e1a0>
> .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: 0x5b341ea3e1a0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5b341ea3e1a0>
> .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: 0x5b341ea3e1a0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5b341ea3e1a0>
> .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: 0x5b341ea3e1a0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5b341ea3e1a0>
> .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: 0x5b341ea3e1a0>
> 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: 0x5b341d78e410>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5b341d78e410>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b341d78e410>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b341d78e410>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2b1c0e24303aa1" "BufferedMatrixFile2b1c0e7cc85495"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2b1c0e24303aa1" "BufferedMatrixFile2b1c0e7cc85495"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b341d6853d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b341d6853d0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5b341d6853d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5b341d6853d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5b341d6853d0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5b341d6853d0>
> .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: 0x5b341f1bb020>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b341f1bb020>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5b341f1bb020>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5b341f1bb020>
> 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: 0x5b341d993070>
> .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: 0x5b341d993070>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.238   0.043   0.271 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.251   0.038   0.278 

Example timings