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

This page was generated on 2026-03-18 11:57 -0400 (Wed, 18 Mar 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4892
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-03-17 13:45 -0400 (Tue, 17 Mar 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 -0400 (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-03-17 21:36:40 -0400 (Tue, 17 Mar 2026)
EndedAt: 2026-03-17 21:37:04 -0400 (Tue, 17 Mar 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.243   0.041   0.273 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478284 25.6    1046725   56   639600 34.2
Vcells 884773  6.8    8388608   64  2081613 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Mar 17 21:36:55 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Mar 17 21:36:55 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: 0x5b96fa67a1c0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Mar 17 21:36:55 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Mar 17 21:36:55 2026"
> 
> ColMode(tmp2)
<pointer: 0x5b96fa67a1c0>
> 
> 
> 
> ### 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.9258338 -1.044465  1.7217850 -0.5735839
[2,] -0.8251591 -0.203069  0.4125262  0.4278338
[3,]  0.5881727  1.467345  0.2795536  0.3490375
[4,] -0.5649499  0.889680 -0.6444169  1.2554536
> 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.9258338 1.044465 1.7217850 0.5735839
[2,]  0.8251591 0.203069 0.4125262 0.4278338
[3,]  0.5881727 1.467345 0.2795536 0.3490375
[4,]  0.5649499 0.889680 0.6444169 1.2554536
> 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.9962910 1.0219907 1.3121681 0.7573532
[2,] 0.9083827 0.4506318 0.6422820 0.6540900
[3,] 0.7669242 1.2113402 0.5287283 0.5907940
[4,] 0.7516315 0.9432285 0.8027558 1.1204703
> 
> 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,] 224.88874 36.26437 39.84347 33.14712
[2,]  34.90899 29.70939 31.83535 31.96873
[3,]  33.25741 38.58075 30.56684 31.25698
[4,]  33.08127 35.32197 33.67197 37.46016
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5b96fb2808b0>
> exp(tmp5)
<pointer: 0x5b96fb2808b0>
> log(tmp5,2)
<pointer: 0x5b96fb2808b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 468.0765
> Min(tmp5)
[1] 52.85481
> mean(tmp5)
[1] 72.85561
> Sum(tmp5)
[1] 14571.12
> Var(tmp5)
[1] 852.9234
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.81207 68.13673 72.48620 68.89819 70.30573 69.86615 70.07555 71.67918
 [9] 73.30811 72.98822
> rowSums(tmp5)
 [1] 1816.241 1362.735 1449.724 1377.964 1406.115 1397.323 1401.511 1433.584
 [9] 1466.162 1459.764
> rowVars(tmp5)
 [1] 7933.64459   66.63739   51.86999   36.70508   69.81754   76.56219
 [7]   59.81572   68.50684   78.00697   86.13266
> rowSd(tmp5)
 [1] 89.071009  8.163173  7.202082  6.058472  8.355689  8.749983  7.734062
 [8]  8.276886  8.832155  9.280768
> rowMax(tmp5)
 [1] 468.07646  84.56952  84.95164  80.19909  83.30385  86.39625  87.19775
 [8]  84.20807  84.00099  88.97678
> rowMin(tmp5)
 [1] 59.04846 55.98801 57.47619 52.85481 58.13523 53.56408 57.75234 54.95612
 [9] 53.81502 53.88614
> 
> colMeans(tmp5)
 [1] 112.33895  72.22289  69.77881  70.37123  71.43304  68.28187  67.28555
 [8]  69.53934  74.60648  72.09987  70.93312  68.81418  77.39431  68.61867
[15]  70.14186  67.39814  68.26291  72.81735  73.32515  71.44857
> colSums(tmp5)
 [1] 1123.3895  722.2289  697.7881  703.7123  714.3304  682.8187  672.8555
 [8]  695.3934  746.0648  720.9987  709.3312  688.1418  773.9431  686.1867
[15]  701.4186  673.9814  682.6291  728.1735  733.2515  714.4857
> colVars(tmp5)
 [1] 15662.26712    98.58026    27.12928    66.86917    22.14723   124.13338
 [7]    38.92332    90.65842    71.73184    44.07149    92.96714    62.22316
[13]    26.94544   106.22053    45.46872    41.29442    27.76156    91.02866
[19]   133.09794    27.12054
> colSd(tmp5)
 [1] 125.148980   9.928759   5.208578   8.177357   4.706084  11.141516
 [7]   6.238856   9.521472   8.469465   6.638636   9.641947   7.888166
[13]   5.190899  10.306334   6.743050   6.426074   5.268924   9.540894
[19]  11.536808   5.207738
> colMax(tmp5)
 [1] 468.07646  84.00099  82.92895  80.62534  81.13764  82.06522  81.81989
 [8]  86.39625  84.95164  82.06606  84.97189  82.65430  87.19775  83.94856
[15]  82.18885  74.76817  76.77633  86.40791  88.97678  79.94265
> colMin(tmp5)
 [1] 60.73410 57.75234 63.62086 53.81502 65.39475 53.88614 61.49350 54.95612
 [9] 55.98801 59.67385 53.56408 58.83743 68.65184 52.85481 59.43299 56.79209
[17] 60.15713 59.99617 58.64282 64.31663
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 90.81207 68.13673 72.48620 68.89819 70.30573 69.86615 70.07555       NA
 [9] 73.30811 72.98822
> rowSums(tmp5)
 [1] 1816.241 1362.735 1449.724 1377.964 1406.115 1397.323 1401.511       NA
 [9] 1466.162 1459.764
> rowVars(tmp5)
 [1] 7933.64459   66.63739   51.86999   36.70508   69.81754   76.56219
 [7]   59.81572   71.34128   78.00697   86.13266
> rowSd(tmp5)
 [1] 89.071009  8.163173  7.202082  6.058472  8.355689  8.749983  7.734062
 [8]  8.446377  8.832155  9.280768
> rowMax(tmp5)
 [1] 468.07646  84.56952  84.95164  80.19909  83.30385  86.39625  87.19775
 [8]        NA  84.00099  88.97678
> rowMin(tmp5)
 [1] 59.04846 55.98801 57.47619 52.85481 58.13523 53.56408 57.75234       NA
 [9] 53.81502 53.88614
> 
> colMeans(tmp5)
 [1] 112.33895  72.22289  69.77881  70.37123  71.43304  68.28187  67.28555
 [8]  69.53934  74.60648  72.09987  70.93312        NA  77.39431  68.61867
[15]  70.14186  67.39814  68.26291  72.81735  73.32515  71.44857
> colSums(tmp5)
 [1] 1123.3895  722.2289  697.7881  703.7123  714.3304  682.8187  672.8555
 [8]  695.3934  746.0648  720.9987  709.3312        NA  773.9431  686.1867
[15]  701.4186  673.9814  682.6291  728.1735  733.2515  714.4857
> colVars(tmp5)
 [1] 15662.26712    98.58026    27.12928    66.86917    22.14723   124.13338
 [7]    38.92332    90.65842    71.73184    44.07149    92.96714          NA
[13]    26.94544   106.22053    45.46872    41.29442    27.76156    91.02866
[19]   133.09794    27.12054
> colSd(tmp5)
 [1] 125.148980   9.928759   5.208578   8.177357   4.706084  11.141516
 [7]   6.238856   9.521472   8.469465   6.638636   9.641947         NA
[13]   5.190899  10.306334   6.743050   6.426074   5.268924   9.540894
[19]  11.536808   5.207738
> colMax(tmp5)
 [1] 468.07646  84.00099  82.92895  80.62534  81.13764  82.06522  81.81989
 [8]  86.39625  84.95164  82.06606  84.97189        NA  87.19775  83.94856
[15]  82.18885  74.76817  76.77633  86.40791  88.97678  79.94265
> colMin(tmp5)
 [1] 60.73410 57.75234 63.62086 53.81502 65.39475 53.88614 61.49350 54.95612
 [9] 55.98801 59.67385 53.56408       NA 68.65184 52.85481 59.43299 56.79209
[17] 60.15713 59.99617 58.64282 64.31663
> 
> Max(tmp5,na.rm=TRUE)
[1] 468.0765
> Min(tmp5,na.rm=TRUE)
[1] 52.85481
> mean(tmp5,na.rm=TRUE)
[1] 72.84104
> Sum(tmp5,na.rm=TRUE)
[1] 14495.37
> Var(tmp5,na.rm=TRUE)
[1] 857.1884
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.81207 68.13673 72.48620 68.89819 70.30573 69.86615 70.07555 71.46466
 [9] 73.30811 72.98822
> rowSums(tmp5,na.rm=TRUE)
 [1] 1816.241 1362.735 1449.724 1377.964 1406.115 1397.323 1401.511 1357.829
 [9] 1466.162 1459.764
> rowVars(tmp5,na.rm=TRUE)
 [1] 7933.64459   66.63739   51.86999   36.70508   69.81754   76.56219
 [7]   59.81572   71.34128   78.00697   86.13266
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.071009  8.163173  7.202082  6.058472  8.355689  8.749983  7.734062
 [8]  8.446377  8.832155  9.280768
> rowMax(tmp5,na.rm=TRUE)
 [1] 468.07646  84.56952  84.95164  80.19909  83.30385  86.39625  87.19775
 [8]  84.20807  84.00099  88.97678
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.04846 55.98801 57.47619 52.85481 58.13523 53.56408 57.75234 54.95612
 [9] 53.81502 53.88614
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.33895  72.22289  69.77881  70.37123  71.43304  68.28187  67.28555
 [8]  69.53934  74.60648  72.09987  70.93312  68.04297  77.39431  68.61867
[15]  70.14186  67.39814  68.26291  72.81735  73.32515  71.44857
> colSums(tmp5,na.rm=TRUE)
 [1] 1123.3895  722.2289  697.7881  703.7123  714.3304  682.8187  672.8555
 [8]  695.3934  746.0648  720.9987  709.3312  612.3868  773.9431  686.1867
[15]  701.4186  673.9814  682.6291  728.1735  733.2515  714.4857
> colVars(tmp5,na.rm=TRUE)
 [1] 15662.26712    98.58026    27.12928    66.86917    22.14723   124.13338
 [7]    38.92332    90.65842    71.73184    44.07149    92.96714    63.31002
[13]    26.94544   106.22053    45.46872    41.29442    27.76156    91.02866
[19]   133.09794    27.12054
> colSd(tmp5,na.rm=TRUE)
 [1] 125.148980   9.928759   5.208578   8.177357   4.706084  11.141516
 [7]   6.238856   9.521472   8.469465   6.638636   9.641947   7.956759
[13]   5.190899  10.306334   6.743050   6.426074   5.268924   9.540894
[19]  11.536808   5.207738
> colMax(tmp5,na.rm=TRUE)
 [1] 468.07646  84.00099  82.92895  80.62534  81.13764  82.06522  81.81989
 [8]  86.39625  84.95164  82.06606  84.97189  82.65430  87.19775  83.94856
[15]  82.18885  74.76817  76.77633  86.40791  88.97678  79.94265
> colMin(tmp5,na.rm=TRUE)
 [1] 60.73410 57.75234 63.62086 53.81502 65.39475 53.88614 61.49350 54.95612
 [9] 55.98801 59.67385 53.56408 58.83743 68.65184 52.85481 59.43299 56.79209
[17] 60.15713 59.99617 58.64282 64.31663
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.81207 68.13673 72.48620 68.89819 70.30573 69.86615 70.07555      NaN
 [9] 73.30811 72.98822
> rowSums(tmp5,na.rm=TRUE)
 [1] 1816.241 1362.735 1449.724 1377.964 1406.115 1397.323 1401.511    0.000
 [9] 1466.162 1459.764
> rowVars(tmp5,na.rm=TRUE)
 [1] 7933.64459   66.63739   51.86999   36.70508   69.81754   76.56219
 [7]   59.81572         NA   78.00697   86.13266
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.071009  8.163173  7.202082  6.058472  8.355689  8.749983  7.734062
 [8]        NA  8.832155  9.280768
> rowMax(tmp5,na.rm=TRUE)
 [1] 468.07646  84.56952  84.95164  80.19909  83.30385  86.39625  87.19775
 [8]        NA  84.00099  88.97678
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.04846 55.98801 57.47619 52.85481 58.13523 53.56408 57.75234       NA
 [9] 53.81502 53.88614
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.61789  71.49625  70.18726  70.84996  71.56333  69.51024  67.50196
 [8]  71.15969  74.11929  70.99251  70.52324       NaN  77.91626  69.33335
[15]  68.80331  66.64789  68.82541  71.55171  73.17004  70.91401
> colSums(tmp5,na.rm=TRUE)
 [1] 1049.5610  643.4662  631.6853  637.6497  644.0700  625.5921  607.5176
 [8]  640.4372  667.0736  638.9326  634.7091    0.0000  701.2463  624.0002
[15]  619.2297  599.8311  619.4287  643.9654  658.5303  638.2261
> colVars(tmp5,na.rm=TRUE)
 [1] 17414.07055   104.96269    28.64363    72.64947    24.72465   122.67501
 [7]    43.26189    72.45320    78.02803    35.78528   102.69803          NA
[13]    27.24883   113.75191    30.99535    40.12404    27.67218    84.38661
[19]   149.46452    27.29590
> colSd(tmp5,na.rm=TRUE)
 [1] 131.962383  10.245130   5.351974   8.523466   4.972389  11.075875
 [7]   6.577377   8.511945   8.833348   5.982080  10.134004         NA
[13]   5.220041  10.665454   5.567347   6.334354   5.260435   9.186218
[19]  12.225568   5.224548
> colMax(tmp5,na.rm=TRUE)
 [1] 468.07646  84.00099  82.92895  80.62534  81.13764  82.06522  81.81989
 [8]  86.39625  84.95164  81.64082  84.97189      -Inf  87.19775  83.94856
[15]  73.31805  74.76817  76.77633  86.40791  88.97678  79.94265
> colMin(tmp5,na.rm=TRUE)
 [1] 60.73410 57.75234 63.62086 53.81502 65.39475 53.88614 61.49350 59.21255
 [9] 55.98801 59.67385 53.56408      Inf 68.65184 52.85481 59.43299 56.79209
[17] 60.15713 59.99617 58.64282 64.31663
> 
> 
> 
> 
> 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] 235.76764 219.02663 385.73181  87.69418 359.05484 214.88748 147.67194
 [8] 240.80325 351.94936 313.47682
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 235.76764 219.02663 385.73181  87.69418 359.05484 214.88748 147.67194
 [8] 240.80325 351.94936 313.47682
> 
> 
> 
> 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]  1.421085e-13 -1.136868e-13 -2.842171e-13 -5.684342e-14 -2.842171e-14
 [6]  5.684342e-14  1.705303e-13 -1.421085e-13  0.000000e+00 -2.842171e-14
[11]  5.684342e-14 -6.394885e-14 -1.136868e-13 -2.842171e-14 -1.421085e-13
[16] -2.842171e-14 -1.421085e-13  2.842171e-14 -5.684342e-14  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
4   19 
10   20 
2   9 
2   3 
2   8 
5   20 
2   13 
4   9 
2   3 
4   5 
10   1 
4   7 
2   1 
7   14 
2   5 
2   13 
3   4 
8   4 
10   4 
5   1 
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] 1.996647
> Min(tmp)
[1] -2.448433
> mean(tmp)
[1] -0.0312911
> Sum(tmp)
[1] -3.12911
> Var(tmp)
[1] 0.994264
> 
> rowMeans(tmp)
[1] -0.0312911
> rowSums(tmp)
[1] -3.12911
> rowVars(tmp)
[1] 0.994264
> rowSd(tmp)
[1] 0.9971279
> rowMax(tmp)
[1] 1.996647
> rowMin(tmp)
[1] -2.448433
> 
> colMeans(tmp)
  [1] -0.550907192 -1.619054213 -0.019224435  0.045237736  0.340400733
  [6] -0.361239968 -0.994122012  1.035560785  0.806726854 -0.891873815
 [11]  0.925867775  0.641752126 -0.816091801 -0.293813470 -1.669409430
 [16]  1.661747586 -0.153886866  1.225066493 -0.512707146 -0.754056844
 [21] -0.234496988  1.017201291  0.907118940 -2.448432641 -0.402726811
 [26]  0.524314663  0.075299855 -2.184062757 -1.072036709  0.640031426
 [31] -0.581110266  1.847208307  1.307400422  0.391438420  1.243815083
 [36] -0.380463691  0.224782080  0.880512860  0.817569134  1.271660069
 [41] -2.133755992 -0.766600363  0.185641786 -1.493734481 -1.141858783
 [46]  0.452491653  0.754224994  1.456677705 -0.262754075 -0.467602752
 [51] -1.691810619 -1.152657695 -0.036750188 -0.750646687  0.008238349
 [56]  0.595108431 -1.200133709  0.163927754  0.568268868 -0.347036837
 [61] -1.067545586  0.100795488  1.065583491 -0.288286442  1.854175144
 [66]  0.256019684 -1.184765329  0.228656429 -0.354616571 -1.044005242
 [71]  1.996646874 -0.863141632  1.655639200  0.984944040 -1.093021366
 [76] -0.248466594 -0.272669886 -0.508394253  0.236054134  0.074693861
 [81]  1.807213516  0.047351688  1.239542811 -0.530228315  1.067855020
 [86] -1.909471539 -0.125268042 -0.553767195  1.862364663 -0.398502655
 [91]  0.379522020 -0.159264498  0.420055510 -0.865591342 -1.910190318
 [96] -0.274110063  0.674157110 -0.230885871 -0.153919191  0.325498054
> colSums(tmp)
  [1] -0.550907192 -1.619054213 -0.019224435  0.045237736  0.340400733
  [6] -0.361239968 -0.994122012  1.035560785  0.806726854 -0.891873815
 [11]  0.925867775  0.641752126 -0.816091801 -0.293813470 -1.669409430
 [16]  1.661747586 -0.153886866  1.225066493 -0.512707146 -0.754056844
 [21] -0.234496988  1.017201291  0.907118940 -2.448432641 -0.402726811
 [26]  0.524314663  0.075299855 -2.184062757 -1.072036709  0.640031426
 [31] -0.581110266  1.847208307  1.307400422  0.391438420  1.243815083
 [36] -0.380463691  0.224782080  0.880512860  0.817569134  1.271660069
 [41] -2.133755992 -0.766600363  0.185641786 -1.493734481 -1.141858783
 [46]  0.452491653  0.754224994  1.456677705 -0.262754075 -0.467602752
 [51] -1.691810619 -1.152657695 -0.036750188 -0.750646687  0.008238349
 [56]  0.595108431 -1.200133709  0.163927754  0.568268868 -0.347036837
 [61] -1.067545586  0.100795488  1.065583491 -0.288286442  1.854175144
 [66]  0.256019684 -1.184765329  0.228656429 -0.354616571 -1.044005242
 [71]  1.996646874 -0.863141632  1.655639200  0.984944040 -1.093021366
 [76] -0.248466594 -0.272669886 -0.508394253  0.236054134  0.074693861
 [81]  1.807213516  0.047351688  1.239542811 -0.530228315  1.067855020
 [86] -1.909471539 -0.125268042 -0.553767195  1.862364663 -0.398502655
 [91]  0.379522020 -0.159264498  0.420055510 -0.865591342 -1.910190318
 [96] -0.274110063  0.674157110 -0.230885871 -0.153919191  0.325498054
> 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.550907192 -1.619054213 -0.019224435  0.045237736  0.340400733
  [6] -0.361239968 -0.994122012  1.035560785  0.806726854 -0.891873815
 [11]  0.925867775  0.641752126 -0.816091801 -0.293813470 -1.669409430
 [16]  1.661747586 -0.153886866  1.225066493 -0.512707146 -0.754056844
 [21] -0.234496988  1.017201291  0.907118940 -2.448432641 -0.402726811
 [26]  0.524314663  0.075299855 -2.184062757 -1.072036709  0.640031426
 [31] -0.581110266  1.847208307  1.307400422  0.391438420  1.243815083
 [36] -0.380463691  0.224782080  0.880512860  0.817569134  1.271660069
 [41] -2.133755992 -0.766600363  0.185641786 -1.493734481 -1.141858783
 [46]  0.452491653  0.754224994  1.456677705 -0.262754075 -0.467602752
 [51] -1.691810619 -1.152657695 -0.036750188 -0.750646687  0.008238349
 [56]  0.595108431 -1.200133709  0.163927754  0.568268868 -0.347036837
 [61] -1.067545586  0.100795488  1.065583491 -0.288286442  1.854175144
 [66]  0.256019684 -1.184765329  0.228656429 -0.354616571 -1.044005242
 [71]  1.996646874 -0.863141632  1.655639200  0.984944040 -1.093021366
 [76] -0.248466594 -0.272669886 -0.508394253  0.236054134  0.074693861
 [81]  1.807213516  0.047351688  1.239542811 -0.530228315  1.067855020
 [86] -1.909471539 -0.125268042 -0.553767195  1.862364663 -0.398502655
 [91]  0.379522020 -0.159264498  0.420055510 -0.865591342 -1.910190318
 [96] -0.274110063  0.674157110 -0.230885871 -0.153919191  0.325498054
> colMin(tmp)
  [1] -0.550907192 -1.619054213 -0.019224435  0.045237736  0.340400733
  [6] -0.361239968 -0.994122012  1.035560785  0.806726854 -0.891873815
 [11]  0.925867775  0.641752126 -0.816091801 -0.293813470 -1.669409430
 [16]  1.661747586 -0.153886866  1.225066493 -0.512707146 -0.754056844
 [21] -0.234496988  1.017201291  0.907118940 -2.448432641 -0.402726811
 [26]  0.524314663  0.075299855 -2.184062757 -1.072036709  0.640031426
 [31] -0.581110266  1.847208307  1.307400422  0.391438420  1.243815083
 [36] -0.380463691  0.224782080  0.880512860  0.817569134  1.271660069
 [41] -2.133755992 -0.766600363  0.185641786 -1.493734481 -1.141858783
 [46]  0.452491653  0.754224994  1.456677705 -0.262754075 -0.467602752
 [51] -1.691810619 -1.152657695 -0.036750188 -0.750646687  0.008238349
 [56]  0.595108431 -1.200133709  0.163927754  0.568268868 -0.347036837
 [61] -1.067545586  0.100795488  1.065583491 -0.288286442  1.854175144
 [66]  0.256019684 -1.184765329  0.228656429 -0.354616571 -1.044005242
 [71]  1.996646874 -0.863141632  1.655639200  0.984944040 -1.093021366
 [76] -0.248466594 -0.272669886 -0.508394253  0.236054134  0.074693861
 [81]  1.807213516  0.047351688  1.239542811 -0.530228315  1.067855020
 [86] -1.909471539 -0.125268042 -0.553767195  1.862364663 -0.398502655
 [91]  0.379522020 -0.159264498  0.420055510 -0.865591342 -1.910190318
 [96] -0.274110063  0.674157110 -0.230885871 -0.153919191  0.325498054
> colMedians(tmp)
  [1] -0.550907192 -1.619054213 -0.019224435  0.045237736  0.340400733
  [6] -0.361239968 -0.994122012  1.035560785  0.806726854 -0.891873815
 [11]  0.925867775  0.641752126 -0.816091801 -0.293813470 -1.669409430
 [16]  1.661747586 -0.153886866  1.225066493 -0.512707146 -0.754056844
 [21] -0.234496988  1.017201291  0.907118940 -2.448432641 -0.402726811
 [26]  0.524314663  0.075299855 -2.184062757 -1.072036709  0.640031426
 [31] -0.581110266  1.847208307  1.307400422  0.391438420  1.243815083
 [36] -0.380463691  0.224782080  0.880512860  0.817569134  1.271660069
 [41] -2.133755992 -0.766600363  0.185641786 -1.493734481 -1.141858783
 [46]  0.452491653  0.754224994  1.456677705 -0.262754075 -0.467602752
 [51] -1.691810619 -1.152657695 -0.036750188 -0.750646687  0.008238349
 [56]  0.595108431 -1.200133709  0.163927754  0.568268868 -0.347036837
 [61] -1.067545586  0.100795488  1.065583491 -0.288286442  1.854175144
 [66]  0.256019684 -1.184765329  0.228656429 -0.354616571 -1.044005242
 [71]  1.996646874 -0.863141632  1.655639200  0.984944040 -1.093021366
 [76] -0.248466594 -0.272669886 -0.508394253  0.236054134  0.074693861
 [81]  1.807213516  0.047351688  1.239542811 -0.530228315  1.067855020
 [86] -1.909471539 -0.125268042 -0.553767195  1.862364663 -0.398502655
 [91]  0.379522020 -0.159264498  0.420055510 -0.865591342 -1.910190318
 [96] -0.274110063  0.674157110 -0.230885871 -0.153919191  0.325498054
> colRanges(tmp)
           [,1]      [,2]        [,3]       [,4]      [,5]     [,6]      [,7]
[1,] -0.5509072 -1.619054 -0.01922444 0.04523774 0.3404007 -0.36124 -0.994122
[2,] -0.5509072 -1.619054 -0.01922444 0.04523774 0.3404007 -0.36124 -0.994122
         [,8]      [,9]      [,10]     [,11]     [,12]      [,13]      [,14]
[1,] 1.035561 0.8067269 -0.8918738 0.9258678 0.6417521 -0.8160918 -0.2938135
[2,] 1.035561 0.8067269 -0.8918738 0.9258678 0.6417521 -0.8160918 -0.2938135
         [,15]    [,16]      [,17]    [,18]      [,19]      [,20]     [,21]
[1,] -1.669409 1.661748 -0.1538869 1.225066 -0.5127071 -0.7540568 -0.234497
[2,] -1.669409 1.661748 -0.1538869 1.225066 -0.5127071 -0.7540568 -0.234497
        [,22]     [,23]     [,24]      [,25]     [,26]      [,27]     [,28]
[1,] 1.017201 0.9071189 -2.448433 -0.4027268 0.5243147 0.07529986 -2.184063
[2,] 1.017201 0.9071189 -2.448433 -0.4027268 0.5243147 0.07529986 -2.184063
         [,29]     [,30]      [,31]    [,32]  [,33]     [,34]    [,35]
[1,] -1.072037 0.6400314 -0.5811103 1.847208 1.3074 0.3914384 1.243815
[2,] -1.072037 0.6400314 -0.5811103 1.847208 1.3074 0.3914384 1.243815
          [,36]     [,37]     [,38]     [,39]   [,40]     [,41]      [,42]
[1,] -0.3804637 0.2247821 0.8805129 0.8175691 1.27166 -2.133756 -0.7666004
[2,] -0.3804637 0.2247821 0.8805129 0.8175691 1.27166 -2.133756 -0.7666004
         [,43]     [,44]     [,45]     [,46]    [,47]    [,48]      [,49]
[1,] 0.1856418 -1.493734 -1.141859 0.4524917 0.754225 1.456678 -0.2627541
[2,] 0.1856418 -1.493734 -1.141859 0.4524917 0.754225 1.456678 -0.2627541
          [,50]     [,51]     [,52]       [,53]      [,54]       [,55]
[1,] -0.4676028 -1.691811 -1.152658 -0.03675019 -0.7506467 0.008238349
[2,] -0.4676028 -1.691811 -1.152658 -0.03675019 -0.7506467 0.008238349
         [,56]     [,57]     [,58]     [,59]      [,60]     [,61]     [,62]
[1,] 0.5951084 -1.200134 0.1639278 0.5682689 -0.3470368 -1.067546 0.1007955
[2,] 0.5951084 -1.200134 0.1639278 0.5682689 -0.3470368 -1.067546 0.1007955
        [,63]      [,64]    [,65]     [,66]     [,67]     [,68]      [,69]
[1,] 1.065583 -0.2882864 1.854175 0.2560197 -1.184765 0.2286564 -0.3546166
[2,] 1.065583 -0.2882864 1.854175 0.2560197 -1.184765 0.2286564 -0.3546166
         [,70]    [,71]      [,72]    [,73]    [,74]     [,75]      [,76]
[1,] -1.044005 1.996647 -0.8631416 1.655639 0.984944 -1.093021 -0.2484666
[2,] -1.044005 1.996647 -0.8631416 1.655639 0.984944 -1.093021 -0.2484666
          [,77]      [,78]     [,79]      [,80]    [,81]      [,82]    [,83]
[1,] -0.2726699 -0.5083943 0.2360541 0.07469386 1.807214 0.04735169 1.239543
[2,] -0.2726699 -0.5083943 0.2360541 0.07469386 1.807214 0.04735169 1.239543
          [,84]    [,85]     [,86]     [,87]      [,88]    [,89]      [,90]
[1,] -0.5302283 1.067855 -1.909472 -0.125268 -0.5537672 1.862365 -0.3985027
[2,] -0.5302283 1.067855 -1.909472 -0.125268 -0.5537672 1.862365 -0.3985027
        [,91]      [,92]     [,93]      [,94]    [,95]      [,96]     [,97]
[1,] 0.379522 -0.1592645 0.4200555 -0.8655913 -1.91019 -0.2741101 0.6741571
[2,] 0.379522 -0.1592645 0.4200555 -0.8655913 -1.91019 -0.2741101 0.6741571
          [,98]      [,99]    [,100]
[1,] -0.2308859 -0.1539192 0.3254981
[2,] -0.2308859 -0.1539192 0.3254981
> 
> 
> Max(tmp2)
[1] 2.231763
> Min(tmp2)
[1] -3.243668
> mean(tmp2)
[1] -0.03497705
> Sum(tmp2)
[1] -3.497705
> Var(tmp2)
[1] 1.099689
> 
> rowMeans(tmp2)
  [1]  2.231762827  1.003133767  1.201693690 -0.320098505 -0.574813382
  [6]  1.281230523 -0.952413794  0.145689237 -0.547617342  0.883522870
 [11]  0.984776837 -0.235196696 -0.572804049 -0.569007542  0.464181059
 [16] -0.247197155 -0.082026208  1.208774113  0.497599146 -0.807138978
 [21] -0.416237324 -1.773789356 -1.064996363 -0.071278149 -1.702551222
 [26]  0.738882233  0.243144898 -0.671272294  1.253813343  1.025695003
 [31] -0.795712912  1.174299232 -0.445256795  0.291700607  1.779530708
 [36] -0.875045967 -1.793340355  0.964511108 -0.391779399 -0.075013595
 [41]  0.265503846 -0.225179117  0.038907191  0.367171591 -0.699282743
 [46] -1.360577922  0.166318520 -1.120297452  1.923444031  0.179652509
 [51] -0.893794323  2.082333724 -1.644599959 -2.380249692 -0.476250717
 [56]  1.045173733 -0.442291519 -0.659467442 -0.954996358 -0.126064901
 [61]  0.172779076  0.846350787 -0.004803824 -0.202983040 -1.848068142
 [66]  0.577070435  0.456767648 -0.389377460  0.052034398 -1.079438205
 [71]  1.682165787 -0.411785658  1.522964981 -0.643101624 -1.332435159
 [76]  0.021040019  1.101788580 -0.716743877  0.561056059  0.080545010
 [81]  2.147120792  0.457421419 -1.126991060  0.672429382 -1.932324012
 [86] -0.643900941 -0.233719744  1.357128519 -1.156881205 -0.254293133
 [91] -1.659311535 -0.184738971  1.094010475 -0.186732679  0.257363150
 [96]  1.131239845  0.242860355 -3.243667734  0.514016926  1.330632862
> rowSums(tmp2)
  [1]  2.231762827  1.003133767  1.201693690 -0.320098505 -0.574813382
  [6]  1.281230523 -0.952413794  0.145689237 -0.547617342  0.883522870
 [11]  0.984776837 -0.235196696 -0.572804049 -0.569007542  0.464181059
 [16] -0.247197155 -0.082026208  1.208774113  0.497599146 -0.807138978
 [21] -0.416237324 -1.773789356 -1.064996363 -0.071278149 -1.702551222
 [26]  0.738882233  0.243144898 -0.671272294  1.253813343  1.025695003
 [31] -0.795712912  1.174299232 -0.445256795  0.291700607  1.779530708
 [36] -0.875045967 -1.793340355  0.964511108 -0.391779399 -0.075013595
 [41]  0.265503846 -0.225179117  0.038907191  0.367171591 -0.699282743
 [46] -1.360577922  0.166318520 -1.120297452  1.923444031  0.179652509
 [51] -0.893794323  2.082333724 -1.644599959 -2.380249692 -0.476250717
 [56]  1.045173733 -0.442291519 -0.659467442 -0.954996358 -0.126064901
 [61]  0.172779076  0.846350787 -0.004803824 -0.202983040 -1.848068142
 [66]  0.577070435  0.456767648 -0.389377460  0.052034398 -1.079438205
 [71]  1.682165787 -0.411785658  1.522964981 -0.643101624 -1.332435159
 [76]  0.021040019  1.101788580 -0.716743877  0.561056059  0.080545010
 [81]  2.147120792  0.457421419 -1.126991060  0.672429382 -1.932324012
 [86] -0.643900941 -0.233719744  1.357128519 -1.156881205 -0.254293133
 [91] -1.659311535 -0.184738971  1.094010475 -0.186732679  0.257363150
 [96]  1.131239845  0.242860355 -3.243667734  0.514016926  1.330632862
> 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]  2.231762827  1.003133767  1.201693690 -0.320098505 -0.574813382
  [6]  1.281230523 -0.952413794  0.145689237 -0.547617342  0.883522870
 [11]  0.984776837 -0.235196696 -0.572804049 -0.569007542  0.464181059
 [16] -0.247197155 -0.082026208  1.208774113  0.497599146 -0.807138978
 [21] -0.416237324 -1.773789356 -1.064996363 -0.071278149 -1.702551222
 [26]  0.738882233  0.243144898 -0.671272294  1.253813343  1.025695003
 [31] -0.795712912  1.174299232 -0.445256795  0.291700607  1.779530708
 [36] -0.875045967 -1.793340355  0.964511108 -0.391779399 -0.075013595
 [41]  0.265503846 -0.225179117  0.038907191  0.367171591 -0.699282743
 [46] -1.360577922  0.166318520 -1.120297452  1.923444031  0.179652509
 [51] -0.893794323  2.082333724 -1.644599959 -2.380249692 -0.476250717
 [56]  1.045173733 -0.442291519 -0.659467442 -0.954996358 -0.126064901
 [61]  0.172779076  0.846350787 -0.004803824 -0.202983040 -1.848068142
 [66]  0.577070435  0.456767648 -0.389377460  0.052034398 -1.079438205
 [71]  1.682165787 -0.411785658  1.522964981 -0.643101624 -1.332435159
 [76]  0.021040019  1.101788580 -0.716743877  0.561056059  0.080545010
 [81]  2.147120792  0.457421419 -1.126991060  0.672429382 -1.932324012
 [86] -0.643900941 -0.233719744  1.357128519 -1.156881205 -0.254293133
 [91] -1.659311535 -0.184738971  1.094010475 -0.186732679  0.257363150
 [96]  1.131239845  0.242860355 -3.243667734  0.514016926  1.330632862
> rowMin(tmp2)
  [1]  2.231762827  1.003133767  1.201693690 -0.320098505 -0.574813382
  [6]  1.281230523 -0.952413794  0.145689237 -0.547617342  0.883522870
 [11]  0.984776837 -0.235196696 -0.572804049 -0.569007542  0.464181059
 [16] -0.247197155 -0.082026208  1.208774113  0.497599146 -0.807138978
 [21] -0.416237324 -1.773789356 -1.064996363 -0.071278149 -1.702551222
 [26]  0.738882233  0.243144898 -0.671272294  1.253813343  1.025695003
 [31] -0.795712912  1.174299232 -0.445256795  0.291700607  1.779530708
 [36] -0.875045967 -1.793340355  0.964511108 -0.391779399 -0.075013595
 [41]  0.265503846 -0.225179117  0.038907191  0.367171591 -0.699282743
 [46] -1.360577922  0.166318520 -1.120297452  1.923444031  0.179652509
 [51] -0.893794323  2.082333724 -1.644599959 -2.380249692 -0.476250717
 [56]  1.045173733 -0.442291519 -0.659467442 -0.954996358 -0.126064901
 [61]  0.172779076  0.846350787 -0.004803824 -0.202983040 -1.848068142
 [66]  0.577070435  0.456767648 -0.389377460  0.052034398 -1.079438205
 [71]  1.682165787 -0.411785658  1.522964981 -0.643101624 -1.332435159
 [76]  0.021040019  1.101788580 -0.716743877  0.561056059  0.080545010
 [81]  2.147120792  0.457421419 -1.126991060  0.672429382 -1.932324012
 [86] -0.643900941 -0.233719744  1.357128519 -1.156881205 -0.254293133
 [91] -1.659311535 -0.184738971  1.094010475 -0.186732679  0.257363150
 [96]  1.131239845  0.242860355 -3.243667734  0.514016926  1.330632862
> 
> colMeans(tmp2)
[1] -0.03497705
> colSums(tmp2)
[1] -3.497705
> colVars(tmp2)
[1] 1.099689
> colSd(tmp2)
[1] 1.048661
> colMax(tmp2)
[1] 2.231763
> colMin(tmp2)
[1] -3.243668
> colMedians(tmp2)
[1] -0.0785199
> colRanges(tmp2)
          [,1]
[1,] -3.243668
[2,]  2.231763
> 
> 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]  4.9356248  2.9892137 -1.7202174 -5.2189863 -0.2293346 -3.6045395
 [7]  0.8399207 -8.6465667 -0.8478802  3.5558893
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1954162
[2,] -0.1208623
[3,]  0.2893185
[4,]  1.3620812
[5,]  2.2120805
> 
> rowApply(tmp,sum)
 [1] -0.78318431  4.28258040 -2.71849471  1.92207574  0.57968392  0.04788399
 [7] -3.69469959 -5.08209238 -0.19360874 -2.30702039
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   10    5    7    4   10   10    2    3   10     7
 [2,]    5    7    9    3    9    2    9    9    8     5
 [3,]    1    2    4    8    1    5    7    8    9     8
 [4,]    6    1    5    2    4    6    5    6    3     2
 [5,]    2   10    1    5    3    9    8    5    5    10
 [6,]    3    8    6    7    5    1    3    2    4     6
 [7,]    9    4   10    6    8    7    1   10    2     3
 [8,]    7    3    3    1    2    4    4    1    1     9
 [9,]    4    9    2    9    6    3   10    4    6     4
[10,]    8    6    8   10    7    8    6    7    7     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.92897400  1.06221119 -2.16935736  2.39205599  1.58536719 -6.88346601
 [7]  3.40759847  3.46237124  2.69240744 -1.62790416 -4.56277884  1.00235551
[13] -2.66037255  1.18782271  0.83879929 -0.61323152 -0.01888312 -0.20618595
[19]  4.31426008 -1.76257094
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.4232648
[2,] -1.1265185
[3,] -0.5572550
[4,] -0.2893481
[5,]  0.4674124
> 
> rowApply(tmp,sum)
[1] -6.6307727  0.4016551  0.1517491 -2.0741794  6.6630725
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   16    1    8    6    1
[2,]   11   13    5    8   19
[3,]    3    8   12    5   10
[4,]    9   19   17   12   16
[5,]   20   17   10    3   14
> 
> 
> as.matrix(tmp)
           [,1]       [,2]        [,3]       [,4]       [,5]       [,6]
[1,]  0.4674124 -0.2831187 -1.36205690 -0.5546073  1.3225573 -2.7843308
[2,] -1.4232648  0.2749276 -0.39307352  1.2384522  1.1973486 -0.1848819
[3,] -0.2893481 -0.7204954 -0.02122193  0.9675679 -0.1821143 -0.9358781
[4,] -0.5572550 -0.5396354 -0.61516106  0.1292050 -1.1464759 -2.5840069
[5,] -1.1265185  2.3305330  0.22215604  0.6114381  0.3940515 -0.3943684
          [,7]       [,8]        [,9]       [,10]      [,11]       [,12]
[1,] 0.7414516  1.1850293  1.05824117 -1.43113846 -1.2862185 -0.68249045
[2,] 1.2021863 -0.8628002 -0.88642040 -0.38630248 -0.9044430  1.06388414
[3,] 0.7794906  1.5878137 -0.07126088  0.53267005 -0.9294718 -0.01338129
[4,] 0.3376974  1.8065726  0.26070022 -0.27665545 -1.2390363  0.83628843
[5,] 0.3467726 -0.2542441  2.33114734 -0.06647781 -0.2036092 -0.20194532
          [,13]       [,14]      [,15]      [,16]      [,17]       [,18]
[1,] -0.7487659 -0.91201428 -1.1568306 -0.1520731  0.1365337 -0.02595421
[2,] -1.0649575  0.70385787  0.5028930 -0.7455655 -0.1923846 -0.09533280
[3,] -1.9492833 -0.21628374 -0.3592034  1.2609284  0.5287977 -0.36135985
[4,]  0.2630763  1.56370080  0.8175067 -0.5410768 -0.6863470  0.05317300
[5,]  0.8395577  0.04856206  1.0344335 -0.4354445  0.1945171  0.22328792
         [,19]      [,20]
[1,] 0.2885022 -0.4509011
[2,] 1.9177368 -0.5602048
[3,] 1.7091596 -1.1653768
[4,] 0.1690981 -0.1255481
[5,] 0.2297634  0.5394599
> 
> 
> 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 -0.1034337 1.5748 0.2186775 -1.004112 1.780369 -2.470913 0.5632072
          col8      col9      col10      col11      col12      col13     col14
row1 0.7137374 -0.715711 -0.6410398 -0.2008271 -0.7906039 -0.8638455 -2.406804
        col15      col16    col17    col18      col19     col20
row1 1.043447 -0.5517647 1.622024 1.696658 -0.4325849 -2.333719
> tmp[,"col10"]
          col10
row1 -0.6410398
row2  0.1285636
row3  0.3526391
row4 -0.7155450
row5  0.6572399
> tmp[c("row1","row5"),]
           col1       col2       col3       col4       col5        col6
row1 -0.1034337  1.5748000  0.2186775 -1.0041115  1.7803695 -2.47091271
row5 -0.7709844 -0.1950049 -0.3306283  0.1261547 -0.2505559 -0.02153105
           col7       col8        col9      col10      col11      col12
row1  0.5632072  0.7137374 -0.71571100 -0.6410398 -0.2008271 -0.7906039
row5 -0.1091649 -0.6008770  0.09097675  0.6572399 -0.2580842 -1.1397614
           col13      col14     col15      col16      col17     col18
row1 -0.86384549 -2.4068037  1.043447 -0.5517647  1.6220241 1.6966576
row5  0.06661835  0.8940329 -1.546707 -0.1551988 -0.4472066 0.1567804
          col19      col20
row1 -0.4325849 -2.3337192
row5  0.8895482 -0.4474479
> tmp[,c("col6","col20")]
            col6      col20
row1 -2.47091271 -2.3337192
row2 -0.55810418  0.6908446
row3  0.11388382 -0.7108528
row4  1.78582008  0.9586271
row5 -0.02153105 -0.4474479
> tmp[c("row1","row5"),c("col6","col20")]
            col6      col20
row1 -2.47091271 -2.3337192
row5 -0.02153105 -0.4474479
> 
> 
> 
> 
> 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.47781 49.88018 49.91734 50.85087 49.49359 104.6281 50.07275 49.9773
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.38062 48.63648 48.21442 49.05268 47.58992 52.26273 49.96156 49.63158
        col17    col18    col19    col20
row1 50.27467 48.91076 49.18372 105.8848
> tmp[,"col10"]
        col10
row1 48.63648
row2 31.95061
row3 29.03921
row4 30.48597
row5 49.99632
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.47781 49.88018 49.91734 50.85087 49.49359 104.6281 50.07275 49.97730
row5 48.75976 49.26965 49.79221 50.91040 50.10793 103.1674 50.00434 49.78856
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.38062 48.63648 48.21442 49.05268 47.58992 52.26273 49.96156 49.63158
row5 49.40797 49.99632 50.22004 49.72577 48.77699 50.04783 48.80495 50.45143
        col17    col18    col19    col20
row1 50.27467 48.91076 49.18372 105.8848
row5 50.69805 49.05189 49.13095 105.3173
> tmp[,c("col6","col20")]
          col6     col20
row1 104.62808 105.88476
row2  73.04182  75.61299
row3  73.82371  74.01798
row4  74.28004  72.33460
row5 103.16740 105.31730
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.6281 105.8848
row5 103.1674 105.3173
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.6281 105.8848
row5 103.1674 105.3173
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.6901933
[2,]  0.9585465
[3,] -1.0552979
[4,] -1.1228336
[5,]  0.6406290
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.7212221 -0.9328980
[2,]  1.5747618 -0.3754084
[3,] -0.1455079  0.5019342
[4,]  0.1584275 -0.8599506
[5,] -1.5823947 -0.2131413
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -1.07511095  0.9494981
[2,] -0.48111532  0.6700799
[3,]  0.35134583 -0.2280433
[4,] -0.43310084  0.5583861
[5,]  0.02239791 -0.9165896
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -1.075111
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -1.0751110
[2,] -0.4811153
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
row3 -1.0606294 -0.8785593 -1.3049267 -0.9333454 -0.2189006 -0.4927543
row1  0.8009794 -0.3754097 -0.2126314 -0.3888705  0.4508147 -0.3029448
           [,7]      [,8]       [,9]      [,10]      [,11]      [,12]     [,13]
row3  0.5260705  1.596326 -0.6938442 -0.5934525  0.2405986 -0.1398073 -0.905329
row1 -1.1326597 -0.332074  1.2208142  1.4441799 -1.2666579  0.2205071  1.313309
          [,14]     [,15]      [,16]      [,17]     [,18]      [,19]      [,20]
row3 -0.2375136 0.9849863 -1.5865167  0.6383316 -2.465689 -0.5187972 -0.9552051
row1 -1.4499322 1.2601535 -0.7320609 -0.9065362 -1.493650 -1.1829367 -0.3727786
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]       [,2]     [,3]      [,4]      [,5]      [,6]     [,7]
row2 -0.9743698 -0.5299217 -2.32844 0.1013885 0.6787801 -1.089066 1.034988
         [,8]       [,9]    [,10]
row2 0.219983 -0.2075124 1.848751
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]     [,2]       [,3]    [,4]      [,5]     [,6]      [,7]
row5 -0.2277747 1.212155 -0.4706006 1.31031 -1.488426 1.010246 0.2071529
            [,8]      [,9]      [,10]     [,11]     [,12]      [,13]     [,14]
row5 -0.08225703 0.4916089 0.08131047 0.4498576 0.8475532 0.02391908 0.7910807
          [,15]     [,16]      [,17]     [,18]    [,19]      [,20]
row5 -0.4475641 0.1466148 -0.2984925 -1.079899 1.148556 0.03723481
> 
> 
> 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: 0x5b96fa0a4ac0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe252776a29296"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe25271b17f99b"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe252756f6861b"
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe25273dfed733"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe252769427470"
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe2527492b95c7"
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe25271f21070d"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe25272cb93cf9"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe2527829da9c" 
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe25273d52aca3"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe252727748a2a"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe252751931b83"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe25275b89da2b"
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe252747e954f6"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BMe25275bf47729"
> 
> 
> ### 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: 0x5b96fb0ec3e0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5b96fb0ec3e0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5b96fb0ec3e0>
> rowMedians(tmp)
  [1]  0.314488408  0.329886968  0.216268915  0.031086630  0.286284051
  [6] -0.349403732  0.104660601  0.425882073  0.191211454  0.143294847
 [11] -0.092585749 -0.080867905 -0.106269439 -0.092845979 -0.143885643
 [16]  0.248415898 -0.129588871  0.057010594  0.078205599  0.326227624
 [21]  0.533305086  0.506430810 -0.013873677 -0.531765409  0.316567234
 [26]  0.172074631 -0.199454853 -0.218445787 -0.112390576 -0.120123701
 [31]  0.281826612  0.418258727  0.226401029 -0.687774429  0.244984148
 [36] -0.323588494 -0.409382697 -0.137051468 -0.109293971  1.012808070
 [41]  0.339401056 -0.040707419  0.212354412 -0.184718245  0.199671149
 [46]  0.405782178 -0.267820527 -0.180138711  0.056925553 -0.131829975
 [51]  0.042934051  0.126676762 -0.096893946 -0.878266559  0.355317461
 [56]  0.252264898  0.366794142 -0.225356492 -0.203920743 -0.174458367
 [61] -0.013478086 -0.580154517 -0.127516284  0.027041091 -0.455774687
 [66]  0.389331664  0.150512549 -0.357331363  0.369127443 -0.498166590
 [71] -0.040881875  0.275877250 -0.153059990 -0.084552718 -0.417377088
 [76]  0.331539909  0.262529184 -0.369847546  0.274493354 -0.263406509
 [81]  0.046808649 -0.112791552 -0.445199490 -0.166511386 -0.335317579
 [86]  0.215517933 -0.213996930 -0.324492893 -0.279174397  0.177188725
 [91]  0.648225624  0.019781499 -0.014968993 -0.632554921  0.608648481
 [96]  0.613705765  0.013781470  0.313687295 -0.538650109  0.462121763
[101]  0.171005979  0.159476873  0.001954091  0.202359119 -0.508541839
[106]  0.088923937  0.031465721 -0.315573604 -0.449455396 -0.794009603
[111]  0.344669244 -0.435322415  0.407087483 -0.132955571  0.316762732
[116]  0.008966305  0.116657662  0.504711612 -0.431716994  0.280235178
[121]  0.234781252 -0.317217673  0.359324814  0.167206489 -0.015919340
[126] -0.426912832 -0.207912148  0.158217042  0.210377440  0.038595261
[131] -0.189881949 -0.330436064 -0.062451469  0.037924854  0.039923515
[136] -0.001726610 -0.058769029 -0.189747756 -0.595003672  0.056235896
[141] -0.511145441  0.067662003  0.756280547 -0.118394199  0.714905833
[146] -0.211183005 -0.370576122 -0.205228239 -0.160254917  0.116425038
[151]  0.123804100 -0.197890646 -0.163601369  0.247371669  0.396331888
[156]  0.254967458 -0.306283760 -0.056523918 -0.706801513  0.422492358
[161] -0.364807583  1.045316355 -0.311890477 -0.079148443  0.536625662
[166] -0.392455179 -0.598380882 -0.174091139 -0.007041367  0.023348656
[171]  0.119316319 -0.296494494  0.417056012 -0.145534823  0.356963360
[176] -0.499698672 -0.081616056  0.590585766  0.593082365  0.241571274
[181]  0.371070129  0.003851465  0.223510732  0.163803413  0.190298557
[186]  0.111200886 -0.077220176  0.163857730  0.189971347 -0.113118964
[191]  0.949365737 -0.350248232 -0.027600138 -0.763175853  0.288900900
[196] -0.252988802  0.247330104  0.093753415  0.335493226  0.162814313
[201]  0.140006574  0.570767916  0.268850106 -0.302891588  0.352922172
[206]  0.092965625  0.079482307  0.495626872 -0.125987466  0.085870513
[211] -0.266425580  0.150514279  0.024550349 -0.279417543 -0.707723770
[216]  0.013746968 -0.488175778 -0.377447412 -0.226209880 -0.049636510
[221]  0.045963269 -0.183720976 -0.026558975  0.069910494  0.269172995
[226]  0.020990280  0.210785523 -0.272695342 -0.287197456  0.370213886
> 
> proc.time()
   user  system elapsed 
  1.207   0.695   1.891 

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: 0x5b94809e01c0>
> .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: 0x5b94809e01c0>
> .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: 0x5b94809e01c0>
> .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: 0x5b94809e01c0>
> 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: 0x5b9480cc3120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b9480cc3120>
> .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: 0x5b9480cc3120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b9480cc3120>
> .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: 0x5b9480cc3120>
> 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: 0x5b947f9774a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b947f9774a0>
> .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: 0x5b947f9774a0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5b947f9774a0>
> .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: 0x5b947f9774a0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5b947f9774a0>
> .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: 0x5b947f9774a0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5b947f9774a0>
> .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: 0x5b947f9774a0>
> 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: 0x5b947fa13390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5b947fa13390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b947fa13390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b947fa13390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilee26e420b19cb1" "BufferedMatrixFilee26e42d7cde11"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilee26e420b19cb1" "BufferedMatrixFilee26e42d7cde11"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b9480292650>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b9480292650>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5b9480292650>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5b9480292650>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5b9480292650>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5b9480292650>
> .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: 0x5b9481419430>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b9481419430>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5b9481419430>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5b9481419430>
> 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: 0x5b948170e250>
> .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: 0x5b948170e250>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.237   0.055   0.281 

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.241   0.047   0.278 

Example timings