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

This page was generated on 2025-10-31 08:34 -0400 (Fri, 31 Oct 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.3 LTS)x86_64R Under development (unstable) (2025-10-20 r88955) -- "Unsuffered Consequences" 4428
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 251/2321HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.75.0  (landing page)
Ben Bolstad
Snapshot Date: 2025-10-30 13:40 -0400 (Thu, 30 Oct 2025)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: ecdbf23
git_last_commit_date: 2025-10-29 09:58:55 -0400 (Wed, 29 Oct 2025)
nebbiolo1Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  YES


CHECK results for BufferedMatrix on nebbiolo1

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

raw results


Summary

Package: BufferedMatrix
Version: 1.75.0
Command: /home/biocbuild/bbs-3.23-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.23-bioc/R/site-library --timings BufferedMatrix_1.75.0.tar.gz
StartedAt: 2025-10-30 20:13:16 -0400 (Thu, 30 Oct 2025)
EndedAt: 2025-10-30 20:13:40 -0400 (Thu, 30 Oct 2025)
EllapsedTime: 24.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.240   0.054   0.283 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 478818 25.6    1048392   56   639317 34.2
Vcells 885623  6.8    8388608   64  2082728 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] "Thu Oct 30 20:13:31 2025"
> 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] "Thu Oct 30 20:13:31 2025"
> 
> 
> 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: 0x620fcc8c35e0>
> 
> 
> 
> 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] "Thu Oct 30 20:13:31 2025"
> 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] "Thu Oct 30 20:13:32 2025"
> 
> ColMode(tmp2)
<pointer: 0x620fcc8c35e0>
> 
> 
> 
> ### 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.2092306  0.3534756  0.8750370 -0.1840163
[2,]  1.1361947 -1.0253958 -0.6813963 -1.5284967
[3,] -0.4362007 -0.2011854  0.9486364 -1.2395358
[4,]  0.1248146 -0.7824675  2.4279591 -0.2714064
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 99.2092306 0.3534756 0.8750370 0.1840163
[2,]  1.1361947 1.0253958 0.6813963 1.5284967
[3,]  0.4362007 0.2011854 0.9486364 1.2395358
[4,]  0.1248146 0.7824675 2.4279591 0.2714064
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9603831 0.5945382 0.9354341 0.4289712
[2,] 1.0659244 1.0126183 0.8254673 1.2363239
[3,] 0.6604549 0.4485370 0.9739797 1.1133444
[4,] 0.3532910 0.8845719 1.5581910 0.5209668
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 223.81306 31.29886 35.22938 29.47373
[2,]  36.79544 36.15158 33.93607 38.89174
[3,]  32.04075 29.68656 35.68843 37.37298
[4,]  28.65772 34.62819 43.00987 30.48107
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x620fcc44e840>
> exp(tmp5)
<pointer: 0x620fcc44e840>
> log(tmp5,2)
<pointer: 0x620fcc44e840>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 465.8376
> Min(tmp5)
[1] 53.94377
> mean(tmp5)
[1] 73.33466
> Sum(tmp5)
[1] 14666.93
> Var(tmp5)
[1] 858.2148
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.64471 71.08924 73.87383 70.89531 71.12468 71.88359 71.70647 71.77919
 [9] 69.02807 72.32146
> rowSums(tmp5)
 [1] 1792.894 1421.785 1477.477 1417.906 1422.494 1437.672 1434.129 1435.584
 [9] 1380.561 1446.429
> rowVars(tmp5)
 [1] 7919.87871   99.42109   50.31935  106.33206  117.93875  100.66215
 [7]   41.22212   61.63425   56.49156  109.57674
> rowSd(tmp5)
 [1] 88.993700  9.971012  7.093614 10.311744 10.859961 10.033053  6.420446
 [8]  7.850748  7.516086 10.467891
> rowMax(tmp5)
 [1] 465.83756  89.03236  90.41159  90.73675  91.46194  89.76328  82.08674
 [8]  85.70907  79.09608  94.68055
> rowMin(tmp5)
 [1] 55.30491 55.42929 61.78868 55.99682 54.86587 56.78011 58.40987 53.94377
 [9] 54.78840 55.23638
> 
> colMeans(tmp5)
 [1] 111.03668  72.70348  74.36392  70.83974  72.84011  75.34654  72.04570
 [8]  70.60549  71.89915  71.82795  64.56367  72.08102  68.84239  70.03783
[15]  70.88093  68.59527  72.79820  74.51953  70.87257  69.99297
> colSums(tmp5)
 [1] 1110.3668  727.0348  743.6392  708.3974  728.4011  753.4654  720.4570
 [8]  706.0549  718.9915  718.2795  645.6367  720.8102  688.4239  700.3783
[15]  708.8093  685.9527  727.9820  745.1953  708.7257  699.9297
> colVars(tmp5)
 [1] 15637.31649    65.98618   109.33185    74.60909   123.94871    98.42294
 [7]   107.35901    86.82598    32.02013    91.24866    62.08894    83.13646
[13]   107.15470    90.56328    39.45439    81.47579    47.42862    80.61562
[19]    38.80618   136.27541
> colSd(tmp5)
 [1] 125.049256   8.123188  10.456187   8.637655  11.133226   9.920834
 [7]  10.361419   9.318046   5.658633   9.552416   7.879654   9.117920
[13]  10.351555   9.516474   6.281273   9.026394   6.886844   8.978620
[19]   6.229460  11.673706
> colMax(tmp5)
 [1] 465.83756  89.76328  94.68055  81.76531  89.03236  88.10284  84.23032
 [8]  87.33217  81.00167  85.24873  78.66483  90.41159  82.36628  91.46194
[15]  79.97906  82.57014  80.97847  90.73675  77.32370  92.63272
> colMin(tmp5)
 [1] 57.10199 61.78868 61.61123 61.34570 54.78840 57.52270 55.23638 56.78011
 [9] 64.83660 55.42929 55.30265 60.68537 53.94377 59.74930 62.62137 58.40987
[17] 60.54311 62.86896 55.99682 56.32177
> 
> 
> ### 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] 89.64471 71.08924 73.87383       NA 71.12468 71.88359 71.70647 71.77919
 [9] 69.02807 72.32146
> rowSums(tmp5)
 [1] 1792.894 1421.785 1477.477       NA 1422.494 1437.672 1434.129 1435.584
 [9] 1380.561 1446.429
> rowVars(tmp5)
 [1] 7919.87871   99.42109   50.31935  109.96316  117.93875  100.66215
 [7]   41.22212   61.63425   56.49156  109.57674
> rowSd(tmp5)
 [1] 88.993700  9.971012  7.093614 10.486332 10.859961 10.033053  6.420446
 [8]  7.850748  7.516086 10.467891
> rowMax(tmp5)
 [1] 465.83756  89.03236  90.41159        NA  91.46194  89.76328  82.08674
 [8]  85.70907  79.09608  94.68055
> rowMin(tmp5)
 [1] 55.30491 55.42929 61.78868       NA 54.86587 56.78011 58.40987 53.94377
 [9] 54.78840 55.23638
> 
> colMeans(tmp5)
 [1] 111.03668  72.70348  74.36392  70.83974  72.84011        NA  72.04570
 [8]  70.60549  71.89915  71.82795  64.56367  72.08102  68.84239  70.03783
[15]  70.88093  68.59527  72.79820  74.51953  70.87257  69.99297
> colSums(tmp5)
 [1] 1110.3668  727.0348  743.6392  708.3974  728.4011        NA  720.4570
 [8]  706.0549  718.9915  718.2795  645.6367  720.8102  688.4239  700.3783
[15]  708.8093  685.9527  727.9820  745.1953  708.7257  699.9297
> colVars(tmp5)
 [1] 15637.31649    65.98618   109.33185    74.60909   123.94871          NA
 [7]   107.35901    86.82598    32.02013    91.24866    62.08894    83.13646
[13]   107.15470    90.56328    39.45439    81.47579    47.42862    80.61562
[19]    38.80618   136.27541
> colSd(tmp5)
 [1] 125.049256   8.123188  10.456187   8.637655  11.133226         NA
 [7]  10.361419   9.318046   5.658633   9.552416   7.879654   9.117920
[13]  10.351555   9.516474   6.281273   9.026394   6.886844   8.978620
[19]   6.229460  11.673706
> colMax(tmp5)
 [1] 465.83756  89.76328  94.68055  81.76531  89.03236        NA  84.23032
 [8]  87.33217  81.00167  85.24873  78.66483  90.41159  82.36628  91.46194
[15]  79.97906  82.57014  80.97847  90.73675  77.32370  92.63272
> colMin(tmp5)
 [1] 57.10199 61.78868 61.61123 61.34570 54.78840       NA 55.23638 56.78011
 [9] 64.83660 55.42929 55.30265 60.68537 53.94377 59.74930 62.62137 58.40987
[17] 60.54311 62.86896 55.99682 56.32177
> 
> Max(tmp5,na.rm=TRUE)
[1] 465.8376
> Min(tmp5,na.rm=TRUE)
[1] 53.94377
> mean(tmp5,na.rm=TRUE)
[1] 73.37826
> Sum(tmp5,na.rm=TRUE)
[1] 14602.27
> Var(tmp5,na.rm=TRUE)
[1] 862.1669
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.64471 71.08924 73.87383 71.22368 71.12468 71.88359 71.70647 71.77919
 [9] 69.02807 72.32146
> rowSums(tmp5,na.rm=TRUE)
 [1] 1792.894 1421.785 1477.477 1353.250 1422.494 1437.672 1434.129 1435.584
 [9] 1380.561 1446.429
> rowVars(tmp5,na.rm=TRUE)
 [1] 7919.87871   99.42109   50.31935  109.96316  117.93875  100.66215
 [7]   41.22212   61.63425   56.49156  109.57674
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.993700  9.971012  7.093614 10.486332 10.859961 10.033053  6.420446
 [8]  7.850748  7.516086 10.467891
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.83756  89.03236  90.41159  90.73675  91.46194  89.76328  82.08674
 [8]  85.70907  79.09608  94.68055
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.30491 55.42929 61.78868 55.99682 54.86587 56.78011 58.40987 53.94377
 [9] 54.78840 55.23638
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.03668  72.70348  74.36392  70.83974  72.84011  76.53433  72.04570
 [8]  70.60549  71.89915  71.82795  64.56367  72.08102  68.84239  70.03783
[15]  70.88093  68.59527  72.79820  74.51953  70.87257  69.99297
> colSums(tmp5,na.rm=TRUE)
 [1] 1110.3668  727.0348  743.6392  708.3974  728.4011  688.8089  720.4570
 [8]  706.0549  718.9915  718.2795  645.6367  720.8102  688.4239  700.3783
[15]  708.8093  685.9527  727.9820  745.1953  708.7257  699.9297
> colVars(tmp5,na.rm=TRUE)
 [1] 15637.31649    65.98618   109.33185    74.60909   123.94871    94.85382
 [7]   107.35901    86.82598    32.02013    91.24866    62.08894    83.13646
[13]   107.15470    90.56328    39.45439    81.47579    47.42862    80.61562
[19]    38.80618   136.27541
> colSd(tmp5,na.rm=TRUE)
 [1] 125.049256   8.123188  10.456187   8.637655  11.133226   9.739293
 [7]  10.361419   9.318046   5.658633   9.552416   7.879654   9.117920
[13]  10.351555   9.516474   6.281273   9.026394   6.886844   8.978620
[19]   6.229460  11.673706
> colMax(tmp5,na.rm=TRUE)
 [1] 465.83756  89.76328  94.68055  81.76531  89.03236  88.10284  84.23032
 [8]  87.33217  81.00167  85.24873  78.66483  90.41159  82.36628  91.46194
[15]  79.97906  82.57014  80.97847  90.73675  77.32370  92.63272
> colMin(tmp5,na.rm=TRUE)
 [1] 57.10199 61.78868 61.61123 61.34570 54.78840 57.52270 55.23638 56.78011
 [9] 64.83660 55.42929 55.30265 60.68537 53.94377 59.74930 62.62137 58.40987
[17] 60.54311 62.86896 55.99682 56.32177
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.64471 71.08924 73.87383      NaN 71.12468 71.88359 71.70647 71.77919
 [9] 69.02807 72.32146
> rowSums(tmp5,na.rm=TRUE)
 [1] 1792.894 1421.785 1477.477    0.000 1422.494 1437.672 1434.129 1435.584
 [9] 1380.561 1446.429
> rowVars(tmp5,na.rm=TRUE)
 [1] 7919.87871   99.42109   50.31935         NA  117.93875  100.66215
 [7]   41.22212   61.63425   56.49156  109.57674
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.993700  9.971012  7.093614        NA 10.859961 10.033053  6.420446
 [8]  7.850748  7.516086 10.467891
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.83756  89.03236  90.41159        NA  91.46194  89.76328  82.08674
 [8]  85.70907  79.09608  94.68055
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.30491 55.42929 61.78868       NA 54.86587 56.78011 58.40987 53.94377
 [9] 54.78840 55.23638
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.74661  72.77342  72.67997  71.66167  72.27604       NaN  72.15207
 [8]  68.74697  72.15916  71.46440  63.71979  73.21780  68.82659  71.08994
[15]  71.73481  67.04251  74.15988  72.71761  72.52543  69.88489
> colSums(tmp5,na.rm=TRUE)
 [1] 1050.7195  654.9607  654.1198  644.9550  650.4843    0.0000  649.3686
 [8]  618.7227  649.4324  643.1796  573.4781  658.9602  619.4394  639.8094
[15]  645.6133  603.3826  667.4389  654.4585  652.7288  628.9640
> colVars(tmp5,na.rm=TRUE)
 [1] 17225.19374    74.17942    91.09709    76.33507   135.86278          NA
 [7]   120.65159    58.82062    35.26208   101.16783    61.83868    78.99031
[13]   120.54623    89.43071    36.18379    64.53569    32.49786    54.16504
[19]    12.92252   153.17841
> colSd(tmp5,na.rm=TRUE)
 [1] 131.244786   8.612748   9.544480   8.736994  11.656019         NA
 [7]  10.984152   7.669460   5.938188  10.058222   7.863757   8.887649
[13]  10.979355   9.456781   6.015296   8.033411   5.700690   7.359690
[19]   3.594791  12.376527
> colMax(tmp5,na.rm=TRUE)
 [1] 465.83756  89.76328  94.68055  81.76531  89.03236      -Inf  84.23032
 [8]  79.78743  81.00167  85.24873  78.66483  90.41159  82.36628  91.46194
[15]  79.97906  81.56857  80.97847  82.63430  77.32370  92.63272
> colMin(tmp5,na.rm=TRUE)
 [1] 57.10199 61.78868 61.61123 61.34570 54.78840      Inf 55.23638 56.78011
 [9] 64.83660 55.42929 55.30265 60.68537 53.94377 59.74930 62.62137 58.40987
[17] 62.97142 62.86896 67.92417 56.32177
> 
> 
> 
> 
> 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] 140.5966 276.9639 264.2940 232.8761 357.6685 212.0904 280.6736 178.7928
 [9] 228.6419 268.3343
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 140.5966 276.9639 264.2940 232.8761 357.6685 212.0904 280.6736 178.7928
 [9] 228.6419 268.3343
> 
> 
> 
> 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] -2.842171e-14 -1.136868e-13 -2.273737e-13  0.000000e+00  0.000000e+00
 [6] -5.684342e-14  1.421085e-14 -1.705303e-13  1.136868e-13  2.842171e-14
[11] -2.842171e-14  0.000000e+00  4.263256e-14  1.136868e-13  5.684342e-14
[16] -1.136868e-13 -8.526513e-14  0.000000e+00 -2.842171e-14  7.105427e-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)
+ }
7   6 
9   12 
10   6 
7   3 
10   19 
10   18 
2   20 
9   12 
5   4 
7   20 
5   11 
4   14 
4   10 
6   7 
7   3 
8   8 
6   9 
10   11 
7   11 
1   10 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.11726
> Min(tmp)
[1] -2.537017
> mean(tmp)
[1] -0.1390517
> Sum(tmp)
[1] -13.90517
> Var(tmp)
[1] 0.9789614
> 
> rowMeans(tmp)
[1] -0.1390517
> rowSums(tmp)
[1] -13.90517
> rowVars(tmp)
[1] 0.9789614
> rowSd(tmp)
[1] 0.9894248
> rowMax(tmp)
[1] 2.11726
> rowMin(tmp)
[1] -2.537017
> 
> colMeans(tmp)
  [1]  1.21824699 -0.03808557 -0.43288164 -2.53701698 -1.23421629  0.02870939
  [7] -1.31309628  0.34530621 -0.83042004 -0.55324379 -0.38853175  1.80333848
 [13]  0.48360578  0.23969864 -0.53128802  0.64540818 -0.16315619 -1.20820039
 [19] -1.98979847  0.27827781 -0.91942305  1.13174668 -0.50379420  0.16717986
 [25]  0.29823815 -0.97002485 -0.67736856 -1.26404213  0.69084303  2.11726033
 [31] -1.50424019 -0.99272754 -0.91783777 -0.02395347  0.43538159  0.72481096
 [37] -1.31449359  0.41348879  1.37987472 -0.38583795 -0.43196580 -0.19473718
 [43]  1.97030021 -1.05836767  0.95428758 -0.46176082 -1.28760221 -0.49051749
 [49]  0.09176308 -0.49365447  1.63132970 -1.91714284 -1.78719929 -0.37036127
 [55]  1.55939448  1.27870631  0.94160588 -0.16475688 -1.95263961 -0.29384580
 [61]  0.10680511 -0.57092058  0.23904438  0.37194628 -1.25278644 -0.06226850
 [67]  0.34310740 -0.62675776 -0.29540355  1.19833196 -0.93664436  0.58895486
 [73]  0.82890663  0.54386042 -0.19465729 -0.92849351  0.66705501 -0.05649988
 [79]  0.80418810  0.77286691 -0.75215839  1.44260725 -0.30320066  0.89875124
 [85]  0.47414829  0.26991757 -0.83434839 -0.36969821 -0.77769482 -0.12563918
 [91] -2.08125179 -0.67407216 -1.77542241  0.69659017 -1.27951411  1.60914909
 [97] -0.42885009  0.25921173 -1.61025060  0.68534355
> colSums(tmp)
  [1]  1.21824699 -0.03808557 -0.43288164 -2.53701698 -1.23421629  0.02870939
  [7] -1.31309628  0.34530621 -0.83042004 -0.55324379 -0.38853175  1.80333848
 [13]  0.48360578  0.23969864 -0.53128802  0.64540818 -0.16315619 -1.20820039
 [19] -1.98979847  0.27827781 -0.91942305  1.13174668 -0.50379420  0.16717986
 [25]  0.29823815 -0.97002485 -0.67736856 -1.26404213  0.69084303  2.11726033
 [31] -1.50424019 -0.99272754 -0.91783777 -0.02395347  0.43538159  0.72481096
 [37] -1.31449359  0.41348879  1.37987472 -0.38583795 -0.43196580 -0.19473718
 [43]  1.97030021 -1.05836767  0.95428758 -0.46176082 -1.28760221 -0.49051749
 [49]  0.09176308 -0.49365447  1.63132970 -1.91714284 -1.78719929 -0.37036127
 [55]  1.55939448  1.27870631  0.94160588 -0.16475688 -1.95263961 -0.29384580
 [61]  0.10680511 -0.57092058  0.23904438  0.37194628 -1.25278644 -0.06226850
 [67]  0.34310740 -0.62675776 -0.29540355  1.19833196 -0.93664436  0.58895486
 [73]  0.82890663  0.54386042 -0.19465729 -0.92849351  0.66705501 -0.05649988
 [79]  0.80418810  0.77286691 -0.75215839  1.44260725 -0.30320066  0.89875124
 [85]  0.47414829  0.26991757 -0.83434839 -0.36969821 -0.77769482 -0.12563918
 [91] -2.08125179 -0.67407216 -1.77542241  0.69659017 -1.27951411  1.60914909
 [97] -0.42885009  0.25921173 -1.61025060  0.68534355
> 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]  1.21824699 -0.03808557 -0.43288164 -2.53701698 -1.23421629  0.02870939
  [7] -1.31309628  0.34530621 -0.83042004 -0.55324379 -0.38853175  1.80333848
 [13]  0.48360578  0.23969864 -0.53128802  0.64540818 -0.16315619 -1.20820039
 [19] -1.98979847  0.27827781 -0.91942305  1.13174668 -0.50379420  0.16717986
 [25]  0.29823815 -0.97002485 -0.67736856 -1.26404213  0.69084303  2.11726033
 [31] -1.50424019 -0.99272754 -0.91783777 -0.02395347  0.43538159  0.72481096
 [37] -1.31449359  0.41348879  1.37987472 -0.38583795 -0.43196580 -0.19473718
 [43]  1.97030021 -1.05836767  0.95428758 -0.46176082 -1.28760221 -0.49051749
 [49]  0.09176308 -0.49365447  1.63132970 -1.91714284 -1.78719929 -0.37036127
 [55]  1.55939448  1.27870631  0.94160588 -0.16475688 -1.95263961 -0.29384580
 [61]  0.10680511 -0.57092058  0.23904438  0.37194628 -1.25278644 -0.06226850
 [67]  0.34310740 -0.62675776 -0.29540355  1.19833196 -0.93664436  0.58895486
 [73]  0.82890663  0.54386042 -0.19465729 -0.92849351  0.66705501 -0.05649988
 [79]  0.80418810  0.77286691 -0.75215839  1.44260725 -0.30320066  0.89875124
 [85]  0.47414829  0.26991757 -0.83434839 -0.36969821 -0.77769482 -0.12563918
 [91] -2.08125179 -0.67407216 -1.77542241  0.69659017 -1.27951411  1.60914909
 [97] -0.42885009  0.25921173 -1.61025060  0.68534355
> colMin(tmp)
  [1]  1.21824699 -0.03808557 -0.43288164 -2.53701698 -1.23421629  0.02870939
  [7] -1.31309628  0.34530621 -0.83042004 -0.55324379 -0.38853175  1.80333848
 [13]  0.48360578  0.23969864 -0.53128802  0.64540818 -0.16315619 -1.20820039
 [19] -1.98979847  0.27827781 -0.91942305  1.13174668 -0.50379420  0.16717986
 [25]  0.29823815 -0.97002485 -0.67736856 -1.26404213  0.69084303  2.11726033
 [31] -1.50424019 -0.99272754 -0.91783777 -0.02395347  0.43538159  0.72481096
 [37] -1.31449359  0.41348879  1.37987472 -0.38583795 -0.43196580 -0.19473718
 [43]  1.97030021 -1.05836767  0.95428758 -0.46176082 -1.28760221 -0.49051749
 [49]  0.09176308 -0.49365447  1.63132970 -1.91714284 -1.78719929 -0.37036127
 [55]  1.55939448  1.27870631  0.94160588 -0.16475688 -1.95263961 -0.29384580
 [61]  0.10680511 -0.57092058  0.23904438  0.37194628 -1.25278644 -0.06226850
 [67]  0.34310740 -0.62675776 -0.29540355  1.19833196 -0.93664436  0.58895486
 [73]  0.82890663  0.54386042 -0.19465729 -0.92849351  0.66705501 -0.05649988
 [79]  0.80418810  0.77286691 -0.75215839  1.44260725 -0.30320066  0.89875124
 [85]  0.47414829  0.26991757 -0.83434839 -0.36969821 -0.77769482 -0.12563918
 [91] -2.08125179 -0.67407216 -1.77542241  0.69659017 -1.27951411  1.60914909
 [97] -0.42885009  0.25921173 -1.61025060  0.68534355
> colMedians(tmp)
  [1]  1.21824699 -0.03808557 -0.43288164 -2.53701698 -1.23421629  0.02870939
  [7] -1.31309628  0.34530621 -0.83042004 -0.55324379 -0.38853175  1.80333848
 [13]  0.48360578  0.23969864 -0.53128802  0.64540818 -0.16315619 -1.20820039
 [19] -1.98979847  0.27827781 -0.91942305  1.13174668 -0.50379420  0.16717986
 [25]  0.29823815 -0.97002485 -0.67736856 -1.26404213  0.69084303  2.11726033
 [31] -1.50424019 -0.99272754 -0.91783777 -0.02395347  0.43538159  0.72481096
 [37] -1.31449359  0.41348879  1.37987472 -0.38583795 -0.43196580 -0.19473718
 [43]  1.97030021 -1.05836767  0.95428758 -0.46176082 -1.28760221 -0.49051749
 [49]  0.09176308 -0.49365447  1.63132970 -1.91714284 -1.78719929 -0.37036127
 [55]  1.55939448  1.27870631  0.94160588 -0.16475688 -1.95263961 -0.29384580
 [61]  0.10680511 -0.57092058  0.23904438  0.37194628 -1.25278644 -0.06226850
 [67]  0.34310740 -0.62675776 -0.29540355  1.19833196 -0.93664436  0.58895486
 [73]  0.82890663  0.54386042 -0.19465729 -0.92849351  0.66705501 -0.05649988
 [79]  0.80418810  0.77286691 -0.75215839  1.44260725 -0.30320066  0.89875124
 [85]  0.47414829  0.26991757 -0.83434839 -0.36969821 -0.77769482 -0.12563918
 [91] -2.08125179 -0.67407216 -1.77542241  0.69659017 -1.27951411  1.60914909
 [97] -0.42885009  0.25921173 -1.61025060  0.68534355
> colRanges(tmp)
         [,1]        [,2]       [,3]      [,4]      [,5]       [,6]      [,7]
[1,] 1.218247 -0.03808557 -0.4328816 -2.537017 -1.234216 0.02870939 -1.313096
[2,] 1.218247 -0.03808557 -0.4328816 -2.537017 -1.234216 0.02870939 -1.313096
          [,8]     [,9]      [,10]      [,11]    [,12]     [,13]     [,14]
[1,] 0.3453062 -0.83042 -0.5532438 -0.3885318 1.803338 0.4836058 0.2396986
[2,] 0.3453062 -0.83042 -0.5532438 -0.3885318 1.803338 0.4836058 0.2396986
         [,15]     [,16]      [,17]   [,18]     [,19]     [,20]      [,21]
[1,] -0.531288 0.6454082 -0.1631562 -1.2082 -1.989798 0.2782778 -0.9194231
[2,] -0.531288 0.6454082 -0.1631562 -1.2082 -1.989798 0.2782778 -0.9194231
        [,22]      [,23]     [,24]     [,25]      [,26]      [,27]     [,28]
[1,] 1.131747 -0.5037942 0.1671799 0.2982381 -0.9700248 -0.6773686 -1.264042
[2,] 1.131747 -0.5037942 0.1671799 0.2982381 -0.9700248 -0.6773686 -1.264042
        [,29]   [,30]    [,31]      [,32]      [,33]       [,34]     [,35]
[1,] 0.690843 2.11726 -1.50424 -0.9927275 -0.9178378 -0.02395347 0.4353816
[2,] 0.690843 2.11726 -1.50424 -0.9927275 -0.9178378 -0.02395347 0.4353816
        [,36]     [,37]     [,38]    [,39]     [,40]      [,41]      [,42]
[1,] 0.724811 -1.314494 0.4134888 1.379875 -0.385838 -0.4319658 -0.1947372
[2,] 0.724811 -1.314494 0.4134888 1.379875 -0.385838 -0.4319658 -0.1947372
      [,43]     [,44]     [,45]      [,46]     [,47]      [,48]      [,49]
[1,] 1.9703 -1.058368 0.9542876 -0.4617608 -1.287602 -0.4905175 0.09176308
[2,] 1.9703 -1.058368 0.9542876 -0.4617608 -1.287602 -0.4905175 0.09176308
          [,50]   [,51]     [,52]     [,53]      [,54]    [,55]    [,56]
[1,] -0.4936545 1.63133 -1.917143 -1.787199 -0.3703613 1.559394 1.278706
[2,] -0.4936545 1.63133 -1.917143 -1.787199 -0.3703613 1.559394 1.278706
         [,57]      [,58]    [,59]      [,60]     [,61]      [,62]     [,63]
[1,] 0.9416059 -0.1647569 -1.95264 -0.2938458 0.1068051 -0.5709206 0.2390444
[2,] 0.9416059 -0.1647569 -1.95264 -0.2938458 0.1068051 -0.5709206 0.2390444
         [,64]     [,65]      [,66]     [,67]      [,68]      [,69]    [,70]
[1,] 0.3719463 -1.252786 -0.0622685 0.3431074 -0.6267578 -0.2954035 1.198332
[2,] 0.3719463 -1.252786 -0.0622685 0.3431074 -0.6267578 -0.2954035 1.198332
          [,71]     [,72]     [,73]     [,74]      [,75]      [,76]    [,77]
[1,] -0.9366444 0.5889549 0.8289066 0.5438604 -0.1946573 -0.9284935 0.667055
[2,] -0.9366444 0.5889549 0.8289066 0.5438604 -0.1946573 -0.9284935 0.667055
           [,78]     [,79]     [,80]      [,81]    [,82]      [,83]     [,84]
[1,] -0.05649988 0.8041881 0.7728669 -0.7521584 1.442607 -0.3032007 0.8987512
[2,] -0.05649988 0.8041881 0.7728669 -0.7521584 1.442607 -0.3032007 0.8987512
         [,85]     [,86]      [,87]      [,88]      [,89]      [,90]     [,91]
[1,] 0.4741483 0.2699176 -0.8343484 -0.3696982 -0.7776948 -0.1256392 -2.081252
[2,] 0.4741483 0.2699176 -0.8343484 -0.3696982 -0.7776948 -0.1256392 -2.081252
          [,92]     [,93]     [,94]     [,95]    [,96]      [,97]     [,98]
[1,] -0.6740722 -1.775422 0.6965902 -1.279514 1.609149 -0.4288501 0.2592117
[2,] -0.6740722 -1.775422 0.6965902 -1.279514 1.609149 -0.4288501 0.2592117
         [,99]    [,100]
[1,] -1.610251 0.6853436
[2,] -1.610251 0.6853436
> 
> 
> Max(tmp2)
[1] 2.213965
> Min(tmp2)
[1] -2.764388
> mean(tmp2)
[1] 0.03008202
> Sum(tmp2)
[1] 3.008202
> Var(tmp2)
[1] 0.917878
> 
> rowMeans(tmp2)
  [1]  0.07399179  0.51057297  0.13068284 -0.02054116  0.56280693  1.52352403
  [7] -0.18281734  2.02269039  0.44046588  0.36835618 -0.29144755  1.66570540
 [13]  0.91311931  0.42419083 -0.25473451 -0.68395895  0.35534212  0.23564934
 [19] -0.42438367  0.11258384 -1.57827761  1.57866143  1.68267707  0.45906931
 [25]  0.02523859  1.33666360 -0.43098031 -1.39452753 -0.38571876 -0.01922740
 [31] -0.71828948  0.95929558  0.08874924  0.74865654 -0.20433037 -1.82769078
 [37]  1.25976357  0.79347833 -0.34648894 -0.73786590  1.12408722 -0.42892414
 [43] -0.86128337  0.19448716 -0.39107555 -0.25143180 -0.62182214 -0.15098722
 [49] -0.99803146 -0.70025461  0.19235814  0.35145896  0.60284279  0.46534742
 [55] -1.65101347 -0.61950451  0.46997925  1.49329261  1.51946056  0.21060563
 [61] -0.40232325 -2.27162213  2.21396536 -2.32010353  0.23961380  0.28338481
 [67]  1.07963640 -0.61433661  0.28290937 -0.09734051  0.05661366  1.02776199
 [73] -1.50152008 -2.76438783 -0.20104377 -1.67448712 -0.18867188  0.45700715
 [79] -1.21706172  0.06610607 -0.65772442  0.52523673  0.40698067  0.89732387
 [85] -0.06228578  0.86037537  1.04485279  0.50612588 -0.91069218 -0.21933491
 [91]  1.06906936  0.94386485 -0.96870015 -0.51310183 -0.07208393  0.69385755
 [97]  0.37713218 -0.63759698 -1.85904988  0.40960584
> rowSums(tmp2)
  [1]  0.07399179  0.51057297  0.13068284 -0.02054116  0.56280693  1.52352403
  [7] -0.18281734  2.02269039  0.44046588  0.36835618 -0.29144755  1.66570540
 [13]  0.91311931  0.42419083 -0.25473451 -0.68395895  0.35534212  0.23564934
 [19] -0.42438367  0.11258384 -1.57827761  1.57866143  1.68267707  0.45906931
 [25]  0.02523859  1.33666360 -0.43098031 -1.39452753 -0.38571876 -0.01922740
 [31] -0.71828948  0.95929558  0.08874924  0.74865654 -0.20433037 -1.82769078
 [37]  1.25976357  0.79347833 -0.34648894 -0.73786590  1.12408722 -0.42892414
 [43] -0.86128337  0.19448716 -0.39107555 -0.25143180 -0.62182214 -0.15098722
 [49] -0.99803146 -0.70025461  0.19235814  0.35145896  0.60284279  0.46534742
 [55] -1.65101347 -0.61950451  0.46997925  1.49329261  1.51946056  0.21060563
 [61] -0.40232325 -2.27162213  2.21396536 -2.32010353  0.23961380  0.28338481
 [67]  1.07963640 -0.61433661  0.28290937 -0.09734051  0.05661366  1.02776199
 [73] -1.50152008 -2.76438783 -0.20104377 -1.67448712 -0.18867188  0.45700715
 [79] -1.21706172  0.06610607 -0.65772442  0.52523673  0.40698067  0.89732387
 [85] -0.06228578  0.86037537  1.04485279  0.50612588 -0.91069218 -0.21933491
 [91]  1.06906936  0.94386485 -0.96870015 -0.51310183 -0.07208393  0.69385755
 [97]  0.37713218 -0.63759698 -1.85904988  0.40960584
> 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.07399179  0.51057297  0.13068284 -0.02054116  0.56280693  1.52352403
  [7] -0.18281734  2.02269039  0.44046588  0.36835618 -0.29144755  1.66570540
 [13]  0.91311931  0.42419083 -0.25473451 -0.68395895  0.35534212  0.23564934
 [19] -0.42438367  0.11258384 -1.57827761  1.57866143  1.68267707  0.45906931
 [25]  0.02523859  1.33666360 -0.43098031 -1.39452753 -0.38571876 -0.01922740
 [31] -0.71828948  0.95929558  0.08874924  0.74865654 -0.20433037 -1.82769078
 [37]  1.25976357  0.79347833 -0.34648894 -0.73786590  1.12408722 -0.42892414
 [43] -0.86128337  0.19448716 -0.39107555 -0.25143180 -0.62182214 -0.15098722
 [49] -0.99803146 -0.70025461  0.19235814  0.35145896  0.60284279  0.46534742
 [55] -1.65101347 -0.61950451  0.46997925  1.49329261  1.51946056  0.21060563
 [61] -0.40232325 -2.27162213  2.21396536 -2.32010353  0.23961380  0.28338481
 [67]  1.07963640 -0.61433661  0.28290937 -0.09734051  0.05661366  1.02776199
 [73] -1.50152008 -2.76438783 -0.20104377 -1.67448712 -0.18867188  0.45700715
 [79] -1.21706172  0.06610607 -0.65772442  0.52523673  0.40698067  0.89732387
 [85] -0.06228578  0.86037537  1.04485279  0.50612588 -0.91069218 -0.21933491
 [91]  1.06906936  0.94386485 -0.96870015 -0.51310183 -0.07208393  0.69385755
 [97]  0.37713218 -0.63759698 -1.85904988  0.40960584
> rowMin(tmp2)
  [1]  0.07399179  0.51057297  0.13068284 -0.02054116  0.56280693  1.52352403
  [7] -0.18281734  2.02269039  0.44046588  0.36835618 -0.29144755  1.66570540
 [13]  0.91311931  0.42419083 -0.25473451 -0.68395895  0.35534212  0.23564934
 [19] -0.42438367  0.11258384 -1.57827761  1.57866143  1.68267707  0.45906931
 [25]  0.02523859  1.33666360 -0.43098031 -1.39452753 -0.38571876 -0.01922740
 [31] -0.71828948  0.95929558  0.08874924  0.74865654 -0.20433037 -1.82769078
 [37]  1.25976357  0.79347833 -0.34648894 -0.73786590  1.12408722 -0.42892414
 [43] -0.86128337  0.19448716 -0.39107555 -0.25143180 -0.62182214 -0.15098722
 [49] -0.99803146 -0.70025461  0.19235814  0.35145896  0.60284279  0.46534742
 [55] -1.65101347 -0.61950451  0.46997925  1.49329261  1.51946056  0.21060563
 [61] -0.40232325 -2.27162213  2.21396536 -2.32010353  0.23961380  0.28338481
 [67]  1.07963640 -0.61433661  0.28290937 -0.09734051  0.05661366  1.02776199
 [73] -1.50152008 -2.76438783 -0.20104377 -1.67448712 -0.18867188  0.45700715
 [79] -1.21706172  0.06610607 -0.65772442  0.52523673  0.40698067  0.89732387
 [85] -0.06228578  0.86037537  1.04485279  0.50612588 -0.91069218 -0.21933491
 [91]  1.06906936  0.94386485 -0.96870015 -0.51310183 -0.07208393  0.69385755
 [97]  0.37713218 -0.63759698 -1.85904988  0.40960584
> 
> colMeans(tmp2)
[1] 0.03008202
> colSums(tmp2)
[1] 3.008202
> colVars(tmp2)
[1] 0.917878
> colSd(tmp2)
[1] 0.9580595
> colMax(tmp2)
[1] 2.213965
> colMin(tmp2)
[1] -2.764388
> colMedians(tmp2)
[1] 0.08137051
> colRanges(tmp2)
          [,1]
[1,] -2.764388
[2,]  2.213965
> 
> 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] -5.515636  2.029454  3.445461  4.296857  2.595870  4.383454 -1.097726
 [8] -5.057536 -2.016501  1.715753
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.19917094
[2,] -0.87217007
[3,] -0.66794314
[4,] -0.09446276
[5,]  0.94595409
> 
> rowApply(tmp,sum)
 [1]  1.9983726  2.5444896 -1.0546627 -1.0164194  2.1929094 -5.6081024
 [7] -2.1474727  5.6204731  0.1311986  2.1186644
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    5    2    5    1    3    2    6    8     3
 [2,]    5    7    4   10    3    4   10    5    2     2
 [3,]    9    9    3    9    9   10    1   10    7     8
 [4,]    6    8   10    6    5    5    7    7    6     4
 [5,]   10    1    6    3    6    6    6    4    3     9
 [6,]    3    3    5    8    8    8    9    9    1    10
 [7,]    8    2    9    2    2    9    3    3    4     5
 [8,]    4    4    7    1    4    1    4    2    9     7
 [9,]    7    6    1    4   10    2    8    1    5     6
[10,]    2   10    8    7    7    7    5    8   10     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  5.27642341  0.64423163  1.81662451  0.84003415 -2.79297112 -0.02556821
 [7] -1.36250751  4.37345237  0.14672556  3.06096814 -0.01299772 -3.16101510
[13] -0.43759574 -1.82217930  1.97944786 -0.66805249  2.36331422 -2.57085582
[19] -0.85633135 -3.25417875
> colApply(tmp,quantile)[,1]
          [,1]
[1,] 0.2831857
[2,] 0.4781712
[3,] 1.2220983
[4,] 1.4226938
[5,] 1.8702744
> 
> rowApply(tmp,sum)
[1]  8.226585  1.290783 -7.478229 -5.053892  6.551721
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   16   19   17   13   18
[2,]   19    2    5   11   19
[3,]    8   20   14   15    3
[4,]   17    3    6   19   10
[5,]    7    6   13    1    8
> 
> 
> as.matrix(tmp)
          [,1]       [,2]        [,3]       [,4]        [,5]       [,6]
[1,] 1.2220983  1.6983202  0.23728233  1.2323185  0.18655536 -0.1532526
[2,] 1.8702744 -1.3945330  2.06492266 -0.9808119 -0.72008269  0.7161771
[3,] 0.4781712 -0.9550042 -0.01984464 -0.9516585 -0.07931132 -0.3050951
[4,] 0.2831857 -0.1969221  0.46104062  1.1471288 -2.34971695 -0.7686847
[5,] 1.4226938  1.4923708 -0.92677645  0.3930573  0.16958448  0.4852871
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -1.0937117  1.4406680  1.1591100  1.9910598  0.7270104 -1.5766006
[2,] -0.2616150  0.6265946 -1.7017196  0.6893268 -0.9428709 -0.8490446
[3,]  0.5243770  0.3241810 -0.6421990  1.0560382 -1.9910125 -0.4525684
[4,] -0.8143890 -0.5898098  0.8356777 -1.5070641  1.5503788 -1.0624187
[5,]  0.2828312  2.5718187  0.4958565  0.8316075  0.6434965  0.7796172
          [,13]      [,14]      [,15]       [,16]     [,17]      [,18]
[1,]  0.5410215  0.9080068 -0.2361601  0.42470890 0.6125116  0.3873116
[2,]  0.3275674 -0.3377630  1.5494405  0.42062714 1.1034229  0.2764507
[3,] -0.5669887 -1.7041277  1.2288371 -1.48276348 0.2265230 -0.7644692
[4,] -1.2102328 -0.2537477  0.4732102 -0.01239590 0.3484456 -1.9796729
[5,]  0.4710368 -0.4345477 -1.0358797 -0.01822915 0.0724111 -0.4904760
          [,19]      [,20]
[1,] -0.6958621 -0.7858107
[2,] -0.6241450 -0.5414349
[3,] -1.0348595 -0.3664543
[4,]  1.0617112 -0.4696159
[5,]  0.4368241 -1.0908630
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1      col2      col3     col4      col5     col6       col7
row1 0.03319647 0.2204145 0.3814751 1.204008 0.3128905 0.209444 -0.2051207
           col8       col9    col10     col11     col12     col13      col14
row1 -0.8784667 -0.3988287 1.137178 -0.588068 0.2507867 -1.047566 -0.7962906
        col15     col16     col17    col18    col19      col20
row1 1.868071 0.4109912 -1.538502 1.796754 1.258647 -0.2709407
> tmp[,"col10"]
          col10
row1  1.1371775
row2  0.2479280
row3  1.4510930
row4 -0.2924615
row5  0.6703627
> tmp[c("row1","row5"),]
           col1      col2      col3       col4      col5     col6       col7
row1 0.03319647 0.2204145 0.3814751  1.2040081 0.3128905 0.209444 -0.2051207
row5 1.02314147 0.1811596 1.4252462 -0.3371317 0.2159131 0.689030  2.4363393
           col8       col9     col10      col11     col12      col13      col14
row1 -0.8784667 -0.3988287 1.1371775 -0.5880680 0.2507867 -1.0475656 -0.7962906
row5 -0.2147631  1.4739363 0.6703627 -0.4017542 0.9772095 -0.4315068 -1.3467106
        col15      col16     col17     col18    col19      col20
row1 1.868071  0.4109912 -1.538502  1.796754 1.258647 -0.2709407
row5 1.003525 -0.5711859  1.514960 -1.040821 2.017229  0.9460007
> tmp[,c("col6","col20")]
           col6      col20
row1  0.2094440 -0.2709407
row2  0.9571521 -0.1056699
row3 -2.5195381 -1.4218508
row4 -2.0216493 -0.9379884
row5  0.6890300  0.9460007
> tmp[c("row1","row5"),c("col6","col20")]
         col6      col20
row1 0.209444 -0.2709407
row5 0.689030  0.9460007
> 
> 
> 
> 
> 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.79141 49.31912 49.97835 49.96089 49.34089 105.6703 50.19377 50.4829
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.15979 47.95423 48.81867 49.31683 50.33754 47.40864 51.04643 49.27531
        col17    col18    col19    col20
row1 50.31596 48.32672 49.93805 105.1146
> tmp[,"col10"]
        col10
row1 47.95423
row2 32.13697
row3 28.85684
row4 31.00306
row5 50.26666
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.79141 49.31912 49.97835 49.96089 49.34089 105.6703 50.19377 50.48290
row5 48.41631 51.33733 49.64526 50.38024 51.22891 104.6411 50.03477 52.43643
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.15979 47.95423 48.81867 49.31683 50.33754 47.40864 51.04643 49.27531
row5 51.83621 50.26666 48.66453 50.24252 49.69560 50.06161 48.25186 50.36180
        col17    col18    col19    col20
row1 50.31596 48.32672 49.93805 105.1146
row5 50.43054 50.30805 49.06671 107.0839
> tmp[,c("col6","col20")]
          col6     col20
row1 105.67034 105.11458
row2  75.24601  74.21500
row3  74.45647  73.20680
row4  75.31134  74.48997
row5 104.64106 107.08385
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.6703 105.1146
row5 104.6411 107.0839
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.6703 105.1146
row5 104.6411 107.0839
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.3948211
[2,] -0.1406370
[3,] -1.3608895
[4,]  0.7416837
[5,]  0.2869800
> tmp[,c("col17","col7")]
           col17       col7
[1,] -0.89324401 -1.1924299
[2,]  0.12414265 -0.2370256
[3,]  0.04471943 -0.4223647
[4,] -0.85558933 -0.5007229
[5,] -0.15566800  1.0520000
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,] -1.2964619 -1.01322652
[2,] -0.4419108 -0.05768143
[3,] -1.2888593 -1.97089472
[4,]  3.9125946  1.05952183
[5,] -1.4672629 -1.55443400
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -1.296462
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -1.2964619
[2,] -0.4419108
> 
> 
> 
> 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.3296696 -0.6528428 -1.1436317 -0.008538992 -1.1808454  0.9354066
row1 -0.2868078 -1.3055446  0.0544434  0.890608315 -0.4884151 -1.5478729
          [,7]       [,8]       [,9]     [,10]     [,11]      [,12]      [,13]
row3  1.145111  1.6245015  0.4005559 0.7556419 0.1050430 -1.6265957  1.2665340
row1 -1.137795 -0.2450891 -0.2115491 0.8042087 0.6295545 -0.6539882 -0.1942415
        [,14]    [,15]      [,16]      [,17]      [,18]      [,19]     [,20]
row3 1.511471 0.116744 -1.5115477 -0.4669604 -0.5668274 -0.6767815  1.301691
row1 1.732987 1.656730  0.7439143 -0.6384071 -1.3463832  0.3459678 -1.204235
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
row2 -1.478733 2.308771 0.1946739 0.2272829 0.5949617 0.2601708 0.1701366
          [,8]      [,9]     [,10]
row2 -2.037549 0.6384802 0.2797291
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]       [,2]      [,3]     [,4]      [,5]       [,6]     [,7]
row5 1.221626 -0.9768914 0.0841396 1.538699 0.6416319 -0.1294674 1.173831
          [,8]       [,9]      [,10]   [,11]     [,12]     [,13]     [,14]
row5 -1.162799 -0.8973627 -0.2258862 1.35606 0.0285823 0.6088504 -1.460232
          [,15]      [,16]    [,17]     [,18]     [,19]     [,20]
row5 0.04260224 0.04145353 1.438377 0.4644996 0.9549115 -1.091783
> 
> 
> 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: 0x620fcd4d6f10>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a99a97982c" 
 [2] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a9970ebc842"
 [3] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a9956969d30"
 [4] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a9944f42221"
 [5] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a9953369ca6"
 [6] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a997dac61d" 
 [7] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a991ea299de"
 [8] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a995889d885"
 [9] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a9933ae3f45"
[10] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a9939a64f1e"
[11] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a99257b5f44"
[12] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a99781cca24"
[13] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a99651b1522"
[14] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a992728cdd2"
[15] "/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM299a993433a9ad"
> 
> 
> ### 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: 0x620fcd8d0110>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x620fcd8d0110>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x620fcd8d0110>
> rowMedians(tmp)
  [1] -0.291247376 -0.349120994  0.110919905  0.231059456 -0.058643553
  [6] -0.285001104 -0.101781019 -0.014628744 -0.113213482  0.013866655
 [11]  0.196192122  0.028979515  0.156163266 -0.054121886 -0.142656561
 [16] -0.032582982  0.720344010  0.101453843 -0.433019759  0.177660263
 [21] -0.028834248  0.007270743 -0.256034769 -0.205173798  0.030383177
 [26] -0.382183415  0.620374634  0.025976876 -0.012602545 -0.456130462
 [31] -0.487620657  0.705744648  0.085867154 -0.074170185  0.145959164
 [36]  0.130856064  0.544150135  0.193103135 -0.347260882 -0.660875316
 [41]  0.617226414  0.361362522  0.259211227 -0.430833486  0.167012906
 [46] -0.021218153  0.576583864 -0.310034046 -0.609820267 -0.010310528
 [51] -0.020809170  0.155449370  0.435529922 -0.379520612  0.077207650
 [56]  0.067571949  0.206296085 -0.749912150  0.213046341  0.054866048
 [61] -0.466273726 -0.477046194  0.435340319 -0.148522237  0.249990160
 [66] -0.934587086 -0.109831008  0.251872594 -0.455071877 -0.029641084
 [71]  0.220791260 -0.061093832  0.108947081 -0.130714642 -0.187353872
 [76]  0.018713238  0.052275972 -0.388429137  0.237850907  0.367302203
 [81]  0.065112122 -0.172195186 -0.147750581  0.482448200  0.138135300
 [86] -0.137864468 -0.437672527 -0.355383037 -0.414762864 -0.235148385
 [91]  0.225979454 -0.274555334  0.268900189 -0.127698360  0.486527072
 [96]  0.158756763 -0.036816464 -0.120748800  0.058061213 -0.035992237
[101]  0.075691795 -0.113177993 -0.204299946  0.505306605  0.096199400
[106]  0.333777883  0.127186381  0.461589468 -0.337005715  0.484209455
[111]  0.192339540 -0.582250830 -0.115185740  0.033425389  0.276697691
[116] -0.406212928  0.216705764 -0.025310650  0.226303109 -0.083149589
[121]  0.388068223  0.067844620  0.269472777  0.542643565  0.258375260
[126]  0.251326876  0.445324888 -0.054245416 -0.102717510  0.324499007
[131] -0.597700907 -0.389693027 -0.509166237  0.288142177 -0.210770304
[136] -0.275243825  0.442181103 -0.332224435 -0.313279352 -0.243879496
[141]  0.239449946  0.502610536  0.666776308 -0.076605562 -0.278687629
[146]  0.458600005 -0.356237117 -0.126657148  0.612895237  0.060250104
[151] -0.067316245 -0.079401920  0.221896729 -0.188938699 -0.131398780
[156] -0.034943272  0.189591112 -0.012044018  0.275455423 -0.360858306
[161]  0.141679328 -0.355098943 -0.159084703 -0.508197565  0.193894767
[166]  0.044997205  0.394603521 -0.308805571  0.027250392 -0.117736793
[171] -0.153129163 -0.199986319 -0.139751573 -0.275663522  0.405497717
[176]  0.223102186 -0.065489390 -0.077123951  0.575813198  0.156282316
[181] -0.035265489 -0.026888276  0.215433108 -0.098986377 -0.081857020
[186]  0.281170207  0.523792932 -0.221953439 -0.360348957  0.234577790
[191]  0.090781333 -0.010689672 -0.063464340 -0.376936566 -0.120487098
[196]  0.037906715  0.232489661 -0.324518760  0.106793960  0.055055336
[201] -0.430861436  0.008367661  0.106749743 -0.185064869  0.127280182
[206]  0.005858675  0.076785671  0.118440351 -0.107047400 -0.071411407
[211]  0.010571483 -0.221641256 -0.337899925  0.411533062  0.156307053
[216] -0.132628660 -0.347338563  0.486173007 -0.025247321 -0.246236945
[221]  0.378653301 -0.207264639  0.479527026  0.711703716  0.357721818
[226]  0.137077700  0.056873563 -0.439336002  0.501943105 -0.158233860
> 
> proc.time()
   user  system elapsed 
  1.380   1.478   2.852 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x62e22c6e2b20>
> .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: 0x62e22c6e2b20>
> .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: 0x62e22c6e2b20>
> .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: 0x62e22c6e2b20>
> 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: 0x62e22c6c3410>
> .Call("R_bm_AddColumn",P)
<pointer: 0x62e22c6c3410>
> .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: 0x62e22c6c3410>
> .Call("R_bm_AddColumn",P)
<pointer: 0x62e22c6c3410>
> .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: 0x62e22c6c3410>
> 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: 0x62e22af707a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x62e22af707a0>
> .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: 0x62e22af707a0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x62e22af707a0>
> .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: 0x62e22af707a0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x62e22af707a0>
> .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: 0x62e22af707a0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x62e22af707a0>
> .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: 0x62e22af707a0>
> 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: 0x62e22bf42680>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x62e22bf42680>
> .Call("R_bm_AddColumn",P)
<pointer: 0x62e22bf42680>
> .Call("R_bm_AddColumn",P)
<pointer: 0x62e22bf42680>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile299ba948a11542" "BufferedMatrixFile299ba976c5551f"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile299ba948a11542" "BufferedMatrixFile299ba976c5551f"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x62e22bcd6490>
> .Call("R_bm_AddColumn",P)
<pointer: 0x62e22bcd6490>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x62e22bcd6490>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x62e22bcd6490>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x62e22bcd6490>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x62e22bcd6490>
> .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: 0x62e22d332110>
> .Call("R_bm_AddColumn",P)
<pointer: 0x62e22d332110>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x62e22d332110>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x62e22d332110>
> 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: 0x62e22d3d55e0>
> .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: 0x62e22d3d55e0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.241   0.054   0.280 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.226   0.062   0.275 

Example timings