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

This page was generated on 2026-02-09 11:57 -0500 (Mon, 09 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-05 13:45 -0500 (Thu, 05 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-05 21:43:47 -0500 (Thu, 05 Feb 2026)
EndedAt: 2026-02-05 21:44:11 -0500 (Thu, 05 Feb 2026)
EllapsedTime: 24.0 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.250   0.041   0.280 

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] "Thu Feb  5 21:44:02 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] "Thu Feb  5 21:44:03 2026"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x628a50b4d1c0>
> 
> 
> 
> 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] "Thu Feb  5 21:44:03 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] "Thu Feb  5 21:44:03 2026"
> 
> ColMode(tmp2)
<pointer: 0x628a50b4d1c0>
> 
> 
> 
> ### 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,] 99.084741834  1.04921121  0.1055990 0.3296700
[2,]  0.334903375  0.73464140 -2.0864313 0.6394418
[3,]  0.002193006  0.05891797 -0.2294185 0.4438803
[4,]  1.107644083 -0.27815475 -0.5059408 0.9786523
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
             [,1]       [,2]      [,3]      [,4]
[1,] 99.084741834 1.04921121 0.1055990 0.3296700
[2,]  0.334903375 0.73464140 2.0864313 0.6394418
[3,]  0.002193006 0.05891797 0.2294185 0.4438803
[4,]  1.107644083 0.27815475 0.5059408 0.9786523
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 9.95413190 1.0243101 0.3249600 0.5741689
[2,] 0.57870837 0.8571122 1.4444484 0.7996511
[3,] 0.04682955 0.2427303 0.4789766 0.6662434
[4,] 1.05244671 0.5274038 0.7112951 0.9892686
> 
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 223.62606 36.29231 28.35520 31.07136
[2,]  31.12199 34.30576 41.53092 33.63595
[3,]  25.47049 27.48622 30.01918 32.10631
[4,]  36.63211 30.55219 32.61889 35.87134
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x628a517538b0>
> exp(tmp5)
<pointer: 0x628a517538b0>
> log(tmp5,2)
<pointer: 0x628a517538b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 465.4483
> Min(tmp5)
[1] 53.01348
> mean(tmp5)
[1] 72.28434
> Sum(tmp5)
[1] 14456.87
> Var(tmp5)
[1] 850.3787
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.96531 69.00872 69.39493 72.50934 69.43586 70.02924 69.92723 69.32408
 [9] 71.50350 68.74513
> rowSums(tmp5)
 [1] 1859.306 1380.174 1387.899 1450.187 1388.717 1400.585 1398.545 1386.482
 [9] 1430.070 1374.903
> rowVars(tmp5)
 [1] 7767.46698   66.18798   90.45667   43.49259   91.00044   43.06220
 [7]   73.38307   55.83957   83.32960   79.23619
> rowSd(tmp5)
 [1] 88.133234  8.135599  9.510871  6.594891  9.539415  6.562180  8.566392
 [8]  7.472588  9.128505  8.901471
> rowMax(tmp5)
 [1] 465.44835  86.44116  88.14554  81.01527  96.08273  81.66024  89.42229
 [8]  85.65383  88.03443  85.73811
> rowMin(tmp5)
 [1] 59.01763 57.50614 53.01348 54.04349 56.79626 57.53659 54.01496 55.70551
 [9] 55.32080 55.49347
> 
> colMeans(tmp5)
 [1] 108.10259  67.79511  70.04696  69.02799  72.13787  69.89599  71.42936
 [8]  69.40979  70.64973  68.54593  76.17379  72.99582  70.20359  68.82052
[15]  71.14157  71.15167  70.81649  74.89336  66.00652  66.44207
> colSums(tmp5)
 [1] 1081.0259  677.9511  700.4696  690.2799  721.3787  698.9599  714.2936
 [8]  694.0979  706.4973  685.4593  761.7379  729.9582  702.0359  688.2052
[15]  711.4157  711.5167  708.1649  748.9336  660.0652  664.4207
> colVars(tmp5)
 [1] 15835.12875    38.13422   153.82902    35.94199    56.56239    32.18841
 [7]   177.17255    45.95590    37.89681    60.10846    76.97472    61.35086
[13]    51.00463    38.11250    52.63529    89.76351    60.61774   119.98014
[19]    33.45944   115.85400
> colSd(tmp5)
 [1] 125.837708   6.175291  12.402783   5.995163   7.520797   5.673483
 [7]  13.310618   6.779078   6.156039   7.752965   8.773524   7.832679
[13]   7.141753   6.173532   7.255019   9.474361   7.785739  10.953545
[19]   5.784414  10.763549
> colMax(tmp5)
 [1] 465.44835  75.53769  88.03443  74.84418  83.09904  78.68070  89.42229
 [8]  78.23676  81.49880  81.45737  97.21223  85.49455  82.17661  79.13978
[15]  82.08819  88.14554  86.38259  96.08273  78.72422  84.76391
> colMin(tmp5)
 [1] 53.01348 57.20897 57.72165 55.32080 60.81424 60.15981 54.04349 58.75661
 [9] 60.79601 57.86060 63.63143 64.37084 63.10588 56.69212 59.95891 61.92778
[17] 58.76048 57.50614 58.59126 54.01496
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 92.96531 69.00872 69.39493 72.50934 69.43586 70.02924 69.92723 69.32408
 [9] 71.50350       NA
> rowSums(tmp5)
 [1] 1859.306 1380.174 1387.899 1450.187 1388.717 1400.585 1398.545 1386.482
 [9] 1430.070       NA
> rowVars(tmp5)
 [1] 7767.46698   66.18798   90.45667   43.49259   91.00044   43.06220
 [7]   73.38307   55.83957   83.32960   80.97018
> rowSd(tmp5)
 [1] 88.133234  8.135599  9.510871  6.594891  9.539415  6.562180  8.566392
 [8]  7.472588  9.128505  8.998343
> rowMax(tmp5)
 [1] 465.44835  86.44116  88.14554  81.01527  96.08273  81.66024  89.42229
 [8]  85.65383  88.03443        NA
> rowMin(tmp5)
 [1] 59.01763 57.50614 53.01348 54.04349 56.79626 57.53659 54.01496 55.70551
 [9] 55.32080       NA
> 
> colMeans(tmp5)
 [1] 108.10259  67.79511  70.04696  69.02799  72.13787        NA  71.42936
 [8]  69.40979  70.64973  68.54593  76.17379  72.99582  70.20359  68.82052
[15]  71.14157  71.15167  70.81649  74.89336  66.00652  66.44207
> colSums(tmp5)
 [1] 1081.0259  677.9511  700.4696  690.2799  721.3787        NA  714.2936
 [8]  694.0979  706.4973  685.4593  761.7379  729.9582  702.0359  688.2052
[15]  711.4157  711.5167  708.1649  748.9336  660.0652  664.4207
> colVars(tmp5)
 [1] 15835.12875    38.13422   153.82902    35.94199    56.56239          NA
 [7]   177.17255    45.95590    37.89681    60.10846    76.97472    61.35086
[13]    51.00463    38.11250    52.63529    89.76351    60.61774   119.98014
[19]    33.45944   115.85400
> colSd(tmp5)
 [1] 125.837708   6.175291  12.402783   5.995163   7.520797         NA
 [7]  13.310618   6.779078   6.156039   7.752965   8.773524   7.832679
[13]   7.141753   6.173532   7.255019   9.474361   7.785739  10.953545
[19]   5.784414  10.763549
> colMax(tmp5)
 [1] 465.44835  75.53769  88.03443  74.84418  83.09904        NA  89.42229
 [8]  78.23676  81.49880  81.45737  97.21223  85.49455  82.17661  79.13978
[15]  82.08819  88.14554  86.38259  96.08273  78.72422  84.76391
> colMin(tmp5)
 [1] 53.01348 57.20897 57.72165 55.32080 60.81424       NA 54.04349 58.75661
 [9] 60.79601 57.86060 63.63143 64.37084 63.10588 56.69212 59.95891 61.92778
[17] 58.76048 57.50614 58.59126 54.01496
> 
> Max(tmp5,na.rm=TRUE)
[1] 465.4483
> Min(tmp5,na.rm=TRUE)
[1] 53.01348
> mean(tmp5,na.rm=TRUE)
[1] 72.33606
> Sum(tmp5,na.rm=TRUE)
[1] 14394.88
> Var(tmp5,na.rm=TRUE)
[1] 854.1357
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.96531 69.00872 69.39493 72.50934 69.43586 70.02924 69.92723 69.32408
 [9] 71.50350 69.10063
> rowSums(tmp5,na.rm=TRUE)
 [1] 1859.306 1380.174 1387.899 1450.187 1388.717 1400.585 1398.545 1386.482
 [9] 1430.070 1312.912
> rowVars(tmp5,na.rm=TRUE)
 [1] 7767.46698   66.18798   90.45667   43.49259   91.00044   43.06220
 [7]   73.38307   55.83957   83.32960   80.97018
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.133234  8.135599  9.510871  6.594891  9.539415  6.562180  8.566392
 [8]  7.472588  9.128505  8.998343
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.44835  86.44116  88.14554  81.01527  96.08273  81.66024  89.42229
 [8]  85.65383  88.03443  85.73811
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.01763 57.50614 53.01348 54.04349 56.79626 57.53659 54.01496 55.70551
 [9] 55.32080 55.49347
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 108.10259  67.79511  70.04696  69.02799  72.13787  70.77436  71.42936
 [8]  69.40979  70.64973  68.54593  76.17379  72.99582  70.20359  68.82052
[15]  71.14157  71.15167  70.81649  74.89336  66.00652  66.44207
> colSums(tmp5,na.rm=TRUE)
 [1] 1081.0259  677.9511  700.4696  690.2799  721.3787  636.9692  714.2936
 [8]  694.0979  706.4973  685.4593  761.7379  729.9582  702.0359  688.2052
[15]  711.4157  711.5167  708.1649  748.9336  660.0652  664.4207
> colVars(tmp5,na.rm=TRUE)
 [1] 15835.12875    38.13422   153.82902    35.94199    56.56239    27.53217
 [7]   177.17255    45.95590    37.89681    60.10846    76.97472    61.35086
[13]    51.00463    38.11250    52.63529    89.76351    60.61774   119.98014
[19]    33.45944   115.85400
> colSd(tmp5,na.rm=TRUE)
 [1] 125.837708   6.175291  12.402783   5.995163   7.520797   5.247111
 [7]  13.310618   6.779078   6.156039   7.752965   8.773524   7.832679
[13]   7.141753   6.173532   7.255019   9.474361   7.785739  10.953545
[19]   5.784414  10.763549
> colMax(tmp5,na.rm=TRUE)
 [1] 465.44835  75.53769  88.03443  74.84418  83.09904  78.68070  89.42229
 [8]  78.23676  81.49880  81.45737  97.21223  85.49455  82.17661  79.13978
[15]  82.08819  88.14554  86.38259  96.08273  78.72422  84.76391
> colMin(tmp5,na.rm=TRUE)
 [1] 53.01348 57.20897 57.72165 55.32080 60.81424 60.15981 54.04349 58.75661
 [9] 60.79601 57.86060 63.63143 64.37084 63.10588 56.69212 59.95891 61.92778
[17] 58.76048 57.50614 58.59126 54.01496
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.96531 69.00872 69.39493 72.50934 69.43586 70.02924 69.92723 69.32408
 [9] 71.50350      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1859.306 1380.174 1387.899 1450.187 1388.717 1400.585 1398.545 1386.482
 [9] 1430.070    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 7767.46698   66.18798   90.45667   43.49259   91.00044   43.06220
 [7]   73.38307   55.83957   83.32960         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.133234  8.135599  9.510871  6.594891  9.539415  6.562180  8.566392
 [8]  7.472588  9.128505        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.44835  86.44116  88.14554  81.01527  96.08273  81.66024  89.42229
 [8]  85.65383  88.03443        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.01763 57.50614 53.01348 54.04349 56.79626 57.53659 54.01496 55.70551
 [9] 55.32080       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.19971  67.86490  71.41643  68.97349  72.17118       NaN  71.15421
 [8]  68.55182  70.22857  69.50961  76.68316  73.95415  70.97521  70.16812
[15]  69.92528  69.53096  72.15605  74.86986  65.78596  67.65859
> colSums(tmp5,na.rm=TRUE)
 [1] 1000.7974  610.7841  642.7479  620.7614  649.5406    0.0000  640.3879
 [8]  616.9664  632.0572  625.5865  690.1485  665.5873  638.7769  631.5131
[15]  629.3275  625.7786  649.4044  673.8288  592.0736  608.9273
> colVars(tmp5,na.rm=TRUE)
 [1] 17706.60814    42.84620   151.95861    40.40132    63.62020          NA
 [7]   198.46738    43.41913    40.63848    57.17441    83.67766    58.68775
[13]    50.68186    22.44626    42.57186    71.43339    48.00782   134.97145
[19]    37.09461   113.68686
> colSd(tmp5,na.rm=TRUE)
 [1] 133.066180   6.545701  12.327149   6.356203   7.976227         NA
 [7]  14.087845   6.589319   6.374832   7.561376   9.147550   7.660793
[13]   7.119119   4.737748   6.524712   8.451827   6.928767  11.617721
[19]   6.090535  10.662404
> colMax(tmp5,na.rm=TRUE)
 [1] 465.44835  75.53769  88.03443  74.84418  83.09904      -Inf  89.42229
 [8]  78.23676  81.49880  81.45737  97.21223  85.49455  82.17661  79.13978
[15]  78.96636  88.14554  86.38259  96.08273  78.72422  84.76391
> colMin(tmp5,na.rm=TRUE)
 [1] 53.01348 57.20897 59.01763 55.32080 60.81424      Inf 54.04349 58.75661
 [9] 60.79601 57.86060 63.63143 65.00872 63.10588 63.74599 59.95891 61.92778
[17] 64.96333 57.50614 58.59126 54.01496
> 
> 
> 
> 
> 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] 220.5217 146.3332 263.9776 161.5177 216.0083 138.3884 302.3777 183.7044
 [9] 262.1963 167.8756
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 220.5217 146.3332 263.9776 161.5177 216.0083 138.3884 302.3777 183.7044
 [9] 262.1963 167.8756
> 
> 
> 
> 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] -8.526513e-14  2.273737e-13  5.684342e-14 -2.842171e-13  5.684342e-14
 [6] -1.705303e-13  0.000000e+00 -1.136868e-13  8.526513e-14  8.526513e-14
[11] -1.705303e-13  2.842171e-14  2.842171e-14  1.421085e-14  1.705303e-13
[16] -1.136868e-13 -2.557954e-13  1.136868e-13 -8.526513e-14 -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   6 
6   1 
2   1 
2   3 
9   17 
3   10 
10   14 
9   12 
5   18 
2   15 
7   11 
9   19 
7   9 
5   13 
10   14 
6   6 
2   18 
6   11 
10   18 
2   15 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.172002
> Min(tmp)
[1] -2.140596
> mean(tmp)
[1] -0.1663761
> Sum(tmp)
[1] -16.63761
> Var(tmp)
[1] 0.8955831
> 
> rowMeans(tmp)
[1] -0.1663761
> rowSums(tmp)
[1] -16.63761
> rowVars(tmp)
[1] 0.8955831
> rowSd(tmp)
[1] 0.9463525
> rowMax(tmp)
[1] 2.172002
> rowMin(tmp)
[1] -2.140596
> 
> colMeans(tmp)
  [1]  0.060650595  1.271292157  0.679436104 -1.225648872  1.338044830
  [6] -0.916161078  1.568303232  0.643466629 -1.800964264 -0.196096230
 [11] -0.478142290  1.493578012 -0.976723910 -0.253413662 -0.024609251
 [16]  0.333934410 -0.157233195  0.008671321 -0.358453902  0.967937483
 [21] -1.623180226  0.492183852  0.155697123 -0.861605076 -1.008441546
 [26]  1.905168098  1.393183005 -0.745812722  1.006439714  0.114991205
 [31]  2.172002014 -0.751913473  0.180721615 -0.955966216 -0.053277930
 [36] -0.361205767 -1.659353116 -0.576491993 -0.077583146 -0.581388196
 [41] -0.537379128 -0.597168775 -0.548439986 -0.039147034 -1.169091364
 [46]  2.137454024  0.821786477  0.239238798 -0.002546057 -0.069754554
 [51] -0.569073102 -0.537882774 -0.399935908 -0.954161489 -1.048505676
 [56]  0.420924922 -0.934108755 -0.973720790 -1.743805839 -0.931596305
 [61] -1.939373629 -0.811586391 -0.566087775  1.076834851  0.765556339
 [66]  1.567655274  0.162180643 -0.180988275  1.472835439  0.787518121
 [71]  0.941836751  0.000571892  0.907848711  0.341258987  1.270600646
 [76] -0.648134786 -0.833374007 -0.804929848 -0.048313370 -0.419910646
 [81] -0.571045815 -0.108912474  1.535316801 -0.148706057 -1.348683009
 [86] -0.321913951 -0.443173589 -0.210393202 -1.434157670  0.186697111
 [91] -0.939197297 -0.942039175 -0.706436207 -0.666586761 -0.279622579
 [96] -1.521853885 -2.140595760 -1.452463238 -0.170935487 -0.700030211
> colSums(tmp)
  [1]  0.060650595  1.271292157  0.679436104 -1.225648872  1.338044830
  [6] -0.916161078  1.568303232  0.643466629 -1.800964264 -0.196096230
 [11] -0.478142290  1.493578012 -0.976723910 -0.253413662 -0.024609251
 [16]  0.333934410 -0.157233195  0.008671321 -0.358453902  0.967937483
 [21] -1.623180226  0.492183852  0.155697123 -0.861605076 -1.008441546
 [26]  1.905168098  1.393183005 -0.745812722  1.006439714  0.114991205
 [31]  2.172002014 -0.751913473  0.180721615 -0.955966216 -0.053277930
 [36] -0.361205767 -1.659353116 -0.576491993 -0.077583146 -0.581388196
 [41] -0.537379128 -0.597168775 -0.548439986 -0.039147034 -1.169091364
 [46]  2.137454024  0.821786477  0.239238798 -0.002546057 -0.069754554
 [51] -0.569073102 -0.537882774 -0.399935908 -0.954161489 -1.048505676
 [56]  0.420924922 -0.934108755 -0.973720790 -1.743805839 -0.931596305
 [61] -1.939373629 -0.811586391 -0.566087775  1.076834851  0.765556339
 [66]  1.567655274  0.162180643 -0.180988275  1.472835439  0.787518121
 [71]  0.941836751  0.000571892  0.907848711  0.341258987  1.270600646
 [76] -0.648134786 -0.833374007 -0.804929848 -0.048313370 -0.419910646
 [81] -0.571045815 -0.108912474  1.535316801 -0.148706057 -1.348683009
 [86] -0.321913951 -0.443173589 -0.210393202 -1.434157670  0.186697111
 [91] -0.939197297 -0.942039175 -0.706436207 -0.666586761 -0.279622579
 [96] -1.521853885 -2.140595760 -1.452463238 -0.170935487 -0.700030211
> 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.060650595  1.271292157  0.679436104 -1.225648872  1.338044830
  [6] -0.916161078  1.568303232  0.643466629 -1.800964264 -0.196096230
 [11] -0.478142290  1.493578012 -0.976723910 -0.253413662 -0.024609251
 [16]  0.333934410 -0.157233195  0.008671321 -0.358453902  0.967937483
 [21] -1.623180226  0.492183852  0.155697123 -0.861605076 -1.008441546
 [26]  1.905168098  1.393183005 -0.745812722  1.006439714  0.114991205
 [31]  2.172002014 -0.751913473  0.180721615 -0.955966216 -0.053277930
 [36] -0.361205767 -1.659353116 -0.576491993 -0.077583146 -0.581388196
 [41] -0.537379128 -0.597168775 -0.548439986 -0.039147034 -1.169091364
 [46]  2.137454024  0.821786477  0.239238798 -0.002546057 -0.069754554
 [51] -0.569073102 -0.537882774 -0.399935908 -0.954161489 -1.048505676
 [56]  0.420924922 -0.934108755 -0.973720790 -1.743805839 -0.931596305
 [61] -1.939373629 -0.811586391 -0.566087775  1.076834851  0.765556339
 [66]  1.567655274  0.162180643 -0.180988275  1.472835439  0.787518121
 [71]  0.941836751  0.000571892  0.907848711  0.341258987  1.270600646
 [76] -0.648134786 -0.833374007 -0.804929848 -0.048313370 -0.419910646
 [81] -0.571045815 -0.108912474  1.535316801 -0.148706057 -1.348683009
 [86] -0.321913951 -0.443173589 -0.210393202 -1.434157670  0.186697111
 [91] -0.939197297 -0.942039175 -0.706436207 -0.666586761 -0.279622579
 [96] -1.521853885 -2.140595760 -1.452463238 -0.170935487 -0.700030211
> colMin(tmp)
  [1]  0.060650595  1.271292157  0.679436104 -1.225648872  1.338044830
  [6] -0.916161078  1.568303232  0.643466629 -1.800964264 -0.196096230
 [11] -0.478142290  1.493578012 -0.976723910 -0.253413662 -0.024609251
 [16]  0.333934410 -0.157233195  0.008671321 -0.358453902  0.967937483
 [21] -1.623180226  0.492183852  0.155697123 -0.861605076 -1.008441546
 [26]  1.905168098  1.393183005 -0.745812722  1.006439714  0.114991205
 [31]  2.172002014 -0.751913473  0.180721615 -0.955966216 -0.053277930
 [36] -0.361205767 -1.659353116 -0.576491993 -0.077583146 -0.581388196
 [41] -0.537379128 -0.597168775 -0.548439986 -0.039147034 -1.169091364
 [46]  2.137454024  0.821786477  0.239238798 -0.002546057 -0.069754554
 [51] -0.569073102 -0.537882774 -0.399935908 -0.954161489 -1.048505676
 [56]  0.420924922 -0.934108755 -0.973720790 -1.743805839 -0.931596305
 [61] -1.939373629 -0.811586391 -0.566087775  1.076834851  0.765556339
 [66]  1.567655274  0.162180643 -0.180988275  1.472835439  0.787518121
 [71]  0.941836751  0.000571892  0.907848711  0.341258987  1.270600646
 [76] -0.648134786 -0.833374007 -0.804929848 -0.048313370 -0.419910646
 [81] -0.571045815 -0.108912474  1.535316801 -0.148706057 -1.348683009
 [86] -0.321913951 -0.443173589 -0.210393202 -1.434157670  0.186697111
 [91] -0.939197297 -0.942039175 -0.706436207 -0.666586761 -0.279622579
 [96] -1.521853885 -2.140595760 -1.452463238 -0.170935487 -0.700030211
> colMedians(tmp)
  [1]  0.060650595  1.271292157  0.679436104 -1.225648872  1.338044830
  [6] -0.916161078  1.568303232  0.643466629 -1.800964264 -0.196096230
 [11] -0.478142290  1.493578012 -0.976723910 -0.253413662 -0.024609251
 [16]  0.333934410 -0.157233195  0.008671321 -0.358453902  0.967937483
 [21] -1.623180226  0.492183852  0.155697123 -0.861605076 -1.008441546
 [26]  1.905168098  1.393183005 -0.745812722  1.006439714  0.114991205
 [31]  2.172002014 -0.751913473  0.180721615 -0.955966216 -0.053277930
 [36] -0.361205767 -1.659353116 -0.576491993 -0.077583146 -0.581388196
 [41] -0.537379128 -0.597168775 -0.548439986 -0.039147034 -1.169091364
 [46]  2.137454024  0.821786477  0.239238798 -0.002546057 -0.069754554
 [51] -0.569073102 -0.537882774 -0.399935908 -0.954161489 -1.048505676
 [56]  0.420924922 -0.934108755 -0.973720790 -1.743805839 -0.931596305
 [61] -1.939373629 -0.811586391 -0.566087775  1.076834851  0.765556339
 [66]  1.567655274  0.162180643 -0.180988275  1.472835439  0.787518121
 [71]  0.941836751  0.000571892  0.907848711  0.341258987  1.270600646
 [76] -0.648134786 -0.833374007 -0.804929848 -0.048313370 -0.419910646
 [81] -0.571045815 -0.108912474  1.535316801 -0.148706057 -1.348683009
 [86] -0.321913951 -0.443173589 -0.210393202 -1.434157670  0.186697111
 [91] -0.939197297 -0.942039175 -0.706436207 -0.666586761 -0.279622579
 [96] -1.521853885 -2.140595760 -1.452463238 -0.170935487 -0.700030211
> colRanges(tmp)
           [,1]     [,2]      [,3]      [,4]     [,5]       [,6]     [,7]
[1,] 0.06065059 1.271292 0.6794361 -1.225649 1.338045 -0.9161611 1.568303
[2,] 0.06065059 1.271292 0.6794361 -1.225649 1.338045 -0.9161611 1.568303
          [,8]      [,9]      [,10]      [,11]    [,12]      [,13]      [,14]
[1,] 0.6434666 -1.800964 -0.1960962 -0.4781423 1.493578 -0.9767239 -0.2534137
[2,] 0.6434666 -1.800964 -0.1960962 -0.4781423 1.493578 -0.9767239 -0.2534137
           [,15]     [,16]      [,17]       [,18]      [,19]     [,20]    [,21]
[1,] -0.02460925 0.3339344 -0.1572332 0.008671321 -0.3584539 0.9679375 -1.62318
[2,] -0.02460925 0.3339344 -0.1572332 0.008671321 -0.3584539 0.9679375 -1.62318
         [,22]     [,23]      [,24]     [,25]    [,26]    [,27]      [,28]
[1,] 0.4921839 0.1556971 -0.8616051 -1.008442 1.905168 1.393183 -0.7458127
[2,] 0.4921839 0.1556971 -0.8616051 -1.008442 1.905168 1.393183 -0.7458127
       [,29]     [,30]    [,31]      [,32]     [,33]      [,34]       [,35]
[1,] 1.00644 0.1149912 2.172002 -0.7519135 0.1807216 -0.9559662 -0.05327793
[2,] 1.00644 0.1149912 2.172002 -0.7519135 0.1807216 -0.9559662 -0.05327793
          [,36]     [,37]     [,38]       [,39]      [,40]      [,41]
[1,] -0.3612058 -1.659353 -0.576492 -0.07758315 -0.5813882 -0.5373791
[2,] -0.3612058 -1.659353 -0.576492 -0.07758315 -0.5813882 -0.5373791
          [,42]    [,43]       [,44]     [,45]    [,46]     [,47]     [,48]
[1,] -0.5971688 -0.54844 -0.03914703 -1.169091 2.137454 0.8217865 0.2392388
[2,] -0.5971688 -0.54844 -0.03914703 -1.169091 2.137454 0.8217865 0.2392388
            [,49]       [,50]      [,51]      [,52]      [,53]      [,54]
[1,] -0.002546057 -0.06975455 -0.5690731 -0.5378828 -0.3999359 -0.9541615
[2,] -0.002546057 -0.06975455 -0.5690731 -0.5378828 -0.3999359 -0.9541615
         [,55]     [,56]      [,57]      [,58]     [,59]      [,60]     [,61]
[1,] -1.048506 0.4209249 -0.9341088 -0.9737208 -1.743806 -0.9315963 -1.939374
[2,] -1.048506 0.4209249 -0.9341088 -0.9737208 -1.743806 -0.9315963 -1.939374
          [,62]      [,63]    [,64]     [,65]    [,66]     [,67]      [,68]
[1,] -0.8115864 -0.5660878 1.076835 0.7655563 1.567655 0.1621806 -0.1809883
[2,] -0.8115864 -0.5660878 1.076835 0.7655563 1.567655 0.1621806 -0.1809883
        [,69]     [,70]     [,71]       [,72]     [,73]    [,74]    [,75]
[1,] 1.472835 0.7875181 0.9418368 0.000571892 0.9078487 0.341259 1.270601
[2,] 1.472835 0.7875181 0.9418368 0.000571892 0.9078487 0.341259 1.270601
          [,76]     [,77]      [,78]       [,79]      [,80]      [,81]
[1,] -0.6481348 -0.833374 -0.8049298 -0.04831337 -0.4199106 -0.5710458
[2,] -0.6481348 -0.833374 -0.8049298 -0.04831337 -0.4199106 -0.5710458
          [,82]    [,83]      [,84]     [,85]     [,86]      [,87]      [,88]
[1,] -0.1089125 1.535317 -0.1487061 -1.348683 -0.321914 -0.4431736 -0.2103932
[2,] -0.1089125 1.535317 -0.1487061 -1.348683 -0.321914 -0.4431736 -0.2103932
         [,89]     [,90]      [,91]      [,92]      [,93]      [,94]      [,95]
[1,] -1.434158 0.1866971 -0.9391973 -0.9420392 -0.7064362 -0.6665868 -0.2796226
[2,] -1.434158 0.1866971 -0.9391973 -0.9420392 -0.7064362 -0.6665868 -0.2796226
         [,96]     [,97]     [,98]      [,99]     [,100]
[1,] -1.521854 -2.140596 -1.452463 -0.1709355 -0.7000302
[2,] -1.521854 -2.140596 -1.452463 -0.1709355 -0.7000302
> 
> 
> Max(tmp2)
[1] 2.190699
> Min(tmp2)
[1] -2.535241
> mean(tmp2)
[1] -0.1400584
> Sum(tmp2)
[1] -14.00584
> Var(tmp2)
[1] 1.014879
> 
> rowMeans(tmp2)
  [1]  0.57946957 -0.20259074 -1.05896017 -0.84464506  0.50736099 -0.08508980
  [7] -0.55700041  0.14960251  0.58680835 -0.35222292  0.82948677 -2.35553603
 [13] -1.11401969 -0.29636058 -0.50362818  0.25649846  0.07913047  0.60446303
 [19] -1.85878823  0.07698617  0.06872066  0.27159467 -1.27345958 -0.58384102
 [25]  0.10438255  1.77029874 -0.05049858  0.44338050 -1.52875612 -0.49980910
 [31]  0.18846344  1.54132115 -1.16539894 -1.52207996  1.35562369 -0.26942541
 [37]  1.71495995 -0.53391223 -1.40843286  0.59826797 -0.39350190  0.27504595
 [43] -2.35530178  0.11312895 -0.76403317  0.13797727  0.20279676 -1.03618526
 [49] -2.51660066  0.17574627  2.19069936  0.35873359  0.19262556 -0.47554475
 [55]  1.71913247 -1.14345320 -0.33665501  0.72241060  0.52519556  0.43162273
 [61] -1.31631830  2.08999299 -0.02759839  0.15207703  1.99982320  0.92129169
 [67] -1.55375697 -0.10381243 -0.15893250 -2.53524075  0.20960476 -1.47431064
 [73] -0.18132462  0.05740962 -0.16164680  0.44491291  0.77749952 -0.16314137
 [79]  0.49701076 -1.79363905 -1.01043177 -0.37087617 -0.46704665 -0.79780817
 [85] -0.44560898  0.42183462 -0.75210522 -0.74081270  0.70860234  1.20099674
 [91] -0.45560369  1.40862115  0.79506051  0.44195540 -1.34498367  0.71524494
 [97]  0.54885609 -1.25003222 -1.46233964 -0.51546401
> rowSums(tmp2)
  [1]  0.57946957 -0.20259074 -1.05896017 -0.84464506  0.50736099 -0.08508980
  [7] -0.55700041  0.14960251  0.58680835 -0.35222292  0.82948677 -2.35553603
 [13] -1.11401969 -0.29636058 -0.50362818  0.25649846  0.07913047  0.60446303
 [19] -1.85878823  0.07698617  0.06872066  0.27159467 -1.27345958 -0.58384102
 [25]  0.10438255  1.77029874 -0.05049858  0.44338050 -1.52875612 -0.49980910
 [31]  0.18846344  1.54132115 -1.16539894 -1.52207996  1.35562369 -0.26942541
 [37]  1.71495995 -0.53391223 -1.40843286  0.59826797 -0.39350190  0.27504595
 [43] -2.35530178  0.11312895 -0.76403317  0.13797727  0.20279676 -1.03618526
 [49] -2.51660066  0.17574627  2.19069936  0.35873359  0.19262556 -0.47554475
 [55]  1.71913247 -1.14345320 -0.33665501  0.72241060  0.52519556  0.43162273
 [61] -1.31631830  2.08999299 -0.02759839  0.15207703  1.99982320  0.92129169
 [67] -1.55375697 -0.10381243 -0.15893250 -2.53524075  0.20960476 -1.47431064
 [73] -0.18132462  0.05740962 -0.16164680  0.44491291  0.77749952 -0.16314137
 [79]  0.49701076 -1.79363905 -1.01043177 -0.37087617 -0.46704665 -0.79780817
 [85] -0.44560898  0.42183462 -0.75210522 -0.74081270  0.70860234  1.20099674
 [91] -0.45560369  1.40862115  0.79506051  0.44195540 -1.34498367  0.71524494
 [97]  0.54885609 -1.25003222 -1.46233964 -0.51546401
> 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.57946957 -0.20259074 -1.05896017 -0.84464506  0.50736099 -0.08508980
  [7] -0.55700041  0.14960251  0.58680835 -0.35222292  0.82948677 -2.35553603
 [13] -1.11401969 -0.29636058 -0.50362818  0.25649846  0.07913047  0.60446303
 [19] -1.85878823  0.07698617  0.06872066  0.27159467 -1.27345958 -0.58384102
 [25]  0.10438255  1.77029874 -0.05049858  0.44338050 -1.52875612 -0.49980910
 [31]  0.18846344  1.54132115 -1.16539894 -1.52207996  1.35562369 -0.26942541
 [37]  1.71495995 -0.53391223 -1.40843286  0.59826797 -0.39350190  0.27504595
 [43] -2.35530178  0.11312895 -0.76403317  0.13797727  0.20279676 -1.03618526
 [49] -2.51660066  0.17574627  2.19069936  0.35873359  0.19262556 -0.47554475
 [55]  1.71913247 -1.14345320 -0.33665501  0.72241060  0.52519556  0.43162273
 [61] -1.31631830  2.08999299 -0.02759839  0.15207703  1.99982320  0.92129169
 [67] -1.55375697 -0.10381243 -0.15893250 -2.53524075  0.20960476 -1.47431064
 [73] -0.18132462  0.05740962 -0.16164680  0.44491291  0.77749952 -0.16314137
 [79]  0.49701076 -1.79363905 -1.01043177 -0.37087617 -0.46704665 -0.79780817
 [85] -0.44560898  0.42183462 -0.75210522 -0.74081270  0.70860234  1.20099674
 [91] -0.45560369  1.40862115  0.79506051  0.44195540 -1.34498367  0.71524494
 [97]  0.54885609 -1.25003222 -1.46233964 -0.51546401
> rowMin(tmp2)
  [1]  0.57946957 -0.20259074 -1.05896017 -0.84464506  0.50736099 -0.08508980
  [7] -0.55700041  0.14960251  0.58680835 -0.35222292  0.82948677 -2.35553603
 [13] -1.11401969 -0.29636058 -0.50362818  0.25649846  0.07913047  0.60446303
 [19] -1.85878823  0.07698617  0.06872066  0.27159467 -1.27345958 -0.58384102
 [25]  0.10438255  1.77029874 -0.05049858  0.44338050 -1.52875612 -0.49980910
 [31]  0.18846344  1.54132115 -1.16539894 -1.52207996  1.35562369 -0.26942541
 [37]  1.71495995 -0.53391223 -1.40843286  0.59826797 -0.39350190  0.27504595
 [43] -2.35530178  0.11312895 -0.76403317  0.13797727  0.20279676 -1.03618526
 [49] -2.51660066  0.17574627  2.19069936  0.35873359  0.19262556 -0.47554475
 [55]  1.71913247 -1.14345320 -0.33665501  0.72241060  0.52519556  0.43162273
 [61] -1.31631830  2.08999299 -0.02759839  0.15207703  1.99982320  0.92129169
 [67] -1.55375697 -0.10381243 -0.15893250 -2.53524075  0.20960476 -1.47431064
 [73] -0.18132462  0.05740962 -0.16164680  0.44491291  0.77749952 -0.16314137
 [79]  0.49701076 -1.79363905 -1.01043177 -0.37087617 -0.46704665 -0.79780817
 [85] -0.44560898  0.42183462 -0.75210522 -0.74081270  0.70860234  1.20099674
 [91] -0.45560369  1.40862115  0.79506051  0.44195540 -1.34498367  0.71524494
 [97]  0.54885609 -1.25003222 -1.46233964 -0.51546401
> 
> colMeans(tmp2)
[1] -0.1400584
> colSums(tmp2)
[1] -14.00584
> colVars(tmp2)
[1] 1.014879
> colSd(tmp2)
[1] 1.007412
> colMax(tmp2)
[1] 2.190699
> colMin(tmp2)
[1] -2.535241
> colMedians(tmp2)
[1] -0.06779419
> colRanges(tmp2)
          [,1]
[1,] -2.535241
[2,]  2.190699
> 
> 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] -3.513505 -1.194881 -5.176298 -4.875840  1.086807  2.153747 -3.872894
 [8] -2.746589 -2.938789 -1.044368
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.9505438
[2,] -0.7810189
[3,] -0.4036529
[4,]  0.2671455
[5,]  0.7026233
> 
> rowApply(tmp,sum)
 [1]  0.2875155  1.4935823 -3.1935436 -1.0835202 -2.7055634 -5.0686652
 [7] -4.7415287 -3.2003013 -3.0513799 -0.8592064
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    7    1    7    9    4    5    5    7    5     1
 [2,]    2    9    6    2    2    9    6    3   10     6
 [3,]    9    2    8    3   10    3    1    4    4     2
 [4,]    8    6    9    6    1    1    3    5    6     7
 [5,]   10    8    2    1    9   10    9    9    2     5
 [6,]    4    3   10   10    6    2   10   10    8     8
 [7,]    3    4    3    7    5    8    8    2    3     3
 [8,]    6    7    4    8    7    6    7    1    1     4
 [9,]    1   10    1    5    8    4    2    6    9    10
[10,]    5    5    5    4    3    7    4    8    7     9
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.50449904  0.02154714  2.19249101  0.73161687  0.52988785 -0.96187420
 [7] -0.65825079  2.09175270  0.24310463  0.05193772  0.79315753  2.23399279
[13]  0.84036496 -1.01932512 -1.21047793 -0.61370135 -4.02948880  2.06149992
[19]  1.63316983  2.65345504
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.18707866
[2,] -0.04277978
[3,] -0.02721028
[4,]  1.12219658
[5,]  1.63937118
> 
> rowApply(tmp,sum)
[1]  6.742388  5.292731 -0.842460  2.636683 -5.739984
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   17    2   13   20   13
[2,]    8   18   12    2   10
[3,]   16    1   20   19   15
[4,]   13   14    5    9   12
[5,]    3    9   17   17    4
> 
> 
> as.matrix(tmp)
            [,1]        [,2]       [,3]        [,4]       [,5]       [,6]
[1,]  1.12219658  0.07359017  1.1134805  0.75001602 -0.8871456 -0.1290546
[2,] -2.18707866  1.77143839 -2.6553165  0.82367880  0.3167999  0.2383350
[3,] -0.02721028 -0.11689653  2.1730848 -0.73589559  0.7842892 -0.6804857
[4,]  1.63937118 -1.41907208  1.3502170 -0.04457673  1.1427715  0.2708902
[5,] -0.04277978 -0.28751281  0.2110251 -0.06160563 -0.8268271 -0.6615591
            [,7]        [,8]       [,9]      [,10]      [,11]      [,12]
[1,]  0.27896870  0.08691604  1.3862863 -0.9162569 -0.9957193  1.9488234
[2,]  0.64589604  0.91222530 -0.9630558  0.8582583  0.3511896  0.2020436
[3,] -0.32819081 -0.12657632 -0.4144765  0.3065639  0.3752702  0.7241460
[4,] -1.33577255  0.19182637  0.7752985  0.6900713 -0.3780615 -0.5375160
[5,]  0.08084783  1.02736132 -0.5409478 -0.8866988  1.4404786 -0.1035042
          [,13]      [,14]      [,15]       [,16]      [,17]      [,18]
[1,] -0.1032494  0.2583310  1.0391304 -0.08808275  0.1837682  1.2220080
[2,]  0.4125077  1.1795780 -0.3079553  0.36115350 -1.6488991  1.9012710
[3,] -0.4700437 -1.1149038  1.0787162 -0.88635048 -0.5397979 -1.2722639
[4,]  0.7385654 -0.5443065 -1.6045156  0.70023928  0.8934774 -0.4241319
[5,]  0.2625850 -0.7980239 -1.4158536 -0.70066090 -2.9180374  0.6346168
          [,19]      [,20]
[1,] -0.5391730  0.9375541
[2,]  0.1919867  2.8886749
[3,]  1.2970306 -0.8684695
[4,]  1.1558680 -0.6239597
[5,] -0.4725425  0.3196553
> 
> 
> 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 :  647  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 :  562  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 1.466655 1.058196 0.7891892 -1.046597 -1.305657 1.016037 -0.4378096
          col8       col9     col10      col11      col12     col13     col14
row1 0.4943984 -0.1083125 -1.867465 -0.9733094 -0.2688094 0.9056597 -2.151532
        col15      col16    col17   col18      col19      col20
row1 1.283068 -0.2307714 1.201195 2.31634 -0.5360529 -0.5922478
> tmp[,"col10"]
          col10
row1 -1.8674646
row2  0.9826119
row3  0.1496636
row4 -0.8288303
row5  2.5481058
> tmp[c("row1","row5"),]
         col1       col2      col3       col4      col5       col6       col7
row1 1.466655  1.0581959 0.7891892 -1.0465972 -1.305657  1.0160370 -0.4378096
row5 2.138728 -0.1616091 1.0090244 -0.9719937 -2.582789 -0.7541689  0.3706998
          col8       col9     col10      col11      col12      col13
row1 0.4943984 -0.1083125 -1.867465 -0.9733094 -0.2688094  0.9056597
row5 1.9804609 -2.4568027  2.548106 -0.3503384  1.3702032 -0.4997650
           col14       col15      col16     col17      col18      col19
row1 -2.15153231 1.283067717 -0.2307714  1.201195  2.3163401 -0.5360529
row5 -0.07504611 0.006050957 -0.5114903 -1.335314 -0.6777244 -0.2232351
          col20
row1 -0.5922478
row5  0.3255497
> tmp[,c("col6","col20")]
           col6       col20
row1  1.0160370 -0.59224778
row2  0.1066467 -0.07322409
row3 -0.5436568 -1.17252433
row4 -0.2355820  1.33279875
row5 -0.7541689  0.32554975
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  1.0160370 -0.5922478
row5 -0.7541689  0.3255497
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5    col6    col7     col8
row1 50.59226 48.86603 49.95349 51.22642 49.74786 106.273 50.6387 49.87816
         col9    col10   col11    col12    col13    col14   col15    col16
row1 50.68181 47.34531 50.4346 48.75779 50.04559 49.97548 50.6908 50.79615
        col17    col18    col19    col20
row1 51.63785 49.70516 49.53023 103.7586
> tmp[,"col10"]
        col10
row1 47.34531
row2 29.56657
row3 28.62252
row4 28.02495
row5 48.77087
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.59226 48.86603 49.95349 51.22642 49.74786 106.2730 50.63870 49.87816
row5 50.48151 49.29570 50.34649 51.96696 50.28188 104.0513 49.15128 48.61641
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.68181 47.34531 50.43460 48.75779 50.04559 49.97548 50.69080 50.79615
row5 47.06994 48.77087 51.03656 49.56029 49.13768 49.82315 49.16841 51.04107
        col17    col18    col19    col20
row1 51.63785 49.70516 49.53023 103.7586
row5 50.92924 47.98652 49.96584 104.6536
> tmp[,c("col6","col20")]
          col6     col20
row1 106.27297 103.75860
row2  75.32637  75.00873
row3  74.16859  75.19736
row4  75.31606  74.58170
row5 104.05131 104.65364
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.2730 103.7586
row5 104.0513 104.6536
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.2730 103.7586
row5 104.0513 104.6536
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.6079828
[2,] -0.4682212
[3,]  0.2004389
[4,] -0.5438641
[5,]  1.0303381
> tmp[,c("col17","col7")]
           col17         col7
[1,] -0.11160963  0.453489243
[2,] -1.16999262 -1.882149762
[3,] -0.44265770 -0.732149027
[4,] -0.02238686  0.003666635
[5,] -0.86272821  0.436462965
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
          col6       col20
[1,] 0.8374633 -1.60997161
[2,] 0.4357901 -0.79028327
[3,] 0.1965482  1.07325368
[4,] 0.7555705  0.30824317
[5,] 1.0514375 -0.06359407
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.8374633
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.8374633
[2,] 0.4357901
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]       [,3]      [,4]        [,5]      [,6]      [,7]
row3 0.1909827 -0.2653792 2.81421499 1.0097180  0.51136791 -1.627291 0.6575945
row1 0.3329370  1.6475500 0.06500692 0.4435872 -0.02508171 -1.552179 1.2199965
           [,8]      [,9]     [,10]      [,11]      [,12]     [,13]      [,14]
row3 0.01743517 0.9381232  1.552542 -1.3138193 -0.7908346 0.6182120 -1.2970723
row1 1.05234173 0.4918493 -2.266995  0.2868645  0.9007936 0.3131449  0.1173005
          [,15]      [,16]      [,17]      [,18]      [,19]      [,20]
row3  0.9260780 -0.2754361 -0.4617465 -0.0825108  0.2807765 -0.2852588
row1 -0.6072834 -0.3761158  0.1566137 -0.8995844 -0.1737898  1.2788078
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]     [,2]      [,3]      [,4]      [,5]     [,6]      [,7]
row2 -1.12444 0.152198 -1.045417 0.2252173 -1.223223 1.102816 0.9421336
            [,8]       [,9]     [,10]
row2 -0.01547206 -0.3772614 -1.034301
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]       [,3]      [,4]     [,5]      [,6]       [,7]
row5 -1.465499 1.161777 0.08195542 -1.093472 1.298106 0.1358506 0.04360441
           [,8]      [,9]     [,10]     [,11]       [,12]   [,13]       [,14]
row5 -0.5019657 -2.260265 0.9245897 0.4804224 -0.02542874 0.63713 -0.01481584
          [,15]     [,16]     [,17]     [,18]        [,19]      [,20]
row5 -0.1496718 -1.244054 -0.830024 0.2104951 -0.008567419 -0.2943188
> 
> 
> 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: 0x628a4f8bfba0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd2282cc49f4b"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd2281b592d67"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd2284fab06c" 
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd228568404b2"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd22854c0e251"
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd228730d1a5b"
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd2283e1b28ca"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd22875e4379c"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd22831988a14"
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd228168cede7"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd2283dba7d9f"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd22819e32cd1"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd228c781290" 
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd22868244c00"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMcd22853b4431d"
> 
> 
> ### 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: 0x628a516016f0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x628a516016f0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x628a516016f0>
> rowMedians(tmp)
  [1] -0.338411009 -0.098101604  0.069875604  0.330404908 -0.235720212
  [6]  0.009252994  0.052457006  0.024250123  0.382110506  0.514741099
 [11]  0.233054021  0.201429672  0.116806676 -0.061358714  0.404526745
 [16]  0.158118728 -0.038714295  0.089190523 -0.352241511  0.410951147
 [21]  0.177834863 -0.513439324  0.493394108  0.232449120 -0.303242373
 [26]  0.635992303  0.506524689  0.282040290  0.231370890  0.002836806
 [31] -0.637407621  0.425748033  0.276183615  0.056724464  0.549742392
 [36]  0.008368447 -0.427381929 -0.635740551  0.488643598  0.068869339
 [41]  0.069006777  0.175930752  0.093391449  0.464139973  0.495779507
 [46] -0.275838075 -0.118035903 -0.160827307  0.151713742 -0.065689743
 [51] -0.459890609 -0.340080426  0.312318991  0.050258326 -0.222761923
 [56]  0.263945099  0.143796337  0.294017427  0.248722969  0.123845568
 [61]  0.032163853  0.084815740 -0.126200039 -0.230889151  0.362354393
 [66] -0.266350463  0.141634527 -0.280839871  0.044995246  0.220868816
 [71]  0.173985725  0.176722751 -0.218794559  0.001903444  0.820684785
 [76]  0.526495516  0.050823656  0.316316888  0.512646170 -0.155780051
 [81]  0.278264625  0.529590846 -0.455355905 -0.029472185 -0.361280257
 [86] -0.490104413  0.007738300  0.241151422  0.152122254  0.498802645
 [91]  0.090041221  0.165139091  0.212093160  0.339629435 -0.090520692
 [96]  0.347042412 -0.258523370  0.045403123  0.267622032  0.037056108
[101] -0.090850617  0.098926359 -0.089926964  0.047945389 -0.114873941
[106] -0.219752764  0.049673269  0.606853541  0.228887531  0.062263415
[111] -0.002158011  0.015741654 -0.315281860  0.171006125  0.230650047
[116] -0.338570664  0.303076190 -0.037742888 -0.392420441  0.261963415
[121]  0.331303253  0.675927097 -0.119078027  0.057314743 -0.194741706
[126] -0.136400287 -0.125747122 -0.445205345 -0.268611232  0.649779131
[131] -0.527975617 -0.442936733 -0.029281791 -0.074664523  0.042007934
[136]  0.558152304 -0.363134718 -0.007748098 -0.010991920  0.783852399
[141] -0.231246091  0.035273219  0.172811649 -0.017872778 -0.367203477
[146] -0.077842065 -0.298830832 -0.189097077 -0.297614344 -0.419997833
[151]  0.704742057 -0.412872785 -0.003764499 -0.461273364  0.098439654
[156]  0.238302647  0.533228411  0.065712281  0.340956516 -0.146377279
[161] -0.026747835  0.174146044 -0.227174214  0.224919336  0.093858685
[166]  0.069326037 -0.125747063  0.575690528  0.099286587  0.070487713
[171]  0.443890013  0.118315723 -0.449023913  0.107395016 -0.056716939
[176] -0.234399357 -0.433128972 -0.178834581 -0.333390663 -0.244796747
[181] -0.041192913  0.730607948  0.356647033  0.244373116 -0.874849493
[186]  0.275905919 -0.127827209  0.116649571 -0.294381445  0.221960416
[191] -0.354267058  0.325628960 -0.039124335  0.309920140  0.109777617
[196]  0.363634871 -0.128300112  0.155395481  0.144474331  0.149746375
[201] -0.077738274 -0.119386077 -0.763491204 -0.575795929 -0.423856127
[206] -0.009299405 -0.006539365  0.506862174 -0.240758471  0.018673983
[211] -0.626457075  0.553979080  0.269593375 -0.578614328  0.209249588
[216]  0.049852033  0.493260468  0.001791141  0.089902584 -0.284259418
[221] -0.386787887 -0.206118797  0.040412883 -0.102012322 -0.079954542
[226] -0.162801101 -0.614187843  0.098520640  0.478202202 -0.075175756
> 
> proc.time()
   user  system elapsed 
  1.268   0.658   1.912 

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: 0x613c759831c0>
> .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: 0x613c759831c0>
> .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: 0x613c759831c0>
> .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: 0x613c759831c0>
> 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: 0x613c75c66120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x613c75c66120>
> .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: 0x613c75c66120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x613c75c66120>
> .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: 0x613c75c66120>
> 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: 0x613c7491a4a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x613c7491a4a0>
> .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: 0x613c7491a4a0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x613c7491a4a0>
> .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: 0x613c7491a4a0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x613c7491a4a0>
> .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: 0x613c7491a4a0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x613c7491a4a0>
> .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: 0x613c7491a4a0>
> 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: 0x613c749b6390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x613c749b6390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x613c749b6390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x613c749b6390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilecd2cc110ed402" "BufferedMatrixFilecd2cc67a84ab5"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilecd2cc110ed402" "BufferedMatrixFilecd2cc67a84ab5"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x613c75235650>
> .Call("R_bm_AddColumn",P)
<pointer: 0x613c75235650>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x613c75235650>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x613c75235650>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x613c75235650>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x613c75235650>
> .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: 0x613c763bc430>
> .Call("R_bm_AddColumn",P)
<pointer: 0x613c763bc430>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x613c763bc430>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x613c763bc430>
> 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: 0x613c766b1250>
> .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: 0x613c766b1250>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.246   0.043   0.277 

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.261   0.045   0.294 

Example timings