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

This page was generated on 2026-02-28 11:34 -0500 (Sat, 28 Feb 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.3 LTS)x86_64R Under development (unstable) (2026-01-15 r89304) -- "Unsuffered Consequences" 4877
kjohnson3macOS 13.7.7 Venturaarm64R Under development (unstable) (2026-01-15 r89304) -- "Unsuffered Consequences" 4570
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 255/2357HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.75.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-02-27 13:40 -0500 (Fri, 27 Feb 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
See other builds for BufferedMatrix in R Universe.


CHECK results for BufferedMatrix on nebbiolo1

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

raw results


Summary

Package: BufferedMatrix
Version: 1.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-02-27 21:49:55 -0500 (Fri, 27 Feb 2026)
EndedAt: 2026-02-27 21:50:20 -0500 (Fri, 27 Feb 2026)
EllapsedTime: 25.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2026-01-15 r89304)
* 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) (2026-01-15 r89304) -- "Unsuffered Consequences"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.235   0.048   0.273 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2026-01-15 r89304) -- "Unsuffered Consequences"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478920 25.6    1048721 56.1   639242 34.2
Vcells 885815  6.8    8388608 64.0  2083259 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] "Fri Feb 27 21:50:10 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] "Fri Feb 27 21:50:10 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: 0x5f7c08704c10>
> 
> 
> 
> 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] "Fri Feb 27 21:50:10 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] "Fri Feb 27 21:50:11 2026"
> 
> ColMode(tmp2)
<pointer: 0x5f7c08704c10>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]       [,3]       [,4]
[1,] 100.8965358 -1.0940948 -1.2457837 -0.5995354
[2,]   0.0196297  2.4120614  0.8400902  0.7779246
[3,]  -1.0316274  1.0861181 -1.3825804  1.0288789
[4,]  -2.3295324 -0.9234769  0.8672107  0.4431447
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 100.8965358 1.0940948 1.2457837 0.5995354
[2,]   0.0196297 2.4120614 0.8400902 0.7779246
[3,]   1.0316274 1.0861181 1.3825804 1.0288789
[4,]   2.3295324 0.9234769 0.8672107 0.4431447
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 10.044727 1.0459899 1.1161468 0.7742967
[2,]  0.140106 1.5530813 0.9165644 0.8820004
[3,]  1.015691 1.0421699 1.1758318 1.0143367
[4,]  1.526281 0.9609771 0.9312415 0.6656911
> 
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 226.34380 36.55399 37.40725 33.34250
[2,]  26.42069 42.94287 35.00573 34.59793
[3,]  36.18853 36.50782 38.14090 36.17225
[4,]  42.59234 35.53325 35.17963 32.10006
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5f7c091ef820>
> exp(tmp5)
<pointer: 0x5f7c091ef820>
> log(tmp5,2)
<pointer: 0x5f7c091ef820>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.105
> Min(tmp5)
[1] 53.93081
> mean(tmp5)
[1] 73.26576
> Sum(tmp5)
[1] 14653.15
> Var(tmp5)
[1] 874.1072
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 93.16894 70.76174 72.86958 71.74838 69.73677 69.92069 71.63224 72.17411
 [9] 69.54637 71.09877
> rowSums(tmp5)
 [1] 1863.379 1415.235 1457.392 1434.968 1394.735 1398.414 1432.645 1443.482
 [9] 1390.927 1421.975
> rowVars(tmp5)
 [1] 7985.10088   95.67320   49.60765   57.82423   56.49427   53.05410
 [7]  108.57498  127.34753   82.64030   64.17502
> rowSd(tmp5)
 [1] 89.359392  9.781268  7.043270  7.604225  7.516267  7.283824 10.419932
 [8] 11.284836  9.090671  8.010931
> rowMax(tmp5)
 [1] 471.10497  89.37997  86.11059  88.65037  82.17674  86.43857  95.17581
 [8]  91.35379  86.69372  85.11855
> rowMin(tmp5)
 [1] 58.74731 54.60020 60.63256 55.08380 56.89558 56.11664 57.97122 53.93081
 [9] 55.40486 57.40836
> 
> colMeans(tmp5)
 [1] 107.28311  75.96828  72.83397  70.63326  72.61379  71.01523  68.05878
 [8]  74.65805  69.00162  66.47839  70.87790  72.79778  75.89692  70.47656
[15]  72.66734  74.21303  68.92688  71.79881  69.72992  69.38555
> colSums(tmp5)
 [1] 1072.8311  759.6828  728.3397  706.3326  726.1379  710.1523  680.5878
 [8]  746.5805  690.0162  664.7839  708.7790  727.9778  758.9692  704.7656
[15]  726.6734  742.1303  689.2688  717.9881  697.2992  693.8555
> colVars(tmp5)
 [1] 16444.72408    55.96489    74.24798    63.96011    64.85442    61.13550
 [7]    71.78045    59.52184    48.79478    81.28713    78.99215    62.76901
[13]    75.06268    68.16363    86.54118    61.58507    74.76984   105.02474
[19]   100.96088    97.55558
> colSd(tmp5)
 [1] 128.236984   7.480968   8.616727   7.997507   8.053224   7.818919
 [7]   8.472335   7.715040   6.985326   9.015938   8.887753   7.922690
[13]   8.663872   8.256127   9.302751   7.847616   8.646956  10.248158
[19]  10.047929   9.877023
> colMax(tmp5)
 [1] 471.10497  89.37997  91.23385  84.57063  86.69372  86.11059  84.50564
 [8]  86.43857  78.79587  75.99576  91.35379  85.11855  95.17581  83.39983
[15]  90.87213  87.01988  89.71869  85.58623  85.46116  81.27564
> colMin(tmp5)
 [1] 54.99120 63.89135 61.29768 56.11664 63.14021 63.03328 59.27839 61.41731
 [9] 60.25040 53.93081 62.68175 57.97122 62.01406 60.45055 58.80432 58.34027
[17] 60.75199 56.89558 57.59535 54.60020
> 
> 
> ### 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] 93.16894 70.76174 72.86958       NA 69.73677 69.92069 71.63224 72.17411
 [9] 69.54637 71.09877
> rowSums(tmp5)
 [1] 1863.379 1415.235 1457.392       NA 1394.735 1398.414 1432.645 1443.482
 [9] 1390.927 1421.975
> rowVars(tmp5)
 [1] 7985.10088   95.67320   49.60765   59.63557   56.49427   53.05410
 [7]  108.57498  127.34753   82.64030   64.17502
> rowSd(tmp5)
 [1] 89.359392  9.781268  7.043270  7.722407  7.516267  7.283824 10.419932
 [8] 11.284836  9.090671  8.010931
> rowMax(tmp5)
 [1] 471.10497  89.37997  86.11059        NA  82.17674  86.43857  95.17581
 [8]  91.35379  86.69372  85.11855
> rowMin(tmp5)
 [1] 58.74731 54.60020 60.63256       NA 56.89558 56.11664 57.97122 53.93081
 [9] 55.40486 57.40836
> 
> colMeans(tmp5)
 [1] 107.28311  75.96828  72.83397  70.63326  72.61379  71.01523  68.05878
 [8]  74.65805  69.00162  66.47839        NA  72.79778  75.89692  70.47656
[15]  72.66734  74.21303  68.92688  71.79881  69.72992  69.38555
> colSums(tmp5)
 [1] 1072.8311  759.6828  728.3397  706.3326  726.1379  710.1523  680.5878
 [8]  746.5805  690.0162  664.7839        NA  727.9778  758.9692  704.7656
[15]  726.6734  742.1303  689.2688  717.9881  697.2992  693.8555
> colVars(tmp5)
 [1] 16444.72408    55.96489    74.24798    63.96011    64.85442    61.13550
 [7]    71.78045    59.52184    48.79478    81.28713          NA    62.76901
[13]    75.06268    68.16363    86.54118    61.58507    74.76984   105.02474
[19]   100.96088    97.55558
> colSd(tmp5)
 [1] 128.236984   7.480968   8.616727   7.997507   8.053224   7.818919
 [7]   8.472335   7.715040   6.985326   9.015938         NA   7.922690
[13]   8.663872   8.256127   9.302751   7.847616   8.646956  10.248158
[19]  10.047929   9.877023
> colMax(tmp5)
 [1] 471.10497  89.37997  91.23385  84.57063  86.69372  86.11059  84.50564
 [8]  86.43857  78.79587  75.99576        NA  85.11855  95.17581  83.39983
[15]  90.87213  87.01988  89.71869  85.58623  85.46116  81.27564
> colMin(tmp5)
 [1] 54.99120 63.89135 61.29768 56.11664 63.14021 63.03328 59.27839 61.41731
 [9] 60.25040 53.93081       NA 57.97122 62.01406 60.45055 58.80432 58.34027
[17] 60.75199 56.89558 57.59535 54.60020
> 
> Max(tmp5,na.rm=TRUE)
[1] 471.105
> Min(tmp5,na.rm=TRUE)
[1] 53.93081
> mean(tmp5,na.rm=TRUE)
[1] 73.24879
> Sum(tmp5,na.rm=TRUE)
[1] 14576.51
> Var(tmp5,na.rm=TRUE)
[1] 878.464
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.16894 70.76174 72.86958 71.49076 69.73677 69.92069 71.63224 72.17411
 [9] 69.54637 71.09877
> rowSums(tmp5,na.rm=TRUE)
 [1] 1863.379 1415.235 1457.392 1358.324 1394.735 1398.414 1432.645 1443.482
 [9] 1390.927 1421.975
> rowVars(tmp5,na.rm=TRUE)
 [1] 7985.10088   95.67320   49.60765   59.63557   56.49427   53.05410
 [7]  108.57498  127.34753   82.64030   64.17502
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.359392  9.781268  7.043270  7.722407  7.516267  7.283824 10.419932
 [8] 11.284836  9.090671  8.010931
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.10497  89.37997  86.11059  88.65037  82.17674  86.43857  95.17581
 [8]  91.35379  86.69372  85.11855
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.74731 54.60020 60.63256 55.08380 56.89558 56.11664 57.97122 53.93081
 [9] 55.40486 57.40836
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 107.28311  75.96828  72.83397  70.63326  72.61379  71.01523  68.05878
 [8]  74.65805  69.00162  66.47839  70.23731  72.79778  75.89692  70.47656
[15]  72.66734  74.21303  68.92688  71.79881  69.72992  69.38555
> colSums(tmp5,na.rm=TRUE)
 [1] 1072.8311  759.6828  728.3397  706.3326  726.1379  710.1523  680.5878
 [8]  746.5805  690.0162  664.7839  632.1358  727.9778  758.9692  704.7656
[15]  726.6734  742.1303  689.2688  717.9881  697.2992  693.8555
> colVars(tmp5,na.rm=TRUE)
 [1] 16444.72408    55.96489    74.24798    63.96011    64.85442    61.13550
 [7]    71.78045    59.52184    48.79478    81.28713    84.24971    62.76901
[13]    75.06268    68.16363    86.54118    61.58507    74.76984   105.02474
[19]   100.96088    97.55558
> colSd(tmp5,na.rm=TRUE)
 [1] 128.236984   7.480968   8.616727   7.997507   8.053224   7.818919
 [7]   8.472335   7.715040   6.985326   9.015938   9.178764   7.922690
[13]   8.663872   8.256127   9.302751   7.847616   8.646956  10.248158
[19]  10.047929   9.877023
> colMax(tmp5,na.rm=TRUE)
 [1] 471.10497  89.37997  91.23385  84.57063  86.69372  86.11059  84.50564
 [8]  86.43857  78.79587  75.99576  91.35379  85.11855  95.17581  83.39983
[15]  90.87213  87.01988  89.71869  85.58623  85.46116  81.27564
> colMin(tmp5,na.rm=TRUE)
 [1] 54.99120 63.89135 61.29768 56.11664 63.14021 63.03328 59.27839 61.41731
 [9] 60.25040 53.93081 62.68175 57.97122 62.01406 60.45055 58.80432 58.34027
[17] 60.75199 56.89558 57.59535 54.60020
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.16894 70.76174 72.86958      NaN 69.73677 69.92069 71.63224 72.17411
 [9] 69.54637 71.09877
> rowSums(tmp5,na.rm=TRUE)
 [1] 1863.379 1415.235 1457.392    0.000 1394.735 1398.414 1432.645 1443.482
 [9] 1390.927 1421.975
> rowVars(tmp5,na.rm=TRUE)
 [1] 7985.10088   95.67320   49.60765         NA   56.49427   53.05410
 [7]  108.57498  127.34753   82.64030   64.17502
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.359392  9.781268  7.043270        NA  7.516267  7.283824 10.419932
 [8] 11.284836  9.090671  8.010931
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.10497  89.37997  86.11059        NA  82.17674  86.43857  95.17581
 [8]  91.35379  86.69372  85.11855
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.74731 54.60020 60.63256       NA 56.89558 56.11664 57.97122 53.93081
 [9] 55.40486 57.40836
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.35341  76.19167  72.79088  71.05783  73.00878  70.56807  68.54283
 [8]  74.68529  69.54473  67.74446       NaN  72.59072  76.09773  70.86694
[15]  73.60622  74.52777  68.41681  70.26688  70.00274  68.58605
> colSums(tmp5,na.rm=TRUE)
 [1] 984.1807 685.7250 655.1179 639.5205 657.0791 635.1126 616.8854 672.1676
 [9] 625.9026 609.7001   0.0000 653.3165 684.8796 637.8024 662.4560 670.7500
[17] 615.7513 632.4019 630.0246 617.2745
> colVars(tmp5,na.rm=TRUE)
 [1] 18452.09530    62.39911    83.50809    69.92713    71.20597    66.52789
 [7]    78.11718    66.95372    51.57570    73.41514          NA    70.13279
[13]    83.99187    74.96966    87.44185    68.16873    81.18912    91.75106
[19]   112.74365   102.55909
> colSd(tmp5,na.rm=TRUE)
 [1] 135.838490   7.899310   9.138276   8.362245   8.438363   8.156463
 [7]   8.838393   8.182525   7.181622   8.568264         NA   8.374532
[13]   9.164708   8.658502   9.351035   8.256436   9.010500   9.578677
[19]  10.618082  10.127146
> colMax(tmp5,na.rm=TRUE)
 [1] 471.10497  89.37997  91.23385  84.57063  86.69372  86.11059  84.50564
 [8]  86.43857  78.79587  75.99576      -Inf  85.11855  95.17581  83.39983
[15]  90.87213  87.01988  89.71869  82.50110  85.46116  81.27564
> colMin(tmp5,na.rm=TRUE)
 [1] 54.99120 63.89135 61.29768 56.11664 63.14021 63.03328 59.27839 61.41731
 [9] 60.25040 53.93081      Inf 57.97122 62.01406 60.45055 58.80432 58.34027
[17] 60.75199 56.89558 57.59535 54.60020
> 
> 
> 
> 
> 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] 112.2473 106.9779 189.0381 239.3858 205.6296 223.3197 230.6998 132.2018
 [9] 243.0056 180.4853
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 112.2473 106.9779 189.0381 239.3858 205.6296 223.3197 230.6998 132.2018
 [9] 243.0056 180.4853
> 
> 
> 
> 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 -1.136868e-13 -1.136868e-13 -1.705303e-13  8.526513e-14
 [6] -7.105427e-15  1.136868e-13  0.000000e+00 -2.842171e-14  8.526513e-14
[11]  2.842171e-13 -2.842171e-14  5.684342e-14 -5.684342e-14 -1.705303e-13
[16]  8.526513e-14 -5.684342e-14 -1.136868e-13  2.842171e-14 -5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
6   6 
7   4 
10   3 
10   9 
8   18 
3   17 
5   17 
10   19 
6   19 
4   7 
4   19 
1   16 
2   6 
8   3 
10   13 
4   8 
3   11 
1   20 
1   19 
8   10 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.872026
> Min(tmp)
[1] -2.857854
> mean(tmp)
[1] 0.01387259
> Sum(tmp)
[1] 1.387259
> Var(tmp)
[1] 1.166599
> 
> rowMeans(tmp)
[1] 0.01387259
> rowSums(tmp)
[1] 1.387259
> rowVars(tmp)
[1] 1.166599
> rowSd(tmp)
[1] 1.080092
> rowMax(tmp)
[1] 2.872026
> rowMin(tmp)
[1] -2.857854
> 
> colMeans(tmp)
  [1] -0.344054750 -0.614109143 -0.374961093  0.452523503  1.159458474
  [6]  1.961609935  0.061598067 -2.209825161  1.127137527  0.997582629
 [11]  0.287828287 -0.384580867  1.432071133 -0.101633470  0.001939002
 [16]  1.729997082  0.078741105  1.375466203 -0.609082879 -0.740277582
 [21] -2.484248718  1.593981046 -0.554562955 -1.126370447  1.293592146
 [26] -1.975921409  0.607683411 -0.448617847  0.556542885  1.600128057
 [31] -0.651469721 -0.026640166 -0.296137194  1.287272557  0.991520813
 [36]  0.408698777  0.264894388  0.356080206 -2.446698174 -0.975126440
 [41]  0.768042722 -1.733105244  1.522960634  0.287446733 -0.168576694
 [46] -0.122665129  0.832441917 -0.707794549 -0.551567339 -0.438896381
 [51]  0.078975004 -0.214710222  0.132174701  0.498273591 -0.517207447
 [56]  1.002266956 -0.224192853  1.169703501 -1.000651357  0.911616251
 [61]  1.434618625  0.113526495  1.127049551 -0.034952828 -1.318399517
 [66] -0.438614092 -2.857854214  0.600338602  0.749138510  0.156109833
 [71] -0.590430063  2.872025558 -2.449162217 -0.441810879  2.373473273
 [76] -0.679355135  1.363900851  0.916908624 -1.296263410 -1.074401532
 [81]  0.643110089 -0.846701876 -1.420434586 -1.166870833  0.938572722
 [86]  0.521142315 -0.352651356  0.154038599 -0.384183100 -0.293282854
 [91]  0.103218636  0.180603822 -0.048932585  0.723769704 -0.074632928
 [96]  0.355943015 -1.924684546 -0.426406411  0.063608567 -0.670377740
> colSums(tmp)
  [1] -0.344054750 -0.614109143 -0.374961093  0.452523503  1.159458474
  [6]  1.961609935  0.061598067 -2.209825161  1.127137527  0.997582629
 [11]  0.287828287 -0.384580867  1.432071133 -0.101633470  0.001939002
 [16]  1.729997082  0.078741105  1.375466203 -0.609082879 -0.740277582
 [21] -2.484248718  1.593981046 -0.554562955 -1.126370447  1.293592146
 [26] -1.975921409  0.607683411 -0.448617847  0.556542885  1.600128057
 [31] -0.651469721 -0.026640166 -0.296137194  1.287272557  0.991520813
 [36]  0.408698777  0.264894388  0.356080206 -2.446698174 -0.975126440
 [41]  0.768042722 -1.733105244  1.522960634  0.287446733 -0.168576694
 [46] -0.122665129  0.832441917 -0.707794549 -0.551567339 -0.438896381
 [51]  0.078975004 -0.214710222  0.132174701  0.498273591 -0.517207447
 [56]  1.002266956 -0.224192853  1.169703501 -1.000651357  0.911616251
 [61]  1.434618625  0.113526495  1.127049551 -0.034952828 -1.318399517
 [66] -0.438614092 -2.857854214  0.600338602  0.749138510  0.156109833
 [71] -0.590430063  2.872025558 -2.449162217 -0.441810879  2.373473273
 [76] -0.679355135  1.363900851  0.916908624 -1.296263410 -1.074401532
 [81]  0.643110089 -0.846701876 -1.420434586 -1.166870833  0.938572722
 [86]  0.521142315 -0.352651356  0.154038599 -0.384183100 -0.293282854
 [91]  0.103218636  0.180603822 -0.048932585  0.723769704 -0.074632928
 [96]  0.355943015 -1.924684546 -0.426406411  0.063608567 -0.670377740
> 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.344054750 -0.614109143 -0.374961093  0.452523503  1.159458474
  [6]  1.961609935  0.061598067 -2.209825161  1.127137527  0.997582629
 [11]  0.287828287 -0.384580867  1.432071133 -0.101633470  0.001939002
 [16]  1.729997082  0.078741105  1.375466203 -0.609082879 -0.740277582
 [21] -2.484248718  1.593981046 -0.554562955 -1.126370447  1.293592146
 [26] -1.975921409  0.607683411 -0.448617847  0.556542885  1.600128057
 [31] -0.651469721 -0.026640166 -0.296137194  1.287272557  0.991520813
 [36]  0.408698777  0.264894388  0.356080206 -2.446698174 -0.975126440
 [41]  0.768042722 -1.733105244  1.522960634  0.287446733 -0.168576694
 [46] -0.122665129  0.832441917 -0.707794549 -0.551567339 -0.438896381
 [51]  0.078975004 -0.214710222  0.132174701  0.498273591 -0.517207447
 [56]  1.002266956 -0.224192853  1.169703501 -1.000651357  0.911616251
 [61]  1.434618625  0.113526495  1.127049551 -0.034952828 -1.318399517
 [66] -0.438614092 -2.857854214  0.600338602  0.749138510  0.156109833
 [71] -0.590430063  2.872025558 -2.449162217 -0.441810879  2.373473273
 [76] -0.679355135  1.363900851  0.916908624 -1.296263410 -1.074401532
 [81]  0.643110089 -0.846701876 -1.420434586 -1.166870833  0.938572722
 [86]  0.521142315 -0.352651356  0.154038599 -0.384183100 -0.293282854
 [91]  0.103218636  0.180603822 -0.048932585  0.723769704 -0.074632928
 [96]  0.355943015 -1.924684546 -0.426406411  0.063608567 -0.670377740
> colMin(tmp)
  [1] -0.344054750 -0.614109143 -0.374961093  0.452523503  1.159458474
  [6]  1.961609935  0.061598067 -2.209825161  1.127137527  0.997582629
 [11]  0.287828287 -0.384580867  1.432071133 -0.101633470  0.001939002
 [16]  1.729997082  0.078741105  1.375466203 -0.609082879 -0.740277582
 [21] -2.484248718  1.593981046 -0.554562955 -1.126370447  1.293592146
 [26] -1.975921409  0.607683411 -0.448617847  0.556542885  1.600128057
 [31] -0.651469721 -0.026640166 -0.296137194  1.287272557  0.991520813
 [36]  0.408698777  0.264894388  0.356080206 -2.446698174 -0.975126440
 [41]  0.768042722 -1.733105244  1.522960634  0.287446733 -0.168576694
 [46] -0.122665129  0.832441917 -0.707794549 -0.551567339 -0.438896381
 [51]  0.078975004 -0.214710222  0.132174701  0.498273591 -0.517207447
 [56]  1.002266956 -0.224192853  1.169703501 -1.000651357  0.911616251
 [61]  1.434618625  0.113526495  1.127049551 -0.034952828 -1.318399517
 [66] -0.438614092 -2.857854214  0.600338602  0.749138510  0.156109833
 [71] -0.590430063  2.872025558 -2.449162217 -0.441810879  2.373473273
 [76] -0.679355135  1.363900851  0.916908624 -1.296263410 -1.074401532
 [81]  0.643110089 -0.846701876 -1.420434586 -1.166870833  0.938572722
 [86]  0.521142315 -0.352651356  0.154038599 -0.384183100 -0.293282854
 [91]  0.103218636  0.180603822 -0.048932585  0.723769704 -0.074632928
 [96]  0.355943015 -1.924684546 -0.426406411  0.063608567 -0.670377740
> colMedians(tmp)
  [1] -0.344054750 -0.614109143 -0.374961093  0.452523503  1.159458474
  [6]  1.961609935  0.061598067 -2.209825161  1.127137527  0.997582629
 [11]  0.287828287 -0.384580867  1.432071133 -0.101633470  0.001939002
 [16]  1.729997082  0.078741105  1.375466203 -0.609082879 -0.740277582
 [21] -2.484248718  1.593981046 -0.554562955 -1.126370447  1.293592146
 [26] -1.975921409  0.607683411 -0.448617847  0.556542885  1.600128057
 [31] -0.651469721 -0.026640166 -0.296137194  1.287272557  0.991520813
 [36]  0.408698777  0.264894388  0.356080206 -2.446698174 -0.975126440
 [41]  0.768042722 -1.733105244  1.522960634  0.287446733 -0.168576694
 [46] -0.122665129  0.832441917 -0.707794549 -0.551567339 -0.438896381
 [51]  0.078975004 -0.214710222  0.132174701  0.498273591 -0.517207447
 [56]  1.002266956 -0.224192853  1.169703501 -1.000651357  0.911616251
 [61]  1.434618625  0.113526495  1.127049551 -0.034952828 -1.318399517
 [66] -0.438614092 -2.857854214  0.600338602  0.749138510  0.156109833
 [71] -0.590430063  2.872025558 -2.449162217 -0.441810879  2.373473273
 [76] -0.679355135  1.363900851  0.916908624 -1.296263410 -1.074401532
 [81]  0.643110089 -0.846701876 -1.420434586 -1.166870833  0.938572722
 [86]  0.521142315 -0.352651356  0.154038599 -0.384183100 -0.293282854
 [91]  0.103218636  0.180603822 -0.048932585  0.723769704 -0.074632928
 [96]  0.355943015 -1.924684546 -0.426406411  0.063608567 -0.670377740
> colRanges(tmp)
           [,1]       [,2]       [,3]      [,4]     [,5]    [,6]       [,7]
[1,] -0.3440547 -0.6141091 -0.3749611 0.4525235 1.159458 1.96161 0.06159807
[2,] -0.3440547 -0.6141091 -0.3749611 0.4525235 1.159458 1.96161 0.06159807
          [,8]     [,9]     [,10]     [,11]      [,12]    [,13]      [,14]
[1,] -2.209825 1.127138 0.9975826 0.2878283 -0.3845809 1.432071 -0.1016335
[2,] -2.209825 1.127138 0.9975826 0.2878283 -0.3845809 1.432071 -0.1016335
           [,15]    [,16]      [,17]    [,18]      [,19]      [,20]     [,21]
[1,] 0.001939002 1.729997 0.07874111 1.375466 -0.6090829 -0.7402776 -2.484249
[2,] 0.001939002 1.729997 0.07874111 1.375466 -0.6090829 -0.7402776 -2.484249
        [,22]     [,23]    [,24]    [,25]     [,26]     [,27]      [,28]
[1,] 1.593981 -0.554563 -1.12637 1.293592 -1.975921 0.6076834 -0.4486178
[2,] 1.593981 -0.554563 -1.12637 1.293592 -1.975921 0.6076834 -0.4486178
         [,29]    [,30]      [,31]       [,32]      [,33]    [,34]     [,35]
[1,] 0.5565429 1.600128 -0.6514697 -0.02664017 -0.2961372 1.287273 0.9915208
[2,] 0.5565429 1.600128 -0.6514697 -0.02664017 -0.2961372 1.287273 0.9915208
         [,36]     [,37]     [,38]     [,39]      [,40]     [,41]     [,42]
[1,] 0.4086988 0.2648944 0.3560802 -2.446698 -0.9751264 0.7680427 -1.733105
[2,] 0.4086988 0.2648944 0.3560802 -2.446698 -0.9751264 0.7680427 -1.733105
        [,43]     [,44]      [,45]      [,46]     [,47]      [,48]      [,49]
[1,] 1.522961 0.2874467 -0.1685767 -0.1226651 0.8324419 -0.7077945 -0.5515673
[2,] 1.522961 0.2874467 -0.1685767 -0.1226651 0.8324419 -0.7077945 -0.5515673
          [,50]    [,51]      [,52]     [,53]     [,54]      [,55]    [,56]
[1,] -0.4388964 0.078975 -0.2147102 0.1321747 0.4982736 -0.5172074 1.002267
[2,] -0.4388964 0.078975 -0.2147102 0.1321747 0.4982736 -0.5172074 1.002267
          [,57]    [,58]     [,59]     [,60]    [,61]     [,62]   [,63]
[1,] -0.2241929 1.169704 -1.000651 0.9116163 1.434619 0.1135265 1.12705
[2,] -0.2241929 1.169704 -1.000651 0.9116163 1.434619 0.1135265 1.12705
           [,64]   [,65]      [,66]     [,67]     [,68]     [,69]     [,70]
[1,] -0.03495283 -1.3184 -0.4386141 -2.857854 0.6003386 0.7491385 0.1561098
[2,] -0.03495283 -1.3184 -0.4386141 -2.857854 0.6003386 0.7491385 0.1561098
          [,71]    [,72]     [,73]      [,74]    [,75]      [,76]    [,77]
[1,] -0.5904301 2.872026 -2.449162 -0.4418109 2.373473 -0.6793551 1.363901
[2,] -0.5904301 2.872026 -2.449162 -0.4418109 2.373473 -0.6793551 1.363901
         [,78]     [,79]     [,80]     [,81]      [,82]     [,83]     [,84]
[1,] 0.9169086 -1.296263 -1.074402 0.6431101 -0.8467019 -1.420435 -1.166871
[2,] 0.9169086 -1.296263 -1.074402 0.6431101 -0.8467019 -1.420435 -1.166871
         [,85]     [,86]      [,87]     [,88]      [,89]      [,90]     [,91]
[1,] 0.9385727 0.5211423 -0.3526514 0.1540386 -0.3841831 -0.2932829 0.1032186
[2,] 0.9385727 0.5211423 -0.3526514 0.1540386 -0.3841831 -0.2932829 0.1032186
         [,92]       [,93]     [,94]       [,95]    [,96]     [,97]      [,98]
[1,] 0.1806038 -0.04893259 0.7237697 -0.07463293 0.355943 -1.924685 -0.4264064
[2,] 0.1806038 -0.04893259 0.7237697 -0.07463293 0.355943 -1.924685 -0.4264064
          [,99]     [,100]
[1,] 0.06360857 -0.6703777
[2,] 0.06360857 -0.6703777
> 
> 
> Max(tmp2)
[1] 3.681258
> Min(tmp2)
[1] -2.354776
> mean(tmp2)
[1] 0.2497941
> Sum(tmp2)
[1] 24.97941
> Var(tmp2)
[1] 1.05931
> 
> rowMeans(tmp2)
  [1] -1.48307409  2.36840741 -1.83985657  1.19780142  0.33492023  1.33944713
  [7] -0.25020704 -1.47893601 -0.32609613  0.58263512  0.35071314  0.45865674
 [13]  0.11398718  0.40837186  0.63121447  1.68475765 -0.96324628  0.37829313
 [19]  0.40872833  0.63393947  1.20360847  0.18310864  0.95371611  0.14876833
 [25] -1.70742463 -1.04355736  0.16714598 -0.54855035  0.17833265  0.67657912
 [31] -0.15937877  0.94902358  0.38645013 -0.54743023  2.39696875  2.11632603
 [37]  0.45303353 -0.45144429  0.50016649  0.17090202  1.03772231  1.15802274
 [43]  0.33127449  0.08909653 -0.85623696  0.46876395 -0.20940629 -0.74667928
 [49]  0.75765985 -0.08706137  0.69430084  0.78548257  0.72549089  0.46480564
 [55] -0.27658479 -1.24003923 -0.50739787  0.19003285  2.36677158 -0.30200209
 [61] -1.13490659 -0.87587438 -2.35477633  0.88980556  3.68125795 -0.54774355
 [67]  0.39738900  1.12253259 -0.39943106 -0.47305437 -0.18121729  0.35534144
 [73] -1.36602537  0.30460282  0.70565948  0.85714470  0.20496686  0.27610742
 [79]  0.97409214 -0.70399934  0.75251636  1.43756503  0.32635195 -1.43188907
 [85]  1.60409161  0.09521130 -0.43891017  1.23975184 -1.31804950  1.04717955
 [91] -1.68572425 -0.06662621  1.11579822  0.62723574  0.90927640  1.90131292
 [97]  0.70270098  1.13756982  1.20789938 -1.33654228
> rowSums(tmp2)
  [1] -1.48307409  2.36840741 -1.83985657  1.19780142  0.33492023  1.33944713
  [7] -0.25020704 -1.47893601 -0.32609613  0.58263512  0.35071314  0.45865674
 [13]  0.11398718  0.40837186  0.63121447  1.68475765 -0.96324628  0.37829313
 [19]  0.40872833  0.63393947  1.20360847  0.18310864  0.95371611  0.14876833
 [25] -1.70742463 -1.04355736  0.16714598 -0.54855035  0.17833265  0.67657912
 [31] -0.15937877  0.94902358  0.38645013 -0.54743023  2.39696875  2.11632603
 [37]  0.45303353 -0.45144429  0.50016649  0.17090202  1.03772231  1.15802274
 [43]  0.33127449  0.08909653 -0.85623696  0.46876395 -0.20940629 -0.74667928
 [49]  0.75765985 -0.08706137  0.69430084  0.78548257  0.72549089  0.46480564
 [55] -0.27658479 -1.24003923 -0.50739787  0.19003285  2.36677158 -0.30200209
 [61] -1.13490659 -0.87587438 -2.35477633  0.88980556  3.68125795 -0.54774355
 [67]  0.39738900  1.12253259 -0.39943106 -0.47305437 -0.18121729  0.35534144
 [73] -1.36602537  0.30460282  0.70565948  0.85714470  0.20496686  0.27610742
 [79]  0.97409214 -0.70399934  0.75251636  1.43756503  0.32635195 -1.43188907
 [85]  1.60409161  0.09521130 -0.43891017  1.23975184 -1.31804950  1.04717955
 [91] -1.68572425 -0.06662621  1.11579822  0.62723574  0.90927640  1.90131292
 [97]  0.70270098  1.13756982  1.20789938 -1.33654228
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -1.48307409  2.36840741 -1.83985657  1.19780142  0.33492023  1.33944713
  [7] -0.25020704 -1.47893601 -0.32609613  0.58263512  0.35071314  0.45865674
 [13]  0.11398718  0.40837186  0.63121447  1.68475765 -0.96324628  0.37829313
 [19]  0.40872833  0.63393947  1.20360847  0.18310864  0.95371611  0.14876833
 [25] -1.70742463 -1.04355736  0.16714598 -0.54855035  0.17833265  0.67657912
 [31] -0.15937877  0.94902358  0.38645013 -0.54743023  2.39696875  2.11632603
 [37]  0.45303353 -0.45144429  0.50016649  0.17090202  1.03772231  1.15802274
 [43]  0.33127449  0.08909653 -0.85623696  0.46876395 -0.20940629 -0.74667928
 [49]  0.75765985 -0.08706137  0.69430084  0.78548257  0.72549089  0.46480564
 [55] -0.27658479 -1.24003923 -0.50739787  0.19003285  2.36677158 -0.30200209
 [61] -1.13490659 -0.87587438 -2.35477633  0.88980556  3.68125795 -0.54774355
 [67]  0.39738900  1.12253259 -0.39943106 -0.47305437 -0.18121729  0.35534144
 [73] -1.36602537  0.30460282  0.70565948  0.85714470  0.20496686  0.27610742
 [79]  0.97409214 -0.70399934  0.75251636  1.43756503  0.32635195 -1.43188907
 [85]  1.60409161  0.09521130 -0.43891017  1.23975184 -1.31804950  1.04717955
 [91] -1.68572425 -0.06662621  1.11579822  0.62723574  0.90927640  1.90131292
 [97]  0.70270098  1.13756982  1.20789938 -1.33654228
> rowMin(tmp2)
  [1] -1.48307409  2.36840741 -1.83985657  1.19780142  0.33492023  1.33944713
  [7] -0.25020704 -1.47893601 -0.32609613  0.58263512  0.35071314  0.45865674
 [13]  0.11398718  0.40837186  0.63121447  1.68475765 -0.96324628  0.37829313
 [19]  0.40872833  0.63393947  1.20360847  0.18310864  0.95371611  0.14876833
 [25] -1.70742463 -1.04355736  0.16714598 -0.54855035  0.17833265  0.67657912
 [31] -0.15937877  0.94902358  0.38645013 -0.54743023  2.39696875  2.11632603
 [37]  0.45303353 -0.45144429  0.50016649  0.17090202  1.03772231  1.15802274
 [43]  0.33127449  0.08909653 -0.85623696  0.46876395 -0.20940629 -0.74667928
 [49]  0.75765985 -0.08706137  0.69430084  0.78548257  0.72549089  0.46480564
 [55] -0.27658479 -1.24003923 -0.50739787  0.19003285  2.36677158 -0.30200209
 [61] -1.13490659 -0.87587438 -2.35477633  0.88980556  3.68125795 -0.54774355
 [67]  0.39738900  1.12253259 -0.39943106 -0.47305437 -0.18121729  0.35534144
 [73] -1.36602537  0.30460282  0.70565948  0.85714470  0.20496686  0.27610742
 [79]  0.97409214 -0.70399934  0.75251636  1.43756503  0.32635195 -1.43188907
 [85]  1.60409161  0.09521130 -0.43891017  1.23975184 -1.31804950  1.04717955
 [91] -1.68572425 -0.06662621  1.11579822  0.62723574  0.90927640  1.90131292
 [97]  0.70270098  1.13756982  1.20789938 -1.33654228
> 
> colMeans(tmp2)
[1] 0.2497941
> colSums(tmp2)
[1] 24.97941
> colVars(tmp2)
[1] 1.05931
> colSd(tmp2)
[1] 1.029228
> colMax(tmp2)
[1] 3.681258
> colMin(tmp2)
[1] -2.354776
> colMedians(tmp2)
[1] 0.3428167
> colRanges(tmp2)
          [,1]
[1,] -2.354776
[2,]  3.681258
> 
> 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]  2.17520319  2.45710540 -4.54546079 -2.60585656 -6.69592574  2.72585974
 [7] -1.35291926  0.08315727 -0.07268973 -1.84143093
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.09114609
[2,] -0.78442974
[3,]  0.01023451
[4,]  1.07484832
[5,]  1.95339620
> 
> rowApply(tmp,sum)
 [1] -1.01643475 -5.76412371 -0.08904879  2.04201806 -5.15567798  2.22302542
 [7]  2.31513168 -1.90355031 -0.56730509 -1.75699194
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    2    4   10    6    7   10    4    8    1    10
 [2,]    9    2    9   10    9    4    3    6    6     7
 [3,]    4   10    2    5    1    5    1    4    7     3
 [4,]    8    6    1    3    4    9    8    7    4     4
 [5,]    7    5    7    1    2    6    5    1    5     1
 [6,]   10    7    5    9    5    7    2    9    3     8
 [7,]    1    1    6    4    3    8    6   10   10     6
 [8,]    3    8    8    8    6    2    9    2    8     2
 [9,]    6    3    3    7    8    3    7    3    9     9
[10,]    5    9    4    2   10    1   10    5    2     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.60891177  1.43265337 -1.75944963 -2.55497028  3.06157626  0.31366974
 [7]  6.73928730 -1.18044843  0.35361952  1.85533475  0.52746058  2.50495780
[13]  1.67185718  0.07997911  0.68041803  2.12443652  3.93512067 -0.21989264
[19]  2.62369345 -1.59193072
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.9530272
[2,] -0.8005900
[3,] -0.3617890
[4,]  1.1176450
[5,]  1.6066731
> 
> rowApply(tmp,sum)
[1] 8.790593 3.057732 3.706136 1.382797 4.269027
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   16    3    9    5   18
[2,]   15    8   17    4   11
[3,]    3    4   14   14    2
[4,]    7    6    8    2    6
[5,]   12   20   19    8    8
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]       [,5]       [,6]
[1,]  1.1176450  1.1064532 -0.5775531 -0.04922282  0.6151239  0.9981655
[2,] -0.9530272 -0.2161127 -0.8832283 -0.40738131  1.5130207  0.2169132
[3,] -0.3617890  1.3005094  0.8855485 -0.46252796  1.5426654 -0.8323472
[4,] -0.8005900 -0.9960628  0.3852836 -1.02132371 -0.3677930 -0.4237869
[5,]  1.6066731  0.2378662 -1.5695003 -0.61451449 -0.2414407  0.3547251
          [,7]       [,8]       [,9]       [,10]      [,11]      [,12]
[1,] 1.5223657  1.2916480 -0.3051505  0.26000036 -0.7029207  0.1411282
[2,] 0.4776636  0.6844300  0.7283198  0.76440501  0.4753915  1.0562488
[3,] 2.4121131 -0.9812336  0.9846909  0.01677565 -0.7359572  0.2429573
[4,] 1.5489854 -1.3646156  0.6580769 -0.28454575 -0.2425977  1.4361218
[5,] 0.7781595 -0.8106772 -1.7123176  1.09869949  1.7335447 -0.3714982
          [,13]      [,14]     [,15]       [,16]      [,17]      [,18]
[1,] -0.8388568 -0.3836801  1.798825  1.25062436  0.5153894  0.8249895
[2,]  0.4507326 -0.7486111 -1.272914 -1.03988993  1.2077838  0.3609772
[3,] -0.7717075  0.9276818 -1.167253  1.47909038  0.2024651 -0.9655305
[4,]  1.4306147  1.8412639  0.110117  0.41510218 -0.6258610  0.3473018
[5,]  1.4010742 -1.5566754  1.211643  0.01950951  2.6353434 -0.7876306
         [,19]      [,20]
[1,] 0.3333191 -0.1276998
[2,] 0.9665555 -0.3235450
[3,] 0.8404580 -0.8504741
[4,] 0.3431789 -1.0060728
[5,] 0.1401819  0.7158611
> 
> 
> 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 :  648  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 :  561  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 -2.356618 -0.4015207 -0.09180153 -0.3453615 0.9463791 0.3858045 -0.5296284
          col8     col9     col10      col11    col12      col13     col14
row1 -1.772957 2.193689 0.2369725 -0.4283786 0.961041 -0.7748716 0.9140165
         col15     col16     col17      col18     col19     col20
row1 -1.081406 -1.124129 -1.397538 -0.8001625 0.4506428 0.1691797
> tmp[,"col10"]
          col10
row1  0.2369725
row2 -0.5478881
row3 -1.7754305
row4  0.3755414
row5 -0.1070713
> tmp[c("row1","row5"),]
            col1       col2        col3       col4       col5      col6
row1 -2.35661823 -0.4015207 -0.09180153 -0.3453615  0.9463791 0.3858045
row5 -0.05340937  1.3432785 -0.24508336 -0.9865526 -0.1908341 0.1365672
           col7       col8       col9      col10      col11      col12
row1 -0.5296284 -1.7729573  2.1936895  0.2369725 -0.4283786 0.96104097
row5  1.2358250  0.1296615 -0.6352001 -0.1070713  1.8667882 0.06779629
          col13     col14      col15     col16      col17      col18      col19
row1 -0.7748716 0.9140165 -1.0814062 -1.124129 -1.3975377 -0.8001625  0.4506428
row5  1.9267918 1.5603413  0.6077397 -1.144758  0.5333407  0.3257136 -0.2013477
          col20
row1  0.1691797
row5 -0.3071275
> tmp[,c("col6","col20")]
          col6       col20
row1 0.3858045  0.16917970
row2 0.8830404 -0.04814999
row3 1.6697858 -0.90141266
row4 1.1860237 -2.14322395
row5 0.1365672 -0.30712745
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 0.3858045  0.1691797
row5 0.1365672 -0.3071275
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1    col2     col3     col4     col5     col6     col7     col8
row1 50.59731 50.7443 49.12019 49.25911 49.57606 104.3957 51.62495 48.85211
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.05941 50.48787 49.45891 47.60349 48.76881 50.04747 51.31632 49.99586
        col17    col18    col19    col20
row1 49.64709 50.24373 49.30055 105.3114
> tmp[,"col10"]
        col10
row1 50.48787
row2 30.27414
row3 28.03722
row4 32.06255
row5 50.49982
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.59731 50.74430 49.12019 49.25911 49.57606 104.3957 51.62495 48.85211
row5 50.24727 48.99493 50.72025 49.89502 49.56368 104.7106 50.35463 51.31864
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.05941 50.48787 49.45891 47.60349 48.76881 50.04747 51.31632 49.99586
row5 50.24959 50.49982 51.82102 50.28076 49.58928 50.10777 50.03526 50.75652
        col17    col18    col19    col20
row1 49.64709 50.24373 49.30055 105.3114
row5 49.84721 50.63811 51.52691 106.1585
> tmp[,c("col6","col20")]
          col6     col20
row1 104.39573 105.31138
row2  77.74470  75.86707
row3  76.49402  73.61679
row4  75.58828  76.15056
row5 104.71061 106.15854
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.3957 105.3114
row5 104.7106 106.1585
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.3957 105.3114
row5 104.7106 106.1585
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  2.2738248
[2,] -0.4589971
[3,]  0.7339846
[4,] -0.2658782
[5,]  1.0166040
> tmp[,c("col17","col7")]
            col17       col7
[1,]  0.007280284  0.3010609
[2,] -1.286791923  0.2901607
[3,]  0.059001814 -0.5180250
[4,]  0.244460360  0.1481844
[5,] -1.668710973 -0.4420326
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
          col6       col20
[1,] 0.7162475  1.29385535
[2,] 0.8893932 -0.05360003
[3,] 0.5402243  1.19480321
[4,] 0.1582124  1.42983548
[5,] 0.8335273  0.49326225
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.7162475
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.7162475
[2,] 0.8893932
> 
> 
> 
> 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.2727627 -0.9556503 -0.8701638 0.1066747  0.5043035 0.001568998
row1 -1.0472849  2.4076412 -0.9959815 1.3742466 -0.1144596 0.451894757
          [,7]      [,8]       [,9]     [,10]       [,11]     [,12]     [,13]
row3 2.3398624 0.9361643 -0.1261074  1.026193 -0.03709363 1.2502533 -1.959779
row1 0.4279676 0.8381261  1.8318562 -0.862926 -0.41750241 0.4585592 -1.905649
          [,14]      [,15]      [,16]      [,17]      [,18]     [,19]     [,20]
row3 -1.9676459 -0.4286241 -2.0595672  0.9807177 -0.3866491  0.110706 -2.488526
row1  0.5556574  0.9460872  0.1814961 -0.4160926  1.0895516 -1.405346  1.637063
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
row2 -1.441874 1.483944 0.8752544 0.8678354 -1.271999 0.3929222 -2.364998
          [,8]       [,9]     [,10]
row2 -1.156055 -0.6936557 0.8414544
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]       [,2]      [,3]      [,4]      [,5]      [,6]     [,7]
row5 -0.2831798 -0.4664202 -1.234063 0.5451673 -1.285173 0.5676975 1.895672
         [,8]       [,9]      [,10]     [,11]      [,12]     [,13]     [,14]
row5 1.006619 -0.7823174 -0.2888582 0.1777406 0.04369039 0.5262882 0.2249251
          [,15]    [,16]     [,17]      [,18]    [,19]    [,20]
row5 0.07983225 0.470009 0.4852082 -0.4664529 1.039329 -1.10234
> 
> 
> 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: 0x5f7c09734320>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff74489b48" 
 [2] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff746cb98f6"
 [3] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff7114b82eb"
 [4] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff763371b26"
 [5] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff74c9e108e"
 [6] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff766cdcebe"
 [7] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff739755cbf"
 [8] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff770614b52"
 [9] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff77f65a29a"
[10] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff74b096b62"
[11] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff7c3d7da5" 
[12] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff734b0a479"
[13] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff75c3a5b1b"
[14] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff730ad26d5"
[15] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM57ff75196d795"
> 
> 
> ### 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: 0x5f7c0b264170>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5f7c0b264170>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5f7c0b264170>
> rowMedians(tmp)
  [1]  0.253149790  0.449643460 -0.513245091  0.558952567 -0.237575680
  [6] -0.008653430  0.294607373  0.148005110  0.040990737 -0.692615602
 [11] -0.227856102 -0.071118027 -0.013837000 -0.276838429 -0.350092855
 [16] -0.109313723 -0.135780918  0.229454737 -0.171292122  0.403250143
 [21] -0.085015586  0.072201480 -0.473964849  0.469188345 -0.353248232
 [26] -0.132546252  0.338956929  0.459208148 -0.046150148  0.015373985
 [31]  0.215470335 -0.295826868  0.426990853 -0.656926310 -0.218041159
 [36] -0.416017878 -0.547570532  0.249317719  0.023199013  0.050019134
 [41] -0.058848610  0.162360300  0.030786203 -0.233720254  0.377031570
 [46]  0.203727754  0.095277160 -0.184594989  0.092871829  0.294086680
 [51]  0.017262131  0.033580026 -0.360660118  0.033903756  0.132911021
 [56] -0.575249140  0.317560639 -0.128700624 -0.462762078  0.087222139
 [61]  0.396444535 -0.162739321 -0.111081095 -0.373863637  0.152109456
 [66] -0.453212552  0.057822631 -0.456939814 -0.019844061 -0.054935270
 [71]  0.205544203 -0.796552301  0.299146101 -0.262386673  0.397696108
 [76] -0.399806577 -0.405317913 -0.441559606 -0.170008532  0.398444818
 [81] -0.186427518 -0.020635939 -0.158884435  0.047970318 -0.158728647
 [86] -0.103465503  0.386973578  0.124245027 -0.352812045  0.128590887
 [91] -0.381376309  0.173132495  0.056672094  0.044218072  0.279872041
 [96] -0.146267464 -0.355675980  0.282234440 -0.584046241  0.167623709
[101]  0.229679945  0.220087647 -0.240859156 -0.104640413 -0.220797566
[106] -0.094202027 -0.362016651  0.819116071  0.706515369 -0.093259171
[111]  0.168968700 -0.228799615 -0.843197225  0.366358700 -0.121126792
[116] -0.041967379 -0.299820311 -0.049282400 -0.012558348  0.014258260
[121]  0.808049676  0.063027429 -0.260729026 -0.077185579 -0.254011779
[126]  0.105785759  0.146205407  0.137597231 -0.102170836 -0.080771926
[131] -0.341736212  0.091171034  0.275429311 -0.037296345  0.136913189
[136] -0.109194552 -0.405821414 -0.519879942 -0.299031793  0.195530075
[141]  0.005147009 -0.152681145  0.007970139  0.162962156 -0.011708213
[146] -0.084966912  0.966533338  0.615691392 -0.449298619  0.372026574
[151] -0.538375062  0.020786163  0.135175166  0.215191050 -0.054022261
[156] -0.106643413  0.052031120  0.768211183  0.351595236  0.212914681
[161] -0.014661662 -0.185051533  0.334801085 -0.629641346  0.028307267
[166]  0.344245424  0.139923632 -0.533131347  0.279747337  0.055176249
[171] -0.181749181 -0.092876105 -0.517438230 -0.117777857  0.437164501
[176]  0.136357276  0.356699808 -0.245317428 -0.234996610 -0.409262067
[181] -0.328790614  0.123102558  0.178019980 -0.109286983  0.068522626
[186] -0.195667672 -0.331101299  0.405790764 -0.226649185 -0.193462518
[191]  0.063926120  0.405277716  0.057804286 -0.213827134 -0.716555360
[196]  0.362633155 -0.002409248  0.103833962  0.406815110 -0.314182487
[201]  0.392881518  0.229698920 -0.607253045 -0.219570131  0.087324447
[206]  0.414810516  0.103508013 -0.569354863  0.845868481  0.574407443
[211] -0.107968633  0.066552529  0.384382416 -0.358836709  0.053218733
[216]  0.101372235  0.163478530  0.099101831  0.347246807  0.391121836
[221] -0.434294891 -0.334204847  0.404182014 -0.074789425  0.533713439
[226] -0.073052677  0.355441038  0.055731844 -0.248209938 -0.199839739
> 
> proc.time()
   user  system elapsed 
  1.337   1.421   2.748 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2026-01-15 r89304) -- "Unsuffered Consequences"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x58f2014e3c10>
> .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: 0x58f2014e3c10>
> .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: 0x58f2014e3c10>
> .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: 0x58f2014e3c10>
> 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: 0x58f2021a62d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58f2021a62d0>
> .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: 0x58f2021a62d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58f2021a62d0>
> .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: 0x58f2021a62d0>
> 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: 0x58f20287bd70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58f20287bd70>
> .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: 0x58f20287bd70>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x58f20287bd70>
> .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: 0x58f20287bd70>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x58f20287bd70>
> .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: 0x58f20287bd70>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x58f20287bd70>
> .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: 0x58f20287bd70>
> 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: 0x58f2023ef370>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x58f2023ef370>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58f2023ef370>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58f2023ef370>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile580bd41fcd6d3" "BufferedMatrixFile580bd6be17046"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile580bd41fcd6d3" "BufferedMatrixFile580bd6be17046"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x58f20233aff0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58f20233aff0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x58f20233aff0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x58f20233aff0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x58f20233aff0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x58f20233aff0>
> .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: 0x58f20251d3d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x58f20251d3d0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x58f20251d3d0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x58f20251d3d0>
> 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: 0x58f203ccefb0>
> .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: 0x58f203ccefb0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.250   0.053   0.292 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2026-01-15 r89304) -- "Unsuffered Consequences"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.235   0.046   0.269 

Example timings