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

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

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.4 LTS)x86_644.6.0 RC (2026-04-17 r89917) -- "Because it was There" 4995
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

Package 262/2418HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.76.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-05-20 13:40 -0400 (Wed, 20 May 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_23
git_last_commit: 9d72964
git_last_commit_date: 2026-04-28 08:32:08 -0400 (Tue, 28 Apr 2026)
nebbiolo1Linux (Ubuntu 24.04.4 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
See other builds for BufferedMatrix in R Universe.


CHECK results for BufferedMatrix on nebbiolo1

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

raw results


Summary

Package: BufferedMatrix
Version: 1.76.0
Command: /home/biocbuild/bbs-3.23-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.23-bioc/R/site-library --timings BufferedMatrix_1.76.0.tar.gz
StartedAt: 2026-05-20 22:06:47 -0400 (Wed, 20 May 2026)
EndedAt: 2026-05-20 22:07:13 -0400 (Wed, 20 May 2026)
EllapsedTime: 26.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.296   0.053   0.335 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 480233 25.7    1053308 56.3   637571 34.1
Vcells 887253  6.8    8388608 64.0  2083896 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed May 20 22:07:03 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed May 20 22:07:03 2026"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x5b603a439690>
> 
> 
> 
> 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] "Wed May 20 22:07:04 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] "Wed May 20 22:07:04 2026"
> 
> ColMode(tmp2)
<pointer: 0x5b603a439690>
> 
> 
> 
> ### 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,] 100.6597545 -0.2745058 -0.03848362  0.6971902
[2,]   0.9123669  0.1684673 -0.64445950  0.4196384
[3,]   1.5002333 -1.2401105  0.08867077 -0.5706021
[4,]   0.1889853  0.1557878  1.28537629 -1.0789219
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]       [,3]      [,4]
[1,] 100.6597545 0.2745058 0.03848362 0.6971902
[2,]   0.9123669 0.1684673 0.64445950 0.4196384
[3,]   1.5002333 1.2401105 0.08867077 0.5706021
[4,]   0.1889853 0.1557878 1.28537629 1.0789219
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0329335 0.5239330 0.1961724 0.8349792
[2,]  0.9551790 0.4104477 0.8027823 0.6477950
[3,]  1.2248401 1.1136025 0.2977764 0.7553821
[4,]  0.4347244 0.3946996 1.1337444 1.0387116
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.98909 30.51384 27.00021 34.04698
[2,]  35.46416 29.27294 33.67228 31.89759
[3,]  38.74863 37.37614 28.06643 33.12442
[4,]  29.53623 29.10278 37.62282 36.46604
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5b603b7ed0c0>
> exp(tmp5)
<pointer: 0x5b603b7ed0c0>
> log(tmp5,2)
<pointer: 0x5b603b7ed0c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.3667
> Min(tmp5)
[1] 54.21562
> mean(tmp5)
[1] 72.17125
> Sum(tmp5)
[1] 14434.25
> Var(tmp5)
[1] 861.7202
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.15384 71.55389 71.51061 69.42124 70.68538 71.45308 70.13260 67.97410
 [9] 66.70053 72.12726
> rowSums(tmp5)
 [1] 1803.077 1431.078 1430.212 1388.425 1413.708 1429.062 1402.652 1359.482
 [9] 1334.011 1442.545
> rowVars(tmp5)
 [1] 8076.55620   40.98974   72.39957   65.72531   66.75871   57.84984
 [7]   60.66964   75.33293   45.86445   56.73307
> rowSd(tmp5)
 [1] 89.869662  6.402323  8.508794  8.107115  8.170600  7.605908  7.789072
 [8]  8.679455  6.772330  7.532136
> rowMax(tmp5)
 [1] 470.36668  83.69552  86.52171  83.65817  85.07207  95.49863  82.12495
 [8]  83.32559  76.79447  84.33318
> rowMin(tmp5)
 [1] 54.81641 60.88496 58.41661 54.21562 58.30454 60.37499 56.24358 54.59964
 [9] 55.56774 55.32456
> 
> colMeans(tmp5)
 [1] 111.86079  67.56774  71.60082  74.22688  66.26300  67.99935  66.54212
 [8]  74.42726  68.51643  70.10984  69.95161  71.45445  69.65579  67.35939
[15]  67.02819  71.71112  71.34214  68.38357  72.94394  74.48062
> colSums(tmp5)
 [1] 1118.6079  675.6774  716.0082  742.2688  662.6300  679.9935  665.4212
 [8]  744.2726  685.1643  701.0984  699.5161  714.5445  696.5579  673.5939
[15]  670.2819  717.1112  713.4214  683.8357  729.4394  744.8062
> colVars(tmp5)
 [1] 15894.43704    79.75762    72.95239    18.75397    72.25340    45.61511
 [7]    61.32545    26.79488    17.59097    60.53080   135.10905    92.15433
[13]    77.92599    58.32987    44.11727    34.73929    70.32076    73.60905
[19]    64.63935    63.46907
> colSd(tmp5)
 [1] 126.073142   8.930712   8.541217   4.330585   8.500200   6.753896
 [7]   7.831057   5.176377   4.194159   7.780154  11.623642   9.599705
[13]   8.827570   7.637399   6.642083   5.894004   8.385747   8.579571
[19]   8.039860   7.966748
> colMax(tmp5)
 [1] 470.36668  80.51946  81.61618  79.31076  83.69552  76.95497  80.53846
 [8]  82.12495  75.36133  82.05081  95.49863  84.33318  83.65817  76.79447
[15]  76.35699  82.45290  85.07207  83.32559  87.38426  86.52171
> colMin(tmp5)
 [1] 61.47579 55.56774 56.19740 66.39065 58.49423 58.26077 57.17713 67.27434
 [9] 60.88496 56.33764 54.59964 54.21562 56.24358 54.81641 56.38622 63.49482
[17] 55.32456 56.70751 63.00858 61.06139
> 
> 
> ### 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.15384 71.55389 71.51061 69.42124 70.68538       NA 70.13260 67.97410
 [9] 66.70053 72.12726
> rowSums(tmp5)
 [1] 1803.077 1431.078 1430.212 1388.425 1413.708       NA 1402.652 1359.482
 [9] 1334.011 1442.545
> rowVars(tmp5)
 [1] 8076.55620   40.98974   72.39957   65.72531   66.75871   57.43785
 [7]   60.66964   75.33293   45.86445   56.73307
> rowSd(tmp5)
 [1] 89.869662  6.402323  8.508794  8.107115  8.170600  7.578776  7.789072
 [8]  8.679455  6.772330  7.532136
> rowMax(tmp5)
 [1] 470.36668  83.69552  86.52171  83.65817  85.07207        NA  82.12495
 [8]  83.32559  76.79447  84.33318
> rowMin(tmp5)
 [1] 54.81641 60.88496 58.41661 54.21562 58.30454       NA 56.24358 54.59964
 [9] 55.56774 55.32456
> 
> colMeans(tmp5)
 [1] 111.86079  67.56774  71.60082  74.22688  66.26300  67.99935  66.54212
 [8]  74.42726  68.51643  70.10984  69.95161        NA  69.65579  67.35939
[15]  67.02819  71.71112  71.34214  68.38357  72.94394  74.48062
> colSums(tmp5)
 [1] 1118.6079  675.6774  716.0082  742.2688  662.6300  679.9935  665.4212
 [8]  744.2726  685.1643  701.0984  699.5161        NA  696.5579  673.5939
[15]  670.2819  717.1112  713.4214  683.8357  729.4394  744.8062
> colVars(tmp5)
 [1] 15894.43704    79.75762    72.95239    18.75397    72.25340    45.61511
 [7]    61.32545    26.79488    17.59097    60.53080   135.10905          NA
[13]    77.92599    58.32987    44.11727    34.73929    70.32076    73.60905
[19]    64.63935    63.46907
> colSd(tmp5)
 [1] 126.073142   8.930712   8.541217   4.330585   8.500200   6.753896
 [7]   7.831057   5.176377   4.194159   7.780154  11.623642         NA
[13]   8.827570   7.637399   6.642083   5.894004   8.385747   8.579571
[19]   8.039860   7.966748
> colMax(tmp5)
 [1] 470.36668  80.51946  81.61618  79.31076  83.69552  76.95497  80.53846
 [8]  82.12495  75.36133  82.05081  95.49863        NA  83.65817  76.79447
[15]  76.35699  82.45290  85.07207  83.32559  87.38426  86.52171
> colMin(tmp5)
 [1] 61.47579 55.56774 56.19740 66.39065 58.49423 58.26077 57.17713 67.27434
 [9] 60.88496 56.33764 54.59964       NA 56.24358 54.81641 56.38622 63.49482
[17] 55.32456 56.70751 63.00858 61.06139
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.3667
> Min(tmp5,na.rm=TRUE)
[1] 54.21562
> mean(tmp5,na.rm=TRUE)
[1] 72.21443
> Sum(tmp5,na.rm=TRUE)
[1] 14370.67
> Var(tmp5,na.rm=TRUE)
[1] 865.6976
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.15384 71.55389 71.51061 69.42124 70.68538 71.86751 70.13260 67.97410
 [9] 66.70053 72.12726
> rowSums(tmp5,na.rm=TRUE)
 [1] 1803.077 1431.078 1430.212 1388.425 1413.708 1365.483 1402.652 1359.482
 [9] 1334.011 1442.545
> rowVars(tmp5,na.rm=TRUE)
 [1] 8076.55620   40.98974   72.39957   65.72531   66.75871   57.43785
 [7]   60.66964   75.33293   45.86445   56.73307
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.869662  6.402323  8.508794  8.107115  8.170600  7.578776  7.789072
 [8]  8.679455  6.772330  7.532136
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.36668  83.69552  86.52171  83.65817  85.07207  95.49863  82.12495
 [8]  83.32559  76.79447  84.33318
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.81641 60.88496 58.41661 54.21562 58.30454 60.37499 56.24358 54.59964
 [9] 55.56774 55.32456
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.86079  67.56774  71.60082  74.22688  66.26300  67.99935  66.54212
 [8]  74.42726  68.51643  70.10984  69.95161  72.32951  69.65579  67.35939
[15]  67.02819  71.71112  71.34214  68.38357  72.94394  74.48062
> colSums(tmp5,na.rm=TRUE)
 [1] 1118.6079  675.6774  716.0082  742.2688  662.6300  679.9935  665.4212
 [8]  744.2726  685.1643  701.0984  699.5161  650.9656  696.5579  673.5939
[15]  670.2819  717.1112  713.4214  683.8357  729.4394  744.8062
> colVars(tmp5,na.rm=TRUE)
 [1] 15894.43704    79.75762    72.95239    18.75397    72.25340    45.61511
 [7]    61.32545    26.79488    17.59097    60.53080   135.10905    95.05917
[13]    77.92599    58.32987    44.11727    34.73929    70.32076    73.60905
[19]    64.63935    63.46907
> colSd(tmp5,na.rm=TRUE)
 [1] 126.073142   8.930712   8.541217   4.330585   8.500200   6.753896
 [7]   7.831057   5.176377   4.194159   7.780154  11.623642   9.749829
[13]   8.827570   7.637399   6.642083   5.894004   8.385747   8.579571
[19]   8.039860   7.966748
> colMax(tmp5,na.rm=TRUE)
 [1] 470.36668  80.51946  81.61618  79.31076  83.69552  76.95497  80.53846
 [8]  82.12495  75.36133  82.05081  95.49863  84.33318  83.65817  76.79447
[15]  76.35699  82.45290  85.07207  83.32559  87.38426  86.52171
> colMin(tmp5,na.rm=TRUE)
 [1] 61.47579 55.56774 56.19740 66.39065 58.49423 58.26077 57.17713 67.27434
 [9] 60.88496 56.33764 54.59964 54.21562 56.24358 54.81641 56.38622 63.49482
[17] 55.32456 56.70751 63.00858 61.06139
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.15384 71.55389 71.51061 69.42124 70.68538      NaN 70.13260 67.97410
 [9] 66.70053 72.12726
> rowSums(tmp5,na.rm=TRUE)
 [1] 1803.077 1431.078 1430.212 1388.425 1413.708    0.000 1402.652 1359.482
 [9] 1334.011 1442.545
> rowVars(tmp5,na.rm=TRUE)
 [1] 8076.55620   40.98974   72.39957   65.72531   66.75871         NA
 [7]   60.66964   75.33293   45.86445   56.73307
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.869662  6.402323  8.508794  8.107115  8.170600        NA  7.789072
 [8]  8.679455  6.772330  7.532136
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.36668  83.69552  86.52171  83.65817  85.07207        NA  82.12495
 [8]  83.32559  76.79447  84.33318
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.81641 60.88496 58.41661 54.21562 58.30454       NA 56.24358 54.59964
 [9] 55.56774 55.32456
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.71963  67.54834  71.27774  73.66200  65.98747  68.12873  67.22735
 [8]  74.82780  68.27184  69.65760  67.11305       NaN  69.40298  66.57327
[15]  66.75039  70.51759  71.81914  68.71500  73.44931  75.04223
> colSums(tmp5,na.rm=TRUE)
 [1] 1050.4767  607.9351  641.4997  662.9580  593.8872  613.1586  605.0462
 [8]  673.4502  614.4466  626.9184  604.0175    0.0000  624.6268  599.1595
[15]  600.7535  634.6583  646.3723  618.4350  661.0438  675.3801
> colVars(tmp5,na.rm=TRUE)
 [1] 17615.64809    89.72309    80.89716    17.50851    80.43098    51.12868
 [7]    63.70870    28.33937    19.11685    65.79624    61.35179          NA
[13]    86.94770    58.66885    48.76372    23.05588    76.55110    81.57443
[19]    69.84596    67.85442
> colSd(tmp5,na.rm=TRUE)
 [1] 132.723954   9.472227   8.994285   4.184318   8.968332   7.150432
 [7]   7.981773   5.323474   4.372282   8.111488   7.832738         NA
[13]   9.324575   7.659559   6.983102   4.801654   8.749348   9.031856
[19]   8.357390   8.237379
> colMax(tmp5,na.rm=TRUE)
 [1] 470.36668  80.51946  81.61618  79.20308  83.69552  76.95497  80.53846
 [8]  82.12495  75.36133  82.05081  77.67924      -Inf  83.65817  76.79447
[15]  76.35699  76.63508  85.07207  83.32559  87.38426  86.52171
> colMin(tmp5,na.rm=TRUE)
 [1] 61.47579 55.56774 56.19740 66.39065 58.49423 58.26077 57.17713 67.27434
 [9] 60.88496 56.33764 54.59964      Inf 56.24358 54.81641 56.38622 63.49482
[17] 55.32456 56.70751 63.00858 61.06139
> 
> 
> 
> 
> 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] 280.2211 128.7378 213.3125 267.7804 147.2916 260.9253 255.6685 216.5589
 [9] 303.3734 179.3316
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 280.2211 128.7378 213.3125 267.7804 147.2916 260.9253 255.6685 216.5589
 [9] 303.3734 179.3316
> 
> 
> 
> 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]  0.000000e+00 -1.705303e-13 -1.421085e-14 -2.842171e-14 -1.136868e-13
 [6]  9.947598e-14  5.684342e-14  2.557954e-13  0.000000e+00  4.263256e-14
[11] -5.684342e-14 -1.136868e-13  0.000000e+00 -1.136868e-13 -1.989520e-13
[16] -2.842171e-14 -8.526513e-14 -5.684342e-14 -2.842171e-14  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
10   17 
1   1 
8   5 
4   18 
10   11 
2   8 
9   18 
4   1 
7   19 
8   17 
6   15 
6   10 
7   11 
2   18 
7   10 
5   12 
2   1 
1   15 
6   6 
3   15 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 1.989371
> Min(tmp)
[1] -1.92577
> mean(tmp)
[1] 0.1343605
> Sum(tmp)
[1] 13.43605
> Var(tmp)
[1] 0.8455968
> 
> rowMeans(tmp)
[1] 0.1343605
> rowSums(tmp)
[1] 13.43605
> rowVars(tmp)
[1] 0.8455968
> rowSd(tmp)
[1] 0.9195634
> rowMax(tmp)
[1] 1.989371
> rowMin(tmp)
[1] -1.92577
> 
> colMeans(tmp)
  [1]  1.298376166 -1.564391392 -0.957197895 -1.065359779  1.324199139
  [6] -0.788892219 -0.439689909 -0.251971233 -0.240859098 -0.514311897
 [11]  0.568503943  1.095914669 -0.149864381  1.628267173  1.010006039
 [16]  0.633130091 -1.925770080  0.106198241  0.954788355  0.714930510
 [21]  0.202974002  0.658304133  0.514899767  0.209524772 -1.710989338
 [26] -0.852730467  0.868854796  0.039604732 -0.547188800  1.378323525
 [31]  0.979082881 -0.199761080  0.772290884 -0.338795891  0.208964097
 [36]  0.318474378  0.030203973  0.899421830  0.588332727  0.706800058
 [41] -0.633840900  0.917631516 -0.537017564  0.883924184 -0.076528438
 [46] -0.788783088 -0.609772229  0.284858826  1.409437603 -0.356610682
 [51]  1.116901343 -0.373104481 -1.500112646 -0.675400598  0.474261110
 [56] -0.175180219  0.802475822  0.684605360  0.942161052  1.886951529
 [61] -0.239589684  0.102811784  0.832062777 -0.691441599  0.471440486
 [66]  1.410639840  0.567212920  0.100974164 -0.459248728  1.666282292
 [71]  1.917777990  0.840429055 -0.372731047  0.695817350  0.841976557
 [76] -0.328528688  0.009052554 -1.210485762  0.428679880  0.885489009
 [81] -1.079098867  0.620739527  0.222886868 -0.041241732 -1.848833272
 [86] -1.069854500  1.207028855 -1.442327281 -0.946691351  1.989371393
 [91] -0.081496312 -1.631676073 -0.340357289  1.034913227 -0.894624330
 [96]  1.226521631  1.363749037 -0.738455677 -0.972370062 -0.450210082
> colSums(tmp)
  [1]  1.298376166 -1.564391392 -0.957197895 -1.065359779  1.324199139
  [6] -0.788892219 -0.439689909 -0.251971233 -0.240859098 -0.514311897
 [11]  0.568503943  1.095914669 -0.149864381  1.628267173  1.010006039
 [16]  0.633130091 -1.925770080  0.106198241  0.954788355  0.714930510
 [21]  0.202974002  0.658304133  0.514899767  0.209524772 -1.710989338
 [26] -0.852730467  0.868854796  0.039604732 -0.547188800  1.378323525
 [31]  0.979082881 -0.199761080  0.772290884 -0.338795891  0.208964097
 [36]  0.318474378  0.030203973  0.899421830  0.588332727  0.706800058
 [41] -0.633840900  0.917631516 -0.537017564  0.883924184 -0.076528438
 [46] -0.788783088 -0.609772229  0.284858826  1.409437603 -0.356610682
 [51]  1.116901343 -0.373104481 -1.500112646 -0.675400598  0.474261110
 [56] -0.175180219  0.802475822  0.684605360  0.942161052  1.886951529
 [61] -0.239589684  0.102811784  0.832062777 -0.691441599  0.471440486
 [66]  1.410639840  0.567212920  0.100974164 -0.459248728  1.666282292
 [71]  1.917777990  0.840429055 -0.372731047  0.695817350  0.841976557
 [76] -0.328528688  0.009052554 -1.210485762  0.428679880  0.885489009
 [81] -1.079098867  0.620739527  0.222886868 -0.041241732 -1.848833272
 [86] -1.069854500  1.207028855 -1.442327281 -0.946691351  1.989371393
 [91] -0.081496312 -1.631676073 -0.340357289  1.034913227 -0.894624330
 [96]  1.226521631  1.363749037 -0.738455677 -0.972370062 -0.450210082
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  1.298376166 -1.564391392 -0.957197895 -1.065359779  1.324199139
  [6] -0.788892219 -0.439689909 -0.251971233 -0.240859098 -0.514311897
 [11]  0.568503943  1.095914669 -0.149864381  1.628267173  1.010006039
 [16]  0.633130091 -1.925770080  0.106198241  0.954788355  0.714930510
 [21]  0.202974002  0.658304133  0.514899767  0.209524772 -1.710989338
 [26] -0.852730467  0.868854796  0.039604732 -0.547188800  1.378323525
 [31]  0.979082881 -0.199761080  0.772290884 -0.338795891  0.208964097
 [36]  0.318474378  0.030203973  0.899421830  0.588332727  0.706800058
 [41] -0.633840900  0.917631516 -0.537017564  0.883924184 -0.076528438
 [46] -0.788783088 -0.609772229  0.284858826  1.409437603 -0.356610682
 [51]  1.116901343 -0.373104481 -1.500112646 -0.675400598  0.474261110
 [56] -0.175180219  0.802475822  0.684605360  0.942161052  1.886951529
 [61] -0.239589684  0.102811784  0.832062777 -0.691441599  0.471440486
 [66]  1.410639840  0.567212920  0.100974164 -0.459248728  1.666282292
 [71]  1.917777990  0.840429055 -0.372731047  0.695817350  0.841976557
 [76] -0.328528688  0.009052554 -1.210485762  0.428679880  0.885489009
 [81] -1.079098867  0.620739527  0.222886868 -0.041241732 -1.848833272
 [86] -1.069854500  1.207028855 -1.442327281 -0.946691351  1.989371393
 [91] -0.081496312 -1.631676073 -0.340357289  1.034913227 -0.894624330
 [96]  1.226521631  1.363749037 -0.738455677 -0.972370062 -0.450210082
> colMin(tmp)
  [1]  1.298376166 -1.564391392 -0.957197895 -1.065359779  1.324199139
  [6] -0.788892219 -0.439689909 -0.251971233 -0.240859098 -0.514311897
 [11]  0.568503943  1.095914669 -0.149864381  1.628267173  1.010006039
 [16]  0.633130091 -1.925770080  0.106198241  0.954788355  0.714930510
 [21]  0.202974002  0.658304133  0.514899767  0.209524772 -1.710989338
 [26] -0.852730467  0.868854796  0.039604732 -0.547188800  1.378323525
 [31]  0.979082881 -0.199761080  0.772290884 -0.338795891  0.208964097
 [36]  0.318474378  0.030203973  0.899421830  0.588332727  0.706800058
 [41] -0.633840900  0.917631516 -0.537017564  0.883924184 -0.076528438
 [46] -0.788783088 -0.609772229  0.284858826  1.409437603 -0.356610682
 [51]  1.116901343 -0.373104481 -1.500112646 -0.675400598  0.474261110
 [56] -0.175180219  0.802475822  0.684605360  0.942161052  1.886951529
 [61] -0.239589684  0.102811784  0.832062777 -0.691441599  0.471440486
 [66]  1.410639840  0.567212920  0.100974164 -0.459248728  1.666282292
 [71]  1.917777990  0.840429055 -0.372731047  0.695817350  0.841976557
 [76] -0.328528688  0.009052554 -1.210485762  0.428679880  0.885489009
 [81] -1.079098867  0.620739527  0.222886868 -0.041241732 -1.848833272
 [86] -1.069854500  1.207028855 -1.442327281 -0.946691351  1.989371393
 [91] -0.081496312 -1.631676073 -0.340357289  1.034913227 -0.894624330
 [96]  1.226521631  1.363749037 -0.738455677 -0.972370062 -0.450210082
> colMedians(tmp)
  [1]  1.298376166 -1.564391392 -0.957197895 -1.065359779  1.324199139
  [6] -0.788892219 -0.439689909 -0.251971233 -0.240859098 -0.514311897
 [11]  0.568503943  1.095914669 -0.149864381  1.628267173  1.010006039
 [16]  0.633130091 -1.925770080  0.106198241  0.954788355  0.714930510
 [21]  0.202974002  0.658304133  0.514899767  0.209524772 -1.710989338
 [26] -0.852730467  0.868854796  0.039604732 -0.547188800  1.378323525
 [31]  0.979082881 -0.199761080  0.772290884 -0.338795891  0.208964097
 [36]  0.318474378  0.030203973  0.899421830  0.588332727  0.706800058
 [41] -0.633840900  0.917631516 -0.537017564  0.883924184 -0.076528438
 [46] -0.788783088 -0.609772229  0.284858826  1.409437603 -0.356610682
 [51]  1.116901343 -0.373104481 -1.500112646 -0.675400598  0.474261110
 [56] -0.175180219  0.802475822  0.684605360  0.942161052  1.886951529
 [61] -0.239589684  0.102811784  0.832062777 -0.691441599  0.471440486
 [66]  1.410639840  0.567212920  0.100974164 -0.459248728  1.666282292
 [71]  1.917777990  0.840429055 -0.372731047  0.695817350  0.841976557
 [76] -0.328528688  0.009052554 -1.210485762  0.428679880  0.885489009
 [81] -1.079098867  0.620739527  0.222886868 -0.041241732 -1.848833272
 [86] -1.069854500  1.207028855 -1.442327281 -0.946691351  1.989371393
 [91] -0.081496312 -1.631676073 -0.340357289  1.034913227 -0.894624330
 [96]  1.226521631  1.363749037 -0.738455677 -0.972370062 -0.450210082
> colRanges(tmp)
         [,1]      [,2]       [,3]     [,4]     [,5]       [,6]       [,7]
[1,] 1.298376 -1.564391 -0.9571979 -1.06536 1.324199 -0.7888922 -0.4396899
[2,] 1.298376 -1.564391 -0.9571979 -1.06536 1.324199 -0.7888922 -0.4396899
           [,8]       [,9]      [,10]     [,11]    [,12]      [,13]    [,14]
[1,] -0.2519712 -0.2408591 -0.5143119 0.5685039 1.095915 -0.1498644 1.628267
[2,] -0.2519712 -0.2408591 -0.5143119 0.5685039 1.095915 -0.1498644 1.628267
        [,15]     [,16]    [,17]     [,18]     [,19]     [,20]    [,21]
[1,] 1.010006 0.6331301 -1.92577 0.1061982 0.9547884 0.7149305 0.202974
[2,] 1.010006 0.6331301 -1.92577 0.1061982 0.9547884 0.7149305 0.202974
         [,22]     [,23]     [,24]     [,25]      [,26]     [,27]      [,28]
[1,] 0.6583041 0.5148998 0.2095248 -1.710989 -0.8527305 0.8688548 0.03960473
[2,] 0.6583041 0.5148998 0.2095248 -1.710989 -0.8527305 0.8688548 0.03960473
          [,29]    [,30]     [,31]      [,32]     [,33]      [,34]     [,35]
[1,] -0.5471888 1.378324 0.9790829 -0.1997611 0.7722909 -0.3387959 0.2089641
[2,] -0.5471888 1.378324 0.9790829 -0.1997611 0.7722909 -0.3387959 0.2089641
         [,36]      [,37]     [,38]     [,39]     [,40]      [,41]     [,42]
[1,] 0.3184744 0.03020397 0.8994218 0.5883327 0.7068001 -0.6338409 0.9176315
[2,] 0.3184744 0.03020397 0.8994218 0.5883327 0.7068001 -0.6338409 0.9176315
          [,43]     [,44]       [,45]      [,46]      [,47]     [,48]    [,49]
[1,] -0.5370176 0.8839242 -0.07652844 -0.7887831 -0.6097722 0.2848588 1.409438
[2,] -0.5370176 0.8839242 -0.07652844 -0.7887831 -0.6097722 0.2848588 1.409438
          [,50]    [,51]      [,52]     [,53]      [,54]     [,55]      [,56]
[1,] -0.3566107 1.116901 -0.3731045 -1.500113 -0.6754006 0.4742611 -0.1751802
[2,] -0.3566107 1.116901 -0.3731045 -1.500113 -0.6754006 0.4742611 -0.1751802
         [,57]     [,58]     [,59]    [,60]      [,61]     [,62]     [,63]
[1,] 0.8024758 0.6846054 0.9421611 1.886952 -0.2395897 0.1028118 0.8320628
[2,] 0.8024758 0.6846054 0.9421611 1.886952 -0.2395897 0.1028118 0.8320628
          [,64]     [,65]   [,66]     [,67]     [,68]      [,69]    [,70]
[1,] -0.6914416 0.4714405 1.41064 0.5672129 0.1009742 -0.4592487 1.666282
[2,] -0.6914416 0.4714405 1.41064 0.5672129 0.1009742 -0.4592487 1.666282
        [,71]     [,72]     [,73]     [,74]     [,75]      [,76]       [,77]
[1,] 1.917778 0.8404291 -0.372731 0.6958173 0.8419766 -0.3285287 0.009052554
[2,] 1.917778 0.8404291 -0.372731 0.6958173 0.8419766 -0.3285287 0.009052554
         [,78]     [,79]    [,80]     [,81]     [,82]     [,83]       [,84]
[1,] -1.210486 0.4286799 0.885489 -1.079099 0.6207395 0.2228869 -0.04124173
[2,] -1.210486 0.4286799 0.885489 -1.079099 0.6207395 0.2228869 -0.04124173
         [,85]     [,86]    [,87]     [,88]      [,89]    [,90]       [,91]
[1,] -1.848833 -1.069854 1.207029 -1.442327 -0.9466914 1.989371 -0.08149631
[2,] -1.848833 -1.069854 1.207029 -1.442327 -0.9466914 1.989371 -0.08149631
         [,92]      [,93]    [,94]      [,95]    [,96]    [,97]      [,98]
[1,] -1.631676 -0.3403573 1.034913 -0.8946243 1.226522 1.363749 -0.7384557
[2,] -1.631676 -0.3403573 1.034913 -0.8946243 1.226522 1.363749 -0.7384557
          [,99]     [,100]
[1,] -0.9723701 -0.4502101
[2,] -0.9723701 -0.4502101
> 
> 
> Max(tmp2)
[1] 2.625234
> Min(tmp2)
[1] -2.864787
> mean(tmp2)
[1] -0.06038239
> Sum(tmp2)
[1] -6.038239
> Var(tmp2)
[1] 0.998427
> 
> rowMeans(tmp2)
  [1]  0.55120221  1.03432524 -0.28807373 -0.10944405  0.98033356 -0.54026532
  [7]  1.12542182 -0.44141636  2.09446340 -0.50027520  1.15315014  1.06939752
 [13]  0.37655893 -0.65402693  0.59507445 -0.41358499 -1.30013319 -1.16027877
 [19] -0.61991540 -0.68645101  0.39115161  1.41358368  0.31981843 -1.23152502
 [25] -0.67414552  1.05897859 -0.43243502  1.02169646  0.45023248 -1.84245233
 [31] -1.13929821  0.14849494  0.42620506  0.27547672 -0.29873515 -0.28605360
 [37]  0.21069820 -0.18341128 -0.33774305  0.03487211 -0.52675107 -0.91215246
 [43] -2.86478731 -0.47891290  1.17776422 -1.41079174  1.36312542 -0.87656659
 [49] -0.53490576 -0.78815512  0.76872112  0.09219640 -0.60412636  0.81482353
 [55]  0.84439542  0.01699766 -0.40249103 -0.06721257 -1.01786235 -1.88434084
 [61] -1.08622457  0.26640074 -1.01001814  1.36062963 -0.94876679 -0.98628673
 [67]  0.38000674  0.47236411  0.09988682  0.92784296 -0.66751228 -1.27464059
 [73] -1.28674196 -0.43705847  1.24408391  0.93950110  2.62523440  0.72765844
 [79]  0.05336456  0.17930306 -0.68917297 -0.55810578 -0.18399749  0.78373824
 [85] -1.51404990  2.13283617  0.45866197  1.91707981 -1.64387016 -1.09133665
 [91] -0.06208341 -0.28978517  1.39550383 -0.84028698 -0.75471858  0.60027188
 [97]  0.98762812 -1.48361198  0.62812234 -1.71052810
> rowSums(tmp2)
  [1]  0.55120221  1.03432524 -0.28807373 -0.10944405  0.98033356 -0.54026532
  [7]  1.12542182 -0.44141636  2.09446340 -0.50027520  1.15315014  1.06939752
 [13]  0.37655893 -0.65402693  0.59507445 -0.41358499 -1.30013319 -1.16027877
 [19] -0.61991540 -0.68645101  0.39115161  1.41358368  0.31981843 -1.23152502
 [25] -0.67414552  1.05897859 -0.43243502  1.02169646  0.45023248 -1.84245233
 [31] -1.13929821  0.14849494  0.42620506  0.27547672 -0.29873515 -0.28605360
 [37]  0.21069820 -0.18341128 -0.33774305  0.03487211 -0.52675107 -0.91215246
 [43] -2.86478731 -0.47891290  1.17776422 -1.41079174  1.36312542 -0.87656659
 [49] -0.53490576 -0.78815512  0.76872112  0.09219640 -0.60412636  0.81482353
 [55]  0.84439542  0.01699766 -0.40249103 -0.06721257 -1.01786235 -1.88434084
 [61] -1.08622457  0.26640074 -1.01001814  1.36062963 -0.94876679 -0.98628673
 [67]  0.38000674  0.47236411  0.09988682  0.92784296 -0.66751228 -1.27464059
 [73] -1.28674196 -0.43705847  1.24408391  0.93950110  2.62523440  0.72765844
 [79]  0.05336456  0.17930306 -0.68917297 -0.55810578 -0.18399749  0.78373824
 [85] -1.51404990  2.13283617  0.45866197  1.91707981 -1.64387016 -1.09133665
 [91] -0.06208341 -0.28978517  1.39550383 -0.84028698 -0.75471858  0.60027188
 [97]  0.98762812 -1.48361198  0.62812234 -1.71052810
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  0.55120221  1.03432524 -0.28807373 -0.10944405  0.98033356 -0.54026532
  [7]  1.12542182 -0.44141636  2.09446340 -0.50027520  1.15315014  1.06939752
 [13]  0.37655893 -0.65402693  0.59507445 -0.41358499 -1.30013319 -1.16027877
 [19] -0.61991540 -0.68645101  0.39115161  1.41358368  0.31981843 -1.23152502
 [25] -0.67414552  1.05897859 -0.43243502  1.02169646  0.45023248 -1.84245233
 [31] -1.13929821  0.14849494  0.42620506  0.27547672 -0.29873515 -0.28605360
 [37]  0.21069820 -0.18341128 -0.33774305  0.03487211 -0.52675107 -0.91215246
 [43] -2.86478731 -0.47891290  1.17776422 -1.41079174  1.36312542 -0.87656659
 [49] -0.53490576 -0.78815512  0.76872112  0.09219640 -0.60412636  0.81482353
 [55]  0.84439542  0.01699766 -0.40249103 -0.06721257 -1.01786235 -1.88434084
 [61] -1.08622457  0.26640074 -1.01001814  1.36062963 -0.94876679 -0.98628673
 [67]  0.38000674  0.47236411  0.09988682  0.92784296 -0.66751228 -1.27464059
 [73] -1.28674196 -0.43705847  1.24408391  0.93950110  2.62523440  0.72765844
 [79]  0.05336456  0.17930306 -0.68917297 -0.55810578 -0.18399749  0.78373824
 [85] -1.51404990  2.13283617  0.45866197  1.91707981 -1.64387016 -1.09133665
 [91] -0.06208341 -0.28978517  1.39550383 -0.84028698 -0.75471858  0.60027188
 [97]  0.98762812 -1.48361198  0.62812234 -1.71052810
> rowMin(tmp2)
  [1]  0.55120221  1.03432524 -0.28807373 -0.10944405  0.98033356 -0.54026532
  [7]  1.12542182 -0.44141636  2.09446340 -0.50027520  1.15315014  1.06939752
 [13]  0.37655893 -0.65402693  0.59507445 -0.41358499 -1.30013319 -1.16027877
 [19] -0.61991540 -0.68645101  0.39115161  1.41358368  0.31981843 -1.23152502
 [25] -0.67414552  1.05897859 -0.43243502  1.02169646  0.45023248 -1.84245233
 [31] -1.13929821  0.14849494  0.42620506  0.27547672 -0.29873515 -0.28605360
 [37]  0.21069820 -0.18341128 -0.33774305  0.03487211 -0.52675107 -0.91215246
 [43] -2.86478731 -0.47891290  1.17776422 -1.41079174  1.36312542 -0.87656659
 [49] -0.53490576 -0.78815512  0.76872112  0.09219640 -0.60412636  0.81482353
 [55]  0.84439542  0.01699766 -0.40249103 -0.06721257 -1.01786235 -1.88434084
 [61] -1.08622457  0.26640074 -1.01001814  1.36062963 -0.94876679 -0.98628673
 [67]  0.38000674  0.47236411  0.09988682  0.92784296 -0.66751228 -1.27464059
 [73] -1.28674196 -0.43705847  1.24408391  0.93950110  2.62523440  0.72765844
 [79]  0.05336456  0.17930306 -0.68917297 -0.55810578 -0.18399749  0.78373824
 [85] -1.51404990  2.13283617  0.45866197  1.91707981 -1.64387016 -1.09133665
 [91] -0.06208341 -0.28978517  1.39550383 -0.84028698 -0.75471858  0.60027188
 [97]  0.98762812 -1.48361198  0.62812234 -1.71052810
> 
> colMeans(tmp2)
[1] -0.06038239
> colSums(tmp2)
[1] -6.038239
> colVars(tmp2)
[1] 0.998427
> colSd(tmp2)
[1] 0.9992132
> colMax(tmp2)
[1] 2.625234
> colMin(tmp2)
[1] -2.864787
> colMedians(tmp2)
[1] -0.1464277
> colRanges(tmp2)
          [,1]
[1,] -2.864787
[2,]  2.625234
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.55582119  0.07198868  5.06062938 -1.51735745  5.37988718 -1.33214717
 [7]  5.10075625  0.32774332  0.09643764  0.46100606
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.34314721
[2,] -0.17514480
[3,]  0.08180809
[4,]  0.56877590
[5,]  0.83331120
> 
> rowApply(tmp,sum)
 [1]  0.2828485  7.4679191  5.0946066 -3.3735879 -5.0057809  2.3086127
 [7]  1.4765699  3.6917206  3.6838367 -1.4219803
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    6    6    2    9   10    6    5    6    1     3
 [2,]    8    1    7    5    2    2    9    7    5     6
 [3,]    9    8    3    8    8    4    7    8    6     4
 [4,]    2    9   10    1    1    1    8    2    7     5
 [5,]    3    7    9   10    6   10    1    5    3     8
 [6,]    4    2    6    7    5    7    2    1    9     1
 [7,]   10    4    8    4    3    8   10    3    8     2
 [8,]    7    5    4    3    4    3    4    4   10     7
 [9,]    5   10    1    6    9    5    3    9    4     9
[10,]    1    3    5    2    7    9    6   10    2    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.9946248 -0.5147813 -0.2065087  4.9777594  2.6516368  0.9030393
 [7]  1.2114668  0.4049099  3.1655928  0.2062170 -2.1476323 -3.4012426
[13] -2.0180175  3.1878668  0.4863563  1.7709380  1.7810072 -1.5330440
[19]  0.3185766 -0.9113611
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5612703
[2,]  0.2029191
[3,]  0.4480471
[4,]  1.4319087
[5,]  1.4730201
> 
> rowApply(tmp,sum)
[1]  0.8603928 -0.6170721 -0.1475070  5.8599312  6.3716595
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   10    2   12   19   18
[2,]   19   11    3    1   14
[3,]    1   18    5   20   10
[4,]   11   15   19   18   16
[5,]   18    6   18   11   15
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]      [,4]       [,5]       [,6]
[1,]  0.4480471  0.8860941 -3.0469707 0.4996726  0.8834336 -1.3181477
[2,] -1.5612703 -0.2258700  1.2368106 0.6959970 -0.4616207  1.4893536
[3,]  0.2029191 -0.7934806 -0.6206920 1.4525188  0.9977654  0.6755545
[4,]  1.4730201 -1.1146978  1.8731749 1.2693305  0.4740611  0.2452149
[5,]  1.4319087  0.7331730  0.3511685 1.0602406  0.7579975 -0.1889360
           [,7]        [,8]        [,9]      [,10]      [,11]      [,12]
[1,] -0.5932593  0.62269513  1.59231802 -0.1758204  0.5118713 -0.8471100
[2,] -0.5498898 -0.33931401  0.04747796  0.2987548 -0.4212662 -1.3239873
[3,]  1.7636599 -0.06163379 -0.44057089  0.3532201 -0.3257317 -0.9872795
[4,]  0.2256029  1.05443586  0.45889675 -0.9623587 -0.2451359  0.1798913
[5,]  0.3653530 -0.87127324  1.50747093  0.6924212 -1.6673699 -0.4227571
          [,13]      [,14]      [,15]      [,16]        [,17]      [,18]
[1,] -0.5491468  0.6201439  0.7369135 -0.3453931 -0.256785145  0.8235809
[2,] -1.3365475 -0.3099883 -0.3077406  0.6514637  1.031997979 -1.5668331
[3,] -0.6868433  0.5296141 -0.4067402  0.7824839  0.155985562 -0.4683304
[4,]  0.7113095  0.8312945 -0.7945119  0.5847096  0.841919259  0.7886602
[5,] -0.1567894  1.5168026  1.2584356  0.0976739  0.007889545 -1.1101215
          [,19]      [,20]
[1,] -0.3272568  0.6955126
[2,]  0.7891917  1.5462084
[3,]  0.2201449 -2.4900709
[4,] -1.0492950 -0.9855910
[5,]  0.6857918  0.3225798
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1      col2      col3      col4     col5       col6      col7
row1 0.4855953 0.6007159 0.1598437 -1.783932 1.282495 0.07894916 -1.038453
          col8       col9      col10      col11     col12     col13      col14
row1 -1.482976 -0.4500745 -0.0152546 -0.3668087 -2.309434 0.0762444 -0.5952556
          col15    col16     col17     col18     col19     col20
row1 -0.1387581 1.322331 0.1077433 0.8454661 -1.331277 0.1380536
> tmp[,"col10"]
          col10
row1 -0.0152546
row2 -1.4355127
row3  1.1248084
row4  1.1798296
row5  2.3744888
> tmp[c("row1","row5"),]
           col1      col2       col3      col4       col5        col6      col7
row1  0.4855953 0.6007159  0.1598437 -1.783932  1.2824952  0.07894916 -1.038453
row5 -0.6395211 0.5897494 -0.1834950  1.202295 -0.8992427 -0.70665666 -0.828424
          col8       col9      col10      col11     col12     col13      col14
row1 -1.482976 -0.4500745 -0.0152546 -0.3668087 -2.309434 0.0762444 -0.5952556
row5  0.240018  0.7747894  2.3744888  0.8669550 -1.046508 0.9617928  1.2270977
          col15      col16      col17     col18     col19      col20
row1 -0.1387581  1.3223315  0.1077433 0.8454661 -1.331277  0.1380536
row5 -0.1537034 -0.6536463 -0.5905628 0.4835034  0.319302 -0.1906974
> tmp[,c("col6","col20")]
            col6      col20
row1  0.07894916  0.1380536
row2 -0.03554899 -0.7236617
row3 -1.21586565  1.0518212
row4 -0.40641193  0.7011159
row5 -0.70665666 -0.1906974
> tmp[c("row1","row5"),c("col6","col20")]
            col6      col20
row1  0.07894916  0.1380536
row5 -0.70665666 -0.1906974
> 
> 
> 
> 
> 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.93398 48.94298 48.59003 49.6392 50.46412 105.5834 51.24772 49.09525
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.78255 50.40473 49.93126 49.63773 49.11957 49.75461 48.65258 50.41995
        col17    col18   col19    col20
row1 50.41001 50.60066 51.5561 107.1764
> tmp[,"col10"]
        col10
row1 50.40473
row2 29.07056
row3 30.18286
row4 30.17404
row5 50.20619
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.93398 48.94298 48.59003 49.63920 50.46412 105.5834 51.24772 49.09525
row5 50.08577 49.22885 48.94510 48.30273 51.28880 106.5262 49.56973 48.60876
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.78255 50.40473 49.93126 49.63773 49.11957 49.75461 48.65258 50.41995
row5 48.61314 50.20619 51.76530 49.95912 50.40045 49.98421 50.75910 49.96664
        col17    col18    col19    col20
row1 50.41001 50.60066 51.55610 107.1764
row5 50.40244 49.58003 50.65223 105.5217
> tmp[,c("col6","col20")]
          col6     col20
row1 105.58339 107.17637
row2  74.88942  77.41872
row3  74.41666  73.85542
row4  74.35837  75.54240
row5 106.52621 105.52175
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.5834 107.1764
row5 106.5262 105.5217
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.5834 107.1764
row5 106.5262 105.5217
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.1618972
[2,] -1.4620753
[3,]  1.1454275
[4,]  1.5199784
[5,]  0.2765887
> tmp[,c("col17","col7")]
          col17       col7
[1,] -1.1120351  0.1210203
[2,]  0.7761329  0.1442748
[3,]  0.9989783 -0.6296344
[4,]  2.0125998 -1.0661478
[5,]  1.2197471  1.4175658
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6     col20
[1,]  0.6223694 0.7847841
[2,]  0.1010638 0.3878688
[3,]  1.7825411 0.6470227
[4,] -0.3836748 0.7745203
[5,] -1.7919250 0.8503652
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.6223694
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.6223694
[2,] 0.1010638
> 
> 
> 
> 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.0664454 1.7221390 0.06579695  0.4156266 -0.09918505  1.7743449
row1 0.1589745 0.5810021 0.26549067 -0.9792945  1.67784678 -0.8145038
           [,7]       [,8]       [,9]     [,10]      [,11]     [,12]      [,13]
row3 -0.2604761 -0.4225023 -0.5263903  1.734266 -2.5952387  0.470695  0.9566412
row1 -1.2646952  0.8354566  0.8309139 -1.210900  0.9854556 -1.732228 -0.3852433
          [,14]       [,15]      [,16]      [,17]     [,18]      [,19]
row3 -0.1709007 -0.80420820  0.4181905 -0.6954184 0.1206605 -0.5436048
row1 -1.8064534  0.01903283 -0.1546202 -0.5179834 1.1103011  0.2078738
         [,20]
row3 2.2088783
row1 0.1583932
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]     [,2]       [,3]      [,4]     [,5]       [,6]      [,7]
row2 -0.2340178 0.821748 0.05964853 0.1948299 1.214611 -0.1846677 0.9457795
           [,8]     [,9]    [,10]
row2 -0.7149842 0.547149 -0.76293
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]       [,2]      [,3]       [,4]      [,5]       [,6]      [,7]
row5 -0.4437486 -0.1625871 -1.076088 0.05470158 0.6695337 -0.7372124 -1.363413
          [,8]      [,9]      [,10]    [,11]     [,12]      [,13]     [,14]
row5 0.6990343 -0.322433 -0.5706609 1.265642 -1.998109 0.02255828 0.6504889
          [,15]    [,16]      [,17]     [,18]      [,19]     [,20]
row5 -0.9693855 1.138432 0.06061104 0.6827151 -0.7852247 -1.415134
> 
> 
> 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: 0x5b60399a1060>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM21010228acdd5c"
 [2] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM2101024008bf14"
 [3] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM2101027a1632cf"
 [4] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM210102361834f2"
 [5] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM21010228482d6d"
 [6] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM2101027bc04a91"
 [7] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM21010214f68abc"
 [8] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM210102721fd9c4"
 [9] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM2101024283cd89"
[10] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM2101023454bed5"
[11] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM21010264b39175"
[12] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM2101025df78c69"
[13] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM210102898eb68" 
[14] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM21010265918696"
[15] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM2101025ec40d49"
> 
> 
> ### 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: 0x5b603bae0c20>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5b603bae0c20>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5b603bae0c20>
> rowMedians(tmp)
  [1]  0.820793345  0.300998661 -0.376236689  0.221028011 -0.459027025
  [6] -0.167744942 -0.756573720  0.089640592 -0.127166201  0.434663110
 [11]  0.317726248  0.851835407 -0.184406740  0.082868346 -0.162372147
 [16] -0.345951584 -0.041138248 -0.437979459  0.120735834 -0.351274838
 [21] -0.186771066 -0.070414537 -0.248528722 -0.082002384  0.504334376
 [26] -0.239989575  0.639027063  0.501466144 -0.210900813 -0.205825229
 [31] -0.335142212 -0.244755764  0.124245029  0.455767273 -0.349894371
 [36]  0.040357359 -0.733838366 -0.284827679  0.245843402 -0.431912962
 [41]  0.009366357 -0.182945603  0.340558673  0.067470528  0.139170734
 [46] -0.120734168 -0.030616407 -0.258370552  0.386912934 -0.269445141
 [51]  0.338149289 -0.133602877 -0.151667258 -0.045609953  0.255187403
 [56] -0.074151995 -0.636113987  0.044486177  0.359086503  0.065386462
 [61] -0.501807758 -0.576134055  0.189616949 -0.530017792 -0.031146660
 [66] -0.639158053 -0.051527181  0.200987816 -0.502869772  0.319296772
 [71]  0.623082394  0.702041634 -0.291352864 -0.370906370 -0.005485414
 [76] -0.289705836  0.225322291 -0.401180023  0.688557130  0.649132265
 [81]  0.341633745 -0.582305181 -0.342149478 -0.544165776 -0.200993850
 [86] -0.108767855  0.238857554 -0.078207680  0.105546088 -0.182038134
 [91] -0.212907221  0.093840782 -0.745020024  0.321749595 -0.085867470
 [96]  0.583410448  0.116509458  0.278938517 -0.147543106 -0.011314079
[101] -0.571142109 -0.368124505 -0.831983648 -0.333861071 -0.375221988
[106] -0.375791523  0.250570363 -0.262971683 -0.228930176  0.219035012
[111] -0.355831805 -0.397814785  0.548916324  0.120799933 -0.290331244
[116]  0.175028973 -0.283452390 -0.384563073  0.021498066 -0.039099652
[121]  0.174250499  0.513576671 -0.309443477  0.280453329 -0.304236396
[126]  0.025309163  0.112176988  0.135556937  0.391595884 -0.195991012
[131]  0.002710302  0.293244632 -0.049470442 -1.137106765  0.421684369
[136] -0.136300630 -0.200230860 -0.546967321 -0.005184376 -0.225839324
[141]  0.536009017 -0.347357093 -0.600200072 -0.028857175 -0.166419298
[146] -0.232668342 -0.353981785  0.356783077  0.432936822 -0.395034111
[151]  0.658054108  0.112719441  0.146231417 -0.594856287  0.226092147
[156]  0.122311320 -0.215572825  0.070921264 -0.017550152  0.199872351
[161]  0.335870456 -0.257324562  0.351695629 -0.186730124  0.509226119
[166]  0.467396771 -0.042466494 -0.062377098  0.072958435  0.338455653
[171] -0.014197566 -0.158517771  0.088234591  0.585417280  0.028681968
[176] -0.147696810  0.217803559  0.219740331 -0.140043656 -0.250814271
[181]  0.072063255  0.474251869  0.059377977 -0.547198423 -0.043078044
[186] -0.094772097 -0.135921216 -0.621614270  0.055336302 -0.584734722
[191] -0.206807494 -0.215821169 -0.204203273  0.280215522  0.097743238
[196] -0.271041770 -0.121210558 -0.127784353 -0.089278316  0.526126433
[201]  0.215096406  0.521234546 -0.437559952 -0.258076520  0.305672397
[206]  0.570025607 -0.097649878  0.094364980 -0.230900569  0.264694995
[211] -0.014701311 -0.005663938  0.043711153 -0.265211135 -0.112554091
[216]  0.190703928  0.151958215  0.232604928 -0.221829872  0.476067532
[221] -0.260524017 -0.180376956 -0.030159044 -0.158215543  0.055475817
[226] -0.189373822 -0.102506505  0.671584606  0.274164413  0.303467350
> 
> proc.time()
   user  system elapsed 
  1.373   1.549   2.911 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x63769d26d0f0>
> .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: 0x63769d26d0f0>
> .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: 0x63769d26d0f0>
> .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: 0x63769d26d0f0>
> 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: 0x63769e0bb690>
> .Call("R_bm_AddColumn",P)
<pointer: 0x63769e0bb690>
> .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: 0x63769e0bb690>
> .Call("R_bm_AddColumn",P)
<pointer: 0x63769e0bb690>
> .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: 0x63769e0bb690>
> 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: 0x63769faf5010>
> .Call("R_bm_AddColumn",P)
<pointer: 0x63769faf5010>
> .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: 0x63769faf5010>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x63769faf5010>
> .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: 0x63769faf5010>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x63769faf5010>
> .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: 0x63769faf5010>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x63769faf5010>
> .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: 0x63769faf5010>
> 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: 0x63769fb45070>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x63769fb45070>
> .Call("R_bm_AddColumn",P)
<pointer: 0x63769fb45070>
> .Call("R_bm_AddColumn",P)
<pointer: 0x63769fb45070>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2102881ab9602"  "BufferedMatrixFile2102883063d2a8"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2102881ab9602"  "BufferedMatrixFile2102883063d2a8"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x63769d7ff7e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x63769d7ff7e0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x63769d7ff7e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x63769d7ff7e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x63769d7ff7e0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x63769d7ff7e0>
> .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: 0x63769f79b3b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x63769f79b3b0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x63769f79b3b0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x63769f79b3b0>
> 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: 0x63769d961520>
> .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: 0x63769d961520>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.230   0.064   0.283 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

Example timings