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

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

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4893
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

Package 257/2361HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.74.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-03-29 13:45 -0400 (Sun, 29 Mar 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_22
git_last_commit: d2ce144
git_last_commit_date: 2025-10-29 09:58:55 -0400 (Wed, 29 Oct 2025)
nebbiolo2Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
See other builds for BufferedMatrix in R Universe.


CHECK results for BufferedMatrix on nebbiolo2

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

raw results


Summary

Package: BufferedMatrix
Version: 1.74.0
Command: /home/biocbuild/bbs-3.22-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.22-bioc/R/site-library --timings BufferedMatrix_1.74.0.tar.gz
StartedAt: 2026-03-29 22:07:36 -0400 (Sun, 29 Mar 2026)
EndedAt: 2026-03-29 22:08:00 -0400 (Sun, 29 Mar 2026)
EllapsedTime: 24.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

Status: 2 NOTEs
See
  ‘/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.272   0.050   0.308 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478284 25.6    1046725   56   639600 34.2
Vcells 884773  6.8    8388608   64  2081613 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sun Mar 29 22:07:51 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] "Sun Mar 29 22:07:51 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: 0x58f9a940a1c0>
> 
> 
> 
> 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] "Sun Mar 29 22:07:51 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] "Sun Mar 29 22:07:51 2026"
> 
> ColMode(tmp2)
<pointer: 0x58f9a940a1c0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]      [,3]       [,4]
[1,] 98.7780605  0.3365572  0.399539 -1.2133109
[2,]  1.0626493  1.2056022 -0.744217  0.5866972
[3,]  1.1747944 -0.1985672 -1.460474  0.9505825
[4,] -0.3035402  1.2947160 -1.582634 -1.2684199
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]     [,3]      [,4]
[1,] 98.7780605 0.3365572 0.399539 1.2133109
[2,]  1.0626493 1.2056022 0.744217 0.5866972
[3,]  1.1747944 0.1985672 1.460474 0.9505825
[4,]  0.3035402 1.2947160 1.582634 1.2684199
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9387152 0.5801355 0.6320910 1.1015039
[2,] 1.0308488 1.0979992 0.8626801 0.7659616
[3,] 1.0838793 0.4456088 1.2085009 0.9749782
[4,] 0.5509448 1.1378559 1.2580278 1.1262415
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 223.16521 31.13791 31.72045 37.22835
[2,]  36.37114 37.18559 34.37102 33.24631
[3,]  37.01359 29.65466 38.54548 35.70036
[4,]  30.81299 37.67327 39.16291 37.53083
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x58f9aa0108b0>
> exp(tmp5)
<pointer: 0x58f9aa0108b0>
> log(tmp5,2)
<pointer: 0x58f9aa0108b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 464.4892
> Min(tmp5)
[1] 55.56308
> mean(tmp5)
[1] 72.44907
> Sum(tmp5)
[1] 14489.81
> Var(tmp5)
[1] 837.8338
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.42477 70.82163 71.30286 71.50894 70.42686 73.10651 70.90167 69.83498
 [9] 67.14936 68.01309
> rowSums(tmp5)
 [1] 1828.495 1416.433 1426.057 1430.179 1408.537 1462.130 1418.033 1396.700
 [9] 1342.987 1360.262
> rowVars(tmp5)
 [1] 7768.47634   61.30915   76.95513   40.64033   53.54241   73.41257
 [7]   65.00936   98.92422   60.31761   27.73725
> rowSd(tmp5)
 [1] 88.138960  7.830016  8.772407  6.374977  7.317268  8.568114  8.062838
 [8]  9.946066  7.766441  5.266616
> rowMax(tmp5)
 [1] 464.48915  84.54308  95.78206  81.51247  85.27524  91.27931  87.00976
 [8]  93.49358  82.47221  79.06341
> rowMin(tmp5)
 [1] 59.60134 55.98530 55.56308 60.87776 55.64236 60.06323 56.96838 55.59160
 [9] 55.67215 57.49165
> 
> colMeans(tmp5)
 [1] 107.36519  69.52686  70.56330  72.56960  65.50049  65.71612  72.38480
 [8]  69.85473  72.91170  66.78835  71.93210  80.52544  70.11991  74.58718
[15]  70.21825  69.89740  69.28947  67.70699  70.92785  70.59562
> colSums(tmp5)
 [1] 1073.6519  695.2686  705.6330  725.6960  655.0049  657.1612  723.8480
 [8]  698.5473  729.1170  667.8835  719.3210  805.2544  701.1991  745.8718
[15]  702.1825  698.9740  692.8947  677.0699  709.2785  705.9562
> colVars(tmp5)
 [1] 15788.79112    74.88894    47.99193    23.73199    44.99538    36.86312
 [7]    32.55162    97.28968    49.76852    76.10581    21.35596    81.26617
[13]    63.75113    84.42192    41.54318    82.17030    69.89174    43.06891
[19]    34.22286    76.26305
> colSd(tmp5)
 [1] 125.653456   8.653840   6.927621   4.871549   6.707860   6.071501
 [7]   5.705402   9.863553   7.054680   8.723864   4.621251   9.014775
[13]   7.984431   9.188140   6.445400   9.064784   8.360128   6.562691
[19]   5.850031   8.732872
> colMax(tmp5)
 [1] 464.48915  79.55660  81.51247  80.96125  80.20958  75.50148  80.18739
 [8]  84.95584  87.00976  85.27524  80.60225  95.78206  83.67461  91.27931
[15]  79.26425  82.33521  84.54308  77.57346  80.41752  84.43930
> colMin(tmp5)
 [1] 59.59360 56.96838 60.30268 67.11620 55.64236 57.00407 63.44579 55.59160
 [9] 63.76693 56.50008 64.37974 66.91750 59.96716 62.94344 55.98530 55.56308
[17] 55.90439 55.67215 62.35037 55.68494
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 91.42477 70.82163 71.30286 71.50894 70.42686       NA 70.90167 69.83498
 [9] 67.14936 68.01309
> rowSums(tmp5)
 [1] 1828.495 1416.433 1426.057 1430.179 1408.537       NA 1418.033 1396.700
 [9] 1342.987 1360.262
> rowVars(tmp5)
 [1] 7768.47634   61.30915   76.95513   40.64033   53.54241   76.34032
 [7]   65.00936   98.92422   60.31761   27.73725
> rowSd(tmp5)
 [1] 88.138960  7.830016  8.772407  6.374977  7.317268  8.737295  8.062838
 [8]  9.946066  7.766441  5.266616
> rowMax(tmp5)
 [1] 464.48915  84.54308  95.78206  81.51247  85.27524        NA  87.00976
 [8]  93.49358  82.47221  79.06341
> rowMin(tmp5)
 [1] 59.60134 55.98530 55.56308 60.87776 55.64236       NA 56.96838 55.59160
 [9] 55.67215 57.49165
> 
> colMeans(tmp5)
 [1] 107.36519  69.52686  70.56330  72.56960  65.50049  65.71612  72.38480
 [8]  69.85473  72.91170  66.78835  71.93210  80.52544  70.11991  74.58718
[15]  70.21825  69.89740        NA  67.70699  70.92785  70.59562
> colSums(tmp5)
 [1] 1073.6519  695.2686  705.6330  725.6960  655.0049  657.1612  723.8480
 [8]  698.5473  729.1170  667.8835  719.3210  805.2544  701.1991  745.8718
[15]  702.1825  698.9740        NA  677.0699  709.2785  705.9562
> colVars(tmp5)
 [1] 15788.79112    74.88894    47.99193    23.73199    44.99538    36.86312
 [7]    32.55162    97.28968    49.76852    76.10581    21.35596    81.26617
[13]    63.75113    84.42192    41.54318    82.17030          NA    43.06891
[19]    34.22286    76.26305
> colSd(tmp5)
 [1] 125.653456   8.653840   6.927621   4.871549   6.707860   6.071501
 [7]   5.705402   9.863553   7.054680   8.723864   4.621251   9.014775
[13]   7.984431   9.188140   6.445400   9.064784         NA   6.562691
[19]   5.850031   8.732872
> colMax(tmp5)
 [1] 464.48915  79.55660  81.51247  80.96125  80.20958  75.50148  80.18739
 [8]  84.95584  87.00976  85.27524  80.60225  95.78206  83.67461  91.27931
[15]  79.26425  82.33521        NA  77.57346  80.41752  84.43930
> colMin(tmp5)
 [1] 59.59360 56.96838 60.30268 67.11620 55.64236 57.00407 63.44579 55.59160
 [9] 63.76693 56.50008 64.37974 66.91750 59.96716 62.94344 55.98530 55.56308
[17]       NA 55.67215 62.35037 55.68494
> 
> Max(tmp5,na.rm=TRUE)
[1] 464.4892
> Min(tmp5,na.rm=TRUE)
[1] 55.56308
> mean(tmp5,na.rm=TRUE)
[1] 72.42347
> Sum(tmp5,na.rm=TRUE)
[1] 14412.27
> Var(tmp5,na.rm=TRUE)
[1] 841.9336
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.42477 70.82163 71.30286 71.50894 70.42686 72.87304 70.90167 69.83498
 [9] 67.14936 68.01309
> rowSums(tmp5,na.rm=TRUE)
 [1] 1828.495 1416.433 1426.057 1430.179 1408.537 1384.588 1418.033 1396.700
 [9] 1342.987 1360.262
> rowVars(tmp5,na.rm=TRUE)
 [1] 7768.47634   61.30915   76.95513   40.64033   53.54241   76.34032
 [7]   65.00936   98.92422   60.31761   27.73725
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.138960  7.830016  8.772407  6.374977  7.317268  8.737295  8.062838
 [8]  9.946066  7.766441  5.266616
> rowMax(tmp5,na.rm=TRUE)
 [1] 464.48915  84.54308  95.78206  81.51247  85.27524  91.27931  87.00976
 [8]  93.49358  82.47221  79.06341
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.60134 55.98530 55.56308 60.87776 55.64236 60.06323 56.96838 55.59160
 [9] 55.67215 57.49165
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 107.36519  69.52686  70.56330  72.56960  65.50049  65.71612  72.38480
 [8]  69.85473  72.91170  66.78835  71.93210  80.52544  70.11991  74.58718
[15]  70.21825  69.89740  68.37248  67.70699  70.92785  70.59562
> colSums(tmp5,na.rm=TRUE)
 [1] 1073.6519  695.2686  705.6330  725.6960  655.0049  657.1612  723.8480
 [8]  698.5473  729.1170  667.8835  719.3210  805.2544  701.1991  745.8718
[15]  702.1825  698.9740  615.3523  677.0699  709.2785  705.9562
> colVars(tmp5,na.rm=TRUE)
 [1] 15788.79112    74.88894    47.99193    23.73199    44.99538    36.86312
 [7]    32.55162    97.28968    49.76852    76.10581    21.35596    81.26617
[13]    63.75113    84.42192    41.54318    82.17030    69.16832    43.06891
[19]    34.22286    76.26305
> colSd(tmp5,na.rm=TRUE)
 [1] 125.653456   8.653840   6.927621   4.871549   6.707860   6.071501
 [7]   5.705402   9.863553   7.054680   8.723864   4.621251   9.014775
[13]   7.984431   9.188140   6.445400   9.064784   8.316749   6.562691
[19]   5.850031   8.732872
> colMax(tmp5,na.rm=TRUE)
 [1] 464.48915  79.55660  81.51247  80.96125  80.20958  75.50148  80.18739
 [8]  84.95584  87.00976  85.27524  80.60225  95.78206  83.67461  91.27931
[15]  79.26425  82.33521  84.54308  77.57346  80.41752  84.43930
> colMin(tmp5,na.rm=TRUE)
 [1] 59.59360 56.96838 60.30268 67.11620 55.64236 57.00407 63.44579 55.59160
 [9] 63.76693 56.50008 64.37974 66.91750 59.96716 62.94344 55.98530 55.56308
[17] 55.90439 55.67215 62.35037 55.68494
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.42477 70.82163 71.30286 71.50894 70.42686      NaN 70.90167 69.83498
 [9] 67.14936 68.01309
> rowSums(tmp5,na.rm=TRUE)
 [1] 1828.495 1416.433 1426.057 1430.179 1408.537    0.000 1418.033 1396.700
 [9] 1342.987 1360.262
> rowVars(tmp5,na.rm=TRUE)
 [1] 7768.47634   61.30915   76.95513   40.64033   53.54241         NA
 [7]   65.00936   98.92422   60.31761   27.73725
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.138960  7.830016  8.772407  6.374977  7.317268        NA  8.062838
 [8]  9.946066  7.766441  5.266616
> rowMax(tmp5,na.rm=TRUE)
 [1] 464.48915  84.54308  95.78206  81.51247  85.27524        NA  87.00976
 [8]  93.49358  82.47221  79.06341
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.60134 55.98530 55.56308 60.87776 55.64236       NA 56.96838 55.59160
 [9] 55.67215 57.49165
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.31135  69.72548  71.70337  71.63719  65.54711  66.34422  72.22235
 [8]  68.17683  73.92779  65.87987  72.01422  81.04591  68.61383  72.73250
[15]  69.87904  69.06370       NaN  67.96699  70.28456  70.07158
> colSums(tmp5,na.rm=TRUE)
 [1] 1010.8021  627.5293  645.3303  644.7347  589.9240  597.0980  650.0011
 [8]  613.5915  665.3501  592.9188  648.1280  729.4132  617.5245  654.5925
[15]  628.9114  621.5733    0.0000  611.7029  632.5611  630.6442
> colVars(tmp5,na.rm=TRUE)
 [1] 17487.16435    83.80628    39.36866    16.91795    50.59535    37.03279
 [7]    36.32367    77.77819    44.37473    76.33388    23.94958    88.37696
[13]    46.20198    56.27643    45.44165    84.62220          NA    47.69202
[19]    33.84533    82.70647
> colSd(tmp5,na.rm=TRUE)
 [1] 132.239042   9.154577   6.274445   4.113144   7.113041   6.085457
 [7]   6.026912   8.819194   6.661436   8.736926   4.893831   9.400902
[13]   6.797204   7.501762   6.741042   9.199032         NA   6.905941
[19]   5.817674   9.094310
> colMax(tmp5,na.rm=TRUE)
 [1] 464.48915  79.55660  81.51247  78.11552  80.20958  75.50148  80.18739
 [8]  81.23210  87.00976  85.27524  80.60225  95.78206  80.31854  83.31797
[15]  79.26425  82.33521      -Inf  77.57346  80.41752  84.43930
> colMin(tmp5,na.rm=TRUE)
 [1] 59.59360 56.96838 62.59873 67.11620 55.64236 57.00407 63.44579 55.59160
 [9] 66.14407 56.50008 64.37974 66.91750 59.96716 62.94344 55.98530 55.56308
[17]      Inf 55.67215 62.35037 55.68494
> 
> 
> 
> 
> 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] 264.1460 173.4101 222.0698 269.4641 105.3193 292.4116 316.1171 104.7248
 [9] 219.8805 193.3443
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 264.1460 173.4101 222.0698 269.4641 105.3193 292.4116 316.1171 104.7248
 [9] 219.8805 193.3443
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  1.136868e-13 -5.684342e-14  0.000000e+00 -1.705303e-13  1.705303e-13
 [6] -3.410605e-13 -5.684342e-14 -2.842171e-14 -1.136868e-13 -1.421085e-14
[11]  1.136868e-13  1.705303e-13  1.705303e-13  2.273737e-13 -1.421085e-13
[16] -2.842171e-14 -1.705303e-13  1.705303e-13  0.000000e+00 -2.842171e-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)
+ }
1   6 
9   20 
2   9 
8   12 
4   16 
5   4 
5   9 
6   4 
6   7 
1   20 
9   9 
6   19 
10   2 
6   2 
4   13 
8   20 
10   7 
3   6 
10   2 
5   12 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 1.937265
> Min(tmp)
[1] -2.755298
> mean(tmp)
[1] -0.006722613
> Sum(tmp)
[1] -0.6722613
> Var(tmp)
[1] 0.8511792
> 
> rowMeans(tmp)
[1] -0.006722613
> rowSums(tmp)
[1] -0.6722613
> rowVars(tmp)
[1] 0.8511792
> rowSd(tmp)
[1] 0.9225937
> rowMax(tmp)
[1] 1.937265
> rowMin(tmp)
[1] -2.755298
> 
> colMeans(tmp)
  [1]  0.237577741 -0.185110119 -0.733245721  0.032702857  0.860493021
  [6]  0.056073221  1.937265230  0.039660183 -0.682644795  0.483321920
 [11]  0.124193645  0.315485643 -1.064057706 -0.682108605 -0.033414834
 [16]  0.610688217  1.437116039 -0.043279458 -0.604459215 -1.301345170
 [21] -0.396529561 -0.036814612 -0.465716845 -0.049594307  0.493242135
 [26] -0.430556715  0.718572015 -0.393180814  1.627341702  1.098807043
 [31] -0.694200902 -1.362403642 -0.304469721  0.716799658  0.315366447
 [36]  0.149740200  1.416817346  1.237428081  1.020068990 -0.812305036
 [41] -1.446326815  0.782421618  0.532774584  0.209388997  1.014508455
 [46] -0.446724627 -2.755298159 -1.260761374  0.800547811  1.297024489
 [51] -1.107504449  0.616972516 -0.108784781  0.085291645  0.221002640
 [56]  1.202381459 -0.219790114  0.201705591 -0.478231562  0.233886726
 [61] -0.892026498  1.602038579 -1.433380248  0.782050848 -1.050928839
 [66]  1.644877376 -0.052548964  0.377976538  1.160538825 -0.829674102
 [71] -0.887325012  0.140811930  0.791318255  1.452982306  0.319544637
 [76] -0.006583557 -1.975595765 -0.424783795 -0.553948391 -0.640602730
 [81] -0.358277676 -0.907039705  0.745524360 -0.784337110  1.171892511
 [86] -0.752196588 -1.360525365 -0.967740544 -0.834785438  0.593613452
 [91]  1.782971452  0.988143720  0.611781614 -1.007157928 -0.258278781
 [96]  0.821590701 -1.073862319 -1.775418479 -0.364612007 -0.496096726
> colSums(tmp)
  [1]  0.237577741 -0.185110119 -0.733245721  0.032702857  0.860493021
  [6]  0.056073221  1.937265230  0.039660183 -0.682644795  0.483321920
 [11]  0.124193645  0.315485643 -1.064057706 -0.682108605 -0.033414834
 [16]  0.610688217  1.437116039 -0.043279458 -0.604459215 -1.301345170
 [21] -0.396529561 -0.036814612 -0.465716845 -0.049594307  0.493242135
 [26] -0.430556715  0.718572015 -0.393180814  1.627341702  1.098807043
 [31] -0.694200902 -1.362403642 -0.304469721  0.716799658  0.315366447
 [36]  0.149740200  1.416817346  1.237428081  1.020068990 -0.812305036
 [41] -1.446326815  0.782421618  0.532774584  0.209388997  1.014508455
 [46] -0.446724627 -2.755298159 -1.260761374  0.800547811  1.297024489
 [51] -1.107504449  0.616972516 -0.108784781  0.085291645  0.221002640
 [56]  1.202381459 -0.219790114  0.201705591 -0.478231562  0.233886726
 [61] -0.892026498  1.602038579 -1.433380248  0.782050848 -1.050928839
 [66]  1.644877376 -0.052548964  0.377976538  1.160538825 -0.829674102
 [71] -0.887325012  0.140811930  0.791318255  1.452982306  0.319544637
 [76] -0.006583557 -1.975595765 -0.424783795 -0.553948391 -0.640602730
 [81] -0.358277676 -0.907039705  0.745524360 -0.784337110  1.171892511
 [86] -0.752196588 -1.360525365 -0.967740544 -0.834785438  0.593613452
 [91]  1.782971452  0.988143720  0.611781614 -1.007157928 -0.258278781
 [96]  0.821590701 -1.073862319 -1.775418479 -0.364612007 -0.496096726
> 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.237577741 -0.185110119 -0.733245721  0.032702857  0.860493021
  [6]  0.056073221  1.937265230  0.039660183 -0.682644795  0.483321920
 [11]  0.124193645  0.315485643 -1.064057706 -0.682108605 -0.033414834
 [16]  0.610688217  1.437116039 -0.043279458 -0.604459215 -1.301345170
 [21] -0.396529561 -0.036814612 -0.465716845 -0.049594307  0.493242135
 [26] -0.430556715  0.718572015 -0.393180814  1.627341702  1.098807043
 [31] -0.694200902 -1.362403642 -0.304469721  0.716799658  0.315366447
 [36]  0.149740200  1.416817346  1.237428081  1.020068990 -0.812305036
 [41] -1.446326815  0.782421618  0.532774584  0.209388997  1.014508455
 [46] -0.446724627 -2.755298159 -1.260761374  0.800547811  1.297024489
 [51] -1.107504449  0.616972516 -0.108784781  0.085291645  0.221002640
 [56]  1.202381459 -0.219790114  0.201705591 -0.478231562  0.233886726
 [61] -0.892026498  1.602038579 -1.433380248  0.782050848 -1.050928839
 [66]  1.644877376 -0.052548964  0.377976538  1.160538825 -0.829674102
 [71] -0.887325012  0.140811930  0.791318255  1.452982306  0.319544637
 [76] -0.006583557 -1.975595765 -0.424783795 -0.553948391 -0.640602730
 [81] -0.358277676 -0.907039705  0.745524360 -0.784337110  1.171892511
 [86] -0.752196588 -1.360525365 -0.967740544 -0.834785438  0.593613452
 [91]  1.782971452  0.988143720  0.611781614 -1.007157928 -0.258278781
 [96]  0.821590701 -1.073862319 -1.775418479 -0.364612007 -0.496096726
> colMin(tmp)
  [1]  0.237577741 -0.185110119 -0.733245721  0.032702857  0.860493021
  [6]  0.056073221  1.937265230  0.039660183 -0.682644795  0.483321920
 [11]  0.124193645  0.315485643 -1.064057706 -0.682108605 -0.033414834
 [16]  0.610688217  1.437116039 -0.043279458 -0.604459215 -1.301345170
 [21] -0.396529561 -0.036814612 -0.465716845 -0.049594307  0.493242135
 [26] -0.430556715  0.718572015 -0.393180814  1.627341702  1.098807043
 [31] -0.694200902 -1.362403642 -0.304469721  0.716799658  0.315366447
 [36]  0.149740200  1.416817346  1.237428081  1.020068990 -0.812305036
 [41] -1.446326815  0.782421618  0.532774584  0.209388997  1.014508455
 [46] -0.446724627 -2.755298159 -1.260761374  0.800547811  1.297024489
 [51] -1.107504449  0.616972516 -0.108784781  0.085291645  0.221002640
 [56]  1.202381459 -0.219790114  0.201705591 -0.478231562  0.233886726
 [61] -0.892026498  1.602038579 -1.433380248  0.782050848 -1.050928839
 [66]  1.644877376 -0.052548964  0.377976538  1.160538825 -0.829674102
 [71] -0.887325012  0.140811930  0.791318255  1.452982306  0.319544637
 [76] -0.006583557 -1.975595765 -0.424783795 -0.553948391 -0.640602730
 [81] -0.358277676 -0.907039705  0.745524360 -0.784337110  1.171892511
 [86] -0.752196588 -1.360525365 -0.967740544 -0.834785438  0.593613452
 [91]  1.782971452  0.988143720  0.611781614 -1.007157928 -0.258278781
 [96]  0.821590701 -1.073862319 -1.775418479 -0.364612007 -0.496096726
> colMedians(tmp)
  [1]  0.237577741 -0.185110119 -0.733245721  0.032702857  0.860493021
  [6]  0.056073221  1.937265230  0.039660183 -0.682644795  0.483321920
 [11]  0.124193645  0.315485643 -1.064057706 -0.682108605 -0.033414834
 [16]  0.610688217  1.437116039 -0.043279458 -0.604459215 -1.301345170
 [21] -0.396529561 -0.036814612 -0.465716845 -0.049594307  0.493242135
 [26] -0.430556715  0.718572015 -0.393180814  1.627341702  1.098807043
 [31] -0.694200902 -1.362403642 -0.304469721  0.716799658  0.315366447
 [36]  0.149740200  1.416817346  1.237428081  1.020068990 -0.812305036
 [41] -1.446326815  0.782421618  0.532774584  0.209388997  1.014508455
 [46] -0.446724627 -2.755298159 -1.260761374  0.800547811  1.297024489
 [51] -1.107504449  0.616972516 -0.108784781  0.085291645  0.221002640
 [56]  1.202381459 -0.219790114  0.201705591 -0.478231562  0.233886726
 [61] -0.892026498  1.602038579 -1.433380248  0.782050848 -1.050928839
 [66]  1.644877376 -0.052548964  0.377976538  1.160538825 -0.829674102
 [71] -0.887325012  0.140811930  0.791318255  1.452982306  0.319544637
 [76] -0.006583557 -1.975595765 -0.424783795 -0.553948391 -0.640602730
 [81] -0.358277676 -0.907039705  0.745524360 -0.784337110  1.171892511
 [86] -0.752196588 -1.360525365 -0.967740544 -0.834785438  0.593613452
 [91]  1.782971452  0.988143720  0.611781614 -1.007157928 -0.258278781
 [96]  0.821590701 -1.073862319 -1.775418479 -0.364612007 -0.496096726
> colRanges(tmp)
          [,1]       [,2]       [,3]       [,4]     [,5]       [,6]     [,7]
[1,] 0.2375777 -0.1851101 -0.7332457 0.03270286 0.860493 0.05607322 1.937265
[2,] 0.2375777 -0.1851101 -0.7332457 0.03270286 0.860493 0.05607322 1.937265
           [,8]       [,9]     [,10]     [,11]     [,12]     [,13]      [,14]
[1,] 0.03966018 -0.6826448 0.4833219 0.1241936 0.3154856 -1.064058 -0.6821086
[2,] 0.03966018 -0.6826448 0.4833219 0.1241936 0.3154856 -1.064058 -0.6821086
           [,15]     [,16]    [,17]       [,18]      [,19]     [,20]      [,21]
[1,] -0.03341483 0.6106882 1.437116 -0.04327946 -0.6044592 -1.301345 -0.3965296
[2,] -0.03341483 0.6106882 1.437116 -0.04327946 -0.6044592 -1.301345 -0.3965296
           [,22]      [,23]       [,24]     [,25]      [,26]    [,27]
[1,] -0.03681461 -0.4657168 -0.04959431 0.4932421 -0.4305567 0.718572
[2,] -0.03681461 -0.4657168 -0.04959431 0.4932421 -0.4305567 0.718572
          [,28]    [,29]    [,30]      [,31]     [,32]      [,33]     [,34]
[1,] -0.3931808 1.627342 1.098807 -0.6942009 -1.362404 -0.3044697 0.7167997
[2,] -0.3931808 1.627342 1.098807 -0.6942009 -1.362404 -0.3044697 0.7167997
         [,35]     [,36]    [,37]    [,38]    [,39]     [,40]     [,41]
[1,] 0.3153664 0.1497402 1.416817 1.237428 1.020069 -0.812305 -1.446327
[2,] 0.3153664 0.1497402 1.416817 1.237428 1.020069 -0.812305 -1.446327
         [,42]     [,43]    [,44]    [,45]      [,46]     [,47]     [,48]
[1,] 0.7824216 0.5327746 0.209389 1.014508 -0.4467246 -2.755298 -1.260761
[2,] 0.7824216 0.5327746 0.209389 1.014508 -0.4467246 -2.755298 -1.260761
         [,49]    [,50]     [,51]     [,52]      [,53]      [,54]     [,55]
[1,] 0.8005478 1.297024 -1.107504 0.6169725 -0.1087848 0.08529164 0.2210026
[2,] 0.8005478 1.297024 -1.107504 0.6169725 -0.1087848 0.08529164 0.2210026
        [,56]      [,57]     [,58]      [,59]     [,60]      [,61]    [,62]
[1,] 1.202381 -0.2197901 0.2017056 -0.4782316 0.2338867 -0.8920265 1.602039
[2,] 1.202381 -0.2197901 0.2017056 -0.4782316 0.2338867 -0.8920265 1.602039
        [,63]     [,64]     [,65]    [,66]       [,67]     [,68]    [,69]
[1,] -1.43338 0.7820508 -1.050929 1.644877 -0.05254896 0.3779765 1.160539
[2,] -1.43338 0.7820508 -1.050929 1.644877 -0.05254896 0.3779765 1.160539
          [,70]     [,71]     [,72]     [,73]    [,74]     [,75]        [,76]
[1,] -0.8296741 -0.887325 0.1408119 0.7913183 1.452982 0.3195446 -0.006583557
[2,] -0.8296741 -0.887325 0.1408119 0.7913183 1.452982 0.3195446 -0.006583557
         [,77]      [,78]      [,79]      [,80]      [,81]      [,82]     [,83]
[1,] -1.975596 -0.4247838 -0.5539484 -0.6406027 -0.3582777 -0.9070397 0.7455244
[2,] -1.975596 -0.4247838 -0.5539484 -0.6406027 -0.3582777 -0.9070397 0.7455244
          [,84]    [,85]      [,86]     [,87]      [,88]      [,89]     [,90]
[1,] -0.7843371 1.171893 -0.7521966 -1.360525 -0.9677405 -0.8347854 0.5936135
[2,] -0.7843371 1.171893 -0.7521966 -1.360525 -0.9677405 -0.8347854 0.5936135
        [,91]     [,92]     [,93]     [,94]      [,95]     [,96]     [,97]
[1,] 1.782971 0.9881437 0.6117816 -1.007158 -0.2582788 0.8215907 -1.073862
[2,] 1.782971 0.9881437 0.6117816 -1.007158 -0.2582788 0.8215907 -1.073862
         [,98]     [,99]     [,100]
[1,] -1.775418 -0.364612 -0.4960967
[2,] -1.775418 -0.364612 -0.4960967
> 
> 
> Max(tmp2)
[1] 2.885914
> Min(tmp2)
[1] -2.260292
> mean(tmp2)
[1] 0.02704815
> Sum(tmp2)
[1] 2.704815
> Var(tmp2)
[1] 0.984169
> 
> rowMeans(tmp2)
  [1] -0.86652979 -0.19939397 -0.35156979  1.10536843 -1.60793156  0.79350159
  [7] -1.56672270 -0.92127242  0.41917891  0.25046045 -2.26029157 -0.30019386
 [13] -0.48079646 -0.26477164  1.37388205  0.08343389  0.08295068  0.34332496
 [19] -0.53895369  0.81316481  1.33416039 -1.48962198 -1.37112231  1.81943582
 [25]  0.37680877  2.36577803 -0.37425641 -0.48403188  0.04449551  2.88591390
 [31]  0.64477882 -1.74578015  0.77905903  0.79315381  0.30819632 -0.11343342
 [37]  0.04376681 -0.78313814  0.67771460  0.11917895  0.09039577 -1.29612896
 [43] -1.50358544  1.77327652 -0.17195575  0.40831143  0.35064769 -0.91356143
 [49] -0.45555931  1.27131945 -0.23933662  0.71320998 -0.04835932 -0.50769378
 [55] -0.41808118  0.74609268 -0.44676008  0.60370225 -0.43968808 -0.71916964
 [61]  0.48824406  0.11038120 -0.49636216  0.19213322 -1.17618291 -0.14200088
 [67] -0.47195732  0.37014378  2.34645921  2.22778744  2.30049572 -0.08968490
 [73] -1.21362035  0.10887075 -1.06002750 -0.68851841  0.27282200  0.93554451
 [79]  0.17363334 -0.49014239 -1.06553940 -0.90664936 -0.72017664 -0.82887144
 [85] -1.72090881  0.54805289  0.08170598  0.27717729 -0.16071664  0.89606008
 [91]  0.21367615  2.07124911  0.85464827 -0.06819565  0.43871788 -0.37729006
 [97] -0.06446042 -0.04062405 -1.51118985  0.55516027
> rowSums(tmp2)
  [1] -0.86652979 -0.19939397 -0.35156979  1.10536843 -1.60793156  0.79350159
  [7] -1.56672270 -0.92127242  0.41917891  0.25046045 -2.26029157 -0.30019386
 [13] -0.48079646 -0.26477164  1.37388205  0.08343389  0.08295068  0.34332496
 [19] -0.53895369  0.81316481  1.33416039 -1.48962198 -1.37112231  1.81943582
 [25]  0.37680877  2.36577803 -0.37425641 -0.48403188  0.04449551  2.88591390
 [31]  0.64477882 -1.74578015  0.77905903  0.79315381  0.30819632 -0.11343342
 [37]  0.04376681 -0.78313814  0.67771460  0.11917895  0.09039577 -1.29612896
 [43] -1.50358544  1.77327652 -0.17195575  0.40831143  0.35064769 -0.91356143
 [49] -0.45555931  1.27131945 -0.23933662  0.71320998 -0.04835932 -0.50769378
 [55] -0.41808118  0.74609268 -0.44676008  0.60370225 -0.43968808 -0.71916964
 [61]  0.48824406  0.11038120 -0.49636216  0.19213322 -1.17618291 -0.14200088
 [67] -0.47195732  0.37014378  2.34645921  2.22778744  2.30049572 -0.08968490
 [73] -1.21362035  0.10887075 -1.06002750 -0.68851841  0.27282200  0.93554451
 [79]  0.17363334 -0.49014239 -1.06553940 -0.90664936 -0.72017664 -0.82887144
 [85] -1.72090881  0.54805289  0.08170598  0.27717729 -0.16071664  0.89606008
 [91]  0.21367615  2.07124911  0.85464827 -0.06819565  0.43871788 -0.37729006
 [97] -0.06446042 -0.04062405 -1.51118985  0.55516027
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.86652979 -0.19939397 -0.35156979  1.10536843 -1.60793156  0.79350159
  [7] -1.56672270 -0.92127242  0.41917891  0.25046045 -2.26029157 -0.30019386
 [13] -0.48079646 -0.26477164  1.37388205  0.08343389  0.08295068  0.34332496
 [19] -0.53895369  0.81316481  1.33416039 -1.48962198 -1.37112231  1.81943582
 [25]  0.37680877  2.36577803 -0.37425641 -0.48403188  0.04449551  2.88591390
 [31]  0.64477882 -1.74578015  0.77905903  0.79315381  0.30819632 -0.11343342
 [37]  0.04376681 -0.78313814  0.67771460  0.11917895  0.09039577 -1.29612896
 [43] -1.50358544  1.77327652 -0.17195575  0.40831143  0.35064769 -0.91356143
 [49] -0.45555931  1.27131945 -0.23933662  0.71320998 -0.04835932 -0.50769378
 [55] -0.41808118  0.74609268 -0.44676008  0.60370225 -0.43968808 -0.71916964
 [61]  0.48824406  0.11038120 -0.49636216  0.19213322 -1.17618291 -0.14200088
 [67] -0.47195732  0.37014378  2.34645921  2.22778744  2.30049572 -0.08968490
 [73] -1.21362035  0.10887075 -1.06002750 -0.68851841  0.27282200  0.93554451
 [79]  0.17363334 -0.49014239 -1.06553940 -0.90664936 -0.72017664 -0.82887144
 [85] -1.72090881  0.54805289  0.08170598  0.27717729 -0.16071664  0.89606008
 [91]  0.21367615  2.07124911  0.85464827 -0.06819565  0.43871788 -0.37729006
 [97] -0.06446042 -0.04062405 -1.51118985  0.55516027
> rowMin(tmp2)
  [1] -0.86652979 -0.19939397 -0.35156979  1.10536843 -1.60793156  0.79350159
  [7] -1.56672270 -0.92127242  0.41917891  0.25046045 -2.26029157 -0.30019386
 [13] -0.48079646 -0.26477164  1.37388205  0.08343389  0.08295068  0.34332496
 [19] -0.53895369  0.81316481  1.33416039 -1.48962198 -1.37112231  1.81943582
 [25]  0.37680877  2.36577803 -0.37425641 -0.48403188  0.04449551  2.88591390
 [31]  0.64477882 -1.74578015  0.77905903  0.79315381  0.30819632 -0.11343342
 [37]  0.04376681 -0.78313814  0.67771460  0.11917895  0.09039577 -1.29612896
 [43] -1.50358544  1.77327652 -0.17195575  0.40831143  0.35064769 -0.91356143
 [49] -0.45555931  1.27131945 -0.23933662  0.71320998 -0.04835932 -0.50769378
 [55] -0.41808118  0.74609268 -0.44676008  0.60370225 -0.43968808 -0.71916964
 [61]  0.48824406  0.11038120 -0.49636216  0.19213322 -1.17618291 -0.14200088
 [67] -0.47195732  0.37014378  2.34645921  2.22778744  2.30049572 -0.08968490
 [73] -1.21362035  0.10887075 -1.06002750 -0.68851841  0.27282200  0.93554451
 [79]  0.17363334 -0.49014239 -1.06553940 -0.90664936 -0.72017664 -0.82887144
 [85] -1.72090881  0.54805289  0.08170598  0.27717729 -0.16071664  0.89606008
 [91]  0.21367615  2.07124911  0.85464827 -0.06819565  0.43871788 -0.37729006
 [97] -0.06446042 -0.04062405 -1.51118985  0.55516027
> 
> colMeans(tmp2)
[1] 0.02704815
> colSums(tmp2)
[1] 2.704815
> colVars(tmp2)
[1] 0.984169
> colSd(tmp2)
[1] 0.9920529
> colMax(tmp2)
[1] 2.885914
> colMin(tmp2)
[1] -2.260292
> colMedians(tmp2)
[1] 0.001571379
> colRanges(tmp2)
          [,1]
[1,] -2.260292
[2,]  2.885914
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.650992 -6.409317  0.351652  3.401025 -1.830937  5.512571  1.992616
 [8] -4.511370  2.535593 -4.757825
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.57787291
[2,] -0.52791599
[3,]  0.04544668
[4,]  0.64426248
[5,]  0.76181382
> 
> rowApply(tmp,sum)
 [1] -2.72511135  4.40324013  1.18793617 -0.03955188 -0.89143087 -2.49220583
 [7]  1.24317434  2.28692801 -3.04776561 -5.29219604
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    6    8    6    6    6    3    3    1     4
 [2,]    4    5    5    1    4    7    6    5    3     2
 [3,]    6    2    4    8   10    5    5    1    9     8
 [4,]   10    8    9    2    5    4    7    2   10     7
 [5,]    2    1    3    9    1    8    8    8    5     1
 [6,]    3    7    6    7    2    9   10   10    6    10
 [7,]    7   10    2    5    9   10    1    7    7     9
 [8,]    5    3    7    3    8    2    2    4    8     3
 [9,]    8    9   10    4    3    3    9    6    4     5
[10,]    1    4    1   10    7    1    4    9    2     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  4.2998141  0.7231256 -1.0017189 -0.7778357 -0.9134230  1.6159984
 [7]  0.5159809 -4.8023533 -0.8724229 -2.8445115  1.4652180  2.9563096
[13] -3.1594849 -1.2876238  2.5538119  2.0683489 -1.2701239 -1.3185071
[19]  2.2207584  3.0496394
> colApply(tmp,quantile)[,1]
           [,1]
[1,] 0.05593308
[2,] 0.53314775
[3,] 0.82566233
[4,] 1.00418315
[5,] 1.88088775
> 
> rowApply(tmp,sum)
[1]  2.5492199 -1.6550606 -2.6184377  4.2066283  0.7386501
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   17   20   17    9   16
[2,]   13   13   11   14    8
[3,]   10    4   16    4    7
[4,]    6   14   14   10    1
[5,]   14    7    6    1   20
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]        [,4]       [,5]       [,6]
[1,] 1.00418315  0.55038695 -0.1037738 -0.17506822  0.5746188 -0.1093381
[2,] 1.88088775 -0.00170857 -0.8212211  0.05665711 -0.4587070 -2.1267460
[3,] 0.82566233 -0.03851542  0.8134437  0.47499233 -0.8173623  1.2809266
[4,] 0.05593308  0.47546679 -0.4948925  0.05604828 -1.6667869  2.3469753
[5,] 0.53314775 -0.26250412 -0.3952753 -1.19046517  1.4548144  0.2241806
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,]  1.0845670 -2.1394355  0.4677592 -1.0617335 -0.1418965  1.5240371
[2,]  1.5399157 -1.0761596 -0.3371119 -1.8436258  0.9433071  0.4187592
[3,] -1.9110439 -2.2575339 -0.2109694 -0.8733145  1.2585679 -0.6892832
[4,]  0.5312417  1.1112885 -1.0974647  0.1390873 -1.0594541  1.1807743
[5,] -0.7286996 -0.4405129  0.3053638  0.7950750  0.4646935  0.5220222
          [,13]      [,14]        [,15]      [,16]       [,17]      [,18]
[1,] -1.0179955 -0.6179428  2.098513776 -0.1599154  0.69323384 -1.0872174
[2,] -0.0262812 -0.6354778 -0.004720347  1.7383506 -0.80575674  0.5339843
[3,] -1.5194788  0.1061735 -0.153633812  1.4574499 -1.15421922 -0.1172364
[4,]  0.1357683 -0.1951498  0.065986424 -0.3416713 -0.02734249 -0.4658781
[5,] -0.7314976  0.0547731  0.547665895 -0.6258648  0.02396073 -0.1821595
          [,19]      [,20]
[1,]  0.6674009  0.4988359
[2,] -0.2904581 -0.3389483
[3,]  0.5893163  0.3176206
[4,]  2.1735034  1.2831948
[5,] -0.9190042  1.2889364
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  564  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
         col1       col2      col3      col4       col5      col6      col7
row1 0.990979 -0.7717496 -1.333692 0.4839753 -0.4662082 -1.090387 -1.057408
          col8       col9    col10     col11     col12    col13      col14
row1 0.3167697 -0.9099596 0.344666 -0.157478 0.6441953 1.217922 -0.7469432
         col15      col16     col17     col18      col19     col20
row1 0.9835725 0.07990314 -1.850941 0.1227829 0.06754347 0.8887629
> tmp[,"col10"]
           col10
row1  0.34466602
row2  0.04472475
row3 -0.85155464
row4  2.28937434
row5 -1.03634762
> tmp[c("row1","row5"),]
          col1       col2       col3       col4       col5      col6      col7
row1 0.9909790 -0.7717496 -1.3336921  0.4839753 -0.4662082 -1.090387 -1.057408
row5 0.4042129 -0.8679418 -0.4151645 -0.1008312 -1.3279897 -1.120255  2.016811
           col8       col9     col10      col11      col12    col13       col14
row1 0.31676975 -0.9099596  0.344666 -0.1574780  0.6441953 1.217922 -0.74694319
row5 0.03469156 -0.5152494 -1.036348 -0.1290717 -0.1381628 1.244206  0.01508384
          col15       col16     col17      col18      col19     col20
row1  0.9835725  0.07990314 -1.850941  0.1227829 0.06754347 0.8887629
row5 -2.5526271 -0.05532250 -1.658956 -2.5938613 0.71700117 0.9192153
> tmp[,c("col6","col20")]
           col6       col20
row1 -1.0903869  0.88876286
row2  0.3220865  0.07823971
row3 -0.3836280 -1.19813305
row4  1.9293844 -1.31088934
row5 -1.1202546  0.91921535
> tmp[c("row1","row5"),c("col6","col20")]
          col6     col20
row1 -1.090387 0.8887629
row5 -1.120255 0.9192153
> 
> 
> 
> 
> 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.51705 49.02864 48.22656 51.45379 51.00091 104.4554 51.01427 51.53185
       col9    col10    col11 col12    col13    col14    col15    col16
row1 49.123 50.39194 50.42272 50.75 51.25601 47.56292 47.55984 51.33814
        col17    col18   col19    col20
row1 48.67024 49.33529 48.6919 105.6524
> tmp[,"col10"]
        col10
row1 50.39194
row2 29.32153
row3 30.23966
row4 30.27665
row5 49.18938
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.51705 49.02864 48.22656 51.45379 51.00091 104.4554 51.01427 51.53185
row5 51.14676 49.07602 50.27156 49.51110 48.24730 104.9878 49.14758 48.94561
         col9    col10    col11  col12    col13    col14    col15    col16
row1 49.12300 50.39194 50.42272 50.750 51.25601 47.56292 47.55984 51.33814
row5 50.87215 49.18938 51.52485 48.697 48.95898 49.69292 48.86219 49.74198
        col17    col18    col19    col20
row1 48.67024 49.33529 48.69190 105.6524
row5 49.27621 50.73549 49.82794 104.7929
> tmp[,c("col6","col20")]
          col6     col20
row1 104.45537 105.65244
row2  75.68824  73.89115
row3  74.73540  73.50788
row4  75.41711  74.77943
row5 104.98782 104.79291
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.4554 105.6524
row5 104.9878 104.7929
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.4554 105.6524
row5 104.9878 104.7929
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  1.5580970
[2,]  0.5815942
[3,]  1.4066527
[4,] -1.0118597
[5,]  0.4844747
> tmp[,c("col17","col7")]
          col17        col7
[1,] -0.6837960  0.04702717
[2,] -0.6338772  0.82667476
[3,]  0.1619223 -1.18382817
[4,] -0.6716295  1.19917223
[5,]  0.9751022  1.04865298
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,]  0.15065230  0.1784371
[2,] -0.05483568 -1.5837145
[3,] -0.11245724  0.9515241
[4,]  0.83038256 -1.1494677
[5,] -0.13364260  0.3383250
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.1506523
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,]  0.15065230
[2,] -0.05483568
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]       [,4]      [,5]       [,6]
row3 -1.9706815  0.9452341 -0.5093532 -0.8462124 0.7849055 -1.5945579
row1  0.3892537 -1.5553436 -1.4313044 -0.1010384 0.6268318  0.9895162
           [,7]      [,8]       [,9]      [,10]      [,11]      [,12]     [,13]
row3 -0.6166020 0.1518291 -0.3423721  0.9040989  1.3749407 -0.6127882 0.7305387
row1 -0.2399155 0.6113007  0.3150543 -0.6843601 -0.8610598 -0.6346585 0.3923657
         [,14]       [,15]      [,16]       [,17]      [,18]     [,19]
row3 0.4674693 -2.30159453  1.4230633 -0.98668874  0.6037258 0.7275143
row1 1.5073710 -0.01368708 -0.9234298  0.03825243 -1.5999940 0.5684518
          [,20]
row3  0.5835052
row1 -1.5532585
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]       [,2]      [,3]      [,4]       [,5]     [,6]       [,7]
row2 0.07846426 0.02188932 0.3742646 0.1877484 -0.5864625 1.313709 -0.3758374
          [,8]      [,9]      [,10]
row2 0.2646305 -1.379308 -0.1278019
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]      [,4]     [,5]     [,6]       [,7]
row5 -1.226102 -0.8408383 -1.124326 0.2739234 1.005596 2.617431 -0.1489066
          [,8]     [,9]     [,10]     [,11]     [,12]      [,13]     [,14]
row5 -1.065641 1.534591 0.8347799 0.9186488 0.9924576 0.09158194 0.7185536
          [,15]     [,16]      [,17]      [,18]     [,19]   [,20]
row5 -0.3922812 0.4258018 -0.8737428 -0.4681296 0.5625765 0.33691
> 
> 
> 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: 0x58f9a8f32b20>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d53d82610"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d13ab0756"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d4fe2e2bd"
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d49a20085"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d707cf665"
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d4f05fc10"
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d3ae106b" 
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d27795ed" 
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894dc89b204" 
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d642f042f"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d6d3da3c0"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d5d09490a"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894dd322065" 
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d1e9a2ee7"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM15894d1623a6d4"
> 
> 
> ### 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: 0x58f9aa8a9b80>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x58f9aa8a9b80>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x58f9aa8a9b80>
> rowMedians(tmp)
  [1]  0.306052264 -0.174938936  0.384492980  0.288768811  0.549617090
  [6]  0.045752153 -0.362890660  0.326744071  0.020884044  0.283386725
 [11] -0.456859817  0.098031472 -0.237290107  0.239587649  0.027488603
 [16]  0.225847178 -0.065429223 -0.228380004 -0.145398609  0.361712841
 [21] -0.289536512  0.008277605  0.621322001  0.684824162 -0.623430672
 [26] -0.278238958  0.811232646 -0.420159049 -0.192392609 -0.161706615
 [31]  0.071438262  0.506129053  0.077390214 -0.361078549 -0.131923638
 [36] -0.006159395 -0.015856448 -0.008574215 -0.350587840  0.320764975
 [41] -0.275848075 -0.035340522  0.078628871 -0.607285767 -0.231036481
 [46] -0.195847718  0.108834576 -0.426281072 -0.630802123 -0.553842812
 [51] -0.748647989 -0.057006836 -0.754957363 -0.260054073 -0.170202877
 [56] -0.268159097 -0.196103292 -0.214281316 -0.110618390  0.024862664
 [61]  0.117355742 -0.258554249 -0.101802573 -0.488929524  0.102471742
 [66] -0.472986950  0.024827599  0.089793553  0.187606259 -0.102961919
 [71]  0.351492843  0.132056750 -0.208912873  0.410877159  0.295938476
 [76]  0.160576766 -0.272998514  0.145134721 -0.108764156  0.297942458
 [81]  0.603519909 -0.205740345 -0.034326110 -0.107723788 -0.136854881
 [86] -0.165415591  0.126065900 -0.009371902 -0.577990210 -0.424726443
 [91]  0.020515076  0.245261183  0.416679490 -0.289533739 -0.583652821
 [96] -0.087301180  0.158917341  0.216117186 -0.278364838  0.077029960
[101] -0.268829250  0.432713778 -0.311349565  0.429961945  0.221675858
[106]  0.324944720 -0.332198263 -0.186491622  0.128445482 -0.454455329
[111] -0.114807367 -0.333253190  0.484978054 -0.386168779 -0.182078693
[116] -0.126796387 -0.153448648 -0.107175363  0.173455549  0.594379539
[121] -0.023197064  0.005363949 -0.314543116 -0.526069715  0.396200983
[126]  0.239927572  0.063965617  0.129585946  0.058605452  0.539474814
[131]  0.055116558 -0.115350390 -0.457347345 -0.041723676  0.213810566
[136] -0.082994588  0.020300241  0.567298363 -0.023313783 -0.224944655
[141]  0.201800665 -0.066487041 -0.002388045  0.147908752  0.201462704
[146]  0.230795859 -0.092266867 -0.373617441 -0.190237235 -0.402861554
[151]  0.049693051 -0.446808621  0.042188209  0.086029048 -0.143881233
[156] -0.252322979 -0.539524713  0.112504903  0.225038015  0.001192867
[161]  0.404497394  0.282804590  0.083716991 -0.475908567 -0.048667249
[166] -0.429475700 -0.031204137 -0.349831460  0.184178688  0.224460295
[171] -0.087801783  0.433013625  0.563085069  0.020706395 -0.338694730
[176]  0.463647786  0.211736888 -0.153782750  0.073031605  0.163651994
[181]  0.059123761  0.219159456  0.185475451  0.036719417 -0.014668997
[186]  0.002913037  0.308743555 -0.242750075  0.238361363 -0.400768106
[191] -0.457756470 -0.288460247 -0.184208455  0.525012573 -0.646062976
[196]  0.492132435  0.118237838  0.242096910 -0.463636214 -0.070199617
[201]  0.415958570 -0.140606588  0.117063901  0.247895778  0.027575252
[206]  0.541889230 -0.429587205  0.029616722 -0.440825180  0.460378220
[211] -0.089545051 -0.196584600  0.127724154 -0.436311402 -0.419908733
[216] -0.086524378 -0.125066107 -0.477445979 -0.033003448  0.089458051
[221] -0.048391852  0.083897923  0.190516517 -0.115054296 -0.023170701
[226]  0.533665434 -0.261104539  0.458849592  0.289809919 -0.489238883
> 
> proc.time()
   user  system elapsed 
  1.294   0.661   1.943 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x55c3625f11c0>
> .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: 0x55c3625f11c0>
> .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: 0x55c3625f11c0>
> .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: 0x55c3625f11c0>
> 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: 0x55c3628d4120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c3628d4120>
> .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: 0x55c3628d4120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c3628d4120>
> .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: 0x55c3628d4120>
> 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: 0x55c3615884a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c3615884a0>
> .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: 0x55c3615884a0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55c3615884a0>
> .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: 0x55c3615884a0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x55c3615884a0>
> .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: 0x55c3615884a0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x55c3615884a0>
> .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: 0x55c3615884a0>
> 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: 0x55c361624390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x55c361624390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c361624390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c361624390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile158b01284ff039" "BufferedMatrixFile158b01ae5f110" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile158b01284ff039" "BufferedMatrixFile158b01ae5f110" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c361ea3650>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c361ea3650>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55c361ea3650>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55c361ea3650>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x55c361ea3650>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x55c361ea3650>
> .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: 0x55c36302a430>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c36302a430>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55c36302a430>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x55c36302a430>
> 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: 0x55c36331f250>
> .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: 0x55c36331f250>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.240   0.049   0.277 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.272   0.041   0.302 

Example timings