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

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

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

Package 257/2361HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.74.0  (landing page)
Ben Bolstad
Snapshot Date: 2026-01-26 13:45 -0500 (Mon, 26 Jan 2026)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_22
git_last_commit: d2ce144
git_last_commit_date: 2025-10-29 09:58:55 -0500 (Wed, 29 Oct 2025)
nebbiolo2Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published


CHECK results for BufferedMatrix on nebbiolo2

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

raw results


Summary

Package: BufferedMatrix
Version: 1.74.0
Command: /home/biocbuild/bbs-3.22-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.22-bioc/R/site-library --timings BufferedMatrix_1.74.0.tar.gz
StartedAt: 2026-01-26 21:50:33 -0500 (Mon, 26 Jan 2026)
EndedAt: 2026-01-26 21:50:57 -0500 (Mon, 26 Jan 2026)
EllapsedTime: 24.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.273   0.035   0.298 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478284 25.6    1046725   56   639600 34.2
Vcells 884773  6.8    8388608   64  2081613 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Jan 26 21:50:48 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] "Mon Jan 26 21:50:48 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: 0x62bb5877f370>
> 
> 
> 
> 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] "Mon Jan 26 21:50:48 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] "Mon Jan 26 21:50:48 2026"
> 
> ColMode(tmp2)
<pointer: 0x62bb5877f370>
> 
> 
> 
> ### 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.9538352 -0.4567952  0.3509548 -0.041424261
[2,] -0.1416446 -0.2740555 -0.3377433  0.341700291
[3,]  1.1156685 -0.6220650  0.6912165  0.004198621
[4,]  0.2232852 -0.6276653  0.2218687 -0.467053211
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]        [,4]
[1,] 99.9538352 0.4567952 0.3509548 0.041424261
[2,]  0.1416446 0.2740555 0.3377433 0.341700291
[3,]  1.1156685 0.6220650 0.6912165 0.004198621
[4,]  0.2232852 0.6276653 0.2218687 0.467053211
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]       [,4]
[1,] 9.9976915 0.6758663 0.5924144 0.20352951
[2,] 0.3763570 0.5235031 0.5811569 0.58455136
[3,] 1.0562521 0.7887110 0.8313943 0.06479677
[4,] 0.4725306 0.7922533 0.4710294 0.68341291
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.93075 32.21546 31.27510 27.07672
[2,]  28.90521 30.50909 31.14931 31.18721
[3,]  36.67819 33.50917 34.00516 25.65217
[4,]  29.94859 33.55020 29.93216 32.30118
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x62bb5977b9b0>
> exp(tmp5)
<pointer: 0x62bb5977b9b0>
> log(tmp5,2)
<pointer: 0x62bb5977b9b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 468.1639
> Min(tmp5)
[1] 52.88252
> mean(tmp5)
[1] 72.97714
> Sum(tmp5)
[1] 14595.43
> Var(tmp5)
[1] 853.8675
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.55054 68.70366 71.20492 72.31971 72.51058 70.02056 71.66249 72.59178
 [9] 70.50184 69.70534
> rowSums(tmp5)
 [1] 1811.011 1374.073 1424.098 1446.394 1450.212 1400.411 1433.250 1451.836
 [9] 1410.037 1394.107
> rowVars(tmp5)
 [1] 7967.63122   55.55789   77.93265   89.21011   91.26820   94.01746
 [7]   49.43169   40.09816   72.26077   28.54385
> rowSd(tmp5)
 [1] 89.261589  7.453716  8.827947  9.445110  9.553439  9.696260  7.030768
 [8]  6.332311  8.500633  5.342644
> rowMax(tmp5)
 [1] 468.16389  79.92320  86.52787  87.33022  84.27401  90.87941  87.02127
 [8]  83.46924  93.86397  80.82975
> rowMin(tmp5)
 [1] 56.35664 58.09642 53.39162 54.58877 52.88252 54.51867 58.29938 57.20933
 [9] 56.04561 57.07890
> 
> colMeans(tmp5)
 [1] 110.28858  68.48559  68.51897  66.61844  70.51119  71.86435  68.09040
 [8]  72.91823  76.25206  70.48648  71.71902  73.22023  69.53258  75.89945
[15]  69.83974  67.52595  74.00376  72.76959  69.23121  71.76697
> colSums(tmp5)
 [1] 1102.8858  684.8559  685.1897  666.1844  705.1119  718.6435  680.9040
 [8]  729.1823  762.5206  704.8648  717.1902  732.2023  695.3258  758.9945
[15]  698.3974  675.2595  740.0376  727.6959  692.3121  717.6697
> colVars(tmp5)
 [1] 15864.97903    29.43033    62.23406    82.77787    53.06728    19.80862
 [7]    35.60005    55.53965    81.14199    74.36549    43.63131    30.07885
[13]    95.77968    33.21948   109.89453    85.34145    73.02499    76.01010
[19]    94.38877   103.02846
> colSd(tmp5)
 [1] 125.956258   5.424973   7.888857   9.098234   7.284729   4.450687
 [7]   5.966577   7.452493   9.007885   8.623543   6.605400   5.484419
[13]   9.786709   5.763635  10.483059   9.238044   8.545466   8.718377
[19]   9.715388  10.150294
> colMax(tmp5)
 [1] 468.16389  81.03788  81.99948  79.31511  81.29157  80.26405  78.32867
 [8]  84.22746  93.86397  84.04273  86.52787  84.87307  84.19145  83.46924
[15]  87.33022  83.05542  90.87941  84.27401  83.59401  87.02127
> colMin(tmp5)
 [1] 60.16242 61.06477 59.14014 53.39162 58.72779 66.56657 61.28288 62.55441
 [9] 59.25391 57.95206 61.64321 66.97292 54.51867 69.04363 56.31358 56.40192
[17] 62.47628 54.58877 52.88252 57.20933
> 
> 
> ### 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] 90.55054 68.70366       NA 72.31971 72.51058 70.02056 71.66249 72.59178
 [9] 70.50184 69.70534
> rowSums(tmp5)
 [1] 1811.011 1374.073       NA 1446.394 1450.212 1400.411 1433.250 1451.836
 [9] 1410.037 1394.107
> rowVars(tmp5)
 [1] 7967.63122   55.55789   80.33647   89.21011   91.26820   94.01746
 [7]   49.43169   40.09816   72.26077   28.54385
> rowSd(tmp5)
 [1] 89.261589  7.453716  8.963062  9.445110  9.553439  9.696260  7.030768
 [8]  6.332311  8.500633  5.342644
> rowMax(tmp5)
 [1] 468.16389  79.92320        NA  87.33022  84.27401  90.87941  87.02127
 [8]  83.46924  93.86397  80.82975
> rowMin(tmp5)
 [1] 56.35664 58.09642       NA 54.58877 52.88252 54.51867 58.29938 57.20933
 [9] 56.04561 57.07890
> 
> colMeans(tmp5)
 [1] 110.28858  68.48559  68.51897  66.61844  70.51119  71.86435        NA
 [8]  72.91823  76.25206  70.48648  71.71902  73.22023  69.53258  75.89945
[15]  69.83974  67.52595  74.00376  72.76959  69.23121  71.76697
> colSums(tmp5)
 [1] 1102.8858  684.8559  685.1897  666.1844  705.1119  718.6435        NA
 [8]  729.1823  762.5206  704.8648  717.1902  732.2023  695.3258  758.9945
[15]  698.3974  675.2595  740.0376  727.6959  692.3121  717.6697
> colVars(tmp5)
 [1] 15864.97903    29.43033    62.23406    82.77787    53.06728    19.80862
 [7]          NA    55.53965    81.14199    74.36549    43.63131    30.07885
[13]    95.77968    33.21948   109.89453    85.34145    73.02499    76.01010
[19]    94.38877   103.02846
> colSd(tmp5)
 [1] 125.956258   5.424973   7.888857   9.098234   7.284729   4.450687
 [7]         NA   7.452493   9.007885   8.623543   6.605400   5.484419
[13]   9.786709   5.763635  10.483059   9.238044   8.545466   8.718377
[19]   9.715388  10.150294
> colMax(tmp5)
 [1] 468.16389  81.03788  81.99948  79.31511  81.29157  80.26405        NA
 [8]  84.22746  93.86397  84.04273  86.52787  84.87307  84.19145  83.46924
[15]  87.33022  83.05542  90.87941  84.27401  83.59401  87.02127
> colMin(tmp5)
 [1] 60.16242 61.06477 59.14014 53.39162 58.72779 66.56657       NA 62.55441
 [9] 59.25391 57.95206 61.64321 66.97292 54.51867 69.04363 56.31358 56.40192
[17] 62.47628 54.58877 52.88252 57.20933
> 
> Max(tmp5,na.rm=TRUE)
[1] 468.1639
> Min(tmp5,na.rm=TRUE)
[1] 52.88252
> mean(tmp5,na.rm=TRUE)
[1] 73.01488
> Sum(tmp5,na.rm=TRUE)
[1] 14529.96
> Var(tmp5,na.rm=TRUE)
[1] 857.8937
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.55054 68.70366 71.50694 72.31971 72.51058 70.02056 71.66249 72.59178
 [9] 70.50184 69.70534
> rowSums(tmp5,na.rm=TRUE)
 [1] 1811.011 1374.073 1358.632 1446.394 1450.212 1400.411 1433.250 1451.836
 [9] 1410.037 1394.107
> rowVars(tmp5,na.rm=TRUE)
 [1] 7967.63122   55.55789   80.33647   89.21011   91.26820   94.01746
 [7]   49.43169   40.09816   72.26077   28.54385
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.261589  7.453716  8.963062  9.445110  9.553439  9.696260  7.030768
 [8]  6.332311  8.500633  5.342644
> rowMax(tmp5,na.rm=TRUE)
 [1] 468.16389  79.92320  86.52787  87.33022  84.27401  90.87941  87.02127
 [8]  83.46924  93.86397  80.82975
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.35664 58.09642 53.39162 54.58877 52.88252 54.51867 58.29938 57.20933
 [9] 56.04561 57.07890
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.28858  68.48559  68.51897  66.61844  70.51119  71.86435  68.38196
 [8]  72.91823  76.25206  70.48648  71.71902  73.22023  69.53258  75.89945
[15]  69.83974  67.52595  74.00376  72.76959  69.23121  71.76697
> colSums(tmp5,na.rm=TRUE)
 [1] 1102.8858  684.8559  685.1897  666.1844  705.1119  718.6435  615.4376
 [8]  729.1823  762.5206  704.8648  717.1902  732.2023  695.3258  758.9945
[15]  698.3974  675.2595  740.0376  727.6959  692.3121  717.6697
> colVars(tmp5,na.rm=TRUE)
 [1] 15864.97903    29.43033    62.23406    82.77787    53.06728    19.80862
 [7]    39.09374    55.53965    81.14199    74.36549    43.63131    30.07885
[13]    95.77968    33.21948   109.89453    85.34145    73.02499    76.01010
[19]    94.38877   103.02846
> colSd(tmp5,na.rm=TRUE)
 [1] 125.956258   5.424973   7.888857   9.098234   7.284729   4.450687
 [7]   6.252499   7.452493   9.007885   8.623543   6.605400   5.484419
[13]   9.786709   5.763635  10.483059   9.238044   8.545466   8.718377
[19]   9.715388  10.150294
> colMax(tmp5,na.rm=TRUE)
 [1] 468.16389  81.03788  81.99948  79.31511  81.29157  80.26405  78.32867
 [8]  84.22746  93.86397  84.04273  86.52787  84.87307  84.19145  83.46924
[15]  87.33022  83.05542  90.87941  84.27401  83.59401  87.02127
> colMin(tmp5,na.rm=TRUE)
 [1] 60.16242 61.06477 59.14014 53.39162 58.72779 66.56657 61.28288 62.55441
 [9] 59.25391 57.95206 61.64321 66.97292 54.51867 69.04363 56.31358 56.40192
[17] 62.47628 54.58877 52.88252 57.20933
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.55054 68.70366      NaN 72.31971 72.51058 70.02056 71.66249 72.59178
 [9] 70.50184 69.70534
> rowSums(tmp5,na.rm=TRUE)
 [1] 1811.011 1374.073    0.000 1446.394 1450.212 1400.411 1433.250 1451.836
 [9] 1410.037 1394.107
> rowVars(tmp5,na.rm=TRUE)
 [1] 7967.63122   55.55789         NA   89.21011   91.26820   94.01746
 [7]   49.43169   40.09816   72.26077   28.54385
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.261589  7.453716        NA  9.445110  9.553439  9.696260  7.030768
 [8]  6.332311  8.500633  5.342644
> rowMax(tmp5,na.rm=TRUE)
 [1] 468.16389  79.92320        NA  87.33022  84.27401  90.87941  87.02127
 [8]  83.46924  93.86397  80.82975
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.35664 58.09642       NA 54.58877 52.88252 54.51867 58.29938 57.20933
 [9] 56.04561 57.07890
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.06055  68.34566  68.26804  68.08809  71.82046  72.37795       NaN
 [8]  71.66165  76.19852  71.56084  70.07359  73.50168  68.88701  75.12024
[15]  70.84412  66.71498  73.45920  73.17893  69.60199  71.33562
> colSums(tmp5,na.rm=TRUE)
 [1] 1026.5449  615.1110  614.4124  612.7928  646.3841  651.4016    0.0000
 [8]  644.9548  685.7867  644.0475  630.6624  661.5151  619.9831  676.0822
[15]  637.5971  600.4348  661.1328  658.6104  626.4179  642.0206
> colVars(tmp5,na.rm=TRUE)
 [1] 17688.03914    32.88884    69.30498    68.82667    40.41617    19.31715
 [7]          NA    44.71838    91.25249    70.67594    18.62660    32.94756
[13]   103.06355    30.54131   112.28254    88.61031    78.81691    83.62627
[19]   104.64075   113.81380
> colSd(tmp5,na.rm=TRUE)
 [1] 132.996388   5.734879   8.324962   8.296184   6.357371   4.395128
 [7]         NA   6.687180   9.552617   8.406899   4.315855   5.739997
[13]  10.152022   5.526419  10.596346   9.413305   8.877889   9.144740
[19]  10.229406  10.668355
> colMax(tmp5,na.rm=TRUE)
 [1] 468.16389  81.03788  81.99948  79.31511  81.29157  80.26405      -Inf
 [8]  80.99855  93.86397  84.04273  75.45366  84.87307  84.19145  83.46924
[15]  87.33022  83.05542  90.87941  84.27401  83.59401  87.02127
> colMin(tmp5,na.rm=TRUE)
 [1] 60.16242 61.06477 59.14014 54.99810 59.19033 66.56657      Inf 62.55441
 [9] 59.25391 57.95206 61.64321 66.97292 54.51867 69.04363 56.31358 56.40192
[17] 62.47628 54.58877 52.88252 57.20933
> 
> 
> 
> 
> 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] 199.8166 220.6308 212.1889 288.8998 265.7832 192.1311 241.9523 127.2624
 [9] 170.3857 246.1525
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 199.8166 220.6308 212.1889 288.8998 265.7832 192.1311 241.9523 127.2624
 [9] 170.3857 246.1525
> 
> 
> 
> 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 -1.136868e-13  9.947598e-14  2.273737e-13
 [6]  1.705303e-13  1.136868e-13 -1.421085e-13  1.705303e-13 -1.634248e-13
[11] -2.842171e-14  5.684342e-14  0.000000e+00 -8.526513e-14 -5.684342e-14
[16]  2.842171e-14  1.421085e-13 -1.136868e-13 -2.842171e-14  4.263256e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
9   20 
2   7 
1   7 
7   5 
6   10 
1   4 
6   17 
6   8 
7   10 
8   1 
7   19 
5   4 
8   2 
7   16 
2   3 
6   19 
9   18 
7   2 
2   4 
8   12 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 3.097447
> Min(tmp)
[1] -3.108195
> mean(tmp)
[1] 0.005273392
> Sum(tmp)
[1] 0.5273392
> Var(tmp)
[1] 1.222895
> 
> rowMeans(tmp)
[1] 0.005273392
> rowSums(tmp)
[1] 0.5273392
> rowVars(tmp)
[1] 1.222895
> rowSd(tmp)
[1] 1.105846
> rowMax(tmp)
[1] 3.097447
> rowMin(tmp)
[1] -3.108195
> 
> colMeans(tmp)
  [1]  0.800624327  0.199347057 -0.366654489  0.514002368  1.443577381
  [6]  0.026097516 -1.188073924  0.096021397  0.841190340 -1.081098042
 [11] -0.818712857  1.770623638 -0.944548269  0.651663551  0.798889411
 [16]  0.392859005 -0.251430455  0.754335932 -0.567879522  0.428548037
 [21]  0.376423214 -2.077547438 -0.565183567  2.894473941 -1.229648367
 [26] -0.375656993 -0.506029018 -0.997513062  0.245568216  0.953320567
 [31] -2.820243254  1.264426427  3.097447096  0.977193188 -0.313628947
 [36] -0.510395968  0.978477451 -1.543144902 -0.346879821 -2.636848726
 [41]  0.648837422  0.558720010  0.824959311  0.116489906 -0.842485413
 [46]  0.088264168 -0.930470720 -1.128695750  0.501173667  0.151938325
 [51] -0.745571088  1.541819288  0.810207158  1.174429950  0.263505913
 [56] -0.087723527  0.431129678  0.508048192 -0.697353390  0.127690566
 [61] -0.836837981 -0.398933662 -1.157800841  1.328701818  0.957556097
 [66]  1.662421527  2.364626763  1.113588858 -1.471571597  1.267630438
 [71]  1.260628620  0.257395511 -1.071603417 -0.007826839 -0.427717195
 [76] -0.073453593  1.140826693 -1.051258694 -0.658856495 -2.087919487
 [81]  0.260865345  0.351747780 -0.746381642 -0.317203794  1.374372048
 [86] -3.108195251 -0.759627050 -0.071002720  0.015352118 -0.335673664
 [91]  0.906237342 -0.782364976  0.689880663  0.138543976 -1.557751722
 [96] -1.074040259 -0.786825952  0.544435549  0.753869972 -0.757401198
> colSums(tmp)
  [1]  0.800624327  0.199347057 -0.366654489  0.514002368  1.443577381
  [6]  0.026097516 -1.188073924  0.096021397  0.841190340 -1.081098042
 [11] -0.818712857  1.770623638 -0.944548269  0.651663551  0.798889411
 [16]  0.392859005 -0.251430455  0.754335932 -0.567879522  0.428548037
 [21]  0.376423214 -2.077547438 -0.565183567  2.894473941 -1.229648367
 [26] -0.375656993 -0.506029018 -0.997513062  0.245568216  0.953320567
 [31] -2.820243254  1.264426427  3.097447096  0.977193188 -0.313628947
 [36] -0.510395968  0.978477451 -1.543144902 -0.346879821 -2.636848726
 [41]  0.648837422  0.558720010  0.824959311  0.116489906 -0.842485413
 [46]  0.088264168 -0.930470720 -1.128695750  0.501173667  0.151938325
 [51] -0.745571088  1.541819288  0.810207158  1.174429950  0.263505913
 [56] -0.087723527  0.431129678  0.508048192 -0.697353390  0.127690566
 [61] -0.836837981 -0.398933662 -1.157800841  1.328701818  0.957556097
 [66]  1.662421527  2.364626763  1.113588858 -1.471571597  1.267630438
 [71]  1.260628620  0.257395511 -1.071603417 -0.007826839 -0.427717195
 [76] -0.073453593  1.140826693 -1.051258694 -0.658856495 -2.087919487
 [81]  0.260865345  0.351747780 -0.746381642 -0.317203794  1.374372048
 [86] -3.108195251 -0.759627050 -0.071002720  0.015352118 -0.335673664
 [91]  0.906237342 -0.782364976  0.689880663  0.138543976 -1.557751722
 [96] -1.074040259 -0.786825952  0.544435549  0.753869972 -0.757401198
> 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.800624327  0.199347057 -0.366654489  0.514002368  1.443577381
  [6]  0.026097516 -1.188073924  0.096021397  0.841190340 -1.081098042
 [11] -0.818712857  1.770623638 -0.944548269  0.651663551  0.798889411
 [16]  0.392859005 -0.251430455  0.754335932 -0.567879522  0.428548037
 [21]  0.376423214 -2.077547438 -0.565183567  2.894473941 -1.229648367
 [26] -0.375656993 -0.506029018 -0.997513062  0.245568216  0.953320567
 [31] -2.820243254  1.264426427  3.097447096  0.977193188 -0.313628947
 [36] -0.510395968  0.978477451 -1.543144902 -0.346879821 -2.636848726
 [41]  0.648837422  0.558720010  0.824959311  0.116489906 -0.842485413
 [46]  0.088264168 -0.930470720 -1.128695750  0.501173667  0.151938325
 [51] -0.745571088  1.541819288  0.810207158  1.174429950  0.263505913
 [56] -0.087723527  0.431129678  0.508048192 -0.697353390  0.127690566
 [61] -0.836837981 -0.398933662 -1.157800841  1.328701818  0.957556097
 [66]  1.662421527  2.364626763  1.113588858 -1.471571597  1.267630438
 [71]  1.260628620  0.257395511 -1.071603417 -0.007826839 -0.427717195
 [76] -0.073453593  1.140826693 -1.051258694 -0.658856495 -2.087919487
 [81]  0.260865345  0.351747780 -0.746381642 -0.317203794  1.374372048
 [86] -3.108195251 -0.759627050 -0.071002720  0.015352118 -0.335673664
 [91]  0.906237342 -0.782364976  0.689880663  0.138543976 -1.557751722
 [96] -1.074040259 -0.786825952  0.544435549  0.753869972 -0.757401198
> colMin(tmp)
  [1]  0.800624327  0.199347057 -0.366654489  0.514002368  1.443577381
  [6]  0.026097516 -1.188073924  0.096021397  0.841190340 -1.081098042
 [11] -0.818712857  1.770623638 -0.944548269  0.651663551  0.798889411
 [16]  0.392859005 -0.251430455  0.754335932 -0.567879522  0.428548037
 [21]  0.376423214 -2.077547438 -0.565183567  2.894473941 -1.229648367
 [26] -0.375656993 -0.506029018 -0.997513062  0.245568216  0.953320567
 [31] -2.820243254  1.264426427  3.097447096  0.977193188 -0.313628947
 [36] -0.510395968  0.978477451 -1.543144902 -0.346879821 -2.636848726
 [41]  0.648837422  0.558720010  0.824959311  0.116489906 -0.842485413
 [46]  0.088264168 -0.930470720 -1.128695750  0.501173667  0.151938325
 [51] -0.745571088  1.541819288  0.810207158  1.174429950  0.263505913
 [56] -0.087723527  0.431129678  0.508048192 -0.697353390  0.127690566
 [61] -0.836837981 -0.398933662 -1.157800841  1.328701818  0.957556097
 [66]  1.662421527  2.364626763  1.113588858 -1.471571597  1.267630438
 [71]  1.260628620  0.257395511 -1.071603417 -0.007826839 -0.427717195
 [76] -0.073453593  1.140826693 -1.051258694 -0.658856495 -2.087919487
 [81]  0.260865345  0.351747780 -0.746381642 -0.317203794  1.374372048
 [86] -3.108195251 -0.759627050 -0.071002720  0.015352118 -0.335673664
 [91]  0.906237342 -0.782364976  0.689880663  0.138543976 -1.557751722
 [96] -1.074040259 -0.786825952  0.544435549  0.753869972 -0.757401198
> colMedians(tmp)
  [1]  0.800624327  0.199347057 -0.366654489  0.514002368  1.443577381
  [6]  0.026097516 -1.188073924  0.096021397  0.841190340 -1.081098042
 [11] -0.818712857  1.770623638 -0.944548269  0.651663551  0.798889411
 [16]  0.392859005 -0.251430455  0.754335932 -0.567879522  0.428548037
 [21]  0.376423214 -2.077547438 -0.565183567  2.894473941 -1.229648367
 [26] -0.375656993 -0.506029018 -0.997513062  0.245568216  0.953320567
 [31] -2.820243254  1.264426427  3.097447096  0.977193188 -0.313628947
 [36] -0.510395968  0.978477451 -1.543144902 -0.346879821 -2.636848726
 [41]  0.648837422  0.558720010  0.824959311  0.116489906 -0.842485413
 [46]  0.088264168 -0.930470720 -1.128695750  0.501173667  0.151938325
 [51] -0.745571088  1.541819288  0.810207158  1.174429950  0.263505913
 [56] -0.087723527  0.431129678  0.508048192 -0.697353390  0.127690566
 [61] -0.836837981 -0.398933662 -1.157800841  1.328701818  0.957556097
 [66]  1.662421527  2.364626763  1.113588858 -1.471571597  1.267630438
 [71]  1.260628620  0.257395511 -1.071603417 -0.007826839 -0.427717195
 [76] -0.073453593  1.140826693 -1.051258694 -0.658856495 -2.087919487
 [81]  0.260865345  0.351747780 -0.746381642 -0.317203794  1.374372048
 [86] -3.108195251 -0.759627050 -0.071002720  0.015352118 -0.335673664
 [91]  0.906237342 -0.782364976  0.689880663  0.138543976 -1.557751722
 [96] -1.074040259 -0.786825952  0.544435549  0.753869972 -0.757401198
> colRanges(tmp)
          [,1]      [,2]       [,3]      [,4]     [,5]       [,6]      [,7]
[1,] 0.8006243 0.1993471 -0.3666545 0.5140024 1.443577 0.02609752 -1.188074
[2,] 0.8006243 0.1993471 -0.3666545 0.5140024 1.443577 0.02609752 -1.188074
          [,8]      [,9]     [,10]      [,11]    [,12]      [,13]     [,14]
[1,] 0.0960214 0.8411903 -1.081098 -0.8187129 1.770624 -0.9445483 0.6516636
[2,] 0.0960214 0.8411903 -1.081098 -0.8187129 1.770624 -0.9445483 0.6516636
         [,15]    [,16]      [,17]     [,18]      [,19]    [,20]     [,21]
[1,] 0.7988894 0.392859 -0.2514305 0.7543359 -0.5678795 0.428548 0.3764232
[2,] 0.7988894 0.392859 -0.2514305 0.7543359 -0.5678795 0.428548 0.3764232
         [,22]      [,23]    [,24]     [,25]     [,26]     [,27]      [,28]
[1,] -2.077547 -0.5651836 2.894474 -1.229648 -0.375657 -0.506029 -0.9975131
[2,] -2.077547 -0.5651836 2.894474 -1.229648 -0.375657 -0.506029 -0.9975131
         [,29]     [,30]     [,31]    [,32]    [,33]     [,34]      [,35]
[1,] 0.2455682 0.9533206 -2.820243 1.264426 3.097447 0.9771932 -0.3136289
[2,] 0.2455682 0.9533206 -2.820243 1.264426 3.097447 0.9771932 -0.3136289
         [,36]     [,37]     [,38]      [,39]     [,40]     [,41]   [,42]
[1,] -0.510396 0.9784775 -1.543145 -0.3468798 -2.636849 0.6488374 0.55872
[2,] -0.510396 0.9784775 -1.543145 -0.3468798 -2.636849 0.6488374 0.55872
         [,43]     [,44]      [,45]      [,46]      [,47]     [,48]     [,49]
[1,] 0.8249593 0.1164899 -0.8424854 0.08826417 -0.9304707 -1.128696 0.5011737
[2,] 0.8249593 0.1164899 -0.8424854 0.08826417 -0.9304707 -1.128696 0.5011737
         [,50]      [,51]    [,52]     [,53]   [,54]     [,55]       [,56]
[1,] 0.1519383 -0.7455711 1.541819 0.8102072 1.17443 0.2635059 -0.08772353
[2,] 0.1519383 -0.7455711 1.541819 0.8102072 1.17443 0.2635059 -0.08772353
         [,57]     [,58]      [,59]     [,60]     [,61]      [,62]     [,63]
[1,] 0.4311297 0.5080482 -0.6973534 0.1276906 -0.836838 -0.3989337 -1.157801
[2,] 0.4311297 0.5080482 -0.6973534 0.1276906 -0.836838 -0.3989337 -1.157801
        [,64]     [,65]    [,66]    [,67]    [,68]     [,69]   [,70]    [,71]
[1,] 1.328702 0.9575561 1.662422 2.364627 1.113589 -1.471572 1.26763 1.260629
[2,] 1.328702 0.9575561 1.662422 2.364627 1.113589 -1.471572 1.26763 1.260629
         [,72]     [,73]        [,74]      [,75]       [,76]    [,77]     [,78]
[1,] 0.2573955 -1.071603 -0.007826839 -0.4277172 -0.07345359 1.140827 -1.051259
[2,] 0.2573955 -1.071603 -0.007826839 -0.4277172 -0.07345359 1.140827 -1.051259
          [,79]     [,80]     [,81]     [,82]      [,83]      [,84]    [,85]
[1,] -0.6588565 -2.087919 0.2608653 0.3517478 -0.7463816 -0.3172038 1.374372
[2,] -0.6588565 -2.087919 0.2608653 0.3517478 -0.7463816 -0.3172038 1.374372
         [,86]      [,87]       [,88]      [,89]      [,90]     [,91]     [,92]
[1,] -3.108195 -0.7596271 -0.07100272 0.01535212 -0.3356737 0.9062373 -0.782365
[2,] -3.108195 -0.7596271 -0.07100272 0.01535212 -0.3356737 0.9062373 -0.782365
         [,93]    [,94]     [,95]    [,96]     [,97]     [,98]   [,99]
[1,] 0.6898807 0.138544 -1.557752 -1.07404 -0.786826 0.5444355 0.75387
[2,] 0.6898807 0.138544 -1.557752 -1.07404 -0.786826 0.5444355 0.75387
         [,100]
[1,] -0.7574012
[2,] -0.7574012
> 
> 
> Max(tmp2)
[1] 2.456242
> Min(tmp2)
[1] -2.286078
> mean(tmp2)
[1] -0.06733803
> Sum(tmp2)
[1] -6.733803
> Var(tmp2)
[1] 1.11079
> 
> rowMeans(tmp2)
  [1] -0.16864236 -0.13597377 -0.47319379  0.53793654 -0.29683754  1.10574016
  [7] -0.21443582  0.86706431  1.17647920  1.14027430  0.59194604 -0.59609920
 [13]  0.77970072  1.74692727 -0.08731454  0.02994746  0.84548434  0.66630016
 [19]  0.24711973 -0.14030389 -0.08427155 -2.22082249  0.91983484 -0.35091903
 [25] -0.48892449  1.16136170  0.05634332  0.07283045  0.75567288  2.26994797
 [31] -1.37549408 -1.03054292 -0.02109670  1.30599100  0.38530377 -0.14630673
 [37] -1.94541168 -2.28607773  2.45624234 -1.65399937 -1.52543456 -0.11581106
 [43]  1.47206118  0.93117461 -2.09121878  1.90682779  0.69186966 -0.23773668
 [49]  0.02182287 -0.60601267 -0.48658233  0.51295355  0.91131320  1.79662055
 [55] -0.36001108 -0.68292377  0.05975700 -0.95581994  0.98976355  0.87804147
 [61]  0.58384311  0.11476845 -0.63001492 -0.71731913 -0.30331818 -0.58682857
 [67] -0.27840764 -0.50265534  1.35235193  1.31923272  0.16759966 -0.18503206
 [73] -1.14828639 -1.37301671 -0.77952401 -1.40239765 -0.36986780 -0.28573503
 [79]  0.01531665 -1.68302531 -0.52327203 -0.26731234 -1.09447538 -1.57910469
 [85]  0.27623957 -0.40403191  0.88847581 -1.30733819 -1.61948982 -0.95941051
 [91]  0.84946622  2.30547875 -1.22754770 -0.39284973 -1.93369491  0.57277204
 [97] -0.09291649 -2.08421473 -0.51841791  0.55772219
> rowSums(tmp2)
  [1] -0.16864236 -0.13597377 -0.47319379  0.53793654 -0.29683754  1.10574016
  [7] -0.21443582  0.86706431  1.17647920  1.14027430  0.59194604 -0.59609920
 [13]  0.77970072  1.74692727 -0.08731454  0.02994746  0.84548434  0.66630016
 [19]  0.24711973 -0.14030389 -0.08427155 -2.22082249  0.91983484 -0.35091903
 [25] -0.48892449  1.16136170  0.05634332  0.07283045  0.75567288  2.26994797
 [31] -1.37549408 -1.03054292 -0.02109670  1.30599100  0.38530377 -0.14630673
 [37] -1.94541168 -2.28607773  2.45624234 -1.65399937 -1.52543456 -0.11581106
 [43]  1.47206118  0.93117461 -2.09121878  1.90682779  0.69186966 -0.23773668
 [49]  0.02182287 -0.60601267 -0.48658233  0.51295355  0.91131320  1.79662055
 [55] -0.36001108 -0.68292377  0.05975700 -0.95581994  0.98976355  0.87804147
 [61]  0.58384311  0.11476845 -0.63001492 -0.71731913 -0.30331818 -0.58682857
 [67] -0.27840764 -0.50265534  1.35235193  1.31923272  0.16759966 -0.18503206
 [73] -1.14828639 -1.37301671 -0.77952401 -1.40239765 -0.36986780 -0.28573503
 [79]  0.01531665 -1.68302531 -0.52327203 -0.26731234 -1.09447538 -1.57910469
 [85]  0.27623957 -0.40403191  0.88847581 -1.30733819 -1.61948982 -0.95941051
 [91]  0.84946622  2.30547875 -1.22754770 -0.39284973 -1.93369491  0.57277204
 [97] -0.09291649 -2.08421473 -0.51841791  0.55772219
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.16864236 -0.13597377 -0.47319379  0.53793654 -0.29683754  1.10574016
  [7] -0.21443582  0.86706431  1.17647920  1.14027430  0.59194604 -0.59609920
 [13]  0.77970072  1.74692727 -0.08731454  0.02994746  0.84548434  0.66630016
 [19]  0.24711973 -0.14030389 -0.08427155 -2.22082249  0.91983484 -0.35091903
 [25] -0.48892449  1.16136170  0.05634332  0.07283045  0.75567288  2.26994797
 [31] -1.37549408 -1.03054292 -0.02109670  1.30599100  0.38530377 -0.14630673
 [37] -1.94541168 -2.28607773  2.45624234 -1.65399937 -1.52543456 -0.11581106
 [43]  1.47206118  0.93117461 -2.09121878  1.90682779  0.69186966 -0.23773668
 [49]  0.02182287 -0.60601267 -0.48658233  0.51295355  0.91131320  1.79662055
 [55] -0.36001108 -0.68292377  0.05975700 -0.95581994  0.98976355  0.87804147
 [61]  0.58384311  0.11476845 -0.63001492 -0.71731913 -0.30331818 -0.58682857
 [67] -0.27840764 -0.50265534  1.35235193  1.31923272  0.16759966 -0.18503206
 [73] -1.14828639 -1.37301671 -0.77952401 -1.40239765 -0.36986780 -0.28573503
 [79]  0.01531665 -1.68302531 -0.52327203 -0.26731234 -1.09447538 -1.57910469
 [85]  0.27623957 -0.40403191  0.88847581 -1.30733819 -1.61948982 -0.95941051
 [91]  0.84946622  2.30547875 -1.22754770 -0.39284973 -1.93369491  0.57277204
 [97] -0.09291649 -2.08421473 -0.51841791  0.55772219
> rowMin(tmp2)
  [1] -0.16864236 -0.13597377 -0.47319379  0.53793654 -0.29683754  1.10574016
  [7] -0.21443582  0.86706431  1.17647920  1.14027430  0.59194604 -0.59609920
 [13]  0.77970072  1.74692727 -0.08731454  0.02994746  0.84548434  0.66630016
 [19]  0.24711973 -0.14030389 -0.08427155 -2.22082249  0.91983484 -0.35091903
 [25] -0.48892449  1.16136170  0.05634332  0.07283045  0.75567288  2.26994797
 [31] -1.37549408 -1.03054292 -0.02109670  1.30599100  0.38530377 -0.14630673
 [37] -1.94541168 -2.28607773  2.45624234 -1.65399937 -1.52543456 -0.11581106
 [43]  1.47206118  0.93117461 -2.09121878  1.90682779  0.69186966 -0.23773668
 [49]  0.02182287 -0.60601267 -0.48658233  0.51295355  0.91131320  1.79662055
 [55] -0.36001108 -0.68292377  0.05975700 -0.95581994  0.98976355  0.87804147
 [61]  0.58384311  0.11476845 -0.63001492 -0.71731913 -0.30331818 -0.58682857
 [67] -0.27840764 -0.50265534  1.35235193  1.31923272  0.16759966 -0.18503206
 [73] -1.14828639 -1.37301671 -0.77952401 -1.40239765 -0.36986780 -0.28573503
 [79]  0.01531665 -1.68302531 -0.52327203 -0.26731234 -1.09447538 -1.57910469
 [85]  0.27623957 -0.40403191  0.88847581 -1.30733819 -1.61948982 -0.95941051
 [91]  0.84946622  2.30547875 -1.22754770 -0.39284973 -1.93369491  0.57277204
 [97] -0.09291649 -2.08421473 -0.51841791  0.55772219
> 
> colMeans(tmp2)
[1] -0.06733803
> colSums(tmp2)
[1] -6.733803
> colVars(tmp2)
[1] 1.11079
> colSd(tmp2)
[1] 1.05394
> colMax(tmp2)
[1] 2.456242
> colMin(tmp2)
[1] -2.286078
> colMedians(tmp2)
[1] -0.1381388
> colRanges(tmp2)
          [,1]
[1,] -2.286078
[2,]  2.456242
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.33580085  0.01575845 -3.32787064  6.16147625  0.17334263  0.16763738
 [7]  0.42933282 -0.21751922  0.91905300 -5.48720877
> colApply(tmp,quantile)[,1]
             [,1]
[1,] -1.307528933
[2,] -0.007267567
[3,]  0.477531880
[4,]  0.624795224
[5,]  0.940380493
> 
> rowApply(tmp,sum)
 [1] -1.9308903 -0.1100597 -3.4496230  2.9926214  1.2526274  4.3409411
 [7] -5.7815282  2.8842977  3.9036416 -2.9322252
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    8    5    4    7    7    6    9    9    7     6
 [2,]    1    9    8    6    3    4    7    7    3     7
 [3,]    3    8    5   10    1    2    2    1    9     5
 [4,]    9   10    6    8    6    9   10    3    8     4
 [5,]    2    6   10    1    9    7    4    2    5     1
 [6,]    7    3    3    3    2   10    8    4    6     8
 [7,]   10    4    2    4    4    1    5    6   10    10
 [8,]    5    2    9    5    8    5    1    5    4     9
 [9,]    6    1    7    9   10    3    6    8    2     3
[10,]    4    7    1    2    5    8    3   10    1     2
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.237463004 -0.785359322 -4.527399272 -0.748287780  1.681844685
 [6]  3.856238098 -3.899567447 -0.511103192 -0.858717671  1.010796390
[11]  4.750692545 -3.225038169  1.697908589  1.397702502  0.012950851
[16] -0.480139381  2.263144285  2.005529879 -0.002983299  1.069799252
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.2869452
[2,] -0.0969288
[3,]  0.5473860
[4,]  0.6219437
[5,]  1.4520073
> 
> rowApply(tmp,sum)
[1]  1.920335  3.180494 -2.862049  5.153740 -1.447045
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   11    3   18   16   18
[2,]    9    4   11   10   12
[3,]   12    1    5   20    1
[4,]    1   11   12   14   11
[5,]   13    6    4   17   20
> 
> 
> as.matrix(tmp)
           [,1]        [,2]        [,3]       [,4]       [,5]      [,6]
[1,] -0.0969288 -0.25228387  0.02741236 -1.6616730  0.3678578 1.4827818
[2,] -1.2869452 -1.04328158 -2.19070240  0.2836415 -0.6273421 0.2130382
[3,]  0.5473860  0.02955973 -0.64924444  0.0432733 -0.7293761 0.8360163
[4,]  0.6219437  0.42650814  1.97518785  0.5602287  0.7647938 0.5229862
[5,]  1.4520073  0.05413826 -3.69005264  0.0262417  1.9059112 0.8014156
           [,7]       [,8]       [,9]      [,10]      [,11]       [,12]
[1,] -0.7193403 -0.8742853 -0.6856432 -1.4544940  2.5914686 -1.02042889
[2,] -1.4804928  0.2877624 -0.1703046  1.7659972  2.2484030 -0.03845080
[3,] -0.5606132  0.4036812 -0.2061203 -1.1922330 -0.1825220 -0.15117672
[4,] -0.8850223  0.4859886  0.7987333  0.9859879  0.5343668 -0.03064178
[5,] -0.2540989 -0.8142501 -0.5953828  0.9055382 -0.4410239 -1.98433997
          [,13]      [,14]      [,15]      [,16]       [,17]     [,18]
[1,] -0.1697976  1.1529699 -0.4879424 -0.7996565  1.43247990  1.155844
[2,]  0.4008159 -0.7953777  0.3047320  0.7488074  1.79174742  0.918990
[3,]  0.2838724  1.5265983  0.3060762  0.1166508 -1.38371314 -0.382981
[4,]  0.5864252 -0.1146999 -0.9807057 -0.1843530  0.40811189 -1.491553
[5,]  0.5965927 -0.3717880  0.8707907 -0.3615882  0.01451821  1.805230
           [,19]      [,20]
[1,]  1.56142856  0.3705658
[2,] -0.09857678  1.9480328
[3,]  0.45772491 -1.9749087
[4,] -0.19420690  0.3636607
[5,] -1.72935310  0.3624486
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  652  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1      col2       col3      col4        col5        col6
row1 -0.1723119 0.6293266 -0.4953154 -0.601991 -0.02435658 0.002912611
           col7       col8      col9     col10      col11     col12       col13
row1 -0.9257028 -0.3557653 -0.326936 -1.158369 -0.6983445 -1.312051 -0.06238227
        col14      col15     col16      col17    col18       col19    col20
row1 1.489961 0.00197082 0.9146993 -0.9474649 1.858701 -0.07810161 -0.56465
> tmp[,"col10"]
           col10
row1 -1.15836871
row2 -0.67198998
row3 -0.33681322
row4  1.42858897
row5  0.06083294
> tmp[c("row1","row5"),]
           col1       col2       col3       col4        col5        col6
row1 -0.1723119  0.6293266 -0.4953154 -0.6019910 -0.02435658 0.002912611
row5 -0.6242118 -1.0077707 -0.8584974 -0.7877077 -0.97468524 1.130008466
           col7       col8      col9       col10       col11      col12
row1 -0.9257028 -0.3557653 -0.326936 -1.15836871 -0.69834454 -1.3120506
row5 -0.2100456 -0.1443683 -1.013692  0.06083294 -0.05869382  0.4587981
           col13     col14       col15      col16      col17      col18
row1 -0.06238227 1.4899613  0.00197082  0.9146993 -0.9474649  1.8587007
row5  2.11300119 0.7202228 -1.41692835 -0.2840526  1.3987207 -0.4081258
           col19     col20
row1 -0.07810161 -0.564650
row5 -0.06701168 -0.535402
> tmp[,c("col6","col20")]
             col6      col20
row1  0.002912611 -0.5646500
row2  2.269397934 -0.2930653
row3 -0.418591308  1.7945345
row4  0.472899907  0.1492582
row5  1.130008466 -0.5354020
> tmp[c("row1","row5"),c("col6","col20")]
            col6     col20
row1 0.002912611 -0.564650
row5 1.130008466 -0.535402
> 
> 
> 
> 
> 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.23441 49.60314 50.51943 52.00803 48.82517 104.2477 49.40871 51.23939
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.47504 50.96341 48.51047 50.08239 49.50827 49.47374 48.20373 47.98681
        col17    col18    col19    col20
row1 49.77638 49.45163 48.59701 104.0224
> tmp[,"col10"]
        col10
row1 50.96341
row2 31.31214
row3 29.07290
row4 27.75849
row5 50.63159
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.23441 49.60314 50.51943 52.00803 48.82517 104.2477 49.40871 51.23939
row5 51.11992 49.73664 51.17206 51.06946 50.89722 106.2672 50.50085 50.67491
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.47504 50.96341 48.51047 50.08239 49.50827 49.47374 48.20373 47.98681
row5 51.21596 50.63159 49.55911 50.05235 51.31720 50.24768 50.53925 49.67896
        col17    col18    col19    col20
row1 49.77638 49.45163 48.59701 104.0224
row5 48.61910 51.75172 50.34849 104.2137
> tmp[,c("col6","col20")]
          col6     col20
row1 104.24771 104.02244
row2  76.79493  74.47179
row3  73.95311  75.37328
row4  74.66281  75.82623
row5 106.26723 104.21367
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.2477 104.0224
row5 106.2672 104.2137
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.2477 104.0224
row5 106.2672 104.2137
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.1432585
[2,] -1.6865586
[3,] -0.8377447
[4,] -0.1905077
[5,]  1.1231590
> tmp[,c("col17","col7")]
          col17        col7
[1,]  0.6447869 -0.71905914
[2,]  1.4671807 -1.60657058
[3,] -2.0701793  0.91698734
[4,]  1.2012073  1.89615142
[5,] -2.5804030 -0.01981629
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -0.43667290  0.3286115
[2,]  0.09843875 -1.0073044
[3,] -1.01473197 -1.9937009
[4,] -1.96870064 -0.9036546
[5,] -0.44631813  0.3552582
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.4366729
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] -0.43667290
[2,]  0.09843875
> 
> 
> 
> 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.7754717  0.6376919 -0.06000948  1.191578 0.6977917 0.3890088
row1  0.8325818 -1.2244940 -1.86683133 -0.678210 1.8534504 0.2824936
            [,7]      [,8]       [,9]      [,10]     [,11]     [,12]      [,13]
row3 -0.04037804  1.063129 -0.6566009  2.9041145 1.3930095 0.1003495  0.7505352
row1 -0.41541776 -1.144303  0.5927287 -0.6392264 0.3911426 1.1254935 -1.2564516
         [,14]       [,15]      [,16]      [,17]       [,18]        [,19]
row3  1.476234 -0.20612932 -0.5603006  0.4262150 -0.06974896 -0.005410106
row1 -0.780953 -0.01436791 -1.0060433 -0.4520832  2.95655013  0.518717452
         [,20]
row3 1.9305958
row1 0.3870178
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
row2 0.2689256 0.9986334 0.1776343 0.3067479 -2.207102 -1.169583 -1.261955
           [,8]       [,9]      [,10]
row2 -0.7676541 -0.7154859 0.08952862
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]       [,4]       [,5]      [,6]      [,7]
row5 0.2125667 0.6030851 -0.8558774 0.01693224 -0.8154709 0.7767456 -1.249551
         [,8]       [,9]     [,10]     [,11]     [,12]      [,13]     [,14]
row5 1.029337 -0.5069402 -1.891288 -1.268227 -1.125777 -0.5059531 -1.021973
        [,15]      [,16]    [,17]      [,18]    [,19]      [,20]
row5 1.430066 -0.5649393 0.817222 -0.4943482 1.237916 -0.9826124
> 
> 
> 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: 0x62bb57424760>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a3150afac38"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a314b1d954d"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a314e9fd728"
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a3160b33f4b"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a317f659d3e"
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a31588e7136"
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a312459d468"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a316946dfe8"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a31734fe5ba"
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a316a877941"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a3163eab4b0"
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a313b603312"
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a314ec47a2" 
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a315853f943"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM160a316abc0f6c"
> 
> 
> ### 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: 0x62bb59c78ac0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x62bb59c78ac0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x62bb59c78ac0>
> rowMedians(tmp)
  [1] -0.565010093 -0.095360591  0.280173773 -0.511050151 -0.324993402
  [6] -0.434997672 -0.244295093  0.089804551  0.372228777 -0.077299016
 [11] -0.092825130 -0.177610529 -0.055433758 -0.485816102  0.265844101
 [16] -0.197440293 -0.065269819  0.064677826 -0.357672837 -0.323908242
 [21]  0.292493285  0.433043692 -0.117506238 -0.054369300  0.229108792
 [26] -0.445110349  0.035771049 -0.230116321  0.190245320  0.468153006
 [31]  0.226634628 -0.082187410 -0.228774361 -0.137564157  0.682501878
 [36]  0.177887558 -0.348162752 -0.313502841  0.082114643 -0.122981240
 [41]  0.311826887 -0.159699641 -0.030682626 -0.239252760 -0.120028532
 [46]  0.392403694 -0.471440712 -0.323584465 -0.105784865  0.010127337
 [51] -0.544888376  0.504162921  0.639127763  0.389872696  0.132422258
 [56]  0.166432060  0.640181762  0.038138754  0.044705506 -0.036497943
 [61] -0.018635566  0.122102466 -0.221431671  0.139097726 -0.095455871
 [66]  0.156896802 -0.043179024 -0.433531673  0.736406445  0.158126262
 [71] -0.386879452  0.218112124  0.456700575 -0.020067822  0.220713451
 [76] -0.259555694  0.265772368 -0.047066126 -0.380455120  0.453481963
 [81]  0.156196112  0.414538879 -0.149526408 -0.072503595  0.087362696
 [86]  0.605117074  0.262009873 -0.643652704 -0.110789006  0.503573586
 [91]  0.405969367 -0.127671917  0.434315847 -0.259128343 -0.642541196
 [96]  0.154484651 -0.131064854  0.196759172  0.100275344  0.040767684
[101] -0.133061822 -0.063832550  0.071470508  0.666415894  0.289325149
[106] -0.367628082  0.347584743 -0.230816154  0.460497412 -0.263310837
[111] -0.166850394 -0.115393396 -0.255820969  0.228167284  0.065918437
[116] -0.391707270 -0.146840808  0.321490467 -0.447716256  0.863191916
[121] -0.446574888  0.431403073 -0.230298498 -0.221190622 -0.234179779
[126]  0.592911534 -0.350607803  0.190128001 -0.064462928  0.348502931
[131]  0.507124636 -0.144518556  0.591996228 -0.539655287 -0.046969480
[136]  0.024673509 -0.112023024 -0.389491993  0.253643441  0.134951859
[141] -0.333927018  0.612326223 -0.086268680  0.283865759 -0.202404402
[146] -0.168009117  0.176362243 -0.241923808 -0.387012568 -0.278367491
[151]  0.481635756 -0.255336111  0.228824346 -0.330405444  0.073110869
[156] -0.158156874  0.076120603 -0.522584890  0.022863762 -0.162972902
[161] -0.064229554  0.161995454 -0.223163111 -0.201987528 -0.184487641
[166]  0.271624320  0.116461893  0.226956558 -0.502342114 -0.008059214
[171] -0.071677356 -0.302362202  0.038412014 -0.613735113 -0.245726965
[176] -0.134079936 -0.331018155 -0.129325498 -0.232780024 -0.194827579
[181] -0.258949543 -0.103184814  0.362239809 -0.034915079  0.083933064
[186] -0.191341090 -0.521240423 -1.007044317  0.049487648 -0.159778278
[191]  0.268377590 -0.202671233 -0.088370660  0.555337306 -0.447359805
[196] -0.116598989 -0.314187382  0.044152019  0.284557451 -0.290716018
[201] -0.356564386 -0.429309284 -0.712745811 -0.062075293 -0.351070475
[206] -0.292421509  0.033143441 -0.577802695 -0.428725053 -0.610707000
[211]  0.411288461 -0.574672753 -0.311545867 -0.134537635 -0.017253900
[216]  0.406949828  0.090984056 -0.108399552 -0.029462473 -0.342421237
[221] -0.026524607  0.284619367  0.033389807 -0.070754124 -0.103943980
[226]  0.223303378  0.056747443  0.319667143  0.036883039 -0.310536366
> 
> proc.time()
   user  system elapsed 
  1.269   0.639   1.896 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x5969d7c11370>
> .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: 0x5969d7c11370>
> .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: 0x5969d7c11370>
> .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: 0x5969d7c11370>
> 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: 0x5969d7bf91c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5969d7bf91c0>
> .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: 0x5969d7bf91c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5969d7bf91c0>
> .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: 0x5969d7bf91c0>
> 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: 0x5969d7edc120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5969d7edc120>
> .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: 0x5969d7edc120>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5969d7edc120>
> .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: 0x5969d7edc120>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5969d7edc120>
> .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: 0x5969d7edc120>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5969d7edc120>
> .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: 0x5969d7edc120>
> 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: 0x5969d6c2c390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5969d6c2c390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5969d6c2c390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5969d6c2c390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile160bd1141c6c66" "BufferedMatrixFile160bd14daff468"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile160bd1141c6c66" "BufferedMatrixFile160bd14daff468"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5969d6b233d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5969d6b233d0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5969d6b233d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5969d6b233d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5969d6b233d0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5969d6b233d0>
> .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: 0x5969d8658fa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5969d8658fa0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5969d8658fa0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5969d8658fa0>
> 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: 0x5969d6e30ff0>
> .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: 0x5969d6e30ff0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.258   0.037   0.285 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

Example timings