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

This page was generated on 2025-11-13 11:32 -0500 (Thu, 13 Nov 2025).

HostnameOSArch (*)R versionInstalled pkgs
kjohnson3macOS 13.7.7 Venturaarm64R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences" 4013
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/2325HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.75.0  (landing page)
Ben Bolstad
Snapshot Date: 2025-11-12 13:40 -0500 (Wed, 12 Nov 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 -0500 (Wed, 29 Oct 2025)
kjohnson3macOS 13.7.7 Ventura / arm64  OK    OK    WARNINGS    OK  YES


CHECK results for BufferedMatrix on kjohnson3

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: /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings BufferedMatrix_1.75.0.tar.gz
StartedAt: 2025-11-12 18:09:56 -0500 (Wed, 12 Nov 2025)
EndedAt: 2025-11-12 18:10:16 -0500 (Wed, 12 Nov 2025)
EllapsedTime: 19.3 seconds
RetCode: 0
Status:   WARNINGS  
CheckDir: BufferedMatrix.Rcheck
Warnings: 1

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings BufferedMatrix_1.75.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2025-11-04 r88984)
* using platform: aarch64-apple-darwin20
* R was compiled by
    Apple clang version 16.0.0 (clang-1600.0.26.6)
    GNU Fortran (GCC) 14.2.0
* running under: macOS Ventura 13.7.8
* using session charset: UTF-8
* using option ‘--no-vignettes’
* 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 ... WARNING
Found the following significant warnings:
  doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
See ‘/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/00install.out’ for details.
* used C compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
* used SDK: ‘MacOSX11.3.1.sdk’
* 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 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’ ... OK
* 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 running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

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


Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/Library/Frameworks/R.framework/Versions/4.6-arm64/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.75.0’
** using staged installation
** libs
using C compiler: ‘Apple clang version 15.0.0 (clang-1500.1.0.2.5)’
using SDK: ‘MacOSX11.3.1.sdk’
clang -arch arm64 -std=gnu2x -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -arch arm64 -std=gnu2x -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ~
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -arch arm64 -std=gnu2x -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -arch arm64 -std=gnu2x -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c init_package.c -o init_package.o
clang -arch arm64 -std=gnu2x -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R
installing to /Library/Frameworks/R.framework/Versions/4.6-arm64/Resources/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-11-04 r88984) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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.125   0.049   0.175 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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] "/Users/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) limit (Mb) max used (Mb)
Ncells 481248 25.8    1058085 56.6         NA   633817 33.9
Vcells 891449  6.9    8388608 64.0     196608  2110969 16.2
> 
> 
> 
> 
> ##
> ## 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] "Wed Nov 12 18:10:06 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] "Wed Nov 12 18:10:06 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: 0x600000f0c120>
> 
> 
> 
> 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] "Wed Nov 12 18:10:08 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] "Wed Nov 12 18:10:09 2025"
> 
> ColMode(tmp2)
<pointer: 0x600000f0c120>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]       [,3]        [,4]
[1,] 100.4937346 -0.9403866 -0.1917917 -0.09641765
[2,]  -0.2410684 -0.1119747  0.5816657 -0.62278272
[3,]   1.6013982 -0.5840941 -0.0156508  0.27551486
[4,]  -1.6414175 -0.5696074 -1.2020233  0.43262263
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/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,] 100.4937346 0.9403866 0.1917917 0.09641765
[2,]   0.2410684 0.1119747 0.5816657 0.62278272
[3,]   1.6013982 0.5840941 0.0156508 0.27551486
[4,]   1.6414175 0.5696074 1.2020233 0.43262263
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/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,] 10.0246563 0.9697353 0.4379403 0.3105119
[2,]  0.4909871 0.3346262 0.7626701 0.7891658
[3,]  1.2654636 0.7642605 0.1251032 0.5248951
[4,]  1.2811782 0.7547234 1.0963682 0.6577405
> 
> 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:    /Users/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,] 225.74030 35.63774 29.57119 28.20154
[2,]  30.15094 28.45824 33.20837 33.51444
[3,]  39.25603 33.22670 26.26668 30.52447
[4,]  39.45320 33.11684 37.16571 32.01003
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x600000f24000>
> exp(tmp5)
<pointer: 0x600000f24000>
> log(tmp5,2)
<pointer: 0x600000f24000>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.8489
> Min(tmp5)
[1] 54.67066
> mean(tmp5)
[1] 72.65978
> Sum(tmp5)
[1] 14531.96
> Var(tmp5)
[1] 860.1476
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.13400 70.04618 70.66556 72.68630 69.53042 73.85371 70.83405 67.56998
 [9] 69.75391 71.52367
> rowSums(tmp5)
 [1] 1802.680 1400.924 1413.311 1453.726 1390.608 1477.074 1416.681 1351.400
 [9] 1395.078 1430.473
> rowVars(tmp5)
 [1] 8064.35265   59.35016   56.00860   42.07955   86.36541   69.12270
 [7]   76.99060   28.32572   75.51475   65.17330
> rowSd(tmp5)
 [1] 89.801741  7.703905  7.483889  6.486875  9.293299  8.314006  8.774428
 [8]  5.322192  8.689922  8.072998
> rowMax(tmp5)
 [1] 469.84885  87.65470  82.22118  82.11666  87.02375  90.38039  86.25273
 [8]  81.81506  85.67822  88.44465
> rowMin(tmp5)
 [1] 55.89462 57.47624 54.67066 60.07550 55.14355 60.89433 58.11473 57.41458
 [9] 55.11693 55.15343
> 
> colMeans(tmp5)
 [1] 113.84246  68.62596  67.58667  71.13400  70.59651  74.20714  69.67477
 [8]  70.65997  67.63754  71.17028  72.27947  74.09173  71.19183  71.15704
[15]  66.58670  71.78737  68.44746  67.62183  74.81939  70.07744
> colSums(tmp5)
 [1] 1138.4246  686.2596  675.8667  711.3400  705.9651  742.0714  696.7477
 [8]  706.5997  676.3754  711.7028  722.7947  740.9173  711.9183  711.5704
[15]  665.8670  717.8737  684.4746  676.2183  748.1939  700.7744
> colVars(tmp5)
 [1] 15715.27846    56.56791   102.97766   101.82687    34.43113    76.80948
 [7]    31.83788    86.61589    42.26228    43.90288    73.09788    19.52045
[13]   110.31259    81.54138    70.52755    74.23836    28.17269    43.95156
[19]    69.52832    59.79620
> colSd(tmp5)
 [1] 125.360594   7.521164  10.147791  10.090930   5.867805   8.764102
 [7]   5.642506   9.306766   6.500945   6.625925   8.549730   4.418196
[13]  10.502980   9.030026   8.398068   8.616168   5.307796   6.629597
[19]   8.338364   7.732800
> colMax(tmp5)
 [1] 469.84885  85.84377  87.82098  86.25273  77.04126  85.67822  74.94728
 [8]  87.02375  80.11984  81.35787  82.91201  82.05015  88.44465  84.40310
[15]  80.96711  83.32325  78.36650  76.37809  87.65470  80.06281
> colMin(tmp5)
 [1] 62.75523 59.23209 54.67066 58.69780 60.07550 61.99032 57.88680 58.11473
 [9] 60.89433 61.72417 58.34872 67.89201 55.14355 55.15343 55.11693 58.97124
[17] 57.41458 55.89462 62.92957 56.12108
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 90.13400 70.04618 70.66556 72.68630 69.53042 73.85371       NA 67.56998
 [9] 69.75391 71.52367
> rowSums(tmp5)
 [1] 1802.680 1400.924 1413.311 1453.726 1390.608 1477.074       NA 1351.400
 [9] 1395.078 1430.473
> rowVars(tmp5)
 [1] 8064.35265   59.35016   56.00860   42.07955   86.36541   69.12270
 [7]   78.39302   28.32572   75.51475   65.17330
> rowSd(tmp5)
 [1] 89.801741  7.703905  7.483889  6.486875  9.293299  8.314006  8.853983
 [8]  5.322192  8.689922  8.072998
> rowMax(tmp5)
 [1] 469.84885  87.65470  82.22118  82.11666  87.02375  90.38039        NA
 [8]  81.81506  85.67822  88.44465
> rowMin(tmp5)
 [1] 55.89462 57.47624 54.67066 60.07550 55.14355 60.89433       NA 57.41458
 [9] 55.11693 55.15343
> 
> colMeans(tmp5)
 [1] 113.84246  68.62596  67.58667  71.13400  70.59651  74.20714  69.67477
 [8]  70.65997  67.63754  71.17028  72.27947  74.09173  71.19183  71.15704
[15]  66.58670  71.78737  68.44746  67.62183  74.81939        NA
> colSums(tmp5)
 [1] 1138.4246  686.2596  675.8667  711.3400  705.9651  742.0714  696.7477
 [8]  706.5997  676.3754  711.7028  722.7947  740.9173  711.9183  711.5704
[15]  665.8670  717.8737  684.4746  676.2183  748.1939        NA
> colVars(tmp5)
 [1] 15715.27846    56.56791   102.97766   101.82687    34.43113    76.80948
 [7]    31.83788    86.61589    42.26228    43.90288    73.09788    19.52045
[13]   110.31259    81.54138    70.52755    74.23836    28.17269    43.95156
[19]    69.52832          NA
> colSd(tmp5)
 [1] 125.360594   7.521164  10.147791  10.090930   5.867805   8.764102
 [7]   5.642506   9.306766   6.500945   6.625925   8.549730   4.418196
[13]  10.502980   9.030026   8.398068   8.616168   5.307796   6.629597
[19]   8.338364         NA
> colMax(tmp5)
 [1] 469.84885  85.84377  87.82098  86.25273  77.04126  85.67822  74.94728
 [8]  87.02375  80.11984  81.35787  82.91201  82.05015  88.44465  84.40310
[15]  80.96711  83.32325  78.36650  76.37809  87.65470        NA
> colMin(tmp5)
 [1] 62.75523 59.23209 54.67066 58.69780 60.07550 61.99032 57.88680 58.11473
 [9] 60.89433 61.72417 58.34872 67.89201 55.14355 55.15343 55.11693 58.97124
[17] 57.41458 55.89462 62.92957       NA
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.8489
> Min(tmp5,na.rm=TRUE)
[1] 54.67066
> mean(tmp5,na.rm=TRUE)
[1] 72.63372
> Sum(tmp5,na.rm=TRUE)
[1] 14454.11
> Var(tmp5,na.rm=TRUE)
[1] 864.3553
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.13400 70.04618 70.66556 72.68630 69.53042 73.85371 70.46503 67.56998
 [9] 69.75391 71.52367
> rowSums(tmp5,na.rm=TRUE)
 [1] 1802.680 1400.924 1413.311 1453.726 1390.608 1477.074 1338.836 1351.400
 [9] 1395.078 1430.473
> rowVars(tmp5,na.rm=TRUE)
 [1] 8064.35265   59.35016   56.00860   42.07955   86.36541   69.12270
 [7]   78.39302   28.32572   75.51475   65.17330
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.801741  7.703905  7.483889  6.486875  9.293299  8.314006  8.853983
 [8]  5.322192  8.689922  8.072998
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.84885  87.65470  82.22118  82.11666  87.02375  90.38039  86.25273
 [8]  81.81506  85.67822  88.44465
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.89462 57.47624 54.67066 60.07550 55.14355 60.89433 58.11473 57.41458
 [9] 55.11693 55.15343
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.84246  68.62596  67.58667  71.13400  70.59651  74.20714  69.67477
 [8]  70.65997  67.63754  71.17028  72.27947  74.09173  71.19183  71.15704
[15]  66.58670  71.78737  68.44746  67.62183  74.81939  69.21433
> colSums(tmp5,na.rm=TRUE)
 [1] 1138.4246  686.2596  675.8667  711.3400  705.9651  742.0714  696.7477
 [8]  706.5997  676.3754  711.7028  722.7947  740.9173  711.9183  711.5704
[15]  665.8670  717.8737  684.4746  676.2183  748.1939  622.9290
> colVars(tmp5,na.rm=TRUE)
 [1] 15715.27846    56.56791   102.97766   101.82687    34.43113    76.80948
 [7]    31.83788    86.61589    42.26228    43.90288    73.09788    19.52045
[13]   110.31259    81.54138    70.52755    74.23836    28.17269    43.95156
[19]    69.52832    58.88993
> colSd(tmp5,na.rm=TRUE)
 [1] 125.360594   7.521164  10.147791  10.090930   5.867805   8.764102
 [7]   5.642506   9.306766   6.500945   6.625925   8.549730   4.418196
[13]  10.502980   9.030026   8.398068   8.616168   5.307796   6.629597
[19]   8.338364   7.673978
> colMax(tmp5,na.rm=TRUE)
 [1] 469.84885  85.84377  87.82098  86.25273  77.04126  85.67822  74.94728
 [8]  87.02375  80.11984  81.35787  82.91201  82.05015  88.44465  84.40310
[15]  80.96711  83.32325  78.36650  76.37809  87.65470  80.06281
> colMin(tmp5,na.rm=TRUE)
 [1] 62.75523 59.23209 54.67066 58.69780 60.07550 61.99032 57.88680 58.11473
 [9] 60.89433 61.72417 58.34872 67.89201 55.14355 55.15343 55.11693 58.97124
[17] 57.41458 55.89462 62.92957 56.12108
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.13400 70.04618 70.66556 72.68630 69.53042 73.85371      NaN 67.56998
 [9] 69.75391 71.52367
> rowSums(tmp5,na.rm=TRUE)
 [1] 1802.680 1400.924 1413.311 1453.726 1390.608 1477.074    0.000 1351.400
 [9] 1395.078 1430.473
> rowVars(tmp5,na.rm=TRUE)
 [1] 8064.35265   59.35016   56.00860   42.07955   86.36541   69.12270
 [7]         NA   28.32572   75.51475   65.17330
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.801741  7.703905  7.483889  6.486875  9.293299  8.314006        NA
 [8]  5.322192  8.689922  8.072998
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.84885  87.65470  82.22118  82.11666  87.02375  90.38039        NA
 [8]  81.81506  85.67822  88.44465
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.89462 57.47624 54.67066 60.07550 55.14355 60.89433       NA 57.41458
 [9] 55.11693 55.15343
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 118.57803  66.71287  68.26062  69.45414  71.70682  75.55958  70.27951
 [8]  72.05389  68.36698  70.03833  72.71907  73.81496  71.44758  71.66360
[15]  64.98888  71.71690  68.65215  67.69801  74.32649       NaN
> colSums(tmp5,na.rm=TRUE)
 [1] 1067.2023  600.4158  614.3456  625.0873  645.3613  680.0362  632.5156
 [8]  648.4850  615.3028  630.3449  654.4716  664.3346  643.0282  644.9724
[15]  584.8999  645.4521  617.8693  609.2821  668.9384    0.0000
> colVars(tmp5,na.rm=TRUE)
 [1] 17427.39933    22.46486   110.74007    82.80855    24.86632    65.83331
 [7]    31.70335    75.58413    41.55911    34.97590    80.06106    21.09875
[13]   123.36581    88.84722    50.62179    83.46229    31.22292    49.38022
[19]    75.48619          NA
> colSd(tmp5,na.rm=TRUE)
 [1] 132.012876   4.739711  10.523311   9.099921   4.986614   8.113773
 [7]   5.630573   8.693913   6.446636   5.914042   8.947684   4.593338
[13]  11.107016   9.425881   7.114899   9.135770   5.587748   7.027106
[19]   8.688279         NA
> colMax(tmp5,na.rm=TRUE)
 [1] 469.84885  74.17529  87.82098  85.35839  77.04126  85.67822  74.94728
 [8]  87.02375  80.11984  79.19474  82.91201  82.05015  88.44465  84.40310
[15]  75.08358  83.32325  78.36650  76.37809  87.65470      -Inf
> colMin(tmp5,na.rm=TRUE)
 [1] 62.75523 59.23209 54.67066 58.69780 60.07550 61.99032 57.88680 61.39332
 [9] 60.89433 61.72417 58.34872 67.89201 55.14355 55.15343 55.11693 58.97124
[17] 57.41458 55.89462 62.92957      Inf
> 
> 
> 
> 
> 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] 231.8082 217.9008 208.8149 150.7107 145.7122 215.6527 272.1450 319.3596
 [9] 211.4767 187.8241
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 231.8082 217.9008 208.8149 150.7107 145.7122 215.6527 272.1450 319.3596
 [9] 211.4767 187.8241
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -1.705303e-13 -5.684342e-14  0.000000e+00  0.000000e+00  1.136868e-13
 [6] -8.526513e-14  8.526513e-14 -4.263256e-14  5.684342e-14  1.705303e-13
[11]  8.526513e-14  5.684342e-14 -5.684342e-14  5.684342e-14  4.547474e-13
[16]  0.000000e+00  5.684342e-14  5.684342e-14 -1.705303e-13 -2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
9   17 
1   19 
8   7 
8   15 
7   3 
5   8 
5   20 
10   10 
10   8 
2   5 
3   17 
10   10 
6   10 
10   7 
9   15 
5   16 
8   10 
6   4 
7   7 
1   13 
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.827186
> Min(tmp)
[1] -2.357118
> mean(tmp)
[1] 0.136671
> Sum(tmp)
[1] 13.6671
> Var(tmp)
[1] 0.9566064
> 
> rowMeans(tmp)
[1] 0.136671
> rowSums(tmp)
[1] 13.6671
> rowVars(tmp)
[1] 0.9566064
> rowSd(tmp)
[1] 0.9780626
> rowMax(tmp)
[1] 2.827186
> rowMin(tmp)
[1] -2.357118
> 
> colMeans(tmp)
  [1]  2.82718555  1.27040900  1.88211968  0.39828901  0.86124108  1.50502300
  [7]  1.62955292  0.10740926 -0.38531201 -1.37862770  0.83022462  0.60078712
 [13] -0.64620120  0.96140001 -1.44526533  1.00292942  0.60851362 -0.14938113
 [19] -0.58354733  0.78795763 -0.18598657  0.66434767 -0.07195630 -0.03412151
 [25] -0.88863477  1.17094664  1.11395328 -2.10132673 -1.78992930 -2.35711787
 [31] -0.06756208 -0.65417069  0.32229212 -1.31611432  1.95170646 -0.22820816
 [37] -0.91141412 -0.86185482 -0.20983107 -0.40284635  0.39484103 -0.06552329
 [43] -0.95303401 -0.25085686  0.48841763  0.36232371  0.73622160  1.07584060
 [49]  0.53668206  0.12721369  0.90117443  0.35075223 -1.38686874  0.83566390
 [55] -0.15125987  0.47699696 -1.04098865  0.88428311 -1.42318392  1.22043012
 [61] -0.76119362 -0.72892226  0.52643320  0.52993385  0.57638529 -0.33495103
 [67] -0.31086822  1.17777643 -1.39108563  1.32122392  0.15223368 -0.10645217
 [73] -0.27658620  1.19576329  0.17350904  0.64282526  0.02331125 -1.06807773
 [79]  0.68322140  0.06258768  0.53063268  1.09595438  1.71932524 -0.06746108
 [85]  0.86347456  1.59002410 -1.14388423 -0.63621590  0.91662356 -0.29004857
 [91] -2.07250600  0.51542547  0.04429379 -1.52771062  0.51295458 -0.29190917
 [97]  0.51233757  0.32318851  1.26292601  0.77660275
> colSums(tmp)
  [1]  2.82718555  1.27040900  1.88211968  0.39828901  0.86124108  1.50502300
  [7]  1.62955292  0.10740926 -0.38531201 -1.37862770  0.83022462  0.60078712
 [13] -0.64620120  0.96140001 -1.44526533  1.00292942  0.60851362 -0.14938113
 [19] -0.58354733  0.78795763 -0.18598657  0.66434767 -0.07195630 -0.03412151
 [25] -0.88863477  1.17094664  1.11395328 -2.10132673 -1.78992930 -2.35711787
 [31] -0.06756208 -0.65417069  0.32229212 -1.31611432  1.95170646 -0.22820816
 [37] -0.91141412 -0.86185482 -0.20983107 -0.40284635  0.39484103 -0.06552329
 [43] -0.95303401 -0.25085686  0.48841763  0.36232371  0.73622160  1.07584060
 [49]  0.53668206  0.12721369  0.90117443  0.35075223 -1.38686874  0.83566390
 [55] -0.15125987  0.47699696 -1.04098865  0.88428311 -1.42318392  1.22043012
 [61] -0.76119362 -0.72892226  0.52643320  0.52993385  0.57638529 -0.33495103
 [67] -0.31086822  1.17777643 -1.39108563  1.32122392  0.15223368 -0.10645217
 [73] -0.27658620  1.19576329  0.17350904  0.64282526  0.02331125 -1.06807773
 [79]  0.68322140  0.06258768  0.53063268  1.09595438  1.71932524 -0.06746108
 [85]  0.86347456  1.59002410 -1.14388423 -0.63621590  0.91662356 -0.29004857
 [91] -2.07250600  0.51542547  0.04429379 -1.52771062  0.51295458 -0.29190917
 [97]  0.51233757  0.32318851  1.26292601  0.77660275
> 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]  2.82718555  1.27040900  1.88211968  0.39828901  0.86124108  1.50502300
  [7]  1.62955292  0.10740926 -0.38531201 -1.37862770  0.83022462  0.60078712
 [13] -0.64620120  0.96140001 -1.44526533  1.00292942  0.60851362 -0.14938113
 [19] -0.58354733  0.78795763 -0.18598657  0.66434767 -0.07195630 -0.03412151
 [25] -0.88863477  1.17094664  1.11395328 -2.10132673 -1.78992930 -2.35711787
 [31] -0.06756208 -0.65417069  0.32229212 -1.31611432  1.95170646 -0.22820816
 [37] -0.91141412 -0.86185482 -0.20983107 -0.40284635  0.39484103 -0.06552329
 [43] -0.95303401 -0.25085686  0.48841763  0.36232371  0.73622160  1.07584060
 [49]  0.53668206  0.12721369  0.90117443  0.35075223 -1.38686874  0.83566390
 [55] -0.15125987  0.47699696 -1.04098865  0.88428311 -1.42318392  1.22043012
 [61] -0.76119362 -0.72892226  0.52643320  0.52993385  0.57638529 -0.33495103
 [67] -0.31086822  1.17777643 -1.39108563  1.32122392  0.15223368 -0.10645217
 [73] -0.27658620  1.19576329  0.17350904  0.64282526  0.02331125 -1.06807773
 [79]  0.68322140  0.06258768  0.53063268  1.09595438  1.71932524 -0.06746108
 [85]  0.86347456  1.59002410 -1.14388423 -0.63621590  0.91662356 -0.29004857
 [91] -2.07250600  0.51542547  0.04429379 -1.52771062  0.51295458 -0.29190917
 [97]  0.51233757  0.32318851  1.26292601  0.77660275
> colMin(tmp)
  [1]  2.82718555  1.27040900  1.88211968  0.39828901  0.86124108  1.50502300
  [7]  1.62955292  0.10740926 -0.38531201 -1.37862770  0.83022462  0.60078712
 [13] -0.64620120  0.96140001 -1.44526533  1.00292942  0.60851362 -0.14938113
 [19] -0.58354733  0.78795763 -0.18598657  0.66434767 -0.07195630 -0.03412151
 [25] -0.88863477  1.17094664  1.11395328 -2.10132673 -1.78992930 -2.35711787
 [31] -0.06756208 -0.65417069  0.32229212 -1.31611432  1.95170646 -0.22820816
 [37] -0.91141412 -0.86185482 -0.20983107 -0.40284635  0.39484103 -0.06552329
 [43] -0.95303401 -0.25085686  0.48841763  0.36232371  0.73622160  1.07584060
 [49]  0.53668206  0.12721369  0.90117443  0.35075223 -1.38686874  0.83566390
 [55] -0.15125987  0.47699696 -1.04098865  0.88428311 -1.42318392  1.22043012
 [61] -0.76119362 -0.72892226  0.52643320  0.52993385  0.57638529 -0.33495103
 [67] -0.31086822  1.17777643 -1.39108563  1.32122392  0.15223368 -0.10645217
 [73] -0.27658620  1.19576329  0.17350904  0.64282526  0.02331125 -1.06807773
 [79]  0.68322140  0.06258768  0.53063268  1.09595438  1.71932524 -0.06746108
 [85]  0.86347456  1.59002410 -1.14388423 -0.63621590  0.91662356 -0.29004857
 [91] -2.07250600  0.51542547  0.04429379 -1.52771062  0.51295458 -0.29190917
 [97]  0.51233757  0.32318851  1.26292601  0.77660275
> colMedians(tmp)
  [1]  2.82718555  1.27040900  1.88211968  0.39828901  0.86124108  1.50502300
  [7]  1.62955292  0.10740926 -0.38531201 -1.37862770  0.83022462  0.60078712
 [13] -0.64620120  0.96140001 -1.44526533  1.00292942  0.60851362 -0.14938113
 [19] -0.58354733  0.78795763 -0.18598657  0.66434767 -0.07195630 -0.03412151
 [25] -0.88863477  1.17094664  1.11395328 -2.10132673 -1.78992930 -2.35711787
 [31] -0.06756208 -0.65417069  0.32229212 -1.31611432  1.95170646 -0.22820816
 [37] -0.91141412 -0.86185482 -0.20983107 -0.40284635  0.39484103 -0.06552329
 [43] -0.95303401 -0.25085686  0.48841763  0.36232371  0.73622160  1.07584060
 [49]  0.53668206  0.12721369  0.90117443  0.35075223 -1.38686874  0.83566390
 [55] -0.15125987  0.47699696 -1.04098865  0.88428311 -1.42318392  1.22043012
 [61] -0.76119362 -0.72892226  0.52643320  0.52993385  0.57638529 -0.33495103
 [67] -0.31086822  1.17777643 -1.39108563  1.32122392  0.15223368 -0.10645217
 [73] -0.27658620  1.19576329  0.17350904  0.64282526  0.02331125 -1.06807773
 [79]  0.68322140  0.06258768  0.53063268  1.09595438  1.71932524 -0.06746108
 [85]  0.86347456  1.59002410 -1.14388423 -0.63621590  0.91662356 -0.29004857
 [91] -2.07250600  0.51542547  0.04429379 -1.52771062  0.51295458 -0.29190917
 [97]  0.51233757  0.32318851  1.26292601  0.77660275
> colRanges(tmp)
         [,1]     [,2]    [,3]     [,4]      [,5]     [,6]     [,7]      [,8]
[1,] 2.827186 1.270409 1.88212 0.398289 0.8612411 1.505023 1.629553 0.1074093
[2,] 2.827186 1.270409 1.88212 0.398289 0.8612411 1.505023 1.629553 0.1074093
          [,9]     [,10]     [,11]     [,12]      [,13]  [,14]     [,15]
[1,] -0.385312 -1.378628 0.8302246 0.6007871 -0.6462012 0.9614 -1.445265
[2,] -0.385312 -1.378628 0.8302246 0.6007871 -0.6462012 0.9614 -1.445265
        [,16]     [,17]      [,18]      [,19]     [,20]      [,21]     [,22]
[1,] 1.002929 0.6085136 -0.1493811 -0.5835473 0.7879576 -0.1859866 0.6643477
[2,] 1.002929 0.6085136 -0.1493811 -0.5835473 0.7879576 -0.1859866 0.6643477
          [,23]       [,24]      [,25]    [,26]    [,27]     [,28]     [,29]
[1,] -0.0719563 -0.03412151 -0.8886348 1.170947 1.113953 -2.101327 -1.789929
[2,] -0.0719563 -0.03412151 -0.8886348 1.170947 1.113953 -2.101327 -1.789929
         [,30]       [,31]      [,32]     [,33]     [,34]    [,35]      [,36]
[1,] -2.357118 -0.06756208 -0.6541707 0.3222921 -1.316114 1.951706 -0.2282082
[2,] -2.357118 -0.06756208 -0.6541707 0.3222921 -1.316114 1.951706 -0.2282082
          [,37]      [,38]      [,39]      [,40]    [,41]       [,42]     [,43]
[1,] -0.9114141 -0.8618548 -0.2098311 -0.4028464 0.394841 -0.06552329 -0.953034
[2,] -0.9114141 -0.8618548 -0.2098311 -0.4028464 0.394841 -0.06552329 -0.953034
          [,44]     [,45]     [,46]     [,47]    [,48]     [,49]     [,50]
[1,] -0.2508569 0.4884176 0.3623237 0.7362216 1.075841 0.5366821 0.1272137
[2,] -0.2508569 0.4884176 0.3623237 0.7362216 1.075841 0.5366821 0.1272137
         [,51]     [,52]     [,53]     [,54]      [,55]    [,56]     [,57]
[1,] 0.9011744 0.3507522 -1.386869 0.8356639 -0.1512599 0.476997 -1.040989
[2,] 0.9011744 0.3507522 -1.386869 0.8356639 -0.1512599 0.476997 -1.040989
         [,58]     [,59]   [,60]      [,61]      [,62]     [,63]     [,64]
[1,] 0.8842831 -1.423184 1.22043 -0.7611936 -0.7289223 0.5264332 0.5299339
[2,] 0.8842831 -1.423184 1.22043 -0.7611936 -0.7289223 0.5264332 0.5299339
         [,65]     [,66]      [,67]    [,68]     [,69]    [,70]     [,71]
[1,] 0.5763853 -0.334951 -0.3108682 1.177776 -1.391086 1.321224 0.1522337
[2,] 0.5763853 -0.334951 -0.3108682 1.177776 -1.391086 1.321224 0.1522337
          [,72]      [,73]    [,74]    [,75]     [,76]      [,77]     [,78]
[1,] -0.1064522 -0.2765862 1.195763 0.173509 0.6428253 0.02331125 -1.068078
[2,] -0.1064522 -0.2765862 1.195763 0.173509 0.6428253 0.02331125 -1.068078
         [,79]      [,80]     [,81]    [,82]    [,83]       [,84]     [,85]
[1,] 0.6832214 0.06258768 0.5306327 1.095954 1.719325 -0.06746108 0.8634746
[2,] 0.6832214 0.06258768 0.5306327 1.095954 1.719325 -0.06746108 0.8634746
        [,86]     [,87]      [,88]     [,89]      [,90]     [,91]     [,92]
[1,] 1.590024 -1.143884 -0.6362159 0.9166236 -0.2900486 -2.072506 0.5154255
[2,] 1.590024 -1.143884 -0.6362159 0.9166236 -0.2900486 -2.072506 0.5154255
          [,93]     [,94]     [,95]      [,96]     [,97]     [,98]    [,99]
[1,] 0.04429379 -1.527711 0.5129546 -0.2919092 0.5123376 0.3231885 1.262926
[2,] 0.04429379 -1.527711 0.5129546 -0.2919092 0.5123376 0.3231885 1.262926
        [,100]
[1,] 0.7766028
[2,] 0.7766028
> 
> 
> Max(tmp2)
[1] 2.692151
> Min(tmp2)
[1] -2.282721
> mean(tmp2)
[1] 0.04954917
> Sum(tmp2)
[1] 4.954917
> Var(tmp2)
[1] 1.1243
> 
> rowMeans(tmp2)
  [1] -0.167946254 -0.607861882 -0.650095623  1.332853543  0.223905420
  [6]  0.723980988 -1.817786512 -0.768125795  0.425863712 -0.848862283
 [11] -2.282721097  1.126623511 -0.794505949 -1.299631129  1.529343928
 [16] -0.536244433  0.924424786 -1.226666719  1.509772119  1.455014681
 [21]  0.070198622  0.253089378 -0.885010559 -1.385196977 -0.708297085
 [26] -0.838095213  0.903391748 -0.540080421  0.196758745  0.003129761
 [31]  1.601084882  0.214623490  0.978243265  0.066988362  0.112752919
 [36] -1.348384291  0.281540524 -0.310230295 -0.269262393  0.546982674
 [41]  0.801918351 -1.123507327 -2.258961779  1.791893141 -0.696654172
 [46] -0.581546104  0.484623239 -0.002508202 -1.011365014  0.956789408
 [51] -0.232230970 -0.525049049  1.174046608  0.538904195  1.395127182
 [56]  0.047586032 -0.047695571  0.237802524 -0.911456775 -2.208642803
 [61] -0.708571540 -0.780586483  0.610393281 -0.141392691  1.752966766
 [66]  0.839998478 -0.540890084  0.687149911 -0.445295219  0.174186239
 [71]  0.720365167  1.377156058 -1.586451598 -0.536442433 -0.908953178
 [76] -0.889871404 -1.266093928 -0.163740018  1.018358812  1.620099891
 [81]  1.560415991  0.175993836  0.759649998  1.197496350  2.448314038
 [86] -1.120404527  0.102229533  2.219492051  2.692150539 -0.824755484
 [91] -0.583525941  0.282737097 -1.751666142  0.871167790  0.804258287
 [96] -0.360824891  0.487491609  1.112583671  0.357544430 -1.332452011
> rowSums(tmp2)
  [1] -0.167946254 -0.607861882 -0.650095623  1.332853543  0.223905420
  [6]  0.723980988 -1.817786512 -0.768125795  0.425863712 -0.848862283
 [11] -2.282721097  1.126623511 -0.794505949 -1.299631129  1.529343928
 [16] -0.536244433  0.924424786 -1.226666719  1.509772119  1.455014681
 [21]  0.070198622  0.253089378 -0.885010559 -1.385196977 -0.708297085
 [26] -0.838095213  0.903391748 -0.540080421  0.196758745  0.003129761
 [31]  1.601084882  0.214623490  0.978243265  0.066988362  0.112752919
 [36] -1.348384291  0.281540524 -0.310230295 -0.269262393  0.546982674
 [41]  0.801918351 -1.123507327 -2.258961779  1.791893141 -0.696654172
 [46] -0.581546104  0.484623239 -0.002508202 -1.011365014  0.956789408
 [51] -0.232230970 -0.525049049  1.174046608  0.538904195  1.395127182
 [56]  0.047586032 -0.047695571  0.237802524 -0.911456775 -2.208642803
 [61] -0.708571540 -0.780586483  0.610393281 -0.141392691  1.752966766
 [66]  0.839998478 -0.540890084  0.687149911 -0.445295219  0.174186239
 [71]  0.720365167  1.377156058 -1.586451598 -0.536442433 -0.908953178
 [76] -0.889871404 -1.266093928 -0.163740018  1.018358812  1.620099891
 [81]  1.560415991  0.175993836  0.759649998  1.197496350  2.448314038
 [86] -1.120404527  0.102229533  2.219492051  2.692150539 -0.824755484
 [91] -0.583525941  0.282737097 -1.751666142  0.871167790  0.804258287
 [96] -0.360824891  0.487491609  1.112583671  0.357544430 -1.332452011
> 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.167946254 -0.607861882 -0.650095623  1.332853543  0.223905420
  [6]  0.723980988 -1.817786512 -0.768125795  0.425863712 -0.848862283
 [11] -2.282721097  1.126623511 -0.794505949 -1.299631129  1.529343928
 [16] -0.536244433  0.924424786 -1.226666719  1.509772119  1.455014681
 [21]  0.070198622  0.253089378 -0.885010559 -1.385196977 -0.708297085
 [26] -0.838095213  0.903391748 -0.540080421  0.196758745  0.003129761
 [31]  1.601084882  0.214623490  0.978243265  0.066988362  0.112752919
 [36] -1.348384291  0.281540524 -0.310230295 -0.269262393  0.546982674
 [41]  0.801918351 -1.123507327 -2.258961779  1.791893141 -0.696654172
 [46] -0.581546104  0.484623239 -0.002508202 -1.011365014  0.956789408
 [51] -0.232230970 -0.525049049  1.174046608  0.538904195  1.395127182
 [56]  0.047586032 -0.047695571  0.237802524 -0.911456775 -2.208642803
 [61] -0.708571540 -0.780586483  0.610393281 -0.141392691  1.752966766
 [66]  0.839998478 -0.540890084  0.687149911 -0.445295219  0.174186239
 [71]  0.720365167  1.377156058 -1.586451598 -0.536442433 -0.908953178
 [76] -0.889871404 -1.266093928 -0.163740018  1.018358812  1.620099891
 [81]  1.560415991  0.175993836  0.759649998  1.197496350  2.448314038
 [86] -1.120404527  0.102229533  2.219492051  2.692150539 -0.824755484
 [91] -0.583525941  0.282737097 -1.751666142  0.871167790  0.804258287
 [96] -0.360824891  0.487491609  1.112583671  0.357544430 -1.332452011
> rowMin(tmp2)
  [1] -0.167946254 -0.607861882 -0.650095623  1.332853543  0.223905420
  [6]  0.723980988 -1.817786512 -0.768125795  0.425863712 -0.848862283
 [11] -2.282721097  1.126623511 -0.794505949 -1.299631129  1.529343928
 [16] -0.536244433  0.924424786 -1.226666719  1.509772119  1.455014681
 [21]  0.070198622  0.253089378 -0.885010559 -1.385196977 -0.708297085
 [26] -0.838095213  0.903391748 -0.540080421  0.196758745  0.003129761
 [31]  1.601084882  0.214623490  0.978243265  0.066988362  0.112752919
 [36] -1.348384291  0.281540524 -0.310230295 -0.269262393  0.546982674
 [41]  0.801918351 -1.123507327 -2.258961779  1.791893141 -0.696654172
 [46] -0.581546104  0.484623239 -0.002508202 -1.011365014  0.956789408
 [51] -0.232230970 -0.525049049  1.174046608  0.538904195  1.395127182
 [56]  0.047586032 -0.047695571  0.237802524 -0.911456775 -2.208642803
 [61] -0.708571540 -0.780586483  0.610393281 -0.141392691  1.752966766
 [66]  0.839998478 -0.540890084  0.687149911 -0.445295219  0.174186239
 [71]  0.720365167  1.377156058 -1.586451598 -0.536442433 -0.908953178
 [76] -0.889871404 -1.266093928 -0.163740018  1.018358812  1.620099891
 [81]  1.560415991  0.175993836  0.759649998  1.197496350  2.448314038
 [86] -1.120404527  0.102229533  2.219492051  2.692150539 -0.824755484
 [91] -0.583525941  0.282737097 -1.751666142  0.871167790  0.804258287
 [96] -0.360824891  0.487491609  1.112583671  0.357544430 -1.332452011
> 
> colMeans(tmp2)
[1] 0.04954917
> colSums(tmp2)
[1] 4.954917
> colVars(tmp2)
[1] 1.1243
> colSd(tmp2)
[1] 1.06033
> colMax(tmp2)
[1] 2.692151
> colMin(tmp2)
[1] -2.282721
> colMedians(tmp2)
[1] 0.06859349
> colRanges(tmp2)
          [,1]
[1,] -2.282721
[2,]  2.692151
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.1788459 -2.0188108 -2.1428946  1.7172024  0.5959688  0.2086925
 [7]  1.0630325 -1.2674020  2.6976137 -3.4651675
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.20596937
[2,] -0.19367707
[3,] -0.02758808
[4,]  0.58454182
[5,]  1.73486350
> 
> rowApply(tmp,sum)
 [1]  1.8216114 -4.2631865 -2.1755002 -1.3078964  1.0199025  3.6115286
 [7]  0.8343369 -0.2897915  1.4898460 -2.1737699
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    5    7    6    5    7    2    9   10    6     3
 [2,]    7    3    3    2    8   10    7    5    1     1
 [3,]    6    2    5   10    1    7    4    9    2     4
 [4,]    4    4    4    7    4    4    5    8   10     9
 [5,]    1    5    8    3    6    9    6    2    9     5
 [6,]    2    8    2    8   10    6    3    6    3    10
 [7,]    8    6    1    6    3    8   10    7    8     6
 [8,]    3   10   10    1    9    3    1    3    4     2
 [9,]    9    9    7    9    2    5    8    4    7     7
[10,]   10    1    9    4    5    1    2    1    5     8
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.22318460  3.73683711 -1.89293078  0.55880223 -3.40499175  3.34547291
 [7] -0.62331329  1.94860056 -2.77937491  0.06110267 -4.49963792 -1.11874128
[13] -0.80047182 -1.86368437 -0.46870034  2.73288768  0.32875879  5.24219532
[19] -0.28541074  1.00433688
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.36702971
[2,] -0.35002877
[3,] -0.01462807
[4,]  0.78546989
[5,]  1.16940127
> 
> rowApply(tmp,sum)
[1]  5.516110  2.942375 -6.417661  2.419278 -2.015180
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   19    9    9   17    6
[2,]    8   19   10   20   14
[3,]    5   10    8   13    5
[4,]   18   11    7    8   15
[5,]    3    4   16    6    3
> 
> 
> as.matrix(tmp)
            [,1]       [,2]         [,3]        [,4]       [,5]        [,6]
[1,]  1.16940127  0.1413947 -0.822519619  1.11526053 -0.9936270 -0.01043150
[2,] -0.01462807  1.7498747  0.006908635  0.08947584 -0.7995779  0.96903319
[3,] -0.36702971 -0.3438934 -0.440031876 -0.79975751  0.3325083  0.89567598
[4,]  0.78546989  1.9087074  0.279810673 -0.13724384 -0.5074750  1.56447575
[5,] -0.35002877  0.2807538 -0.917098593  0.29106719 -1.4368202 -0.07328051
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,]  0.6227639  0.9654841 -1.2029129  0.6827448  0.7996918 -0.9845854
[2,]  0.8987973 -1.0631109  0.1038166  0.9179927 -1.6872944 -0.2880081
[3,] -0.1130186  1.4049640 -1.5737703 -0.2018916 -0.2287182 -0.8373496
[4,] -0.4378567 -0.1020651  0.1950203 -1.0054690 -1.5864706  0.7381401
[5,] -1.5939991  0.7433285 -0.3015286 -0.3322742 -1.7968465  0.2530617
           [,13]      [,14]      [,15]       [,16]      [,17]     [,18]
[1,] -0.07328942  0.3417243 -1.1250369  2.23614658  0.9680490 0.9080009
[2,]  1.58618726 -0.3584623 -0.0506278 -0.62131771 -1.9429432 2.2747894
[3,] -0.29722900 -2.3806100  1.5917823  0.39561342 -1.1696172 0.3296679
[4,] -0.69244143 -0.6105528 -0.6236188  0.70071723  0.2392118 0.7653885
[5,] -1.32369923  1.1442164 -0.2611992  0.02172816  2.2340584 0.9643486
           [,19]      [,20]
[1,]  0.48056319  0.2972872
[2,]  0.80108224  0.3703870
[3,] -1.55301378 -1.0619416
[4,]  0.02583979  0.9196893
[5,] -0.03988219  0.4789150
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /Users/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:    /Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  655  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  567  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/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.3137895 -0.1799106 0.5620171 -1.146437 2.441176 1.464525 1.048245
          col8     col9     col10      col11     col12     col13      col14
row1 0.2743024 1.307087 -1.103808 -0.7155773 0.2646721 -0.559405 -0.5112706
          col15     col16    col17      col18     col19      col20
row1 -0.3502727 -1.311953 1.210574 -0.7598995 0.3814082 -0.7017177
> tmp[,"col10"]
          col10
row1 -1.1038081
row2  0.9452084
row3 -1.5296705
row4  1.0714378
row5  0.2859111
> tmp[c("row1","row5"),]
           col1        col2       col3       col4       col5      col6     col7
row1 0.31378954 -0.17991061  0.5620171 -1.1464365  2.4411762 1.4645245 1.048245
row5 0.03869596  0.05740298 -0.3154679 -0.2377427 -0.9650306 0.3150751 1.233210
           col8      col9      col10      col11     col12      col13      col14
row1  0.2743024  1.307087 -1.1038081 -0.7155773 0.2646721 -0.5594050 -0.5112706
row5 -1.1188265 -1.357422  0.2859111 -2.5023972 0.2308857  0.8148787 -0.1524977
          col15      col16     col17      col18      col19      col20
row1 -0.3502727 -1.3119526  1.210574 -0.7598995  0.3814082 -0.7017177
row5 -1.6646284  0.4678648 -0.976009  1.1139458 -1.3378712 -1.0159585
> tmp[,c("col6","col20")]
           col6      col20
row1  1.4645245 -0.7017177
row2 -1.3568679 -0.4774498
row3  1.8371817 -0.6525231
row4  0.8041342  1.1313574
row5  0.3150751 -1.0159585
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 1.4645245 -0.7017177
row5 0.3150751 -1.0159585
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.04791 48.78271 49.54665 48.80563 50.18728 108.1252 52.10065 48.45092
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.87015 49.95582 50.75375 50.86413 50.20698 47.38499 50.78531 51.40446
        col17    col18    col19    col20
row1 50.76836 51.41518 49.90183 106.7408
> tmp[,"col10"]
        col10
row1 49.95582
row2 29.60549
row3 28.21563
row4 31.00114
row5 50.81309
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.04791 48.78271 49.54665 48.80563 50.18728 108.1252 52.10065 48.45092
row5 50.21187 49.09714 49.93566 49.17040 51.87914 103.7458 50.86454 49.88674
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.87015 49.95582 50.75375 50.86413 50.20698 47.38499 50.78531 51.40446
row5 49.86040 50.81309 49.11939 49.93913 50.54631 49.87980 49.99890 48.58670
        col17    col18    col19    col20
row1 50.76836 51.41518 49.90183 106.7408
row5 49.35984 49.62624 50.09728 105.7936
> tmp[,c("col6","col20")]
          col6     col20
row1 108.12521 106.74083
row2  74.72164  73.15750
row3  74.52592  76.26914
row4  74.90780  74.42792
row5 103.74581 105.79356
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 108.1252 106.7408
row5 103.7458 105.7936
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 108.1252 106.7408
row5 103.7458 105.7936
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  0.05877325
[2,] -0.69455515
[3,]  2.60994213
[4,] -0.17952285
[5,] -2.32715713
> tmp[,c("col17","col7")]
            col17       col7
[1,] -0.564630566 -0.5125154
[2,]  0.981521133 -1.2924714
[3,]  0.054881886 -1.1773994
[4,] -0.004553985 -0.7008954
[5,] -1.596750755  0.4161558
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.5149623 -0.7615255
[2,]  1.1352118 -0.7576212
[3,]  1.7362882 -2.5936161
[4,] -1.1318500 -0.9698923
[5,] -0.7304188 -0.2122200
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.5149623
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.5149623
[2,]  1.1352118
> 
> 
> 
> 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]      [,7]
row3  1.082667 -0.7046937  0.4626562 -0.1498166 -0.7162804 -0.3699512 -1.653896
row1 -1.083336 -0.4279523 -2.1625312 -0.3003785 -0.9016100 -0.9909458 -1.006320
         [,8]      [,9]      [,10]       [,11]      [,12]      [,13]      [,14]
row3 1.058236 0.4980295 -0.3556008 -0.02931597 0.07310573 -1.0943569  0.1068327
row1 2.238130 0.2822979 -0.0393385 -0.78807645 0.01266957 -0.4102347 -0.8396964
           [,15]     [,16]       [,17]       [,18]       [,19]      [,20]
row3 -0.26856491  2.145679  0.01605845 -0.46100886 -0.03496212 -0.6902886
row1 -0.06601736 -0.189780 -0.17292759  0.07905042 -0.44253842  3.4799588
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]      [,3]      [,4]      [,5]    [,6]      [,7]
row2 0.9656725 -1.246251 0.7906154 0.8701598 0.3015772 1.01034 0.8589667
         [,8]     [,9]    [,10]
row2 1.503509 1.128086 2.063091
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]      [,3]       [,4]       [,5]      [,6]      [,7]
row5 -1.968632 -0.225809 0.8960463 -0.1620018 -0.0123754 0.3309203 0.5400627
          [,8]      [,9]    [,10]      [,11]     [,12]    [,13]     [,14]
row5 0.4321913 0.2716559 1.574793 0.09010511 0.6667638 -1.06533 0.8022857
          [,15]      [,16]      [,17]   [,18]        [,19]     [,20]
row5 -0.1896641 -0.1678318 -0.7503156 1.94965 -0.004175823 -1.013392
> 
> 
> 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: 0x600000f244e0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a513a9e0" 
 [2] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a4df5b3ba"
 [3] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a3deaa052"
 [4] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a76c3873f"
 [5] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a1ee47603"
 [6] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a28ffcecd"
 [7] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a326209c2"
 [8] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a426eb965"
 [9] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a734db7f5"
[10] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a736870f6"
[11] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a4dd061ab"
[12] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a2bbc4976"
[13] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a567af868"
[14] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a234aa033"
[15] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b3a785b865e"
> 
> 
> ### 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: 0x600000f0c900>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x600000f0c900>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x600000f0c900>
> rowMedians(tmp)
  [1] -0.066989667  0.092548547 -0.143955472  0.064738895 -0.039448398
  [6] -0.083753181 -0.606642027  0.664116395 -0.431245825 -0.326450340
 [11]  0.399444787  1.037765419  0.158359919  0.008071458  0.249240395
 [16]  0.140147851  0.119375394 -0.019727937 -0.856310042  0.234767496
 [21] -0.093045211  0.447353454 -0.212795053 -0.021674775 -0.349615401
 [26] -0.674204672  0.099166309  0.112228192  0.459310309 -0.085514344
 [31] -0.124289780 -0.273919848 -0.448630746 -0.386090703 -0.447375888
 [36]  0.031949886  0.144082473 -0.665711636  0.747640562 -0.446683090
 [41]  0.272514270  0.178251212  0.355198634 -0.170581922 -0.186628394
 [46]  0.270445163 -0.166721920  0.457282782 -0.184608377 -0.192447484
 [51]  0.063393079 -0.128874044 -0.349659144  0.274342830 -0.040857834
 [56] -0.676788781  0.168724106 -0.022909690  0.222611445 -0.310670826
 [61]  0.513039316 -0.346756675 -0.021720273 -0.054744932  0.526702456
 [66] -0.130233234 -0.038816459  0.083397116  0.424418486  0.152573899
 [71]  0.290227405  0.184176288  0.147415583 -0.240043709  0.050625216
 [76] -0.062377822 -0.253279324 -0.328011866  0.136199172  0.046517137
 [81] -0.118439122  0.127136958  0.441629887  0.109702926  0.172505014
 [86]  0.113751794  0.386643283 -0.059166881  0.348057033 -0.007111463
 [91] -0.440709176  0.731674542 -0.289329759  0.121931175  0.168205137
 [96]  0.301232806 -0.239132130 -0.003657551  0.023650331  0.419326947
[101] -0.449076754  0.042367385  0.114800011  0.119007905  0.001477415
[106]  0.042968787 -0.408345918  0.073815275  0.194838208  0.214169361
[111] -0.277889937  0.155711254 -0.008062706 -0.429837802 -0.515654704
[116] -0.030219940 -0.077613174 -0.077990000 -0.317437322 -0.127057671
[121] -0.442457530  0.049447388  0.405123782 -0.311327722 -0.167919686
[126]  0.045898299 -0.068700697 -0.097464678  0.107082292 -0.116038263
[131] -0.793545442 -0.212985504 -0.313214661  0.144984099 -0.374629027
[136] -0.156332171  0.378508438 -0.038330501 -0.332981671  0.289963420
[141] -0.100013968  0.533559212  0.281220421  0.014828085  0.466946870
[146]  0.424135635 -0.232954766 -0.079254755  0.508602651  0.149214070
[151] -0.068100462 -0.595572111 -0.233284969  0.100044724  0.242090649
[156]  0.098436259 -0.019582379 -0.085929417  0.270602489 -0.182563590
[161] -0.549936526  0.242071659 -0.104859768 -0.079146618 -0.389652052
[166] -0.132337936  0.468514631  0.186748176  0.162006307  0.149324826
[171] -0.189991499  0.260508163 -0.415794426 -0.452775928 -0.040323052
[176]  0.349907833  0.046835805 -0.004745203 -0.395008125 -0.264425485
[181] -0.133581455  0.117230083 -0.128142688  0.091377536  0.448574798
[186]  0.237504858  0.077110623  0.226358509 -0.315900217  0.081551590
[191]  0.095556522  0.436707282 -0.352121189  0.266139245  0.373653748
[196]  0.300519951 -0.109183995  0.194723859  0.627115234  0.296680018
[201] -0.087864909 -0.028314322 -0.318047707 -0.011926333  0.692871063
[206] -0.374799708  0.167660283 -0.228747762 -0.396936973  0.138457564
[211] -0.387388483  0.004232804  0.071133222  0.166055846 -0.336600921
[216]  0.303410241 -0.071687276 -0.024785503  0.119034109  0.075881059
[221] -0.686780357 -0.292983177 -0.410601039  0.379434831 -0.560924154
[226] -0.379575744 -0.050321292  0.451099094  0.488762001 -0.158948772
> 
> proc.time()
   user  system elapsed 
  0.750   4.242   5.452 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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: 0x600001780000>
> .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: 0x600001780000>
> .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: 0x600001780000>
> .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: 0x600001780000>
> 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: 0x600001788000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001788000>
> .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: 0x600001788000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001788000>
> .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: 0x600001788000>
> 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: 0x6000017907e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000017907e0>
> .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: 0x6000017907e0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x6000017907e0>
> .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: 0x6000017907e0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x6000017907e0>
> .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: 0x6000017907e0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x6000017907e0>
> .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: 0x6000017907e0>
> 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: 0x6000017909c0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x6000017909c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000017909c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000017909c0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1507c1cf07e5e" "BufferedMatrixFile1507c4fb3ac3b"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1507c1cf07e5e" "BufferedMatrixFile1507c4fb3ac3b"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001790c60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001790c60>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x600001790c60>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x600001790c60>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x600001790c60>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x600001790c60>
> .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: 0x60000178c000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x60000178c000>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x60000178c000>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x60000178c000>
> 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: 0x6000017845a0>
> .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: 0x6000017845a0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.133   0.054   0.187 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

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.139   0.036   0.171 

Example timings