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

This page was generated on 2026-01-28 11:32 -0500 (Wed, 28 Jan 2026).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.3 LTS)x86_64R Under development (unstable) (2026-01-15 r89304) -- "Unsuffered Consequences" 4815
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 254/2347HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.75.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-01-27 13:40 -0500 (Tue, 27 Jan 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: ecdbf23
git_last_commit_date: 2025-10-29 09:58:55 -0500 (Wed, 29 Oct 2025)
nebbiolo1Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published


CHECK results for BufferedMatrix on nebbiolo1

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

raw results


Summary

Package: BufferedMatrix
Version: 1.75.0
Command: /home/biocbuild/bbs-3.23-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.23-bioc/R/site-library --timings BufferedMatrix_1.75.0.tar.gz
StartedAt: 2026-01-27 21:48:00 -0500 (Tue, 27 Jan 2026)
EndedAt: 2026-01-27 21:48:25 -0500 (Tue, 27 Jan 2026)
EllapsedTime: 25.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.261   0.039   0.287 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478920 25.6    1048721 56.1   639242 34.2
Vcells 885815  6.8    8388608 64.0  2083259 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Jan 27 21:48:15 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Jan 27 21:48:15 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: 0x5ffe71269c10>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Jan 27 21:48:16 2026"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Jan 27 21:48:16 2026"
> 
> ColMode(tmp2)
<pointer: 0x5ffe71269c10>
> 
> 
> 
> ### 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,] 99.88997827 -1.1150962 1.0801924  0.01045508
[2,] -0.23695626  1.2297499 0.2143220 -1.88834825
[3,]  0.08177976 -0.5683163 0.6748686  1.31101650
[4,]  0.09657983  1.0638900 1.0148505 -0.18479611
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]       [,4]
[1,] 99.88997827 1.1150962 1.0801924 0.01045508
[2,]  0.23695626 1.2297499 0.2143220 1.88834825
[3,]  0.08177976 0.5683163 0.6748686 1.31101650
[4,]  0.09657983 1.0638900 1.0148505 0.18479611
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9944974 1.0559811 1.0393230 0.1022501
[2,] 0.4867815 1.1089409 0.4629492 1.3741718
[3,] 0.2859716 0.7538676 0.8215039 1.1449963
[4,] 0.3107729 1.0314504 1.0073979 0.4298792
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.83495 36.67491 36.47342 26.03296
[2,]  30.10477 37.31916 29.84381 40.63007
[3,]  27.94150 33.10699 33.88991 37.76098
[4,]  28.20431 36.37839 36.08883 29.48359
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5ffe720c0ff0>
> exp(tmp5)
<pointer: 0x5ffe720c0ff0>
> log(tmp5,2)
<pointer: 0x5ffe720c0ff0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.9645
> Min(tmp5)
[1] 53.1833
> mean(tmp5)
[1] 73.12401
> Sum(tmp5)
[1] 14624.8
> Var(tmp5)
[1] 860.9931
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.24208 69.94533 68.86502 69.85391 71.99173 71.47418 72.46489 71.55633
 [9] 70.26216 72.58448
> rowSums(tmp5)
 [1] 1844.842 1398.907 1377.300 1397.078 1439.835 1429.484 1449.298 1431.127
 [9] 1405.243 1451.690
> rowVars(tmp5)
 [1] 7868.55466   97.14851   64.17843   49.59975   74.09756   75.99927
 [7]  103.40253   55.89773   98.47165   88.51025
> rowSd(tmp5)
 [1] 88.704874  9.856394  8.011144  7.042709  8.607994  8.717756 10.168703
 [8]  7.476478  9.923288  9.407989
> rowMax(tmp5)
 [1] 467.96450  89.41302  85.31202  79.94187  87.42351  93.78745  89.01429
 [8]  86.44054  84.80100  85.79625
> rowMin(tmp5)
 [1] 54.18419 53.87902 54.25759 56.26162 57.96494 56.48944 57.96477 56.65062
 [9] 53.44713 53.18330
> 
> colMeans(tmp5)
 [1] 108.10250  71.00138  73.55230  71.02157  68.07337  68.50245  68.61766
 [8]  70.54257  69.26760  71.11178  73.67152  72.15087  70.72213  72.91306
[15]  71.26545  69.81357  73.19233  73.68129  74.07177  71.20504
> colSums(tmp5)
 [1] 1081.0250  710.0138  735.5230  710.2157  680.7337  685.0245  686.1766
 [8]  705.4257  692.6760  711.1178  736.7152  721.5087  707.2213  729.1306
[15]  712.6545  698.1357  731.9233  736.8129  740.7177  712.0504
> colVars(tmp5)
 [1] 16053.90343    93.85560    30.32306   157.81684    77.39351   100.77248
 [7]    64.44782    90.46218    57.87254    67.88015    81.70984    33.22178
[13]    92.86641    91.33816    64.96704    64.29649    69.78445   122.20867
[19]    43.97971    76.48893
> colSd(tmp5)
 [1] 126.703999   9.687910   5.506638  12.562517   8.797358  10.038550
 [7]   8.027940   9.511161   7.607400   8.238941   9.039349   5.763834
[13]   9.636722   9.557100   8.060213   8.018509   8.353709  11.054803
[19]   6.631720   8.745795
> colMax(tmp5)
 [1] 467.96450  88.60715  79.90251  93.78745  79.27022  83.90996  78.69257
 [8]  86.98813  77.59364  81.32376  89.01429  85.04918  82.33886  84.90227
[15]  81.99814  82.63257  86.44054  89.41302  85.31202  85.79625
> colMin(tmp5)
 [1] 58.15656 56.48944 62.11599 54.18419 56.66529 53.18330 53.88393 53.44713
 [9] 54.73491 54.25759 56.26162 63.73499 54.45602 53.87902 55.22129 59.79374
[17] 59.95449 58.79408 68.63157 57.96494
> 
> 
> ### 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]       NA 69.94533 68.86502 69.85391 71.99173 71.47418 72.46489 71.55633
 [9] 70.26216 72.58448
> rowSums(tmp5)
 [1]       NA 1398.907 1377.300 1397.078 1439.835 1429.484 1449.298 1431.127
 [9] 1405.243 1451.690
> rowVars(tmp5)
 [1] 8285.14024   97.14851   64.17843   49.59975   74.09756   75.99927
 [7]  103.40253   55.89773   98.47165   88.51025
> rowSd(tmp5)
 [1] 91.022746  9.856394  8.011144  7.042709  8.607994  8.717756 10.168703
 [8]  7.476478  9.923288  9.407989
> rowMax(tmp5)
 [1]       NA 89.41302 85.31202 79.94187 87.42351 93.78745 89.01429 86.44054
 [9] 84.80100 85.79625
> rowMin(tmp5)
 [1]       NA 53.87902 54.25759 56.26162 57.96494 56.48944 57.96477 56.65062
 [9] 53.44713 53.18330
> 
> colMeans(tmp5)
 [1] 108.10250  71.00138  73.55230  71.02157  68.07337  68.50245  68.61766
 [8]  70.54257  69.26760        NA  73.67152  72.15087  70.72213  72.91306
[15]  71.26545  69.81357  73.19233  73.68129  74.07177  71.20504
> colSums(tmp5)
 [1] 1081.0250  710.0138  735.5230  710.2157  680.7337  685.0245  686.1766
 [8]  705.4257  692.6760        NA  736.7152  721.5087  707.2213  729.1306
[15]  712.6545  698.1357  731.9233  736.8129  740.7177  712.0504
> colVars(tmp5)
 [1] 16053.90343    93.85560    30.32306   157.81684    77.39351   100.77248
 [7]    64.44782    90.46218    57.87254          NA    81.70984    33.22178
[13]    92.86641    91.33816    64.96704    64.29649    69.78445   122.20867
[19]    43.97971    76.48893
> colSd(tmp5)
 [1] 126.703999   9.687910   5.506638  12.562517   8.797358  10.038550
 [7]   8.027940   9.511161   7.607400         NA   9.039349   5.763834
[13]   9.636722   9.557100   8.060213   8.018509   8.353709  11.054803
[19]   6.631720   8.745795
> colMax(tmp5)
 [1] 467.96450  88.60715  79.90251  93.78745  79.27022  83.90996  78.69257
 [8]  86.98813  77.59364        NA  89.01429  85.04918  82.33886  84.90227
[15]  81.99814  82.63257  86.44054  89.41302  85.31202  85.79625
> colMin(tmp5)
 [1] 58.15656 56.48944 62.11599 54.18419 56.66529 53.18330 53.88393 53.44713
 [9] 54.73491       NA 56.26162 63.73499 54.45602 53.87902 55.22129 59.79374
[17] 59.95449 58.79408 68.63157 57.96494
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.9645
> Min(tmp5,na.rm=TRUE)
[1] 53.1833
> mean(tmp5,na.rm=TRUE)
[1] 73.12215
> Sum(tmp5,na.rm=TRUE)
[1] 14551.31
> Var(tmp5,na.rm=TRUE)
[1] 865.3409
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.22885 69.94533 68.86502 69.85391 71.99173 71.47418 72.46489 71.55633
 [9] 70.26216 72.58448
> rowSums(tmp5,na.rm=TRUE)
 [1] 1771.348 1398.907 1377.300 1397.078 1439.835 1429.484 1449.298 1431.127
 [9] 1405.243 1451.690
> rowVars(tmp5,na.rm=TRUE)
 [1] 8285.14024   97.14851   64.17843   49.59975   74.09756   75.99927
 [7]  103.40253   55.89773   98.47165   88.51025
> rowSd(tmp5,na.rm=TRUE)
 [1] 91.022746  9.856394  8.011144  7.042709  8.607994  8.717756 10.168703
 [8]  7.476478  9.923288  9.407989
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.96450  89.41302  85.31202  79.94187  87.42351  93.78745  89.01429
 [8]  86.44054  84.80100  85.79625
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.18419 53.87902 54.25759 56.26162 57.96494 56.48944 57.96477 56.65062
 [9] 53.44713 53.18330
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 108.10250  71.00138  73.55230  71.02157  68.07337  68.50245  68.61766
 [8]  70.54257  69.26760  70.84716  73.67152  72.15087  70.72213  72.91306
[15]  71.26545  69.81357  73.19233  73.68129  74.07177  71.20504
> colSums(tmp5,na.rm=TRUE)
 [1] 1081.0250  710.0138  735.5230  710.2157  680.7337  685.0245  686.1766
 [8]  705.4257  692.6760  637.6244  736.7152  721.5087  707.2213  729.1306
[15]  712.6545  698.1357  731.9233  736.8129  740.7177  712.0504
> colVars(tmp5,na.rm=TRUE)
 [1] 16053.90343    93.85560    30.32306   157.81684    77.39351   100.77248
 [7]    64.44782    90.46218    57.87254    75.57738    81.70984    33.22178
[13]    92.86641    91.33816    64.96704    64.29649    69.78445   122.20867
[19]    43.97971    76.48893
> colSd(tmp5,na.rm=TRUE)
 [1] 126.703999   9.687910   5.506638  12.562517   8.797358  10.038550
 [7]   8.027940   9.511161   7.607400   8.693525   9.039349   5.763834
[13]   9.636722   9.557100   8.060213   8.018509   8.353709  11.054803
[19]   6.631720   8.745795
> colMax(tmp5,na.rm=TRUE)
 [1] 467.96450  88.60715  79.90251  93.78745  79.27022  83.90996  78.69257
 [8]  86.98813  77.59364  81.32376  89.01429  85.04918  82.33886  84.90227
[15]  81.99814  82.63257  86.44054  89.41302  85.31202  85.79625
> colMin(tmp5,na.rm=TRUE)
 [1] 58.15656 56.48944 62.11599 54.18419 56.66529 53.18330 53.88393 53.44713
 [9] 54.73491 54.25759 56.26162 63.73499 54.45602 53.87902 55.22129 59.79374
[17] 59.95449 58.79408 68.63157 57.96494
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1]      NaN 69.94533 68.86502 69.85391 71.99173 71.47418 72.46489 71.55633
 [9] 70.26216 72.58448
> rowSums(tmp5,na.rm=TRUE)
 [1]    0.000 1398.907 1377.300 1397.078 1439.835 1429.484 1449.298 1431.127
 [9] 1405.243 1451.690
> rowVars(tmp5,na.rm=TRUE)
 [1]        NA  97.14851  64.17843  49.59975  74.09756  75.99927 103.40253
 [8]  55.89773  98.47165  88.51025
> rowSd(tmp5,na.rm=TRUE)
 [1]        NA  9.856394  8.011144  7.042709  8.607994  8.717756 10.168703
 [8]  7.476478  9.923288  9.407989
> rowMax(tmp5,na.rm=TRUE)
 [1]       NA 89.41302 85.31202 79.94187 87.42351 93.78745 89.01429 86.44054
 [9] 84.80100 85.79625
> rowMin(tmp5,na.rm=TRUE)
 [1]       NA 53.87902 54.25759 56.26162 57.96494 56.48944 57.96477 56.65062
 [9] 53.44713 53.18330
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 68.11783 70.40887 73.28981 72.89239 68.53147 67.53504 67.87546 68.71529
 [9] 69.48212      NaN 74.03161 73.08596 70.05493 72.35645 70.86237 68.83167
[17] 73.52884 73.54738 74.63802 71.36292
> colSums(tmp5,na.rm=TRUE)
 [1] 613.0605 633.6798 659.6083 656.0315 616.7833 607.8154 610.8791 618.4376
 [9] 625.3391   0.0000 666.2845 657.7737 630.4944 651.2080 637.7614 619.4850
[17] 661.7596 661.9264 671.7422 642.2662
> colVars(tmp5,na.rm=TRUE)
 [1]  74.43918 101.63797  33.33835 138.16932  84.70676 102.84037  66.30658
 [8]  64.20655  64.58889        NA  90.46477  27.53742  99.46676  99.27001
[15]  71.26011  61.48708  77.23352 137.28302  45.87001  85.76964
> colSd(tmp5,na.rm=TRUE)
 [1]  8.627814 10.081566  5.773937 11.754545  9.203627 10.141024  8.142885
 [8]  8.012899  8.036721        NA  9.511297  5.247611  9.973302  9.963434
[15]  8.441570  7.841370  8.788261 11.716784  6.772740  9.261190
> colMax(tmp5,na.rm=TRUE)
 [1] 81.69470 88.60715 79.90251 93.78745 79.27022 83.90996 78.69257 83.60871
 [9] 77.59364     -Inf 89.01429 85.04918 82.33886 84.90227 81.99814 82.63257
[17] 86.44054 89.41302 85.31202 85.79625
> colMin(tmp5,na.rm=TRUE)
 [1] 58.15656 56.48944 62.11599 56.65062 56.66529 53.18330 53.88393 53.44713
 [9] 54.73491      Inf 56.26162 66.49392 54.45602 53.87902 55.22129 59.79374
[17] 59.95449 58.79408 68.63157 57.96494
> 
> 
> 
> 
> 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] 216.0196 259.0744 167.1063 130.7008 269.8529 264.7025 358.9300 166.5066
 [9] 385.8233 372.6938
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 216.0196 259.0744 167.1063 130.7008 269.8529 264.7025 358.9300 166.5066
 [9] 385.8233 372.6938
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14  2.842171e-14  0.000000e+00  0.000000e+00  2.842171e-14
 [6]  0.000000e+00 -1.421085e-13 -1.705303e-13 -1.421085e-13  0.000000e+00
[11]  1.705303e-13 -1.705303e-13  8.526513e-14  1.136868e-13  0.000000e+00
[16]  8.526513e-14  2.842171e-14  5.684342e-14  5.684342e-14  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## 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)
+ }
3   9 
4   5 
2   16 
3   3 
2   3 
4   17 
6   9 
1   3 
8   11 
5   17 
6   10 
6   16 
9   12 
10   19 
7   2 
6   2 
9   1 
7   8 
8   4 
2   11 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.505827
> Min(tmp)
[1] -1.983627
> mean(tmp)
[1] 0.0499816
> Sum(tmp)
[1] 4.99816
> Var(tmp)
[1] 0.9847581
> 
> rowMeans(tmp)
[1] 0.0499816
> rowSums(tmp)
[1] 4.99816
> rowVars(tmp)
[1] 0.9847581
> rowSd(tmp)
[1] 0.9923498
> rowMax(tmp)
[1] 2.505827
> rowMin(tmp)
[1] -1.983627
> 
> colMeans(tmp)
  [1]  0.723805972  0.291947697 -0.819475739  0.292071290  1.491333262
  [6] -1.983626721 -0.391909545 -0.774433702 -0.261765633 -1.084435843
 [11]  0.900370022 -0.056549623 -0.093370693  1.558743367  0.433390462
 [16] -1.718085286  0.383613498 -1.711884660  0.024050272  0.623605305
 [21]  1.523899850  1.292394322  1.068362433  1.007700561  0.071374911
 [26]  0.700389851  2.123225756 -0.629342232 -0.514995640  0.527279492
 [31] -1.905529501  0.428323487  0.454771771 -0.101628104  0.729834897
 [36]  1.219827214 -1.576332941 -0.757370614  0.798335333 -1.466116055
 [41] -0.373359306 -0.869157690 -1.530583062  0.415554890 -0.155407942
 [46] -0.821925244  1.151699146  1.739708665 -0.206807420 -0.544482171
 [51]  0.951639339 -0.238525493 -0.231365672 -0.537394445  1.853608100
 [56] -0.460618975  0.644542463  0.708849244  0.404881614 -0.804791557
 [61]  1.837401080  0.968466692  0.212136648  0.945702061  0.147713539
 [66] -1.313807274  1.052713832 -0.717269592  0.803397757  1.778345908
 [71]  1.437401633 -0.607914498  1.368580139  0.961072553 -1.255819476
 [76]  2.505826523  0.168527366 -0.646552694  0.671710464  0.104623659
 [81]  0.413959376  0.320608284 -0.983244818 -0.128090698  0.230817337
 [86]  0.231752813  0.302218734 -1.240138450 -0.899398846 -0.430278022
 [91] -1.384945046 -0.469376483 -0.002642674 -1.221218376 -0.989862615
 [96] -0.466345638  0.364449116 -0.409583548 -1.218400256 -1.362239755
> colSums(tmp)
  [1]  0.723805972  0.291947697 -0.819475739  0.292071290  1.491333262
  [6] -1.983626721 -0.391909545 -0.774433702 -0.261765633 -1.084435843
 [11]  0.900370022 -0.056549623 -0.093370693  1.558743367  0.433390462
 [16] -1.718085286  0.383613498 -1.711884660  0.024050272  0.623605305
 [21]  1.523899850  1.292394322  1.068362433  1.007700561  0.071374911
 [26]  0.700389851  2.123225756 -0.629342232 -0.514995640  0.527279492
 [31] -1.905529501  0.428323487  0.454771771 -0.101628104  0.729834897
 [36]  1.219827214 -1.576332941 -0.757370614  0.798335333 -1.466116055
 [41] -0.373359306 -0.869157690 -1.530583062  0.415554890 -0.155407942
 [46] -0.821925244  1.151699146  1.739708665 -0.206807420 -0.544482171
 [51]  0.951639339 -0.238525493 -0.231365672 -0.537394445  1.853608100
 [56] -0.460618975  0.644542463  0.708849244  0.404881614 -0.804791557
 [61]  1.837401080  0.968466692  0.212136648  0.945702061  0.147713539
 [66] -1.313807274  1.052713832 -0.717269592  0.803397757  1.778345908
 [71]  1.437401633 -0.607914498  1.368580139  0.961072553 -1.255819476
 [76]  2.505826523  0.168527366 -0.646552694  0.671710464  0.104623659
 [81]  0.413959376  0.320608284 -0.983244818 -0.128090698  0.230817337
 [86]  0.231752813  0.302218734 -1.240138450 -0.899398846 -0.430278022
 [91] -1.384945046 -0.469376483 -0.002642674 -1.221218376 -0.989862615
 [96] -0.466345638  0.364449116 -0.409583548 -1.218400256 -1.362239755
> 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.723805972  0.291947697 -0.819475739  0.292071290  1.491333262
  [6] -1.983626721 -0.391909545 -0.774433702 -0.261765633 -1.084435843
 [11]  0.900370022 -0.056549623 -0.093370693  1.558743367  0.433390462
 [16] -1.718085286  0.383613498 -1.711884660  0.024050272  0.623605305
 [21]  1.523899850  1.292394322  1.068362433  1.007700561  0.071374911
 [26]  0.700389851  2.123225756 -0.629342232 -0.514995640  0.527279492
 [31] -1.905529501  0.428323487  0.454771771 -0.101628104  0.729834897
 [36]  1.219827214 -1.576332941 -0.757370614  0.798335333 -1.466116055
 [41] -0.373359306 -0.869157690 -1.530583062  0.415554890 -0.155407942
 [46] -0.821925244  1.151699146  1.739708665 -0.206807420 -0.544482171
 [51]  0.951639339 -0.238525493 -0.231365672 -0.537394445  1.853608100
 [56] -0.460618975  0.644542463  0.708849244  0.404881614 -0.804791557
 [61]  1.837401080  0.968466692  0.212136648  0.945702061  0.147713539
 [66] -1.313807274  1.052713832 -0.717269592  0.803397757  1.778345908
 [71]  1.437401633 -0.607914498  1.368580139  0.961072553 -1.255819476
 [76]  2.505826523  0.168527366 -0.646552694  0.671710464  0.104623659
 [81]  0.413959376  0.320608284 -0.983244818 -0.128090698  0.230817337
 [86]  0.231752813  0.302218734 -1.240138450 -0.899398846 -0.430278022
 [91] -1.384945046 -0.469376483 -0.002642674 -1.221218376 -0.989862615
 [96] -0.466345638  0.364449116 -0.409583548 -1.218400256 -1.362239755
> colMin(tmp)
  [1]  0.723805972  0.291947697 -0.819475739  0.292071290  1.491333262
  [6] -1.983626721 -0.391909545 -0.774433702 -0.261765633 -1.084435843
 [11]  0.900370022 -0.056549623 -0.093370693  1.558743367  0.433390462
 [16] -1.718085286  0.383613498 -1.711884660  0.024050272  0.623605305
 [21]  1.523899850  1.292394322  1.068362433  1.007700561  0.071374911
 [26]  0.700389851  2.123225756 -0.629342232 -0.514995640  0.527279492
 [31] -1.905529501  0.428323487  0.454771771 -0.101628104  0.729834897
 [36]  1.219827214 -1.576332941 -0.757370614  0.798335333 -1.466116055
 [41] -0.373359306 -0.869157690 -1.530583062  0.415554890 -0.155407942
 [46] -0.821925244  1.151699146  1.739708665 -0.206807420 -0.544482171
 [51]  0.951639339 -0.238525493 -0.231365672 -0.537394445  1.853608100
 [56] -0.460618975  0.644542463  0.708849244  0.404881614 -0.804791557
 [61]  1.837401080  0.968466692  0.212136648  0.945702061  0.147713539
 [66] -1.313807274  1.052713832 -0.717269592  0.803397757  1.778345908
 [71]  1.437401633 -0.607914498  1.368580139  0.961072553 -1.255819476
 [76]  2.505826523  0.168527366 -0.646552694  0.671710464  0.104623659
 [81]  0.413959376  0.320608284 -0.983244818 -0.128090698  0.230817337
 [86]  0.231752813  0.302218734 -1.240138450 -0.899398846 -0.430278022
 [91] -1.384945046 -0.469376483 -0.002642674 -1.221218376 -0.989862615
 [96] -0.466345638  0.364449116 -0.409583548 -1.218400256 -1.362239755
> colMedians(tmp)
  [1]  0.723805972  0.291947697 -0.819475739  0.292071290  1.491333262
  [6] -1.983626721 -0.391909545 -0.774433702 -0.261765633 -1.084435843
 [11]  0.900370022 -0.056549623 -0.093370693  1.558743367  0.433390462
 [16] -1.718085286  0.383613498 -1.711884660  0.024050272  0.623605305
 [21]  1.523899850  1.292394322  1.068362433  1.007700561  0.071374911
 [26]  0.700389851  2.123225756 -0.629342232 -0.514995640  0.527279492
 [31] -1.905529501  0.428323487  0.454771771 -0.101628104  0.729834897
 [36]  1.219827214 -1.576332941 -0.757370614  0.798335333 -1.466116055
 [41] -0.373359306 -0.869157690 -1.530583062  0.415554890 -0.155407942
 [46] -0.821925244  1.151699146  1.739708665 -0.206807420 -0.544482171
 [51]  0.951639339 -0.238525493 -0.231365672 -0.537394445  1.853608100
 [56] -0.460618975  0.644542463  0.708849244  0.404881614 -0.804791557
 [61]  1.837401080  0.968466692  0.212136648  0.945702061  0.147713539
 [66] -1.313807274  1.052713832 -0.717269592  0.803397757  1.778345908
 [71]  1.437401633 -0.607914498  1.368580139  0.961072553 -1.255819476
 [76]  2.505826523  0.168527366 -0.646552694  0.671710464  0.104623659
 [81]  0.413959376  0.320608284 -0.983244818 -0.128090698  0.230817337
 [86]  0.231752813  0.302218734 -1.240138450 -0.899398846 -0.430278022
 [91] -1.384945046 -0.469376483 -0.002642674 -1.221218376 -0.989862615
 [96] -0.466345638  0.364449116 -0.409583548 -1.218400256 -1.362239755
> colRanges(tmp)
         [,1]      [,2]       [,3]      [,4]     [,5]      [,6]       [,7]
[1,] 0.723806 0.2919477 -0.8194757 0.2920713 1.491333 -1.983627 -0.3919095
[2,] 0.723806 0.2919477 -0.8194757 0.2920713 1.491333 -1.983627 -0.3919095
           [,8]       [,9]     [,10]   [,11]       [,12]       [,13]    [,14]
[1,] -0.7744337 -0.2617656 -1.084436 0.90037 -0.05654962 -0.09337069 1.558743
[2,] -0.7744337 -0.2617656 -1.084436 0.90037 -0.05654962 -0.09337069 1.558743
         [,15]     [,16]     [,17]     [,18]      [,19]     [,20]  [,21]
[1,] 0.4333905 -1.718085 0.3836135 -1.711885 0.02405027 0.6236053 1.5239
[2,] 0.4333905 -1.718085 0.3836135 -1.711885 0.02405027 0.6236053 1.5239
        [,22]    [,23]    [,24]      [,25]     [,26]    [,27]      [,28]
[1,] 1.292394 1.068362 1.007701 0.07137491 0.7003899 2.123226 -0.6293422
[2,] 1.292394 1.068362 1.007701 0.07137491 0.7003899 2.123226 -0.6293422
          [,29]     [,30]    [,31]     [,32]     [,33]      [,34]     [,35]
[1,] -0.5149956 0.5272795 -1.90553 0.4283235 0.4547718 -0.1016281 0.7298349
[2,] -0.5149956 0.5272795 -1.90553 0.4283235 0.4547718 -0.1016281 0.7298349
        [,36]     [,37]      [,38]     [,39]     [,40]      [,41]      [,42]
[1,] 1.219827 -1.576333 -0.7573706 0.7983353 -1.466116 -0.3733593 -0.8691577
[2,] 1.219827 -1.576333 -0.7573706 0.7983353 -1.466116 -0.3733593 -0.8691577
         [,43]     [,44]      [,45]      [,46]    [,47]    [,48]      [,49]
[1,] -1.530583 0.4155549 -0.1554079 -0.8219252 1.151699 1.739709 -0.2068074
[2,] -1.530583 0.4155549 -0.1554079 -0.8219252 1.151699 1.739709 -0.2068074
          [,50]     [,51]      [,52]      [,53]      [,54]    [,55]     [,56]
[1,] -0.5444822 0.9516393 -0.2385255 -0.2313657 -0.5373944 1.853608 -0.460619
[2,] -0.5444822 0.9516393 -0.2385255 -0.2313657 -0.5373944 1.853608 -0.460619
         [,57]     [,58]     [,59]      [,60]    [,61]     [,62]     [,63]
[1,] 0.6445425 0.7088492 0.4048816 -0.8047916 1.837401 0.9684667 0.2121366
[2,] 0.6445425 0.7088492 0.4048816 -0.8047916 1.837401 0.9684667 0.2121366
         [,64]     [,65]     [,66]    [,67]      [,68]     [,69]    [,70]
[1,] 0.9457021 0.1477135 -1.313807 1.052714 -0.7172696 0.8033978 1.778346
[2,] 0.9457021 0.1477135 -1.313807 1.052714 -0.7172696 0.8033978 1.778346
        [,71]      [,72]   [,73]     [,74]     [,75]    [,76]     [,77]
[1,] 1.437402 -0.6079145 1.36858 0.9610726 -1.255819 2.505827 0.1685274
[2,] 1.437402 -0.6079145 1.36858 0.9610726 -1.255819 2.505827 0.1685274
          [,78]     [,79]     [,80]     [,81]     [,82]      [,83]      [,84]
[1,] -0.6465527 0.6717105 0.1046237 0.4139594 0.3206083 -0.9832448 -0.1280907
[2,] -0.6465527 0.6717105 0.1046237 0.4139594 0.3206083 -0.9832448 -0.1280907
         [,85]     [,86]     [,87]     [,88]      [,89]     [,90]     [,91]
[1,] 0.2308173 0.2317528 0.3022187 -1.240138 -0.8993988 -0.430278 -1.384945
[2,] 0.2308173 0.2317528 0.3022187 -1.240138 -0.8993988 -0.430278 -1.384945
          [,92]        [,93]     [,94]      [,95]      [,96]     [,97]
[1,] -0.4693765 -0.002642674 -1.221218 -0.9898626 -0.4663456 0.3644491
[2,] -0.4693765 -0.002642674 -1.221218 -0.9898626 -0.4663456 0.3644491
          [,98]   [,99]   [,100]
[1,] -0.4095835 -1.2184 -1.36224
[2,] -0.4095835 -1.2184 -1.36224
> 
> 
> Max(tmp2)
[1] 2.245361
> Min(tmp2)
[1] -3.057939
> mean(tmp2)
[1] -0.1130832
> Sum(tmp2)
[1] -11.30832
> Var(tmp2)
[1] 1.004042
> 
> rowMeans(tmp2)
  [1] -1.41462274 -0.64632896  0.50439798 -0.03015459 -0.49755019 -0.79415265
  [7]  0.96643342 -0.37221358 -0.51475109 -0.84695659  1.07471574 -0.22700183
 [13]  0.88153331 -0.95097498 -0.29320668 -1.13776061 -1.09023546 -0.45413503
 [19] -0.01563626 -2.36415723  0.11955482 -1.25489114 -0.35884507  0.91802246
 [25] -0.33549856 -0.33041624 -0.89293758  0.15243521  0.02933330  1.13122093
 [31] -1.73686863 -1.42415617 -0.21709712 -0.10067855 -0.57432676 -0.38855718
 [37] -1.33241167  0.61045651  0.69805658  0.23764005  0.37265131 -2.36966522
 [43] -3.05793950  0.80240207  0.81658671 -1.20085880  0.70256414 -0.88740735
 [49] -0.87735723  0.31308345 -0.79171133 -0.92440512  0.46940949  0.44450965
 [55]  0.76838038 -0.13979711  0.82856235  0.76503250 -0.85998284  0.73537146
 [61]  0.04227580  1.86926095  0.18006554  0.42754886  0.21915675 -0.60008869
 [67] -0.41207871  0.10559773  2.24536141  0.80875940 -0.09266219  0.21958499
 [73] -1.49416749  0.37846309 -0.54547789  0.91112934  0.85096014  1.35723025
 [79] -0.57065247 -2.03649577 -1.98537901  0.96891871  0.42794185  1.22869242
 [85] -0.50056922 -0.54808769 -0.39626348 -1.18202765  1.03206275  1.76525146
 [91]  0.54044140 -0.57856255  0.82513322 -0.62756385 -0.88909936  0.89644711
 [97]  2.22108311  0.10110470 -1.83559039  0.72726600
> rowSums(tmp2)
  [1] -1.41462274 -0.64632896  0.50439798 -0.03015459 -0.49755019 -0.79415265
  [7]  0.96643342 -0.37221358 -0.51475109 -0.84695659  1.07471574 -0.22700183
 [13]  0.88153331 -0.95097498 -0.29320668 -1.13776061 -1.09023546 -0.45413503
 [19] -0.01563626 -2.36415723  0.11955482 -1.25489114 -0.35884507  0.91802246
 [25] -0.33549856 -0.33041624 -0.89293758  0.15243521  0.02933330  1.13122093
 [31] -1.73686863 -1.42415617 -0.21709712 -0.10067855 -0.57432676 -0.38855718
 [37] -1.33241167  0.61045651  0.69805658  0.23764005  0.37265131 -2.36966522
 [43] -3.05793950  0.80240207  0.81658671 -1.20085880  0.70256414 -0.88740735
 [49] -0.87735723  0.31308345 -0.79171133 -0.92440512  0.46940949  0.44450965
 [55]  0.76838038 -0.13979711  0.82856235  0.76503250 -0.85998284  0.73537146
 [61]  0.04227580  1.86926095  0.18006554  0.42754886  0.21915675 -0.60008869
 [67] -0.41207871  0.10559773  2.24536141  0.80875940 -0.09266219  0.21958499
 [73] -1.49416749  0.37846309 -0.54547789  0.91112934  0.85096014  1.35723025
 [79] -0.57065247 -2.03649577 -1.98537901  0.96891871  0.42794185  1.22869242
 [85] -0.50056922 -0.54808769 -0.39626348 -1.18202765  1.03206275  1.76525146
 [91]  0.54044140 -0.57856255  0.82513322 -0.62756385 -0.88909936  0.89644711
 [97]  2.22108311  0.10110470 -1.83559039  0.72726600
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -1.41462274 -0.64632896  0.50439798 -0.03015459 -0.49755019 -0.79415265
  [7]  0.96643342 -0.37221358 -0.51475109 -0.84695659  1.07471574 -0.22700183
 [13]  0.88153331 -0.95097498 -0.29320668 -1.13776061 -1.09023546 -0.45413503
 [19] -0.01563626 -2.36415723  0.11955482 -1.25489114 -0.35884507  0.91802246
 [25] -0.33549856 -0.33041624 -0.89293758  0.15243521  0.02933330  1.13122093
 [31] -1.73686863 -1.42415617 -0.21709712 -0.10067855 -0.57432676 -0.38855718
 [37] -1.33241167  0.61045651  0.69805658  0.23764005  0.37265131 -2.36966522
 [43] -3.05793950  0.80240207  0.81658671 -1.20085880  0.70256414 -0.88740735
 [49] -0.87735723  0.31308345 -0.79171133 -0.92440512  0.46940949  0.44450965
 [55]  0.76838038 -0.13979711  0.82856235  0.76503250 -0.85998284  0.73537146
 [61]  0.04227580  1.86926095  0.18006554  0.42754886  0.21915675 -0.60008869
 [67] -0.41207871  0.10559773  2.24536141  0.80875940 -0.09266219  0.21958499
 [73] -1.49416749  0.37846309 -0.54547789  0.91112934  0.85096014  1.35723025
 [79] -0.57065247 -2.03649577 -1.98537901  0.96891871  0.42794185  1.22869242
 [85] -0.50056922 -0.54808769 -0.39626348 -1.18202765  1.03206275  1.76525146
 [91]  0.54044140 -0.57856255  0.82513322 -0.62756385 -0.88909936  0.89644711
 [97]  2.22108311  0.10110470 -1.83559039  0.72726600
> rowMin(tmp2)
  [1] -1.41462274 -0.64632896  0.50439798 -0.03015459 -0.49755019 -0.79415265
  [7]  0.96643342 -0.37221358 -0.51475109 -0.84695659  1.07471574 -0.22700183
 [13]  0.88153331 -0.95097498 -0.29320668 -1.13776061 -1.09023546 -0.45413503
 [19] -0.01563626 -2.36415723  0.11955482 -1.25489114 -0.35884507  0.91802246
 [25] -0.33549856 -0.33041624 -0.89293758  0.15243521  0.02933330  1.13122093
 [31] -1.73686863 -1.42415617 -0.21709712 -0.10067855 -0.57432676 -0.38855718
 [37] -1.33241167  0.61045651  0.69805658  0.23764005  0.37265131 -2.36966522
 [43] -3.05793950  0.80240207  0.81658671 -1.20085880  0.70256414 -0.88740735
 [49] -0.87735723  0.31308345 -0.79171133 -0.92440512  0.46940949  0.44450965
 [55]  0.76838038 -0.13979711  0.82856235  0.76503250 -0.85998284  0.73537146
 [61]  0.04227580  1.86926095  0.18006554  0.42754886  0.21915675 -0.60008869
 [67] -0.41207871  0.10559773  2.24536141  0.80875940 -0.09266219  0.21958499
 [73] -1.49416749  0.37846309 -0.54547789  0.91112934  0.85096014  1.35723025
 [79] -0.57065247 -2.03649577 -1.98537901  0.96891871  0.42794185  1.22869242
 [85] -0.50056922 -0.54808769 -0.39626348 -1.18202765  1.03206275  1.76525146
 [91]  0.54044140 -0.57856255  0.82513322 -0.62756385 -0.88909936  0.89644711
 [97]  2.22108311  0.10110470 -1.83559039  0.72726600
> 
> colMeans(tmp2)
[1] -0.1130832
> colSums(tmp2)
[1] -11.30832
> colVars(tmp2)
[1] 1.004042
> colSd(tmp2)
[1] 1.002019
> colMax(tmp2)
[1] 2.245361
> colMin(tmp2)
[1] -3.057939
> colMedians(tmp2)
[1] -0.09667037
> colRanges(tmp2)
          [,1]
[1,] -3.057939
[2,]  2.245361
> 
> 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]  3.1903956 -0.7592161 -0.1819458  1.2665594 -0.1462820 -5.9351134
 [7] -6.9067753 -2.1884163 -3.2199412  2.1639806
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.4123913
[2,] -0.4772889
[3,]  0.1350138
[4,]  1.4397082
[5,]  1.6944101
> 
> rowApply(tmp,sum)
 [1] -1.5034233 -6.7391046 -2.2890550  1.7931669 -1.7511906  1.7869488
 [7]  3.2361632 -4.4521001 -3.5430955  0.7449357
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    2   10    7    9    2   10    8    5     4
 [2,]    3    9    8    5    8    7    6    5    9     1
 [3,]    6    7    4    6    7    9    1    7    8     7
 [4,]    5    8    9    1    1    8    5   10    6     9
 [5,]    8   10    2    9   10    6    2    1    1     8
 [6,]    7    1    6    2    5    5    3    4    2     3
 [7,]    2    3    3    3    4    4    7    2    4     2
 [8,]    1    5    7    8    2   10    4    9    3     5
 [9,]    4    6    1   10    3    3    8    6    7     6
[10,]   10    4    5    4    6    1    9    3   10    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.86041440 -0.75513054  3.39034056  3.57918660  1.59005283  1.68429624
 [7] -0.69491122 -0.54823294  0.36354970 -0.77782090 -1.12870247  0.15475916
[13]  2.28390628 -3.13309561 -0.01450309 -1.43007300 -3.16856635  0.86966436
[19]  2.21549485 -1.77763813
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1511072
[2,] -0.9505198
[3,] -0.6007176
[4,] -0.3436694
[5,]  0.1855995
> 
> rowApply(tmp,sum)
[1]  5.2249123 -0.3491867 -6.3833941 -2.9741688  4.3239993
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    4    3   10   14    8
[2,]    6   11    6   16   14
[3,]   11   17   17   19    7
[4,]   16   12    3   20   20
[5,]   14   15   14    1   17
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]       [,5]        [,6]
[1,] -1.1511072 -1.0217752  0.4914796  1.19154628  0.8021616 -0.29382262
[2,] -0.9505198 -0.2022367  1.1490889  0.01887467  1.0387321  1.24039771
[3,] -0.6007176 -0.9398212  1.0277230 -1.49209638  0.1599410  1.30246661
[4,]  0.1855995  0.7657302  1.1056728  1.69027373 -1.7025256  0.06756928
[5,] -0.3436694  0.6429725 -0.3836238  2.17058830  1.2917437 -0.63231474
           [,7]       [,8]        [,9]      [,10]      [,11]      [,12]
[1,]  0.2423937  2.1029985 -1.28260860  0.9454514 -1.0962531  1.4618708
[2,] -0.4478895  0.5932098  1.07302406  0.1373448 -0.6633397 -0.9074517
[3,] -0.9893244 -1.8844375  0.04201336 -0.2190611  0.4480399 -1.0737265
[4,] -1.2964635 -0.3256937 -0.60112536 -0.8843679  0.6573242  0.8047687
[5,]  1.7963724 -1.0343100  1.13224624 -0.7571881 -0.4744738 -0.1307022
           [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,]  0.79377396 -1.7050451 -0.2655670  0.2350226 -1.6717581  2.1417086
[2,] -0.64668373  1.2869271  1.6514683 -0.9460874 -1.7977550 -0.7477704
[3,]  1.11871017 -2.6956141 -0.6592997  1.3605383  0.3950157 -0.8146013
[4,]  0.92544723  0.1276910 -1.0328432 -0.4293371 -1.3434484 -1.2134670
[5,]  0.09265865 -0.1470546  0.2917385 -1.6502095  1.2493794  1.5037945
           [,19]      [,20]
[1,]  2.54701807  0.7574241
[2,] -0.25052240 -0.9779979
[3,]  0.01007077 -0.8792133
[4,] -0.21918718 -0.2557866
[5,]  0.12811558 -0.4220645
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1       col2      col3     col4      col5      col6      col7
row1 0.4943249 0.07638262 0.9314145 1.743332 -1.410033 0.6205411 0.4558522
         col8      col9    col10     col11     col12      col13  col14    col15
row1 0.736832 -2.087105 0.713727 -1.989014 0.5275917 -0.2482586 -1.446 1.747269
          col16     col17     col18     col19      col20
row1 -0.5578145 0.1558309 0.2508421 -1.202764 0.07637955
> tmp[,"col10"]
           col10
row1  0.71372704
row2 -1.21372504
row3  0.20032727
row4 -2.68450096
row5  0.02597674
> tmp[c("row1","row5"),]
          col1        col2      col3       col4      col5      col6       col7
row1 0.4943249  0.07638262 0.9314145  1.7433316 -1.410033 0.6205411  0.4558522
row5 1.9167107 -1.98750988 1.0924702 -0.8895512 -1.179247 1.4875386 -0.7944726
          col8      col9      col10      col11      col12      col13      col14
row1 0.7368320 -2.087105 0.71372704 -1.9890141  0.5275917 -0.2482586 -1.4460003
row5 0.7331177 -0.644671 0.02597674  0.9915097 -1.1155743 -1.2400805  0.4866139
         col15      col16     col17      col18     col19       col20
row1 1.7472693 -0.5578145 0.1558309  0.2508421 -1.202764  0.07637955
row5 0.6725515 -0.8820223 0.5382020 -0.9080520  1.277804 -0.25076026
> tmp[,c("col6","col20")]
           col6       col20
row1  0.6205411  0.07637955
row2  0.3362069 -1.85247720
row3  1.3620321  1.16655267
row4 -0.1877167 -1.27990999
row5  1.4875386 -0.25076026
> tmp[c("row1","row5"),c("col6","col20")]
          col6       col20
row1 0.6205411  0.07637955
row5 1.4875386 -0.25076026
> 
> 
> 
> 
> 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 49.42723 48.69369 48.41469 49.51861 50.47252 104.0195 49.01349 49.70244
         col9    col10    col11    col12   col13    col14    col15    col16
row1 50.67238 49.81592 49.83225 51.92543 49.9596 49.19384 51.55038 50.45829
        col17    col18    col19    col20
row1 50.53678 50.50411 49.09924 104.7026
> tmp[,"col10"]
        col10
row1 49.81592
row2 29.42326
row3 29.40684
row4 31.09034
row5 51.06441
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.42723 48.69369 48.41469 49.51861 50.47252 104.0195 49.01349 49.70244
row5 51.08526 48.56942 50.23191 50.17212 49.61549 105.7816 50.07866 50.67335
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.67238 49.81592 49.83225 51.92543 49.95960 49.19384 51.55038 50.45829
row5 50.05842 51.06441 50.08117 49.98649 49.60925 50.82244 50.09096 49.76014
        col17    col18    col19    col20
row1 50.53678 50.50411 49.09924 104.7026
row5 49.79853 51.14974 50.30534 105.7992
> tmp[,c("col6","col20")]
          col6     col20
row1 104.01946 104.70257
row2  74.87768  73.79094
row3  74.68780  76.09110
row4  75.41039  75.46776
row5 105.78159 105.79925
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.0195 104.7026
row5 105.7816 105.7992
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.0195 104.7026
row5 105.7816 105.7992
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  0.72009776
[2,]  1.29423476
[3,] -0.09996269
[4,]  1.13110880
[5,]  1.13626563
> tmp[,c("col17","col7")]
           col17        col7
[1,]  1.74419928  0.01195814
[2,] -0.07660301 -0.23770405
[3,]  0.44228878  0.15628688
[4,] -0.16211717  1.97906548
[5,]  2.34810436 -1.21361245
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,]  1.5996409  1.14005231
[2,] -0.5133254 -0.61900449
[3,]  2.1590346 -0.21234863
[4,]  0.1375211 -0.63194950
[5,] -0.7661768  0.05471429
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.599641
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  1.5996409
[2,] -0.5133254
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]      [,2]       [,3]       [,4]        [,5]       [,6]
row3 0.3474315 -1.267067 -1.0223887 -0.8034280  0.03272916 -0.6440535
row1 0.6172441 -0.612830 -0.1582661  0.5449177 -1.21356465  0.5097338
           [,7]       [,8]       [,9]      [,10]     [,11]     [,12]
row3 -0.9145976  0.1147438 -0.6477460 -0.7564228 2.2850275  1.977192
row1 -0.1982261 -0.6607542 -0.6638373 -0.4769960 0.3555583 -1.543091
            [,13]      [,14]     [,15]      [,16]      [,17]     [,18]
row3 -0.008348287  0.2468693 -1.246889  0.3924723 -0.7526866 0.2249749
row1 -0.973629888 -0.3165094  2.167906 -1.4114527  1.6594457 0.9808370
           [,19]       [,20]
row3  0.05466109  0.66676375
row1 -1.60028175 -0.07200412
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]    [,2]      [,3]     [,4]     [,5]        [,6]      [,7]
row2 0.3852743 1.62568 0.1239268 0.426127 2.280593 -0.07716562 0.9559531
          [,8]      [,9]    [,10]
row2 -1.800285 0.1842636 1.047232
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]     [,3]      [,4]      [,5]      [,6]       [,7]
row5 -0.753382 -1.055353 0.981596 -0.905308 0.7346132 0.2180913 -0.1194079
           [,8]      [,9]     [,10]    [,11]      [,12]      [,13]      [,14]
row5 -0.4709192 0.6044072 0.3363253 1.446315 -0.9263046 -0.9805157 -0.1579007
        [,15]     [,16]      [,17]     [,18]     [,19]     [,20]
row5 1.985778 0.8060426 -0.7296633 0.7457118 -1.129067 0.8225325
> 
> 
> 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: 0x5ffe73404840>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e410ab02e"
 [2] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e56dc0001"
 [3] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e7e3c1fe8"
 [4] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e5bce6cc5"
 [5] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e25a555d4"
 [6] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e61f3b4db"
 [7] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e722c7869"
 [8] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e59164350"
 [9] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e6bebdba8"
[10] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e7a0ea248"
[11] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e73c3fafd"
[12] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e46982123"
[13] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e30f85662"
[14] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e22516a5b"
[15] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM3a727e1f681d75"
> 
> 
> ### 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: 0x5ffe735c2fc0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5ffe735c2fc0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5ffe735c2fc0>
> rowMedians(tmp)
  [1]  0.268072898 -0.034513698 -0.236384959 -0.219824664  0.229761175
  [6]  0.501122291  0.177460086  0.451729517  0.180638754 -0.276037384
 [11] -0.118056546  0.019946857 -0.531860474  0.115325262 -0.075188926
 [16]  0.152988187 -0.369488628  0.210723715  0.239274383  0.385607071
 [21] -0.132371803  0.088998156 -0.054939630 -0.176125724  0.485864617
 [26]  0.313493287  0.083437690 -0.046429748 -0.095969426  0.508271334
 [31]  0.624153144 -0.246409953  0.355442710 -0.330978847 -0.462347439
 [36]  0.154934617  0.434545638  0.388396784 -0.092092606 -0.201108297
 [41] -0.249143093  0.007893058  0.730536113  0.135483770 -0.346038081
 [46]  0.017755368  0.083354411 -0.753187242 -0.083127145 -0.014026388
 [51]  0.076966563 -0.112320642 -0.356238544  0.338917711  0.345649297
 [56]  0.775989753 -0.334132444 -0.037948349  0.366512782  0.245689214
 [61] -0.021189740  0.309427534  0.096741479  0.010947926  0.496494385
 [66] -0.076612728  0.134952472  0.093893890  0.077608454 -0.446594947
 [71] -0.171970311  0.355559645 -0.279268363  0.357187601 -0.198209831
 [76]  0.335794645  0.249024534 -0.024929648  0.005597728  0.298448741
 [81]  0.241603964 -0.295968444 -0.209494916 -0.034889252  0.070986324
 [86]  0.545990358 -0.015123929  0.322979444 -0.114141152 -0.568529853
 [91]  0.094785813  0.388945219 -0.017029510  0.078191094  0.047843565
 [96] -0.166279769  0.237497037  0.244972461 -0.854024937 -0.422801482
[101] -0.432476255  0.736184700  0.349901285 -0.005362766  0.484111226
[106] -0.008358358 -0.648023862 -0.829563858  0.142693959  0.562226016
[111] -0.685132617  0.017282805 -0.293686739  0.458036120 -0.119777990
[116]  0.322827192  0.039672496  0.298073977 -0.042996510  0.315314758
[121] -0.338541003  0.538868368 -0.096957350 -0.117846998  0.174156197
[126]  0.187913254  0.260472593  0.049672232 -0.177829472 -0.308852458
[131] -0.140513821 -0.370760792  0.568440521 -0.267145990 -0.105411539
[136] -0.009817113 -0.534607973  0.211116291 -0.106992109 -0.288002875
[141]  0.208355477  0.080592778  0.268246418  0.141546188  0.189324638
[146] -0.025137925  0.251581336  0.026794163  0.225158025 -0.258785608
[151] -0.278755842  0.073871931 -0.121344138  0.086545568  0.715590216
[156] -0.362928885 -0.483350865  0.169202159  0.498529846 -0.084111502
[161] -0.177347926 -0.166484346 -0.043946211  0.176151560 -0.086705830
[166]  0.391170850 -0.273180424  0.062774769  0.137433915  0.321161812
[171]  0.180713605  0.103111051  0.317699483 -0.430031197  0.049699057
[176] -0.410035843  0.488377213 -0.159003271 -0.145879596  0.156432030
[181]  0.068412297 -0.079132742  0.327394903  0.174434731  0.204078419
[186] -0.089679259  0.049799551 -0.169974353  1.007740997 -0.390726993
[191] -0.190034319 -0.371600078  0.235488483  0.409497780 -0.116171099
[196] -0.061718872 -0.230725868 -0.357502022 -0.349231091  0.032342578
[201] -0.243851642  0.126425615 -0.282359602 -0.285009896  0.294322650
[206]  0.218180842  0.202958332 -0.486095906  0.083389278  0.035559901
[211] -0.312249322 -0.239049301 -0.002666844  0.102224220  0.219616230
[216]  0.444662289 -0.236798204 -0.178172761  0.517586145  0.079609929
[221] -0.096695913  0.389991509 -0.197539685 -0.055829957 -0.052656352
[226] -0.165444514 -0.249948543  0.677733481  0.584746278  0.186462282
> 
> proc.time()
   user  system elapsed 
  1.354   1.478   2.820 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x5890fa6f2c10>
> .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: 0x5890fa6f2c10>
> .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: 0x5890fa6f2c10>
> .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: 0x5890fa6f2c10>
> 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: 0x5890fb3b52d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5890fb3b52d0>
> .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: 0x5890fb3b52d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5890fb3b52d0>
> .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: 0x5890fb3b52d0>
> 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: 0x5890fba8ad70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5890fba8ad70>
> .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: 0x5890fba8ad70>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5890fba8ad70>
> .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: 0x5890fba8ad70>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5890fba8ad70>
> .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: 0x5890fba8ad70>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5890fba8ad70>
> .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: 0x5890fba8ad70>
> 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: 0x5890fb5fe370>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5890fb5fe370>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5890fb5fe370>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5890fb5fe370>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3a72ecb07a845" "BufferedMatrixFile3a72ecdeff320"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3a72ecb07a845" "BufferedMatrixFile3a72ecdeff320"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5890fb549ff0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5890fb549ff0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5890fb549ff0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5890fb549ff0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5890fb549ff0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5890fb549ff0>
> .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: 0x5890fb72c3d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5890fb72c3d0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5890fb72c3d0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5890fb72c3d0>
> 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: 0x5890fceddfb0>
> .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: 0x5890fceddfb0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.252   0.049   0.289 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.239   0.047   0.274 

Example timings