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

This page was generated on 2026-04-22 11:57 -0400 (Wed, 22 Apr 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.4 LTS)x86_644.6.0 RC (2026-04-17 r89917) -- "Because it was There" 4796
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 249/2351HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.75.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-04-21 14:59 -0400 (Tue, 21 Apr 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: ecdbf23
git_last_commit_date: 2025-10-29 09:58:55 -0400 (Wed, 29 Oct 2025)
nebbiolo2Linux (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 nebbiolo2

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

raw results


Summary

Package: BufferedMatrix
Version: 1.75.0
Command: /home/biocbuild/bbs-3.24-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.24-bioc/R/site-library --timings BufferedMatrix_1.75.0.tar.gz
StartedAt: 2026-04-21 22:27:46 -0400 (Tue, 21 Apr 2026)
EndedAt: 2026-04-21 22:28:10 -0400 (Tue, 21 Apr 2026)
EllapsedTime: 24.2 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.24-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-04-22 02:27:46 UTC
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.75.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.24-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.24-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.75.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.24-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.24-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.24-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.24-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.24-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.24-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.24-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.257   0.042   0.288 

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.24-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] "Tue Apr 21 22:28:01 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Apr 21 22:28:01 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: 0x648bc80ab520>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Apr 21 22:28:02 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Apr 21 22:28:02 2026"
> 
> ColMode(tmp2)
<pointer: 0x648bc80ab520>
> 
> 
> 
> ### 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,] 98.6414916  1.2479261  0.27916490 -1.6294996
[2,]  0.6260028 -0.4333539  0.08479309 -0.6533520
[3,]  0.9735015  1.0628269 -0.85146613  0.7421449
[4,]  1.5289008  0.1840108  2.01402656  0.8567364
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.24-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,] 98.6414916 1.2479261 0.27916490 1.6294996
[2,]  0.6260028 0.4333539 0.08479309 0.6533520
[3,]  0.9735015 1.0628269 0.85146613 0.7421449
[4,]  1.5289008 0.1840108 2.01402656 0.8567364
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9318423 1.1171061 0.5283606 1.2765185
[2,] 0.7912034 0.6582962 0.2911925 0.8083019
[3,] 0.9866618 1.0309350 0.9227492 0.8614783
[4,] 1.2364873 0.4289648 1.4191640 0.9256006
> 
> 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.24-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,] 222.95991 37.41899 30.56277 39.39469
[2,]  33.53804 32.01632 27.99672 33.73637
[3,]  35.84012 36.37218 35.07896 34.35693
[4,]  38.89377 29.47366 41.20567 35.11274
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x648bc98a49d0>
> exp(tmp5)
<pointer: 0x648bc98a49d0>
> log(tmp5,2)
<pointer: 0x648bc98a49d0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 464.0619
> Min(tmp5)
[1] 53.93708
> mean(tmp5)
[1] 74.03432
> Sum(tmp5)
[1] 14806.86
> Var(tmp5)
[1] 836.1864
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.38148 70.08046 73.84104 73.49325 72.23847 69.11648 75.24916 69.19010
 [9] 71.59404 73.15870
> rowSums(tmp5)
 [1] 1847.630 1401.609 1476.821 1469.865 1444.769 1382.330 1504.983 1383.802
 [9] 1431.881 1463.174
> rowVars(tmp5)
 [1] 7705.80854   68.54568   53.39904   76.45945   46.49683   58.17965
 [7]   76.04307   86.72649   58.54475   94.42662
> rowSd(tmp5)
 [1] 87.782735  8.279232  7.307465  8.744109  6.818858  7.627559  8.720268
 [8]  9.312706  7.651454  9.717336
> rowMax(tmp5)
 [1] 464.06185  87.82239  86.90706  87.28831  85.15664  84.31931  92.64372
 [8]  88.28482  87.11098  97.54408
> rowMin(tmp5)
 [1] 59.86809 54.93617 62.56190 60.34213 58.49987 55.54634 59.26666 53.93708
 [9] 59.83844 59.12080
> 
> colMeans(tmp5)
 [1] 110.97629  71.96889  73.76502  76.65710  69.67718  73.54694  71.94378
 [8]  72.93348  72.62619  74.38107  71.60667  68.11159  71.05676  71.63414
[15]  70.68536  73.82181  73.25207  72.77156  74.68766  64.58279
> colSums(tmp5)
 [1] 1109.7629  719.6889  737.6502  766.5710  696.7718  735.4694  719.4378
 [8]  729.3348  726.2619  743.8107  716.0667  681.1159  710.5676  716.3414
[15]  706.8536  738.2181  732.5207  727.7156  746.8766  645.8279
> colVars(tmp5)
 [1] 15458.76658    57.88133   106.52248    82.69720    47.67187    94.09354
 [7]    37.81753    65.41554    40.01026   103.76826    42.96731    35.23758
[13]   128.98124   120.02037    25.41439    84.57698    48.93532    63.64896
[19]    52.88618    56.52000
> colSd(tmp5)
 [1] 124.333288   7.607978  10.320973   9.093800   6.904482   9.700182
 [7]   6.149596   8.087987   6.325366  10.186671   6.554945   5.936125
[13]  11.356991  10.955381   5.041269   9.196574   6.995378   7.978030
[19]   7.272288   7.517978
> colMax(tmp5)
 [1] 464.06185  81.58845  88.28482  97.54408  81.03897  92.09251  83.97702
 [8]  86.31713  79.37244  96.45366  80.90016  77.50486  87.82239  92.64372
[15]  79.75514  87.11098  84.83747  84.39501  87.28831  75.69596
> colMin(tmp5)
 [1] 59.83844 61.34556 58.27150 67.74011 58.93872 60.32313 60.60942 62.69280
 [9] 63.77181 59.49477 59.26666 59.12080 53.93708 56.82137 63.34598 61.08431
[17] 62.85611 58.26357 64.32271 54.93617
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 92.38148 70.08046 73.84104 73.49325       NA 69.11648 75.24916 69.19010
 [9] 71.59404 73.15870
> rowSums(tmp5)
 [1] 1847.630 1401.609 1476.821 1469.865       NA 1382.330 1504.983 1383.802
 [9] 1431.881 1463.174
> rowVars(tmp5)
 [1] 7705.80854   68.54568   53.39904   76.45945   38.04203   58.17965
 [7]   76.04307   86.72649   58.54475   94.42662
> rowSd(tmp5)
 [1] 87.782735  8.279232  7.307465  8.744109  6.167822  7.627559  8.720268
 [8]  9.312706  7.651454  9.717336
> rowMax(tmp5)
 [1] 464.06185  87.82239  86.90706  87.28831        NA  84.31931  92.64372
 [8]  88.28482  87.11098  97.54408
> rowMin(tmp5)
 [1] 59.86809 54.93617 62.56190 60.34213       NA 55.54634 59.26666 53.93708
 [9] 59.83844 59.12080
> 
> colMeans(tmp5)
 [1] 110.97629  71.96889  73.76502  76.65710  69.67718  73.54694  71.94378
 [8]  72.93348  72.62619  74.38107  71.60667  68.11159        NA  71.63414
[15]  70.68536  73.82181  73.25207  72.77156  74.68766  64.58279
> colSums(tmp5)
 [1] 1109.7629  719.6889  737.6502  766.5710  696.7718  735.4694  719.4378
 [8]  729.3348  726.2619  743.8107  716.0667  681.1159        NA  716.3414
[15]  706.8536  738.2181  732.5207  727.7156  746.8766  645.8279
> colVars(tmp5)
 [1] 15458.76658    57.88133   106.52248    82.69720    47.67187    94.09354
 [7]    37.81753    65.41554    40.01026   103.76826    42.96731    35.23758
[13]          NA   120.02037    25.41439    84.57698    48.93532    63.64896
[19]    52.88618    56.52000
> colSd(tmp5)
 [1] 124.333288   7.607978  10.320973   9.093800   6.904482   9.700182
 [7]   6.149596   8.087987   6.325366  10.186671   6.554945   5.936125
[13]         NA  10.955381   5.041269   9.196574   6.995378   7.978030
[19]   7.272288   7.517978
> colMax(tmp5)
 [1] 464.06185  81.58845  88.28482  97.54408  81.03897  92.09251  83.97702
 [8]  86.31713  79.37244  96.45366  80.90016  77.50486        NA  92.64372
[15]  79.75514  87.11098  84.83747  84.39501  87.28831  75.69596
> colMin(tmp5)
 [1] 59.83844 61.34556 58.27150 67.74011 58.93872 60.32313 60.60942 62.69280
 [9] 63.77181 59.49477 59.26666 59.12080       NA 56.82137 63.34598 61.08431
[17] 62.85611 58.26357 64.32271 54.93617
> 
> Max(tmp5,na.rm=TRUE)
[1] 464.0619
> Min(tmp5,na.rm=TRUE)
[1] 53.93708
> mean(tmp5,na.rm=TRUE)
[1] 74.11238
> Sum(tmp5,na.rm=TRUE)
[1] 14748.36
> Var(tmp5,na.rm=TRUE)
[1] 839.1846
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.38148 70.08046 73.84104 73.49325 72.96155 69.11648 75.24916 69.19010
 [9] 71.59404 73.15870
> rowSums(tmp5,na.rm=TRUE)
 [1] 1847.630 1401.609 1476.821 1469.865 1386.269 1382.330 1504.983 1383.802
 [9] 1431.881 1463.174
> rowVars(tmp5,na.rm=TRUE)
 [1] 7705.80854   68.54568   53.39904   76.45945   38.04203   58.17965
 [7]   76.04307   86.72649   58.54475   94.42662
> rowSd(tmp5,na.rm=TRUE)
 [1] 87.782735  8.279232  7.307465  8.744109  6.167822  7.627559  8.720268
 [8]  9.312706  7.651454  9.717336
> rowMax(tmp5,na.rm=TRUE)
 [1] 464.06185  87.82239  86.90706  87.28831  85.15664  84.31931  92.64372
 [8]  88.28482  87.11098  97.54408
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.86809 54.93617 62.56190 60.34213 58.93872 55.54634 59.26666 53.93708
 [9] 59.83844 59.12080
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.97629  71.96889  73.76502  76.65710  69.67718  73.54694  71.94378
 [8]  72.93348  72.62619  74.38107  71.60667  68.11159  72.45198  71.63414
[15]  70.68536  73.82181  73.25207  72.77156  74.68766  64.58279
> colSums(tmp5,na.rm=TRUE)
 [1] 1109.7629  719.6889  737.6502  766.5710  696.7718  735.4694  719.4378
 [8]  729.3348  726.2619  743.8107  716.0667  681.1159  652.0678  716.3414
[15]  706.8536  738.2181  732.5207  727.7156  746.8766  645.8279
> colVars(tmp5,na.rm=TRUE)
 [1] 15458.76658    57.88133   106.52248    82.69720    47.67187    94.09354
 [7]    37.81753    65.41554    40.01026   103.76826    42.96731    35.23758
[13]   123.20451   120.02037    25.41439    84.57698    48.93532    63.64896
[19]    52.88618    56.52000
> colSd(tmp5,na.rm=TRUE)
 [1] 124.333288   7.607978  10.320973   9.093800   6.904482   9.700182
 [7]   6.149596   8.087987   6.325366  10.186671   6.554945   5.936125
[13]  11.099753  10.955381   5.041269   9.196574   6.995378   7.978030
[19]   7.272288   7.517978
> colMax(tmp5,na.rm=TRUE)
 [1] 464.06185  81.58845  88.28482  97.54408  81.03897  92.09251  83.97702
 [8]  86.31713  79.37244  96.45366  80.90016  77.50486  87.82239  92.64372
[15]  79.75514  87.11098  84.83747  84.39501  87.28831  75.69596
> colMin(tmp5,na.rm=TRUE)
 [1] 59.83844 61.34556 58.27150 67.74011 58.93872 60.32313 60.60942 62.69280
 [9] 63.77181 59.49477 59.26666 59.12080 53.93708 56.82137 63.34598 61.08431
[17] 62.85611 58.26357 64.32271 54.93617
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.38148 70.08046 73.84104 73.49325      NaN 69.11648 75.24916 69.19010
 [9] 71.59404 73.15870
> rowSums(tmp5,na.rm=TRUE)
 [1] 1847.630 1401.609 1476.821 1469.865    0.000 1382.330 1504.983 1383.802
 [9] 1431.881 1463.174
> rowVars(tmp5,na.rm=TRUE)
 [1] 7705.80854   68.54568   53.39904   76.45945         NA   58.17965
 [7]   76.04307   86.72649   58.54475   94.42662
> rowSd(tmp5,na.rm=TRUE)
 [1] 87.782735  8.279232  7.307465  8.744109        NA  7.627559  8.720268
 [8]  9.312706  7.651454  9.717336
> rowMax(tmp5,na.rm=TRUE)
 [1] 464.06185  87.82239  86.90706  87.28831        NA  84.31931  92.64372
 [8]  88.28482  87.11098  97.54408
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.86809 54.93617 62.56190 60.34213       NA 55.54634 59.26666 53.93708
 [9] 59.83844 59.12080
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.84515  71.70986  73.52285  76.79960  70.87034  73.97824  71.95837
 [8]  74.04933  71.87660  74.21197  71.53992  67.37457       NaN  71.21865
[15]  70.77507  73.46194  74.40718  72.33824  74.93928  63.34800
> colSums(tmp5,na.rm=TRUE)
 [1] 1024.6063  645.3887  661.7057  691.1964  637.8331  665.8042  647.6253
 [8]  666.4439  646.8894  667.9077  643.8592  606.3712    0.0000  640.9679
[15]  636.9756  661.1575  669.6646  651.0441  674.4535  570.1320
> colVars(tmp5,na.rm=TRUE)
 [1] 17298.52149    64.36163   119.17803    92.80591    37.61493   103.76251
 [7]    42.54233    59.58490    38.69043   116.41760    48.28809    33.53143
[13]          NA   133.08084    28.50066    93.69219    40.04169    69.49269
[19]    58.78467    46.43186
> colSd(tmp5,na.rm=TRUE)
 [1] 131.523844   8.022570  10.916869   9.633582   6.133101  10.186388
 [7]   6.522448   7.719126   6.220163  10.789699   6.948964   5.790633
[13]         NA  11.536067   5.338601   9.679473   6.327850   8.336228
[19]   7.667116   6.814093
> colMax(tmp5,na.rm=TRUE)
 [1] 464.06185  81.58845  88.28482  97.54408  81.03897  92.09251  83.97702
 [8]  86.31713  79.34677  96.45366  80.90016  77.50486      -Inf  92.64372
[15]  79.75514  87.11098  84.83747  84.39501  87.28831  72.53168
> colMin(tmp5,na.rm=TRUE)
 [1] 59.83844 61.34556 58.27150 67.74011 61.68013 60.32313 60.60942 62.69280
 [9] 63.77181 59.49477 59.26666 59.12080      Inf 56.82137 63.34598 61.08431
[17] 65.54605 58.26357 64.32271 54.93617
> 
> 
> 
> 
> 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] 134.8151 209.1590 150.8591 155.5094 251.5315 294.6004 151.3490 268.7429
 [9] 182.7835 240.8826
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 134.8151 209.1590 150.8591 155.5094 251.5315 294.6004 151.3490 268.7429
 [9] 182.7835 240.8826
> 
> 
> 
> 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.136868e-13 -2.842171e-14  0.000000e+00 -5.684342e-14
 [6]  0.000000e+00 -2.842171e-14  2.842171e-14  2.842171e-14 -1.421085e-14
[11] -8.526513e-14  0.000000e+00 -2.842171e-14  5.684342e-14  3.410605e-13
[16]  0.000000e+00 -8.526513e-14  5.684342e-14 -1.421085e-13 -5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
4   9 
5   9 
3   14 
6   5 
9   1 
4   1 
10   7 
3   18 
8   1 
8   5 
5   12 
6   18 
7   2 
7   5 
3   6 
9   13 
8   5 
10   5 
4   14 
3   10 
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.986323
> Min(tmp)
[1] -2.104527
> mean(tmp)
[1] 0.0158031
> Sum(tmp)
[1] 1.58031
> Var(tmp)
[1] 0.9230231
> 
> rowMeans(tmp)
[1] 0.0158031
> rowSums(tmp)
[1] 1.58031
> rowVars(tmp)
[1] 0.9230231
> rowSd(tmp)
[1] 0.9607409
> rowMax(tmp)
[1] 1.986323
> rowMin(tmp)
[1] -2.104527
> 
> colMeans(tmp)
  [1]  0.667446686 -0.833820963 -0.162215337  0.287385452 -0.104258000
  [6]  0.231819391  0.603030412 -1.073179721  1.404863577  0.888274929
 [11] -0.141086751 -1.471769346 -1.860363725 -1.235176532  1.271469233
 [16]  0.194138969  1.804968490  0.533400601 -0.765748757 -0.903981352
 [21]  0.914424128 -0.007769363 -0.006637702 -0.635286430 -0.187523559
 [26] -0.898951298 -1.178013302 -0.027982379  1.158962732 -1.184736137
 [31]  0.537178839 -0.995372081  1.501635551 -1.376428513  1.344117068
 [36] -1.074845074  1.674582713  1.010607238  1.604370263 -0.021272731
 [41] -1.497206762  1.486662588  0.026396820 -0.392623818  0.138330901
 [46]  0.357720856 -0.142585487 -0.691577438  0.132263569  1.171480571
 [51] -0.808007283 -0.449889751  1.204834390  0.444157418  0.467879230
 [56] -0.039068341  1.986322516 -1.197226489  0.078023480  0.150426474
 [61] -0.621089253  0.257837708 -0.720280974 -0.018221777 -0.869961401
 [66] -1.027700961  0.293151452  0.556212591 -0.471880504 -1.002862164
 [71]  0.851944635  1.595141241  0.477109674 -0.865592279 -0.900138839
 [76] -0.015628449  0.702969845  0.792283182 -0.745138779  0.380734935
 [81]  0.309344068  1.162823731 -0.330306386 -0.007719954  0.306633963
 [86] -0.445856860  1.930680332  1.011869037 -0.526284461  0.597064849
 [91]  0.509300299 -1.773064338 -1.848425997 -1.784583122  0.676763316
 [96]  1.354250944 -0.511594975 -2.104527201  0.804977405 -0.312495110
> colSums(tmp)
  [1]  0.667446686 -0.833820963 -0.162215337  0.287385452 -0.104258000
  [6]  0.231819391  0.603030412 -1.073179721  1.404863577  0.888274929
 [11] -0.141086751 -1.471769346 -1.860363725 -1.235176532  1.271469233
 [16]  0.194138969  1.804968490  0.533400601 -0.765748757 -0.903981352
 [21]  0.914424128 -0.007769363 -0.006637702 -0.635286430 -0.187523559
 [26] -0.898951298 -1.178013302 -0.027982379  1.158962732 -1.184736137
 [31]  0.537178839 -0.995372081  1.501635551 -1.376428513  1.344117068
 [36] -1.074845074  1.674582713  1.010607238  1.604370263 -0.021272731
 [41] -1.497206762  1.486662588  0.026396820 -0.392623818  0.138330901
 [46]  0.357720856 -0.142585487 -0.691577438  0.132263569  1.171480571
 [51] -0.808007283 -0.449889751  1.204834390  0.444157418  0.467879230
 [56] -0.039068341  1.986322516 -1.197226489  0.078023480  0.150426474
 [61] -0.621089253  0.257837708 -0.720280974 -0.018221777 -0.869961401
 [66] -1.027700961  0.293151452  0.556212591 -0.471880504 -1.002862164
 [71]  0.851944635  1.595141241  0.477109674 -0.865592279 -0.900138839
 [76] -0.015628449  0.702969845  0.792283182 -0.745138779  0.380734935
 [81]  0.309344068  1.162823731 -0.330306386 -0.007719954  0.306633963
 [86] -0.445856860  1.930680332  1.011869037 -0.526284461  0.597064849
 [91]  0.509300299 -1.773064338 -1.848425997 -1.784583122  0.676763316
 [96]  1.354250944 -0.511594975 -2.104527201  0.804977405 -0.312495110
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.667446686 -0.833820963 -0.162215337  0.287385452 -0.104258000
  [6]  0.231819391  0.603030412 -1.073179721  1.404863577  0.888274929
 [11] -0.141086751 -1.471769346 -1.860363725 -1.235176532  1.271469233
 [16]  0.194138969  1.804968490  0.533400601 -0.765748757 -0.903981352
 [21]  0.914424128 -0.007769363 -0.006637702 -0.635286430 -0.187523559
 [26] -0.898951298 -1.178013302 -0.027982379  1.158962732 -1.184736137
 [31]  0.537178839 -0.995372081  1.501635551 -1.376428513  1.344117068
 [36] -1.074845074  1.674582713  1.010607238  1.604370263 -0.021272731
 [41] -1.497206762  1.486662588  0.026396820 -0.392623818  0.138330901
 [46]  0.357720856 -0.142585487 -0.691577438  0.132263569  1.171480571
 [51] -0.808007283 -0.449889751  1.204834390  0.444157418  0.467879230
 [56] -0.039068341  1.986322516 -1.197226489  0.078023480  0.150426474
 [61] -0.621089253  0.257837708 -0.720280974 -0.018221777 -0.869961401
 [66] -1.027700961  0.293151452  0.556212591 -0.471880504 -1.002862164
 [71]  0.851944635  1.595141241  0.477109674 -0.865592279 -0.900138839
 [76] -0.015628449  0.702969845  0.792283182 -0.745138779  0.380734935
 [81]  0.309344068  1.162823731 -0.330306386 -0.007719954  0.306633963
 [86] -0.445856860  1.930680332  1.011869037 -0.526284461  0.597064849
 [91]  0.509300299 -1.773064338 -1.848425997 -1.784583122  0.676763316
 [96]  1.354250944 -0.511594975 -2.104527201  0.804977405 -0.312495110
> colMin(tmp)
  [1]  0.667446686 -0.833820963 -0.162215337  0.287385452 -0.104258000
  [6]  0.231819391  0.603030412 -1.073179721  1.404863577  0.888274929
 [11] -0.141086751 -1.471769346 -1.860363725 -1.235176532  1.271469233
 [16]  0.194138969  1.804968490  0.533400601 -0.765748757 -0.903981352
 [21]  0.914424128 -0.007769363 -0.006637702 -0.635286430 -0.187523559
 [26] -0.898951298 -1.178013302 -0.027982379  1.158962732 -1.184736137
 [31]  0.537178839 -0.995372081  1.501635551 -1.376428513  1.344117068
 [36] -1.074845074  1.674582713  1.010607238  1.604370263 -0.021272731
 [41] -1.497206762  1.486662588  0.026396820 -0.392623818  0.138330901
 [46]  0.357720856 -0.142585487 -0.691577438  0.132263569  1.171480571
 [51] -0.808007283 -0.449889751  1.204834390  0.444157418  0.467879230
 [56] -0.039068341  1.986322516 -1.197226489  0.078023480  0.150426474
 [61] -0.621089253  0.257837708 -0.720280974 -0.018221777 -0.869961401
 [66] -1.027700961  0.293151452  0.556212591 -0.471880504 -1.002862164
 [71]  0.851944635  1.595141241  0.477109674 -0.865592279 -0.900138839
 [76] -0.015628449  0.702969845  0.792283182 -0.745138779  0.380734935
 [81]  0.309344068  1.162823731 -0.330306386 -0.007719954  0.306633963
 [86] -0.445856860  1.930680332  1.011869037 -0.526284461  0.597064849
 [91]  0.509300299 -1.773064338 -1.848425997 -1.784583122  0.676763316
 [96]  1.354250944 -0.511594975 -2.104527201  0.804977405 -0.312495110
> colMedians(tmp)
  [1]  0.667446686 -0.833820963 -0.162215337  0.287385452 -0.104258000
  [6]  0.231819391  0.603030412 -1.073179721  1.404863577  0.888274929
 [11] -0.141086751 -1.471769346 -1.860363725 -1.235176532  1.271469233
 [16]  0.194138969  1.804968490  0.533400601 -0.765748757 -0.903981352
 [21]  0.914424128 -0.007769363 -0.006637702 -0.635286430 -0.187523559
 [26] -0.898951298 -1.178013302 -0.027982379  1.158962732 -1.184736137
 [31]  0.537178839 -0.995372081  1.501635551 -1.376428513  1.344117068
 [36] -1.074845074  1.674582713  1.010607238  1.604370263 -0.021272731
 [41] -1.497206762  1.486662588  0.026396820 -0.392623818  0.138330901
 [46]  0.357720856 -0.142585487 -0.691577438  0.132263569  1.171480571
 [51] -0.808007283 -0.449889751  1.204834390  0.444157418  0.467879230
 [56] -0.039068341  1.986322516 -1.197226489  0.078023480  0.150426474
 [61] -0.621089253  0.257837708 -0.720280974 -0.018221777 -0.869961401
 [66] -1.027700961  0.293151452  0.556212591 -0.471880504 -1.002862164
 [71]  0.851944635  1.595141241  0.477109674 -0.865592279 -0.900138839
 [76] -0.015628449  0.702969845  0.792283182 -0.745138779  0.380734935
 [81]  0.309344068  1.162823731 -0.330306386 -0.007719954  0.306633963
 [86] -0.445856860  1.930680332  1.011869037 -0.526284461  0.597064849
 [91]  0.509300299 -1.773064338 -1.848425997 -1.784583122  0.676763316
 [96]  1.354250944 -0.511594975 -2.104527201  0.804977405 -0.312495110
> colRanges(tmp)
          [,1]      [,2]       [,3]      [,4]      [,5]      [,6]      [,7]
[1,] 0.6674467 -0.833821 -0.1622153 0.2873855 -0.104258 0.2318194 0.6030304
[2,] 0.6674467 -0.833821 -0.1622153 0.2873855 -0.104258 0.2318194 0.6030304
         [,8]     [,9]     [,10]      [,11]     [,12]     [,13]     [,14]
[1,] -1.07318 1.404864 0.8882749 -0.1410868 -1.471769 -1.860364 -1.235177
[2,] -1.07318 1.404864 0.8882749 -0.1410868 -1.471769 -1.860364 -1.235177
        [,15]    [,16]    [,17]     [,18]      [,19]      [,20]     [,21]
[1,] 1.271469 0.194139 1.804968 0.5334006 -0.7657488 -0.9039814 0.9144241
[2,] 1.271469 0.194139 1.804968 0.5334006 -0.7657488 -0.9039814 0.9144241
            [,22]        [,23]      [,24]      [,25]      [,26]     [,27]
[1,] -0.007769363 -0.006637702 -0.6352864 -0.1875236 -0.8989513 -1.178013
[2,] -0.007769363 -0.006637702 -0.6352864 -0.1875236 -0.8989513 -1.178013
           [,28]    [,29]     [,30]     [,31]      [,32]    [,33]     [,34]
[1,] -0.02798238 1.158963 -1.184736 0.5371788 -0.9953721 1.501636 -1.376429
[2,] -0.02798238 1.158963 -1.184736 0.5371788 -0.9953721 1.501636 -1.376429
        [,35]     [,36]    [,37]    [,38]   [,39]       [,40]     [,41]
[1,] 1.344117 -1.074845 1.674583 1.010607 1.60437 -0.02127273 -1.497207
[2,] 1.344117 -1.074845 1.674583 1.010607 1.60437 -0.02127273 -1.497207
        [,42]      [,43]      [,44]     [,45]     [,46]      [,47]      [,48]
[1,] 1.486663 0.02639682 -0.3926238 0.1383309 0.3577209 -0.1425855 -0.6915774
[2,] 1.486663 0.02639682 -0.3926238 0.1383309 0.3577209 -0.1425855 -0.6915774
         [,49]    [,50]      [,51]      [,52]    [,53]     [,54]     [,55]
[1,] 0.1322636 1.171481 -0.8080073 -0.4498898 1.204834 0.4441574 0.4678792
[2,] 0.1322636 1.171481 -0.8080073 -0.4498898 1.204834 0.4441574 0.4678792
           [,56]    [,57]     [,58]      [,59]     [,60]      [,61]     [,62]
[1,] -0.03906834 1.986323 -1.197226 0.07802348 0.1504265 -0.6210893 0.2578377
[2,] -0.03906834 1.986323 -1.197226 0.07802348 0.1504265 -0.6210893 0.2578377
         [,63]       [,64]      [,65]     [,66]     [,67]     [,68]      [,69]
[1,] -0.720281 -0.01822178 -0.8699614 -1.027701 0.2931515 0.5562126 -0.4718805
[2,] -0.720281 -0.01822178 -0.8699614 -1.027701 0.2931515 0.5562126 -0.4718805
         [,70]     [,71]    [,72]     [,73]      [,74]      [,75]       [,76]
[1,] -1.002862 0.8519446 1.595141 0.4771097 -0.8655923 -0.9001388 -0.01562845
[2,] -1.002862 0.8519446 1.595141 0.4771097 -0.8655923 -0.9001388 -0.01562845
         [,77]     [,78]      [,79]     [,80]     [,81]    [,82]      [,83]
[1,] 0.7029698 0.7922832 -0.7451388 0.3807349 0.3093441 1.162824 -0.3303064
[2,] 0.7029698 0.7922832 -0.7451388 0.3807349 0.3093441 1.162824 -0.3303064
            [,84]    [,85]      [,86]   [,87]    [,88]      [,89]     [,90]
[1,] -0.007719954 0.306634 -0.4458569 1.93068 1.011869 -0.5262845 0.5970648
[2,] -0.007719954 0.306634 -0.4458569 1.93068 1.011869 -0.5262845 0.5970648
         [,91]     [,92]     [,93]     [,94]     [,95]    [,96]     [,97]
[1,] 0.5093003 -1.773064 -1.848426 -1.784583 0.6767633 1.354251 -0.511595
[2,] 0.5093003 -1.773064 -1.848426 -1.784583 0.6767633 1.354251 -0.511595
         [,98]     [,99]     [,100]
[1,] -2.104527 0.8049774 -0.3124951
[2,] -2.104527 0.8049774 -0.3124951
> 
> 
> Max(tmp2)
[1] 2.33017
> Min(tmp2)
[1] -2.697696
> mean(tmp2)
[1] -0.03557292
> Sum(tmp2)
[1] -3.557292
> Var(tmp2)
[1] 0.9978821
> 
> rowMeans(tmp2)
  [1]  1.04789458 -0.65468975  0.40407194  1.23950712 -1.07167817 -1.48880128
  [7]  0.75770253  0.37274631 -1.45286954  0.09849013 -0.99919471 -0.93724485
 [13] -2.64141472 -0.37866975 -0.23939227 -2.69769634 -2.22828795 -0.02945385
 [19] -0.01093166  0.35556378 -0.03348097  0.69191885  0.27146222 -0.54004920
 [25] -0.06629116 -0.64376924  1.01200939 -0.22206146  0.66741468  0.36544247
 [31]  0.64544169  1.06852627 -0.72853607  2.05247297  2.23237863 -1.70794673
 [37] -0.22835198 -0.62385807  0.15507529 -0.45180154 -0.61803515  0.28114927
 [43]  0.29268292 -1.34784843  1.25126071  2.10638309 -0.65459926 -0.19095162
 [49]  0.24615736  0.76350006  1.10889635 -0.29012440 -1.51974986 -1.67044534
 [55]  0.61943072  0.39240550 -1.35587430  0.33948938  0.05019003 -0.57647433
 [61]  0.99583892 -1.40868033  0.50537412  0.16697812 -0.57671739 -0.15011578
 [67]  0.06383613  2.33016965  1.70294872  0.85715103 -0.67990616 -0.06273280
 [73]  0.68845817  1.45652536 -0.66917651 -0.02668724 -0.79350542 -0.47064279
 [79] -1.20078540 -0.39966432  0.20284063  1.63077890  0.13902897 -0.67539607
 [85]  0.94364358  0.30873165 -0.78263939 -0.25485071  1.17995562 -1.00560315
 [91] -0.05105726  0.29713222  0.97639805  0.39735726 -0.75715575 -0.97917252
 [97] -0.10592986 -0.58434001  1.41359537 -0.76836623
> rowSums(tmp2)
  [1]  1.04789458 -0.65468975  0.40407194  1.23950712 -1.07167817 -1.48880128
  [7]  0.75770253  0.37274631 -1.45286954  0.09849013 -0.99919471 -0.93724485
 [13] -2.64141472 -0.37866975 -0.23939227 -2.69769634 -2.22828795 -0.02945385
 [19] -0.01093166  0.35556378 -0.03348097  0.69191885  0.27146222 -0.54004920
 [25] -0.06629116 -0.64376924  1.01200939 -0.22206146  0.66741468  0.36544247
 [31]  0.64544169  1.06852627 -0.72853607  2.05247297  2.23237863 -1.70794673
 [37] -0.22835198 -0.62385807  0.15507529 -0.45180154 -0.61803515  0.28114927
 [43]  0.29268292 -1.34784843  1.25126071  2.10638309 -0.65459926 -0.19095162
 [49]  0.24615736  0.76350006  1.10889635 -0.29012440 -1.51974986 -1.67044534
 [55]  0.61943072  0.39240550 -1.35587430  0.33948938  0.05019003 -0.57647433
 [61]  0.99583892 -1.40868033  0.50537412  0.16697812 -0.57671739 -0.15011578
 [67]  0.06383613  2.33016965  1.70294872  0.85715103 -0.67990616 -0.06273280
 [73]  0.68845817  1.45652536 -0.66917651 -0.02668724 -0.79350542 -0.47064279
 [79] -1.20078540 -0.39966432  0.20284063  1.63077890  0.13902897 -0.67539607
 [85]  0.94364358  0.30873165 -0.78263939 -0.25485071  1.17995562 -1.00560315
 [91] -0.05105726  0.29713222  0.97639805  0.39735726 -0.75715575 -0.97917252
 [97] -0.10592986 -0.58434001  1.41359537 -0.76836623
> 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]  1.04789458 -0.65468975  0.40407194  1.23950712 -1.07167817 -1.48880128
  [7]  0.75770253  0.37274631 -1.45286954  0.09849013 -0.99919471 -0.93724485
 [13] -2.64141472 -0.37866975 -0.23939227 -2.69769634 -2.22828795 -0.02945385
 [19] -0.01093166  0.35556378 -0.03348097  0.69191885  0.27146222 -0.54004920
 [25] -0.06629116 -0.64376924  1.01200939 -0.22206146  0.66741468  0.36544247
 [31]  0.64544169  1.06852627 -0.72853607  2.05247297  2.23237863 -1.70794673
 [37] -0.22835198 -0.62385807  0.15507529 -0.45180154 -0.61803515  0.28114927
 [43]  0.29268292 -1.34784843  1.25126071  2.10638309 -0.65459926 -0.19095162
 [49]  0.24615736  0.76350006  1.10889635 -0.29012440 -1.51974986 -1.67044534
 [55]  0.61943072  0.39240550 -1.35587430  0.33948938  0.05019003 -0.57647433
 [61]  0.99583892 -1.40868033  0.50537412  0.16697812 -0.57671739 -0.15011578
 [67]  0.06383613  2.33016965  1.70294872  0.85715103 -0.67990616 -0.06273280
 [73]  0.68845817  1.45652536 -0.66917651 -0.02668724 -0.79350542 -0.47064279
 [79] -1.20078540 -0.39966432  0.20284063  1.63077890  0.13902897 -0.67539607
 [85]  0.94364358  0.30873165 -0.78263939 -0.25485071  1.17995562 -1.00560315
 [91] -0.05105726  0.29713222  0.97639805  0.39735726 -0.75715575 -0.97917252
 [97] -0.10592986 -0.58434001  1.41359537 -0.76836623
> rowMin(tmp2)
  [1]  1.04789458 -0.65468975  0.40407194  1.23950712 -1.07167817 -1.48880128
  [7]  0.75770253  0.37274631 -1.45286954  0.09849013 -0.99919471 -0.93724485
 [13] -2.64141472 -0.37866975 -0.23939227 -2.69769634 -2.22828795 -0.02945385
 [19] -0.01093166  0.35556378 -0.03348097  0.69191885  0.27146222 -0.54004920
 [25] -0.06629116 -0.64376924  1.01200939 -0.22206146  0.66741468  0.36544247
 [31]  0.64544169  1.06852627 -0.72853607  2.05247297  2.23237863 -1.70794673
 [37] -0.22835198 -0.62385807  0.15507529 -0.45180154 -0.61803515  0.28114927
 [43]  0.29268292 -1.34784843  1.25126071  2.10638309 -0.65459926 -0.19095162
 [49]  0.24615736  0.76350006  1.10889635 -0.29012440 -1.51974986 -1.67044534
 [55]  0.61943072  0.39240550 -1.35587430  0.33948938  0.05019003 -0.57647433
 [61]  0.99583892 -1.40868033  0.50537412  0.16697812 -0.57671739 -0.15011578
 [67]  0.06383613  2.33016965  1.70294872  0.85715103 -0.67990616 -0.06273280
 [73]  0.68845817  1.45652536 -0.66917651 -0.02668724 -0.79350542 -0.47064279
 [79] -1.20078540 -0.39966432  0.20284063  1.63077890  0.13902897 -0.67539607
 [85]  0.94364358  0.30873165 -0.78263939 -0.25485071  1.17995562 -1.00560315
 [91] -0.05105726  0.29713222  0.97639805  0.39735726 -0.75715575 -0.97917252
 [97] -0.10592986 -0.58434001  1.41359537 -0.76836623
> 
> colMeans(tmp2)
[1] -0.03557292
> colSums(tmp2)
[1] -3.557292
> colVars(tmp2)
[1] 0.9978821
> colSd(tmp2)
[1] 0.9989405
> colMax(tmp2)
[1] 2.33017
> colMin(tmp2)
[1] -2.697696
> colMedians(tmp2)
[1] -0.03146741
> colRanges(tmp2)
          [,1]
[1,] -2.697696
[2,]  2.330170
> 
> 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] -1.0260288  1.7619182  1.3831045 -1.3252739  6.1714726 -0.7241302
 [7]  4.9735458  3.1408993  2.4957219 -1.8386120
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.6391733
[2,] -0.6571755
[3,]  0.2655257
[4,]  0.7181117
[5,]  1.4473757
> 
> rowApply(tmp,sum)
 [1] -0.6612802  8.2513096  5.3309712  4.5039977 -1.2213637 -0.1601999
 [7] -2.5048457  3.4784124 -3.7411844  1.7368004
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    7    6    5   10    1    2    6    6    1     9
 [2,]    9    3    4    9    4    1    3    7    8     7
 [3,]    3    5    1    7   10    4    5    5    9     4
 [4,]    2    8    8    5    2    9    9    1    3     2
 [5,]   10   10   10    4    8    8    7    4    5     5
 [6,]    5    2    2    2    5    7    1   10    4     3
 [7,]    4    9    6    6    6    6   10    9    6     8
 [8,]    1    4    3    3    7   10    2    8    7    10
 [9,]    8    1    9    1    9    5    4    3   10     6
[10,]    6    7    7    8    3    3    8    2    2     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.0149528  1.8029205  3.0859123 -3.0773366  1.4901060 -2.1964020
 [7]  4.7332086 -1.3718094 -0.1687066  0.1148413  2.7869163  3.7902698
[13]  0.9559801 -4.1676785 -3.5881771 -2.0011257 -0.5399208 -0.5567143
[19] -2.7425476  1.7894760
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.34074243
[2,] -0.55292151
[3,] -0.17895352
[4,]  0.08244471
[5,]  0.97521996
> 
> rowApply(tmp,sum)
[1] -3.47189808 -8.27303483  5.82963537  5.09625414 -0.05669709
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   11    3   13    4   10
[2,]    3   11   18   14   16
[3,]    8   20   20    7   11
[4,]    1    6    5   13   18
[5,]   19    5   17   16    2
> 
> 
> as.matrix(tmp)
            [,1]       [,2]       [,3]       [,4]      [,5]        [,6]
[1,] -0.17895352 -1.1062774 -0.5635014 -2.6048529  1.329898 -0.90189932
[2,] -1.34074243 -0.5594782  1.2120780 -1.1806983 -1.182773  0.04660761
[3,]  0.97521996  2.2403978  2.4354893 -0.9377835  1.650165 -0.11102738
[4,] -0.55292151  0.6914845 -0.1217013  0.5706255  0.941808 -1.17509257
[5,]  0.08244471  0.5367939  0.1235477  1.0753725 -1.248992 -0.05499033
          [,7]       [,8]       [,9]      [,10]      [,11]       [,12]
[1,] 0.7773300 -0.6684106  1.2223983  1.3649943  1.3105002  0.01561542
[2,] 1.0814655  0.2725471  0.7165639 -0.4144340 -1.1633745  0.60749191
[3,] 0.8162602 -1.9630444 -2.3300565 -0.4384646  0.2580731  1.17877470
[4,] 1.6085190  0.1596368  1.2971905  0.4708754  2.0458344 -0.22682248
[5,] 0.4496339  0.8274617 -1.0748028 -0.8681298  0.3358830  2.21521025
          [,13]      [,14]      [,15]       [,16]      [,17]      [,18]
[1,] -0.6431787 -0.1130085 -1.4631160 -1.03025305  0.3384133 -0.4389081
[2,] -0.7032704 -1.5430062  0.3829218 -0.99916652  0.6241466 -1.7187551
[3,]  1.4321915 -0.1421014 -1.4124356  0.12511613 -1.0744152  2.4268213
[4,]  2.2630173 -2.5124812  0.1510615 -0.05682938  0.7173291 -1.1464656
[5,] -1.3927796  0.1429188 -1.2466089 -0.03999291 -1.1453947  0.3205933
          [,19]      [,20]
[1,] -0.3109882  0.1922997
[2,] -1.1543027 -1.2568558
[3,] -0.3350303  1.0354849
[4,] -0.5467232  0.5179095
[5,] -0.3955032  1.3006377
> 
> 
> 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.24-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.24-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.24-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.24-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.4929049 -1.365872 -0.1552196 1.993272 -1.545355 0.07763671 0.2895444
         col8       col9     col10      col11       col12     col13    col14
row1 1.096439 -0.1258611 -1.627854 -0.6395428 -0.06766479 -1.281332 1.008315
          col15      col16     col17      col18    col19    col20
row1 -0.1437149 -0.8270898 0.2362822 -0.2552992 1.296187 1.030836
> tmp[,"col10"]
           col10
row1 -1.62785437
row2 -0.06517092
row3  0.34041463
row4 -0.67104036
row5  1.25301915
> tmp[c("row1","row5"),]
           col1       col2       col3      col4      col5        col6      col7
row1  0.4929049 -1.3658717 -0.1552196 1.9932725 -1.545355  0.07763671 0.2895444
row5 -1.2102833 -0.4776717  0.9493295 0.7622973 -1.247766 -0.73786377 1.0235094
          col8       col9     col10      col11       col12      col13    col14
row1 1.0964391 -0.1258611 -1.627854 -0.6395428 -0.06766479 -1.2813321 1.008315
row5 0.3238902  0.3050834  1.253019 -1.5446963  0.35890934  0.6520728 1.530176
          col15      col16      col17      col18     col19      col20
row1 -0.1437149 -0.8270898 0.23628217 -0.2552992  1.296187  1.0308356
row5  0.9509466  0.8617189 0.03748593  0.1570873 -1.773582 -0.5640749
> tmp[,c("col6","col20")]
            col6      col20
row1  0.07763671  1.0308356
row2 -0.54398265 -1.1428218
row3 -0.53757424  0.2726402
row4 -0.45458763  0.3300025
row5 -0.73786377 -0.5640749
> tmp[c("row1","row5"),c("col6","col20")]
            col6      col20
row1  0.07763671  1.0308356
row5 -0.73786377 -0.5640749
> 
> 
> 
> 
> 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 47.02654 51.49322 50.31225 50.65464 50.20101 104.8982 50.85129 50.41846
         col9    col10    col11    col12    col13   col14    col15   col16
row1 49.11184 51.13752 50.03549 50.85178 48.48044 49.9712 50.80162 50.0424
        col17    col18    col19    col20
row1 48.93988 51.32826 50.98834 104.0888
> tmp[,"col10"]
        col10
row1 51.13752
row2 29.97329
row3 30.53746
row4 30.73307
row5 47.10911
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 47.02654 51.49322 50.31225 50.65464 50.20101 104.8982 50.85129 50.41846
row5 50.20890 49.31197 49.59799 49.21201 51.44663 105.0494 49.91266 50.14624
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.11184 51.13752 50.03549 50.85178 48.48044 49.97120 50.80162 50.04240
row5 50.77253 47.10911 49.79405 50.75373 50.05071 49.96934 50.00067 48.87181
        col17    col18    col19    col20
row1 48.93988 51.32826 50.98834 104.0888
row5 50.68218 48.28584 50.29472 105.8172
> tmp[,c("col6","col20")]
          col6     col20
row1 104.89820 104.08883
row2  75.15908  74.04032
row3  74.11508  77.38218
row4  74.69512  75.33830
row5 105.04944 105.81715
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.8982 104.0888
row5 105.0494 105.8172
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.8982 104.0888
row5 105.0494 105.8172
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.2141157
[2,] -0.1709220
[3,]  1.5150324
[4,]  0.6821335
[5,] -0.5518042
> tmp[,c("col17","col7")]
           col17       col7
[1,]  1.68658475 -0.6274672
[2,] -0.01963705  1.8884057
[3,] -0.03780920 -0.7598625
[4,] -0.91754062 -0.7487457
[5,] -1.70736421  0.6961646
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -0.49657127  0.5789113
[2,] -0.35639186  0.4963777
[3,]  0.89548866 -0.8948747
[4,] -0.07114871  1.6546681
[5,] -0.33874673 -0.6122398
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.4965713
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.4965713
[2,] -0.3563919
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]       [,4]      [,5]       [,6]      [,7]
row3  0.1438631  0.4646706 0.3886431  0.3868157 0.4535993 -0.9813693 0.5613206
row1 -1.3247497 -0.9415906 1.0146202 -1.9761240 0.3757632  1.4136070 1.0950776
           [,8]      [,9]     [,10]      [,11]      [,12]      [,13]      [,14]
row3 -0.7440266 -1.303818  2.162646  1.3124121 -0.1620262  1.0213054  0.3817752
row1 -1.0747730  1.564451 -0.430335 -0.7395312  1.0480962 -0.7122494 -0.3334614
          [,15]      [,16]       [,17]      [,18]      [,19]      [,20]
row3 -0.8022407  0.1702645 -0.08133186 -0.6087134  1.7433053 -1.3142238
row1 -0.3350551 -1.0649713 -1.66564383 -0.3369962 -0.8962095  0.9301057
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]      [,2]     [,3]         [,4]      [,5]      [,6]       [,7]
row2 -0.7651807 0.1044107 1.097933 -0.007405627 0.7370765 0.7767338 -0.5406701
           [,8]      [,9]      [,10]
row2 -0.2914021 0.1347854 0.00544691
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]        [,2]      [,3]     [,4]      [,5]      [,6]      [,7]
row5 -0.1264669 0.001602059 -1.944228 1.240337 0.2197286 0.8854618 -3.461772
         [,8]      [,9]     [,10]      [,11]     [,12]    [,13]     [,14]
row5 1.262417 0.1636256 0.4137707 -0.2160465 0.2655641 -0.47288 -0.502129
         [,15]     [,16]      [,17]     [,18]    [,19]   [,20]
row5 0.7549625 0.3346734 -0.2262394 0.3328439 0.532477 1.55585
> 
> 
> 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: 0x648bc9be69b0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c67f985385"
 [2] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c6b017cf2" 
 [3] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c6c1dbfb5" 
 [4] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c63ab821c3"
 [5] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c628de927c"
 [6] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c6632e2c53"
 [7] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c62f52e364"
 [8] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c661bd9eae"
 [9] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c6cd57788" 
[10] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c64986dd42"
[11] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c61da56338"
[12] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c61fb33df" 
[13] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c641abe1de"
[14] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c64ca06a29"
[15] "/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests/BM1912c61c05a2fa"
> 
> 
> ### 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: 0x648bca42b540>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x648bca42b540>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.24-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x648bca42b540>
> rowMedians(tmp)
  [1]  0.300651109  0.115186572 -0.470882153  0.154098067  0.202686097
  [6] -0.594057797 -0.391761336  0.039560386 -0.112956699  0.046204473
 [11]  0.391788219 -0.259791888  0.172482845 -0.140978781  0.071677120
 [16] -0.508202734 -0.042766468  0.040489705 -0.049145123 -0.156167340
 [21]  0.621393484 -0.105625018 -0.082560185 -0.051965250  0.379349989
 [26]  0.341180207  0.332671999  0.007610253  0.635023773  0.165239058
 [31]  0.291263277  0.592515636 -0.386726573  0.296843443  0.400639199
 [36] -0.066378050 -0.459711346  0.361297289  0.136278303 -0.311179313
 [41]  0.113591517 -0.759893796 -0.045369418  0.493016756 -0.370395716
 [46] -0.280398036  0.117109241  0.310231431  0.600631551  0.060196780
 [51]  0.456123546 -0.202590113  0.326209797  0.378434421  0.001571912
 [56]  0.036972174 -0.208769487  0.159695515  0.022389622 -0.224819944
 [61]  0.085475247 -0.026861700 -0.020142621 -0.010808822  0.011992740
 [66] -0.488783173 -0.127400290 -0.267314036 -0.107520753  0.229692514
 [71]  0.567304060  0.115224604 -0.172277406  0.074264263 -0.151333336
 [76]  0.387951508 -0.251748824 -0.085990738  0.204999146 -0.443145944
 [81]  0.172157594 -0.580285549  0.161077706  0.436197377  0.097317977
 [86]  0.376784174  0.353451094 -0.159238574 -0.120294802 -0.016592438
 [91]  0.039315775  0.097577804 -0.119057719 -0.012225801  0.259675353
 [96]  0.211309865 -0.276731615  0.260655935  0.127152577 -0.280020292
[101]  0.047438594 -0.553940034 -0.162861221  0.100933581  0.078931713
[106] -0.107470339 -0.292866112 -0.087399540  0.060410950  0.209259267
[111]  0.478023492  0.049273113 -0.236185516 -0.135912649  0.233894914
[116]  0.458417052 -0.622093267  0.497742561  0.369324105  0.427496452
[121]  0.325745938 -0.339989424  0.295542326 -0.013199720  0.222062003
[126] -0.424882747  0.254334894  0.062377879 -0.199712426 -0.747957116
[131]  0.152270154  0.424301338  0.034028052  0.064372382 -0.047706212
[136] -0.107159026 -0.111552325 -0.023006370  0.121889595 -0.037481457
[141] -0.327960980 -0.216977605 -0.311307623 -0.675166728  0.297058345
[146]  0.089783600 -0.516488265 -0.125562548  0.136707871 -0.199869137
[151]  0.510662673 -0.236628222  0.052151469 -0.041824666  0.389656665
[156] -0.396144728  0.205580385  0.099205109 -0.415459797 -0.460605428
[161] -0.466640871 -0.090320235  0.786170072 -0.099670628  0.511066306
[166]  0.023504992  0.605059280  0.398403780  0.436193908 -0.385544082
[171] -0.493248559 -0.464154637  0.657068686  0.069558122  0.285467421
[176]  0.607839019  0.381432400  0.547656619 -0.202923889  0.136959356
[181] -0.180303582  0.480268046  0.243428376  0.576912328 -0.195405483
[186]  0.122362574 -0.341101335 -0.184175063 -0.827538997 -0.203791068
[191] -0.433510451  0.081014841 -0.564095222  0.708573886 -0.195547109
[196]  0.401009952  0.142479999 -0.171169482  0.120947815 -0.620498696
[201]  0.011412750 -0.503918108  0.384014069  0.234253087 -0.484972271
[206] -0.694031425 -0.368922240 -0.191125145  0.199247901  0.095504947
[211] -0.571846598  0.193268699  0.472373282  0.185070305 -0.137576469
[216] -0.334619475 -0.229044102 -0.446864247 -0.117286362  0.288188289
[221]  0.065705732  0.349432228  0.102008990 -0.168618764 -0.034553959
[226] -0.176477984 -0.034197409 -0.251267810  0.642156707  0.014486824
> 
> proc.time()
   user  system elapsed 
  1.274   0.721   1.984 

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: 0x59c697411520>
> .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: 0x59c697411520>
> .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: 0x59c697411520>
> .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: 0x59c697411520>
> 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: 0x59c696fbaf60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x59c696fbaf60>
> .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: 0x59c696fbaf60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x59c696fbaf60>
> .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: 0x59c696fbaf60>
> 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: 0x59c697b64b40>
> .Call("R_bm_AddColumn",P)
<pointer: 0x59c697b64b40>
> .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: 0x59c697b64b40>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x59c697b64b40>
> .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: 0x59c697b64b40>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x59c697b64b40>
> .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: 0x59c697b64b40>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x59c697b64b40>
> .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: 0x59c697b64b40>
> 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: 0x59c697ba1bc0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x59c697ba1bc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x59c697ba1bc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x59c697ba1bc0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile19142560911644" "BufferedMatrixFile1914256ef5842b"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile19142560911644" "BufferedMatrixFile1914256ef5842b"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x59c698f29de0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x59c698f29de0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x59c698f29de0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x59c698f29de0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x59c698f29de0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x59c698f29de0>
> .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: 0x59c696c5ff80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x59c696c5ff80>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x59c696c5ff80>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x59c696c5ff80>
> 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: 0x59c697bfa690>
> .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: 0x59c697bfa690>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.259   0.048   0.296 

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.255   0.041   0.285 

Example timings