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

This page was generated on 2026-01-08 11:34 -0500 (Thu, 08 Jan 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.3 LTS)x86_64R Under development (unstable) (2025-12-22 r89219) -- "Unsuffered Consequences" 4815
kjohnson3macOS 13.7.7 Venturaarm64R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences" 4593
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 253/2332HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.75.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-01-07 13:40 -0500 (Wed, 07 Jan 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 -0500 (Wed, 29 Oct 2025)
nebbiolo1Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.7.7 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published


CHECK results for BufferedMatrix on nebbiolo1

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

raw results


Summary

Package: BufferedMatrix
Version: 1.75.0
Command: /home/biocbuild/bbs-3.23-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.23-bioc/R/site-library --timings BufferedMatrix_1.75.0.tar.gz
StartedAt: 2026-01-07 21:35:40 -0500 (Wed, 07 Jan 2026)
EndedAt: 2026-01-07 21:36:05 -0500 (Wed, 07 Jan 2026)
EllapsedTime: 25.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R Under development (unstable) (2025-12-22 r89219) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.242   0.046   0.277 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2025-12-22 r89219) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478851 25.6    1048487   56   639317 34.2
Vcells 885659  6.8    8388608   64  2082734 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Jan  7 21:35:54 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Jan  7 21:35:54 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: 0x6260d1e4a2b0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Jan  7 21:35:55 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Jan  7 21:35:55 2026"
> 
> ColMode(tmp2)
<pointer: 0x6260d1e4a2b0>
> 
> 
> 
> ### 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,] 101.4494508  0.16260478 -1.2374861 -0.5821053
[2,]  -0.3305229  1.13486963  1.2845235  1.1147890
[3,]   0.5632354 -0.18779844 -1.4780607 -0.2789088
[4,]  -0.2200570 -0.04238396  0.7506683  0.9993550
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]       [,2]      [,3]      [,4]
[1,] 101.4494508 0.16260478 1.2374861 0.5821053
[2,]   0.3305229 1.13486963 1.2845235 1.1147890
[3,]   0.5632354 0.18779844 1.4780607 0.2789088
[4,]   0.2200570 0.04238396 0.7506683 0.9993550
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0722118 0.4032428 1.1124235 0.7629583
[2,]  0.5749112 1.0653026 1.1333682 1.0558357
[3,]  0.7504901 0.4333572 1.2157552 0.5281182
[4,]  0.4691023 0.2058737 0.8664111 0.9996774
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 227.17157 29.19503 37.36172 33.21169
[2,]  31.07963 36.78790 37.61821 36.67315
[3,]  33.06814 29.52137 38.63561 30.56009
[4,]  29.91108 27.10112 34.41478 35.99613
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x6260d2551500>
> exp(tmp5)
<pointer: 0x6260d2551500>
> log(tmp5,2)
<pointer: 0x6260d2551500>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 472.8279
> Min(tmp5)
[1] 54.02099
> mean(tmp5)
[1] 73.09426
> Sum(tmp5)
[1] 14618.85
> Var(tmp5)
[1] 877.7155
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.35150 71.39374 70.82373 69.99147 70.95662 72.06949 68.98654 73.08788
 [9] 73.21537 69.06630
> rowSums(tmp5)
 [1] 1827.030 1427.875 1416.475 1399.829 1419.132 1441.390 1379.731 1461.758
 [9] 1464.307 1381.326
> rowVars(tmp5)
 [1] 8154.84329   79.42566   63.09756   58.04188   75.80514   79.53449
 [7]   54.71034   64.21684   74.62964   78.36486
> rowSd(tmp5)
 [1] 90.304171  8.912107  7.943397  7.618522  8.706615  8.918211  7.396644
 [8]  8.013541  8.638845  8.852393
> rowMax(tmp5)
 [1] 472.82786  87.49219  85.58005  85.74061  87.91768  90.44524  84.70295
 [8]  88.72883  89.42755  85.51134
> rowMin(tmp5)
 [1] 54.59983 54.02099 56.01973 56.40743 54.05200 57.47798 56.24932 58.71377
 [9] 60.12711 54.97462
> 
> colMeans(tmp5)
 [1] 111.35398  64.13216  76.84185  71.91605  71.34649  72.44086  70.88870
 [8]  72.58767  74.16384  71.07625  73.47303  65.87138  70.40658  72.71532
[15]  67.69845  73.09793  72.72209  70.42183  65.08596  73.64487
> colSums(tmp5)
 [1] 1113.5398  641.3216  768.4185  719.1605  713.4649  724.4086  708.8870
 [8]  725.8767  741.6384  710.7625  734.7303  658.7138  704.0658  727.1532
[15]  676.9845  730.9793  727.2209  704.2183  650.8596  736.4487
> colVars(tmp5)
 [1] 16188.336226    30.382877    58.150052    35.999156    57.116400
 [6]   116.100783   150.811817    64.793180   108.273860   148.065476
[11]   114.854087     5.244302    96.916905    20.583488    61.630606
[16]    63.328764    63.247860    25.070684    33.368658    38.446866
> colSd(tmp5)
 [1] 127.233393   5.512066   7.625618   5.999930   7.557539  10.775007
 [7]  12.280546   8.049421  10.405473  12.168216  10.717000   2.290044
[13]   9.844638   4.536903   7.850516   7.957937   7.952852   5.007063
[19]   5.776561   6.200554
> colMax(tmp5)
 [1] 472.82786  76.56918  85.32128  77.66019  86.58956  89.42755  88.72883
 [8]  85.51134  89.86450  84.70295  90.44524  70.13739  85.59402  79.30882
[15]  82.29069  79.68614  85.74061  76.82707  72.96469  82.35125
> colMin(tmp5)
 [1] 62.25600 56.40743 58.64220 59.76242 62.16980 56.24932 54.05200 60.37708
 [9] 58.66684 54.02099 58.98287 62.39046 57.79991 62.38908 57.47798 58.71377
[17] 58.82720 62.74341 56.01973 63.04183
> 
> 
> ### 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] 91.35150       NA 70.82373 69.99147 70.95662 72.06949 68.98654 73.08788
 [9] 73.21537 69.06630
> rowSums(tmp5)
 [1] 1827.030       NA 1416.475 1399.829 1419.132 1441.390 1379.731 1461.758
 [9] 1464.307 1381.326
> rowVars(tmp5)
 [1] 8154.84329   82.41304   63.09756   58.04188   75.80514   79.53449
 [7]   54.71034   64.21684   74.62964   78.36486
> rowSd(tmp5)
 [1] 90.304171  9.078163  7.943397  7.618522  8.706615  8.918211  7.396644
 [8]  8.013541  8.638845  8.852393
> rowMax(tmp5)
 [1] 472.82786        NA  85.58005  85.74061  87.91768  90.44524  84.70295
 [8]  88.72883  89.42755  85.51134
> rowMin(tmp5)
 [1] 54.59983       NA 56.01973 56.40743 54.05200 57.47798 56.24932 58.71377
 [9] 60.12711 54.97462
> 
> colMeans(tmp5)
 [1] 111.35398  64.13216  76.84185        NA  71.34649  72.44086  70.88870
 [8]  72.58767  74.16384  71.07625  73.47303  65.87138  70.40658  72.71532
[15]  67.69845  73.09793  72.72209  70.42183  65.08596  73.64487
> colSums(tmp5)
 [1] 1113.5398  641.3216  768.4185        NA  713.4649  724.4086  708.8870
 [8]  725.8767  741.6384  710.7625  734.7303  658.7138  704.0658  727.1532
[15]  676.9845  730.9793  727.2209  704.2183  650.8596  736.4487
> colVars(tmp5)
 [1] 16188.336226    30.382877    58.150052           NA    57.116400
 [6]   116.100783   150.811817    64.793180   108.273860   148.065476
[11]   114.854087     5.244302    96.916905    20.583488    61.630606
[16]    63.328764    63.247860    25.070684    33.368658    38.446866
> colSd(tmp5)
 [1] 127.233393   5.512066   7.625618         NA   7.557539  10.775007
 [7]  12.280546   8.049421  10.405473  12.168216  10.717000   2.290044
[13]   9.844638   4.536903   7.850516   7.957937   7.952852   5.007063
[19]   5.776561   6.200554
> colMax(tmp5)
 [1] 472.82786  76.56918  85.32128        NA  86.58956  89.42755  88.72883
 [8]  85.51134  89.86450  84.70295  90.44524  70.13739  85.59402  79.30882
[15]  82.29069  79.68614  85.74061  76.82707  72.96469  82.35125
> colMin(tmp5)
 [1] 62.25600 56.40743 58.64220       NA 62.16980 56.24932 54.05200 60.37708
 [9] 58.66684 54.02099 58.98287 62.39046 57.79991 62.38908 57.47798 58.71377
[17] 58.82720 62.74341 56.01973 63.04183
> 
> Max(tmp5,na.rm=TRUE)
[1] 472.8279
> Min(tmp5,na.rm=TRUE)
[1] 54.02099
> mean(tmp5,na.rm=TRUE)
[1] 73.078
> Sum(tmp5,na.rm=TRUE)
[1] 14542.52
> Var(tmp5,na.rm=TRUE)
[1] 882.0953
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.35150 71.13391 70.82373 69.99147 70.95662 72.06949 68.98654 73.08788
 [9] 73.21537 69.06630
> rowSums(tmp5,na.rm=TRUE)
 [1] 1827.030 1351.544 1416.475 1399.829 1419.132 1441.390 1379.731 1461.758
 [9] 1464.307 1381.326
> rowVars(tmp5,na.rm=TRUE)
 [1] 8154.84329   82.41304   63.09756   58.04188   75.80514   79.53449
 [7]   54.71034   64.21684   74.62964   78.36486
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.304171  9.078163  7.943397  7.618522  8.706615  8.918211  7.396644
 [8]  8.013541  8.638845  8.852393
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.82786  87.49219  85.58005  85.74061  87.91768  90.44524  84.70295
 [8]  88.72883  89.42755  85.51134
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.59983 54.02099 56.01973 56.40743 54.05200 57.47798 56.24932 58.71377
 [9] 60.12711 54.97462
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.35398  64.13216  76.84185  71.42557  71.34649  72.44086  70.88870
 [8]  72.58767  74.16384  71.07625  73.47303  65.87138  70.40658  72.71532
[15]  67.69845  73.09793  72.72209  70.42183  65.08596  73.64487
> colSums(tmp5,na.rm=TRUE)
 [1] 1113.5398  641.3216  768.4185  642.8301  713.4649  724.4086  708.8870
 [8]  725.8767  741.6384  710.7625  734.7303  658.7138  704.0658  727.1532
[15]  676.9845  730.9793  727.2209  704.2183  650.8596  736.4487
> colVars(tmp5,na.rm=TRUE)
 [1] 16188.336226    30.382877    58.150052    37.792656    57.116400
 [6]   116.100783   150.811817    64.793180   108.273860   148.065476
[11]   114.854087     5.244302    96.916905    20.583488    61.630606
[16]    63.328764    63.247860    25.070684    33.368658    38.446866
> colSd(tmp5,na.rm=TRUE)
 [1] 127.233393   5.512066   7.625618   6.147573   7.557539  10.775007
 [7]  12.280546   8.049421  10.405473  12.168216  10.717000   2.290044
[13]   9.844638   4.536903   7.850516   7.957937   7.952852   5.007063
[19]   5.776561   6.200554
> colMax(tmp5,na.rm=TRUE)
 [1] 472.82786  76.56918  85.32128  77.66019  86.58956  89.42755  88.72883
 [8]  85.51134  89.86450  84.70295  90.44524  70.13739  85.59402  79.30882
[15]  82.29069  79.68614  85.74061  76.82707  72.96469  82.35125
> colMin(tmp5,na.rm=TRUE)
 [1] 62.25600 56.40743 58.64220 59.76242 62.16980 56.24932 54.05200 60.37708
 [9] 58.66684 54.02099 58.98287 62.39046 57.79991 62.38908 57.47798 58.71377
[17] 58.82720 62.74341 56.01973 63.04183
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.35150      NaN 70.82373 69.99147 70.95662 72.06949 68.98654 73.08788
 [9] 73.21537 69.06630
> rowSums(tmp5,na.rm=TRUE)
 [1] 1827.030    0.000 1416.475 1399.829 1419.132 1441.390 1379.731 1461.758
 [9] 1464.307 1381.326
> rowVars(tmp5,na.rm=TRUE)
 [1] 8154.84329         NA   63.09756   58.04188   75.80514   79.53449
 [7]   54.71034   64.21684   74.62964   78.36486
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.304171        NA  7.943397  7.618522  8.706615  8.918211  7.396644
 [8]  8.013541  8.638845  8.852393
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.82786        NA  85.58005  85.74061  87.91768  90.44524  84.70295
 [8]  88.72883  89.42755  85.51134
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.59983       NA 56.01973 56.40743 54.05200 57.47798 56.24932 58.71377
 [9] 60.12711 54.97462
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.53907  62.75027  76.68013       NaN  69.65282  72.59689  71.25861
 [8]  72.76531  72.68291  72.97128  73.53237  66.11852  69.58807  73.86268
[15]  68.63885  72.46422  72.55677  69.71013  65.62256  74.24722
> colSums(tmp5,na.rm=TRUE)
 [1] 1048.8516  564.7524  690.1211    0.0000  626.8754  653.3720  641.3275
 [8]  654.8878  654.1462  656.7415  661.7913  595.0667  626.2926  664.7642
[15]  617.7497  652.1780  653.0109  627.3912  590.6031  668.2250
> colVars(tmp5,na.rm=TRUE)
 [1] 17909.420459    12.697457    65.124568           NA    31.984984
 [6]   130.339488   168.123882    72.537317    97.135175   126.173396
[11]   129.171234     5.212733   101.494332     8.346516    59.385478
[16]    66.726995    70.846350    22.506306    34.300355    39.170977
> colSd(tmp5,na.rm=TRUE)
 [1] 133.826083   3.563349   8.069979         NA   5.655527  11.416632
 [7]  12.966259   8.516884   9.855718  11.232693  11.365352   2.283141
[13]  10.074440   2.889034   7.706197   8.168659   8.417027   4.744081
[19]   5.856650   6.258672
> colMax(tmp5,na.rm=TRUE)
 [1] 472.82786  67.62660  85.32128      -Inf  80.07190  89.42755  88.72883
 [8]  85.51134  89.86450  84.70295  90.44524  70.13739  85.59402  79.30882
[15]  82.29069  79.68614  85.74061  75.07434  72.96469  82.35125
> colMin(tmp5,na.rm=TRUE)
 [1] 62.25600 56.40743 58.64220      Inf 62.16980 56.24932 54.05200 60.37708
 [9] 58.66684 54.59983 58.98287 62.39046 57.79991 69.88759 57.47798 58.71377
[17] 58.82720 62.74341 56.01973 63.04183
> 
> 
> 
> 
> 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] 197.6116 139.6796 138.4140 128.2120 244.8690 198.8143 116.4013 331.7404
 [9] 163.5535 179.8218
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 197.6116 139.6796 138.4140 128.2120 244.8690 198.8143 116.4013 331.7404
 [9] 163.5535 179.8218
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14  7.105427e-14  8.526513e-14  2.842171e-14  5.684342e-14
 [6]  0.000000e+00 -1.705303e-13 -2.842171e-14  2.273737e-13 -2.273737e-13
[11]  0.000000e+00 -2.557954e-13  0.000000e+00  1.136868e-13  5.684342e-14
[16] -5.684342e-14  5.684342e-14  0.000000e+00  5.684342e-14 -1.705303e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## 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)
+ }
8   4 
6   8 
3   6 
10   8 
8   2 
9   14 
9   16 
8   3 
3   9 
6   9 
10   4 
8   6 
4   1 
5   8 
2   2 
6   19 
1   15 
7   15 
1   9 
9   3 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 3.080607
> Min(tmp)
[1] -2.642174
> mean(tmp)
[1] 0.1740977
> Sum(tmp)
[1] 17.40977
> Var(tmp)
[1] 0.8965595
> 
> rowMeans(tmp)
[1] 0.1740977
> rowSums(tmp)
[1] 17.40977
> rowVars(tmp)
[1] 0.8965595
> rowSd(tmp)
[1] 0.9468683
> rowMax(tmp)
[1] 3.080607
> rowMin(tmp)
[1] -2.642174
> 
> colMeans(tmp)
  [1]  0.78244534  0.29306028 -0.29359393 -0.52914409 -1.02713350  0.77503589
  [7]  0.39179900  0.95453580 -1.22899738 -1.06799617 -0.02175118  1.11642053
 [13] -1.72456322  0.62226054  1.32291465  0.02161349  0.71373555  0.40822953
 [19] -1.90718713  1.12743157  0.73588470 -0.69375697 -1.22827040  0.23767634
 [25]  0.08029393 -0.67299796 -0.08831075 -2.24531148  0.99804705 -0.55167546
 [31] -0.12323458  3.08060741 -1.34079093  0.76651180  0.58077202 -0.31881990
 [37]  1.08346732  1.69117947 -0.45468070 -0.72139005 -0.27867141  0.43709866
 [43] -1.12814813 -0.39958238 -0.49668422  1.94594432 -0.15391150  1.60684074
 [49]  0.78266628  0.62710137  0.49294733  0.64199036  1.10092449  0.21276973
 [55]  0.57433242 -0.17828203  0.99798827  2.30510652 -0.93213894  0.86758256
 [61]  1.20740712  0.26314045 -2.64217437  0.54248492 -1.80892846  0.64502338
 [67]  0.71508949  0.16817936 -0.32461785  0.74837977  0.37738550  1.13362240
 [73] -0.37109305  0.74627642 -0.76557448 -0.44209285  0.23936404 -0.10981994
 [79]  1.58639050  0.52022647  1.20517584  0.05985932 -0.38116201  0.02060864
 [85]  1.15221902  0.36670803 -0.62053282  0.97171745 -0.31715571  0.85237639
 [91]  0.21776906  0.51819751 -1.07101862  0.44523180  0.37514068  0.21823744
 [97] -0.60682647  0.45196771  0.02969208  0.52270478
> colSums(tmp)
  [1]  0.78244534  0.29306028 -0.29359393 -0.52914409 -1.02713350  0.77503589
  [7]  0.39179900  0.95453580 -1.22899738 -1.06799617 -0.02175118  1.11642053
 [13] -1.72456322  0.62226054  1.32291465  0.02161349  0.71373555  0.40822953
 [19] -1.90718713  1.12743157  0.73588470 -0.69375697 -1.22827040  0.23767634
 [25]  0.08029393 -0.67299796 -0.08831075 -2.24531148  0.99804705 -0.55167546
 [31] -0.12323458  3.08060741 -1.34079093  0.76651180  0.58077202 -0.31881990
 [37]  1.08346732  1.69117947 -0.45468070 -0.72139005 -0.27867141  0.43709866
 [43] -1.12814813 -0.39958238 -0.49668422  1.94594432 -0.15391150  1.60684074
 [49]  0.78266628  0.62710137  0.49294733  0.64199036  1.10092449  0.21276973
 [55]  0.57433242 -0.17828203  0.99798827  2.30510652 -0.93213894  0.86758256
 [61]  1.20740712  0.26314045 -2.64217437  0.54248492 -1.80892846  0.64502338
 [67]  0.71508949  0.16817936 -0.32461785  0.74837977  0.37738550  1.13362240
 [73] -0.37109305  0.74627642 -0.76557448 -0.44209285  0.23936404 -0.10981994
 [79]  1.58639050  0.52022647  1.20517584  0.05985932 -0.38116201  0.02060864
 [85]  1.15221902  0.36670803 -0.62053282  0.97171745 -0.31715571  0.85237639
 [91]  0.21776906  0.51819751 -1.07101862  0.44523180  0.37514068  0.21823744
 [97] -0.60682647  0.45196771  0.02969208  0.52270478
> 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.78244534  0.29306028 -0.29359393 -0.52914409 -1.02713350  0.77503589
  [7]  0.39179900  0.95453580 -1.22899738 -1.06799617 -0.02175118  1.11642053
 [13] -1.72456322  0.62226054  1.32291465  0.02161349  0.71373555  0.40822953
 [19] -1.90718713  1.12743157  0.73588470 -0.69375697 -1.22827040  0.23767634
 [25]  0.08029393 -0.67299796 -0.08831075 -2.24531148  0.99804705 -0.55167546
 [31] -0.12323458  3.08060741 -1.34079093  0.76651180  0.58077202 -0.31881990
 [37]  1.08346732  1.69117947 -0.45468070 -0.72139005 -0.27867141  0.43709866
 [43] -1.12814813 -0.39958238 -0.49668422  1.94594432 -0.15391150  1.60684074
 [49]  0.78266628  0.62710137  0.49294733  0.64199036  1.10092449  0.21276973
 [55]  0.57433242 -0.17828203  0.99798827  2.30510652 -0.93213894  0.86758256
 [61]  1.20740712  0.26314045 -2.64217437  0.54248492 -1.80892846  0.64502338
 [67]  0.71508949  0.16817936 -0.32461785  0.74837977  0.37738550  1.13362240
 [73] -0.37109305  0.74627642 -0.76557448 -0.44209285  0.23936404 -0.10981994
 [79]  1.58639050  0.52022647  1.20517584  0.05985932 -0.38116201  0.02060864
 [85]  1.15221902  0.36670803 -0.62053282  0.97171745 -0.31715571  0.85237639
 [91]  0.21776906  0.51819751 -1.07101862  0.44523180  0.37514068  0.21823744
 [97] -0.60682647  0.45196771  0.02969208  0.52270478
> colMin(tmp)
  [1]  0.78244534  0.29306028 -0.29359393 -0.52914409 -1.02713350  0.77503589
  [7]  0.39179900  0.95453580 -1.22899738 -1.06799617 -0.02175118  1.11642053
 [13] -1.72456322  0.62226054  1.32291465  0.02161349  0.71373555  0.40822953
 [19] -1.90718713  1.12743157  0.73588470 -0.69375697 -1.22827040  0.23767634
 [25]  0.08029393 -0.67299796 -0.08831075 -2.24531148  0.99804705 -0.55167546
 [31] -0.12323458  3.08060741 -1.34079093  0.76651180  0.58077202 -0.31881990
 [37]  1.08346732  1.69117947 -0.45468070 -0.72139005 -0.27867141  0.43709866
 [43] -1.12814813 -0.39958238 -0.49668422  1.94594432 -0.15391150  1.60684074
 [49]  0.78266628  0.62710137  0.49294733  0.64199036  1.10092449  0.21276973
 [55]  0.57433242 -0.17828203  0.99798827  2.30510652 -0.93213894  0.86758256
 [61]  1.20740712  0.26314045 -2.64217437  0.54248492 -1.80892846  0.64502338
 [67]  0.71508949  0.16817936 -0.32461785  0.74837977  0.37738550  1.13362240
 [73] -0.37109305  0.74627642 -0.76557448 -0.44209285  0.23936404 -0.10981994
 [79]  1.58639050  0.52022647  1.20517584  0.05985932 -0.38116201  0.02060864
 [85]  1.15221902  0.36670803 -0.62053282  0.97171745 -0.31715571  0.85237639
 [91]  0.21776906  0.51819751 -1.07101862  0.44523180  0.37514068  0.21823744
 [97] -0.60682647  0.45196771  0.02969208  0.52270478
> colMedians(tmp)
  [1]  0.78244534  0.29306028 -0.29359393 -0.52914409 -1.02713350  0.77503589
  [7]  0.39179900  0.95453580 -1.22899738 -1.06799617 -0.02175118  1.11642053
 [13] -1.72456322  0.62226054  1.32291465  0.02161349  0.71373555  0.40822953
 [19] -1.90718713  1.12743157  0.73588470 -0.69375697 -1.22827040  0.23767634
 [25]  0.08029393 -0.67299796 -0.08831075 -2.24531148  0.99804705 -0.55167546
 [31] -0.12323458  3.08060741 -1.34079093  0.76651180  0.58077202 -0.31881990
 [37]  1.08346732  1.69117947 -0.45468070 -0.72139005 -0.27867141  0.43709866
 [43] -1.12814813 -0.39958238 -0.49668422  1.94594432 -0.15391150  1.60684074
 [49]  0.78266628  0.62710137  0.49294733  0.64199036  1.10092449  0.21276973
 [55]  0.57433242 -0.17828203  0.99798827  2.30510652 -0.93213894  0.86758256
 [61]  1.20740712  0.26314045 -2.64217437  0.54248492 -1.80892846  0.64502338
 [67]  0.71508949  0.16817936 -0.32461785  0.74837977  0.37738550  1.13362240
 [73] -0.37109305  0.74627642 -0.76557448 -0.44209285  0.23936404 -0.10981994
 [79]  1.58639050  0.52022647  1.20517584  0.05985932 -0.38116201  0.02060864
 [85]  1.15221902  0.36670803 -0.62053282  0.97171745 -0.31715571  0.85237639
 [91]  0.21776906  0.51819751 -1.07101862  0.44523180  0.37514068  0.21823744
 [97] -0.60682647  0.45196771  0.02969208  0.52270478
> colRanges(tmp)
          [,1]      [,2]       [,3]       [,4]      [,5]      [,6]     [,7]
[1,] 0.7824453 0.2930603 -0.2935939 -0.5291441 -1.027133 0.7750359 0.391799
[2,] 0.7824453 0.2930603 -0.2935939 -0.5291441 -1.027133 0.7750359 0.391799
          [,8]      [,9]     [,10]       [,11]    [,12]     [,13]     [,14]
[1,] 0.9545358 -1.228997 -1.067996 -0.02175118 1.116421 -1.724563 0.6222605
[2,] 0.9545358 -1.228997 -1.067996 -0.02175118 1.116421 -1.724563 0.6222605
        [,15]      [,16]     [,17]     [,18]     [,19]    [,20]     [,21]
[1,] 1.322915 0.02161349 0.7137356 0.4082295 -1.907187 1.127432 0.7358847
[2,] 1.322915 0.02161349 0.7137356 0.4082295 -1.907187 1.127432 0.7358847
         [,22]    [,23]     [,24]      [,25]     [,26]       [,27]     [,28]
[1,] -0.693757 -1.22827 0.2376763 0.08029393 -0.672998 -0.08831075 -2.245311
[2,] -0.693757 -1.22827 0.2376763 0.08029393 -0.672998 -0.08831075 -2.245311
        [,29]      [,30]      [,31]    [,32]     [,33]     [,34]    [,35]
[1,] 0.998047 -0.5516755 -0.1232346 3.080607 -1.340791 0.7665118 0.580772
[2,] 0.998047 -0.5516755 -0.1232346 3.080607 -1.340791 0.7665118 0.580772
          [,36]    [,37]    [,38]      [,39]    [,40]      [,41]     [,42]
[1,] -0.3188199 1.083467 1.691179 -0.4546807 -0.72139 -0.2786714 0.4370987
[2,] -0.3188199 1.083467 1.691179 -0.4546807 -0.72139 -0.2786714 0.4370987
         [,43]      [,44]      [,45]    [,46]      [,47]    [,48]     [,49]
[1,] -1.128148 -0.3995824 -0.4966842 1.945944 -0.1539115 1.606841 0.7826663
[2,] -1.128148 -0.3995824 -0.4966842 1.945944 -0.1539115 1.606841 0.7826663
         [,50]     [,51]     [,52]    [,53]     [,54]     [,55]     [,56]
[1,] 0.6271014 0.4929473 0.6419904 1.100924 0.2127697 0.5743324 -0.178282
[2,] 0.6271014 0.4929473 0.6419904 1.100924 0.2127697 0.5743324 -0.178282
         [,57]    [,58]      [,59]     [,60]    [,61]     [,62]     [,63]
[1,] 0.9979883 2.305107 -0.9321389 0.8675826 1.207407 0.2631405 -2.642174
[2,] 0.9979883 2.305107 -0.9321389 0.8675826 1.207407 0.2631405 -2.642174
         [,64]     [,65]     [,66]     [,67]     [,68]      [,69]     [,70]
[1,] 0.5424849 -1.808928 0.6450234 0.7150895 0.1681794 -0.3246179 0.7483798
[2,] 0.5424849 -1.808928 0.6450234 0.7150895 0.1681794 -0.3246179 0.7483798
         [,71]    [,72]      [,73]     [,74]      [,75]      [,76]    [,77]
[1,] 0.3773855 1.133622 -0.3710931 0.7462764 -0.7655745 -0.4420929 0.239364
[2,] 0.3773855 1.133622 -0.3710931 0.7462764 -0.7655745 -0.4420929 0.239364
          [,78]   [,79]     [,80]    [,81]      [,82]     [,83]      [,84]
[1,] -0.1098199 1.58639 0.5202265 1.205176 0.05985932 -0.381162 0.02060864
[2,] -0.1098199 1.58639 0.5202265 1.205176 0.05985932 -0.381162 0.02060864
        [,85]    [,86]      [,87]     [,88]      [,89]     [,90]     [,91]
[1,] 1.152219 0.366708 -0.6205328 0.9717175 -0.3171557 0.8523764 0.2177691
[2,] 1.152219 0.366708 -0.6205328 0.9717175 -0.3171557 0.8523764 0.2177691
         [,92]     [,93]     [,94]     [,95]     [,96]      [,97]     [,98]
[1,] 0.5181975 -1.071019 0.4452318 0.3751407 0.2182374 -0.6068265 0.4519677
[2,] 0.5181975 -1.071019 0.4452318 0.3751407 0.2182374 -0.6068265 0.4519677
          [,99]    [,100]
[1,] 0.02969208 0.5227048
[2,] 0.02969208 0.5227048
> 
> 
> Max(tmp2)
[1] 1.733115
> Min(tmp2)
[1] -2.456515
> mean(tmp2)
[1] 0.01729533
> Sum(tmp2)
[1] 1.729533
> Var(tmp2)
[1] 0.8655978
> 
> rowMeans(tmp2)
  [1] -0.964032550 -1.579286307  0.006164245  0.371499864  0.229499975
  [6] -0.791169760  1.499099464  0.633939869  0.384098028 -0.074535182
 [11]  0.028096333 -1.219741710  0.184783983  0.358219067 -0.795803014
 [16] -2.268076744  1.259041243 -0.971050463 -0.500696166  0.776287938
 [21] -1.405706209 -0.235133409 -0.018178473 -1.764334804  0.146212437
 [26]  0.413115246  0.879087927  1.355622236 -0.971733084 -0.151242134
 [31] -1.013227774  0.388616973  0.794172564 -1.168937315  0.569070542
 [36]  1.150309188  1.101234894 -0.008427868 -1.005397151  0.391377836
 [41] -0.174736936 -0.395452678  1.572242250  0.062872582  0.130827576
 [46]  0.715936188  1.157376856 -0.172344935 -0.308858189  1.444305134
 [51]  1.205008459 -1.007502665 -1.160161877  0.235737128  0.793822531
 [56]  0.512400244 -1.702207958  0.514766081 -1.203013638 -1.512631993
 [61]  0.242934269 -0.046315403  0.372734800 -0.570127753 -0.129403353
 [66] -1.644256588  0.661279183 -2.456515085  0.105112003 -0.691162528
 [71]  1.317207066  0.541063866 -0.036639840 -1.267265786  0.842006375
 [76]  0.492923166  0.271277907  0.052026971 -0.523705935 -0.569828666
 [81]  1.142665266 -0.313370962 -0.750040688  1.088639099  0.035115801
 [86] -0.425285935  0.960335025  1.630938441  0.911689648 -1.092742979
 [91] -0.281271625 -1.075989233  1.733114592  1.189275430  0.710461969
 [96] -0.349034349  0.309416704  1.124358944  0.443630180  1.053059143
> rowSums(tmp2)
  [1] -0.964032550 -1.579286307  0.006164245  0.371499864  0.229499975
  [6] -0.791169760  1.499099464  0.633939869  0.384098028 -0.074535182
 [11]  0.028096333 -1.219741710  0.184783983  0.358219067 -0.795803014
 [16] -2.268076744  1.259041243 -0.971050463 -0.500696166  0.776287938
 [21] -1.405706209 -0.235133409 -0.018178473 -1.764334804  0.146212437
 [26]  0.413115246  0.879087927  1.355622236 -0.971733084 -0.151242134
 [31] -1.013227774  0.388616973  0.794172564 -1.168937315  0.569070542
 [36]  1.150309188  1.101234894 -0.008427868 -1.005397151  0.391377836
 [41] -0.174736936 -0.395452678  1.572242250  0.062872582  0.130827576
 [46]  0.715936188  1.157376856 -0.172344935 -0.308858189  1.444305134
 [51]  1.205008459 -1.007502665 -1.160161877  0.235737128  0.793822531
 [56]  0.512400244 -1.702207958  0.514766081 -1.203013638 -1.512631993
 [61]  0.242934269 -0.046315403  0.372734800 -0.570127753 -0.129403353
 [66] -1.644256588  0.661279183 -2.456515085  0.105112003 -0.691162528
 [71]  1.317207066  0.541063866 -0.036639840 -1.267265786  0.842006375
 [76]  0.492923166  0.271277907  0.052026971 -0.523705935 -0.569828666
 [81]  1.142665266 -0.313370962 -0.750040688  1.088639099  0.035115801
 [86] -0.425285935  0.960335025  1.630938441  0.911689648 -1.092742979
 [91] -0.281271625 -1.075989233  1.733114592  1.189275430  0.710461969
 [96] -0.349034349  0.309416704  1.124358944  0.443630180  1.053059143
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.964032550 -1.579286307  0.006164245  0.371499864  0.229499975
  [6] -0.791169760  1.499099464  0.633939869  0.384098028 -0.074535182
 [11]  0.028096333 -1.219741710  0.184783983  0.358219067 -0.795803014
 [16] -2.268076744  1.259041243 -0.971050463 -0.500696166  0.776287938
 [21] -1.405706209 -0.235133409 -0.018178473 -1.764334804  0.146212437
 [26]  0.413115246  0.879087927  1.355622236 -0.971733084 -0.151242134
 [31] -1.013227774  0.388616973  0.794172564 -1.168937315  0.569070542
 [36]  1.150309188  1.101234894 -0.008427868 -1.005397151  0.391377836
 [41] -0.174736936 -0.395452678  1.572242250  0.062872582  0.130827576
 [46]  0.715936188  1.157376856 -0.172344935 -0.308858189  1.444305134
 [51]  1.205008459 -1.007502665 -1.160161877  0.235737128  0.793822531
 [56]  0.512400244 -1.702207958  0.514766081 -1.203013638 -1.512631993
 [61]  0.242934269 -0.046315403  0.372734800 -0.570127753 -0.129403353
 [66] -1.644256588  0.661279183 -2.456515085  0.105112003 -0.691162528
 [71]  1.317207066  0.541063866 -0.036639840 -1.267265786  0.842006375
 [76]  0.492923166  0.271277907  0.052026971 -0.523705935 -0.569828666
 [81]  1.142665266 -0.313370962 -0.750040688  1.088639099  0.035115801
 [86] -0.425285935  0.960335025  1.630938441  0.911689648 -1.092742979
 [91] -0.281271625 -1.075989233  1.733114592  1.189275430  0.710461969
 [96] -0.349034349  0.309416704  1.124358944  0.443630180  1.053059143
> rowMin(tmp2)
  [1] -0.964032550 -1.579286307  0.006164245  0.371499864  0.229499975
  [6] -0.791169760  1.499099464  0.633939869  0.384098028 -0.074535182
 [11]  0.028096333 -1.219741710  0.184783983  0.358219067 -0.795803014
 [16] -2.268076744  1.259041243 -0.971050463 -0.500696166  0.776287938
 [21] -1.405706209 -0.235133409 -0.018178473 -1.764334804  0.146212437
 [26]  0.413115246  0.879087927  1.355622236 -0.971733084 -0.151242134
 [31] -1.013227774  0.388616973  0.794172564 -1.168937315  0.569070542
 [36]  1.150309188  1.101234894 -0.008427868 -1.005397151  0.391377836
 [41] -0.174736936 -0.395452678  1.572242250  0.062872582  0.130827576
 [46]  0.715936188  1.157376856 -0.172344935 -0.308858189  1.444305134
 [51]  1.205008459 -1.007502665 -1.160161877  0.235737128  0.793822531
 [56]  0.512400244 -1.702207958  0.514766081 -1.203013638 -1.512631993
 [61]  0.242934269 -0.046315403  0.372734800 -0.570127753 -0.129403353
 [66] -1.644256588  0.661279183 -2.456515085  0.105112003 -0.691162528
 [71]  1.317207066  0.541063866 -0.036639840 -1.267265786  0.842006375
 [76]  0.492923166  0.271277907  0.052026971 -0.523705935 -0.569828666
 [81]  1.142665266 -0.313370962 -0.750040688  1.088639099  0.035115801
 [86] -0.425285935  0.960335025  1.630938441  0.911689648 -1.092742979
 [91] -0.281271625 -1.075989233  1.733114592  1.189275430  0.710461969
 [96] -0.349034349  0.309416704  1.124358944  0.443630180  1.053059143
> 
> colMeans(tmp2)
[1] 0.01729533
> colSums(tmp2)
[1] 1.729533
> colVars(tmp2)
[1] 0.8655978
> colSd(tmp2)
[1] 0.9303751
> colMax(tmp2)
[1] 1.733115
> colMin(tmp2)
[1] -2.456515
> colMedians(tmp2)
[1] 0.08399229
> colRanges(tmp2)
          [,1]
[1,] -2.456515
[2,]  1.733115
> 
> 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] -6.8477937  1.6843912 -2.5701615 -0.7056415 -7.3846594  7.2345798
 [7]  4.3491250  2.2698615 -0.9039145  6.8101579
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.01290738
[2,] -1.24921216
[3,] -0.83969547
[4,] -0.04230923
[5,]  1.25321430
> 
> rowApply(tmp,sum)
 [1] -0.5820917  2.6252463 -0.4741144 -0.4046006  5.3270134  3.8477684
 [7]  1.2105058 -1.4642029 -3.2415497 -2.9080297
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    5    2    1    7    1    6    4    2     2
 [2,]    2    2    9    8   10    2    2    7    6     8
 [3,]    1    3    8    5    2    3    7   10    4     1
 [4,]    5    8    3    4    4    9    4    2    3     9
 [5,]    3    1    5    7    1    6    1    5    1     4
 [6,]    8    9   10    3    9   10    8    3    7     7
 [7,]   10    6    4    6    3    8    9    9    9     6
 [8,]    7    4    6   10    8    7    3    1    8     3
 [9,]    6    7    1    9    5    5   10    6    5     5
[10,]    9   10    7    2    6    4    5    8   10    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.7940311  0.4100394 -5.8858179  0.1098240 -2.2782115 -2.6022313
 [7] -0.6733569 -0.3594647  0.9895794 -0.3282674  1.7935148 -0.1951469
[13]  0.2039698 -5.2151881  3.2288262 -2.1816847  2.8148430 -1.1602854
[19]  0.1540089 -3.4027652
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.97239572
[2,] -0.74988798
[3,] -0.07354199
[4,] -0.06942016
[5,]  0.07121471
> 
> rowApply(tmp,sum)
[1] -3.894297 -4.500824 -5.663305  3.794152 -6.107573
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   13   12    5    9    7
[2,]   19   10    8    6   13
[3,]    1    6    3   14    1
[4,]    6    8   13   20    8
[5,]   15   16    6    1   15
> 
> 
> as.matrix(tmp)
            [,1]        [,2]       [,3]       [,4]       [,5]         [,6]
[1,]  0.07121471  1.12767955 -1.9633217 -0.7590757  0.2451639 -1.315685641
[2,] -0.06942016 -0.09160973 -0.6902383 -0.6093949  0.1713283 -0.006899803
[3,] -0.97239572 -0.65614746 -1.2268374  0.2938463 -0.9034179 -1.101635780
[4,] -0.07354199 -0.17625276  0.6804922  1.8740469 -2.0932562  1.054203311
[5,] -0.74988798  0.20636976 -2.6859127 -0.6895986  0.3019704 -1.232213435
           [,7]       [,8]       [,9]      [,10]        [,11]        [,12]
[1,] -0.2764943  0.6743896 -1.1986128 -0.7271724  0.497082796 -0.454924622
[2,] -1.1063143 -0.6566443  0.3166616 -0.4944280 -0.007574418 -1.465481237
[3,]  0.0795828  0.6372884  0.9874995  0.6304546 -0.092558920  0.004246757
[4,]  0.2805569 -0.1452566  1.4608736  0.9335534 -0.273104799  1.277471626
[5,]  0.3493120 -0.8692418 -0.5768425 -0.6706750  1.669670161  0.443540626
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,]  1.0798202 -1.7128711  2.8837221 -0.8587491  0.1532117 -0.4473300
[2,]  0.5871211 -0.0857555 -1.5709919 -0.7694215  2.4478252  0.5176234
[3,] -1.7127137 -2.4615984  0.2965053  0.4288049 -0.3165000 -0.8477872
[4,]  1.4733142 -0.1371479  0.3659872 -0.5146747  0.2530237 -0.9046414
[5,] -1.2235720 -0.8178152  1.2536034 -0.4676442  0.2772823  0.5218498
          [,19]      [,20]
[1,] -0.7173474 -0.1949966
[2,]  0.0691949 -0.9864041
[3,]  0.7835400  0.4865192
[4,]  0.3454334 -1.8869281
[5,] -0.3268120 -0.8209556
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  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.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1     col2       col3       col4     col5        col6       col7
row1 0.7728531 0.895378 -0.7012966 -0.3232149 1.773927 -0.09316934 0.02167106
         col8      col9     col10    col11      col12      col13    col14
row1 3.041208 0.6906887 0.5515582 1.414572 -0.3463405 -0.3159079 0.300897
          col15      col16     col17    col18      col19    col20
row1 -0.6728857 -0.8124006 0.4062096 1.001576 -0.3880432 1.203736
> tmp[,"col10"]
          col10
row1  0.5515582
row2  0.6539020
row3 -0.3356969
row4  2.3922509
row5  2.1666930
> tmp[c("row1","row5"),]
          col1        col2       col3       col4      col5        col6
row1 0.7728531  0.89537800 -0.7012966 -0.3232149 1.7739274 -0.09316934
row5 0.7789567 -0.04664213  0.1232265 -0.4247152 0.8208485  1.14006230
            col7      col8       col9     col10     col11      col12      col13
row1  0.02167106  3.041208  0.6906887 0.5515582  1.414572 -0.3463405 -0.3159079
row5 -0.52585876 -2.166875 -0.9310567 2.1666930 -1.191514 -2.0081465 -0.8824715
          col14      col15      col16     col17     col18      col19     col20
row1  0.3008970 -0.6728857 -0.8124006 0.4062096  1.001576 -0.3880432 1.2037359
row5 -0.5715791  0.8509813  0.8767132 1.0489732 -2.135226  0.2759689 0.4530907
> tmp[,c("col6","col20")]
            col6      col20
row1 -0.09316934  1.2037359
row2  0.05517612 -0.1110939
row3 -0.02317430  0.1134395
row4  1.38073869 -2.5147340
row5  1.14006230  0.4530907
> tmp[c("row1","row5"),c("col6","col20")]
            col6     col20
row1 -0.09316934 1.2037359
row5  1.14006230 0.4530907
> 
> 
> 
> 
> 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 51.38112 49.68751 49.49377 50.94771 49.95081 105.1222 47.95322 51.02903
         col9    col10    col11    col12    col13   col14    col15    col16
row1 49.24447 51.07523 52.04311 49.62865 50.31606 52.1979 50.95623 49.73375
        col17    col18    col19    col20
row1 50.78354 48.78388 49.81804 104.4266
> tmp[,"col10"]
        col10
row1 51.07523
row2 29.80238
row3 30.25956
row4 29.06203
row5 51.38590
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.38112 49.68751 49.49377 50.94771 49.95081 105.1222 47.95322 51.02903
row5 50.71288 48.92514 49.68741 51.24488 48.71322 105.1566 51.89512 49.88552
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.24447 51.07523 52.04311 49.62865 50.31606 52.19790 50.95623 49.73375
row5 51.07892 51.38590 49.38764 50.24665 49.59277 51.84425 50.29807 49.02041
        col17    col18    col19    col20
row1 50.78354 48.78388 49.81804 104.4266
row5 51.25401 50.36199 50.91543 105.9989
> tmp[,c("col6","col20")]
          col6     col20
row1 105.12222 104.42661
row2  76.49100  74.43085
row3  75.03369  74.19053
row4  76.02252  74.05512
row5 105.15660 105.99894
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.1222 104.4266
row5 105.1566 105.9989
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.1222 104.4266
row5 105.1566 105.9989
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -0.38443021
[2,] -0.30379693
[3,] -0.49282085
[4,] -0.03662926
[5,]  1.67694635
> tmp[,c("col17","col7")]
           col17       col7
[1,] -0.18961507 0.33191249
[2,]  1.10984134 1.71718803
[3,] -1.01275392 1.34515894
[4,]  0.01076635 0.06651774
[5,]  0.22839726 0.05535784
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.3716058  0.5774824
[2,]  0.1604755  0.4379846
[3,] -1.2743198 -1.4056920
[4,] -0.7422964  1.4801797
[5,] -0.9573869  0.1781953
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.3716058
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.3716058
[2,]  0.1604755
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]       [,3]      [,4]        [,5]      [,6]
row3 -0.3959535 -1.364787 -1.0223046 0.1084517 -2.00904001 0.5984027
row1  0.1323206 -0.980723 -0.0204195 0.2881870  0.04666047 0.4697823
            [,7]       [,8]      [,9]       [,10]      [,11]      [,12]
row3  1.10197244 -0.3694553 0.5608745 -0.03006331  0.8437989  0.9930711
row1 -0.02777556 -0.8317165 1.5460166  0.25037428 -0.5352001 -0.4328855
         [,13]      [,14]     [,15]      [,16]     [,17]      [,18]      [,19]
row3  1.413058  0.1281447 0.1395667 -0.5643978 0.3232339  0.6131884  0.4463361
row1 -1.171867 -0.8046686 0.4364592 -0.4933020 0.3673270 -1.4360943 -0.4685787
          [,20]
row3 -0.7074321
row1  0.5662487
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]        [,2]      [,3]     [,4]       [,5]     [,6]      [,7]
row2 1.007457 -0.04359881 -2.229229 1.513703 -0.8309578 1.161585 0.3038792
           [,8]       [,9]     [,10]
row2 0.06181085 -0.9772004 -1.000023
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]      [,3]       [,4]      [,5]      [,6]      [,7]
row5 -1.871729 0.0390032 0.6671985 0.01304672 0.8137233 0.4433741 -1.247737
           [,8]     [,9]      [,10]     [,11]    [,12]      [,13]     [,14]
row5 -0.1487661 -1.57036 -0.4448558 0.8120515 2.381494 -0.4067434 0.5641561
         [,15]      [,16]      [,17]    [,18]     [,19]      [,20]
row5 -2.863215 -0.4680052 -0.3489402 1.290459 -0.290861 -0.3157481
> 
> 
> 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: 0x6260d16cbaf0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c32369282b"
 [2] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c375c6956f"
 [3] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c32ae3c542"
 [4] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c31160f280"
 [5] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c330319d9e"
 [6] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c34c3ad237"
 [7] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c361666564"
 [8] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c3120c9566"
 [9] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c31374ff44"
[10] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c3539c2536"
[11] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c319b13bbf"
[12] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c36125f8a3"
[13] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c375fe6e42"
[14] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c351dd91ce"
[15] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM24a9c31b83307c"
> 
> 
> ### 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: 0x6260d307bad0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x6260d307bad0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x6260d307bad0>
> rowMedians(tmp)
  [1]  0.204538163 -0.066645943 -0.092078805  0.303135095  0.153024900
  [6]  0.089838300 -0.715582047 -1.018832229  0.512779573  0.055188919
 [11]  0.217007976  0.471385975 -0.059398518 -0.245295961  0.123279831
 [16]  0.344986113  0.439671814 -0.040941543 -0.608828047  0.584157244
 [21]  0.267713206  0.021068166 -0.599619959  0.088125256 -0.097942723
 [26]  0.676871039 -0.311473007 -0.221976078  0.290508956  0.269489896
 [31]  0.322158356  0.070773361  0.151238067 -0.023938719 -0.521510803
 [36] -0.105971578 -0.382203891 -0.047680799 -0.087221620  0.106261088
 [41]  0.041238603  0.086013350  0.107839985  0.166948968 -0.008945402
 [46] -0.009813836 -0.465061478  0.131598135 -0.737432069 -0.075743344
 [51]  0.503753174 -0.258668038  0.216010572 -0.121209618 -0.519752172
 [56]  0.832524819 -0.357964472 -0.117949439  0.298866975  0.079516384
 [61] -0.461731580 -0.552269874  0.275460249  0.094525554  0.437063462
 [66] -0.089189927  0.405940393 -0.559615472 -0.001480678  0.020252668
 [71] -0.603274201  0.014748989  0.004061008 -0.416051823  0.289186160
 [76]  0.371034463 -0.245964339 -0.581238837  0.696349457 -0.726798888
 [81] -0.393559415  0.158787141 -0.092238752 -0.054168972  0.307372493
 [86] -0.598129306 -0.039632080  0.128273021 -0.334727289 -0.460985153
 [91] -0.145557662  0.093868096  0.368794477 -0.373190108 -0.587992967
 [96]  0.108582349 -0.205864398 -0.121233061  0.152568615  0.130512435
[101] -0.187473433 -0.223247940 -0.264978890  0.318909677  0.316395393
[106] -0.476106775  0.425282984 -0.205132628  0.083924890 -0.112130612
[111]  0.430247783  0.367643516  0.361606303 -0.136381759 -0.046999079
[116] -0.359606374 -0.005182035  0.520157282 -0.284377696 -0.064630420
[121] -0.536148444  0.018386051  0.032206105 -0.101735488  0.151056246
[126]  0.096714481 -0.208915254  0.456267849 -0.041465219 -0.125844369
[131] -0.387469262 -0.099938594  0.561557036 -0.216915439  0.099376227
[136]  0.186268043 -0.045372403  0.395504723 -0.084750914 -0.145863956
[141] -0.063408595  0.426500928  0.289954802 -0.033386271  0.306837316
[146] -0.098868992 -0.487660831 -0.004649711  0.618440547  0.112858599
[151]  0.079743415 -0.535423398 -0.075459865 -0.083429866  0.154089348
[156] -0.627402503  0.231709433  0.170297331  0.013570768  0.087819012
[161] -0.092828599  0.453347489 -0.126458812  0.440531805 -0.156647147
[166]  0.155332661 -0.442826052 -0.022641628 -0.038462641  0.265944488
[171]  0.428690046 -0.047865886 -0.089189533 -0.085354932  0.353684477
[176]  0.697030089 -0.178092764 -0.462410735  0.358699607  0.300167007
[181]  0.106387903  0.346146978  0.144614875  0.446773768  0.241212309
[186] -0.303436913 -0.250789460  0.192649687 -0.247117913 -0.072049213
[191] -0.608183355  0.642604552  0.125812890  0.026559901 -0.541583292
[196] -0.013797833  0.388830208  0.261772799 -0.491251246  0.189690162
[201] -0.033307461 -0.065924394  0.195516033 -0.199700976 -0.022983561
[206]  0.156816852  0.052989138  0.470143061 -0.266165889 -0.622118183
[211] -0.025320769  0.069549671 -0.224747711  0.148441685  0.716317346
[216]  0.408698947 -0.415725576  0.370831901 -0.120202509  0.208656093
[221]  0.014544558  0.424693514  0.217774349  0.333444183  0.025017991
[226] -0.323150292  0.078045196 -0.173731427 -0.296633939 -0.034308127
> 
> proc.time()
   user  system elapsed 
  1.341   1.478   2.809 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2025-12-22 r89219) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x6530f1a565f0>
> .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: 0x6530f1a565f0>
> .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: 0x6530f1a565f0>
> .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: 0x6530f1a565f0>
> 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: 0x6530f22d42b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6530f22d42b0>
> .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: 0x6530f22d42b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6530f22d42b0>
> .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: 0x6530f22d42b0>
> 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: 0x6530f19b7a20>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6530f19b7a20>
> .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: 0x6530f19b7a20>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x6530f19b7a20>
> .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: 0x6530f19b7a20>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x6530f19b7a20>
> .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: 0x6530f19b7a20>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x6530f19b7a20>
> .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: 0x6530f19b7a20>
> 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: 0x6530f2194e00>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x6530f2194e00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6530f2194e00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6530f2194e00>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile24aafd2407aa84" "BufferedMatrixFile24aafd7d7a9db7"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile24aafd2407aa84" "BufferedMatrixFile24aafd7d7a9db7"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x6530f209c4c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6530f209c4c0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x6530f209c4c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x6530f209c4c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x6530f209c4c0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x6530f209c4c0>
> .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: 0x6530f24457e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6530f24457e0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x6530f24457e0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x6530f24457e0>
> 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: 0x6530f351e520>
> .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: 0x6530f351e520>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.249   0.047   0.285 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2025-12-22 r89219) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.245   0.044   0.277 

Example timings