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

This page was generated on 2025-11-19 10:13 -0500 (Wed, 19 Nov 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 24.04.3 LTS)x86_64R Under development (unstable) (2025-10-20 r88955) -- "Unsuffered Consequences" 4827
lconwaymacOS 12.7.6 Montereyx86_64R Under development (unstable) (2025-10-21 r88958) -- "Unsuffered Consequences" 4600
kjohnson3macOS 13.7.7 Venturaarm64R Under development (unstable) (2025-11-04 r88984) -- "Unsuffered Consequences" 4564
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-18 13:40 -0500 (Tue, 18 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)
nebbiolo1Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
lconwaymacOS 12.7.6 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.7.7 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published


CHECK results for BufferedMatrix on lconway

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-18 19:48:17 -0500 (Tue, 18 Nov 2025)
EndedAt: 2025-11-18 19:49:13 -0500 (Tue, 18 Nov 2025)
EllapsedTime: 55.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-10-21 r88958)
* using platform: x86_64-apple-darwin20
* R was compiled by
    Apple clang version 14.0.0 (clang-1400.0.29.202)
    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 14.0.3 (clang-1403.0.22.14.1)’
* 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-x86_64/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.75.0’
** using staged installation
** libs
using C compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using SDK: ‘MacOSX11.3.1.sdk’
clang -arch x86_64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/x86_64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -arch x86_64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/x86_64/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 x86_64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/x86_64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -arch x86_64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/x86_64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c init_package.c -o init_package.o
clang -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/x86_64/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-x86_64/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-10-21 r88958) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-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.325   0.155   0.499 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2025-10-21 r88958) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-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 481268 25.8    1058102 56.6         NA   633897 33.9
Vcells 891509  6.9    8388608 64.0      98304  2110436 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] "Tue Nov 18 19:48:45 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] "Tue Nov 18 19:48:45 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: 0x600003f38000>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Nov 18 19:48:50 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] "Tue Nov 18 19:48:52 2025"
> 
> ColMode(tmp2)
<pointer: 0x600003f38000>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]       [,3]        [,4]
[1,] 98.7557458 -0.3702357  0.9821002 -0.08566931
[2,]  0.6448573  1.0547075 -0.8762210  0.21424688
[3,] -1.3243470 -1.1857782  2.2474504 -0.35108174
[4,]  0.3413920 -0.5750576 -1.0998803  2.55617972
> 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,] 98.7557458 0.3702357 0.9821002 0.08566931
[2,]  0.6448573 1.0547075 0.8762210 0.21424688
[3,]  1.3243470 1.1857782 2.2474504 0.35108174
[4,]  0.3413920 0.5750576 1.0998803 2.55617972
> 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,] 9.9375926 0.6084700 0.9910097 0.2926932
[2,] 0.8030301 1.0269895 0.9360668 0.4628681
[3,] 1.1508027 1.0889344 1.4991499 0.5925215
[4,] 0.5842876 0.7583255 1.0487518 1.5988057
> 
> 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,] 223.13167 31.45494 35.89220 28.01260
[2,]  33.67516 36.32460 35.23689 29.84293
[3,]  37.83237 37.07512 42.23895 31.27630
[4,]  31.18427 33.15831 36.58740 43.54424
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x600003f580c0>
> exp(tmp5)
<pointer: 0x600003f580c0>
> log(tmp5,2)
<pointer: 0x600003f580c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 464.4193
> Min(tmp5)
[1] 52.83235
> mean(tmp5)
[1] 73.27864
> Sum(tmp5)
[1] 14655.73
> Var(tmp5)
[1] 833.0722
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.17798 70.69753 74.95896 72.72412 69.26357 73.27135 69.87201 73.39037
 [9] 69.34682 68.08372
> rowSums(tmp5)
 [1] 1823.560 1413.951 1499.179 1454.482 1385.271 1465.427 1397.440 1467.807
 [9] 1386.936 1361.674
> rowVars(tmp5)
 [1] 7770.28522   46.75785   42.42443   86.91004   47.88860   69.51830
 [7]   37.49294   69.94229   63.16842   69.51078
> rowSd(tmp5)
 [1] 88.149221  6.837971  6.513404  9.322556  6.920159  8.337763  6.123148
 [8]  8.363151  7.947856  8.337312
> rowMax(tmp5)
 [1] 464.41934  79.95694  87.91484  90.63162  85.11999  96.64589  80.80496
 [8]  90.46441  82.98526  88.19178
> rowMin(tmp5)
 [1] 58.30456 57.19882 60.26057 56.42902 54.13022 60.93984 58.67219 57.08543
 [9] 52.83235 53.68715
> 
> colMeans(tmp5)
 [1] 111.73131  69.85221  73.59309  71.42272  70.64064  69.01415  70.06267
 [8]  72.85809  68.00985  70.99086  69.68480  75.54482  70.98041  70.52409
[15]  71.38763  70.98202  71.52459  69.35465  74.18047  73.23377
> colSums(tmp5)
 [1] 1117.3131  698.5221  735.9309  714.2272  706.4064  690.1415  700.6267
 [8]  728.5809  680.0985  709.9086  696.8480  755.4482  709.8041  705.2409
[15]  713.8763  709.8202  715.2459  693.5465  741.8047  732.3377
> colVars(tmp5)
 [1] 15409.80122    31.27329    66.31150    97.85054    91.59920    38.58618
 [7]    88.19834    59.35278    61.96418    58.35516    66.15220    82.28695
[13]    29.68948   126.13885    53.69884    38.26321    55.86641    51.77588
[19]    46.51966    64.67823
> colSd(tmp5)
 [1] 124.136220   5.592253   8.143187   9.891943   9.570747   6.211777
 [7]   9.391397   7.704076   7.871733   7.639055   8.133401   9.071215
[13]   5.448805  11.231155   7.327949   6.185726   7.474383   7.195546
[19]   6.820532   8.042277
> colMax(tmp5)
 [1] 464.41934  78.24822  87.91484  90.63162  80.80496  78.44697  87.13999
 [8]  90.12795  78.73820  83.80986  85.11999  88.19178  79.28155  96.64589
[15]  81.12454  79.53836  84.19689  80.37867  83.88009  90.46441
> colMin(tmp5)
 [1] 63.12053 60.52082 60.62726 58.30456 53.68715 57.08543 58.67219 60.12069
 [9] 56.42902 57.19882 52.83235 58.95525 62.05489 56.20318 58.64874 60.93984
[17] 60.26057 58.52312 63.29606 64.50402
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 91.17798 70.69753 74.95896 72.72412 69.26357 73.27135 69.87201       NA
 [9] 69.34682 68.08372
> rowSums(tmp5)
 [1] 1823.560 1413.951 1499.179 1454.482 1385.271 1465.427 1397.440       NA
 [9] 1386.936 1361.674
> rowVars(tmp5)
 [1] 7770.28522   46.75785   42.42443   86.91004   47.88860   69.51830
 [7]   37.49294   70.99305   63.16842   69.51078
> rowSd(tmp5)
 [1] 88.149221  6.837971  6.513404  9.322556  6.920159  8.337763  6.123148
 [8]  8.425737  7.947856  8.337312
> rowMax(tmp5)
 [1] 464.41934  79.95694  87.91484  90.63162  85.11999  96.64589  80.80496
 [8]        NA  82.98526  88.19178
> rowMin(tmp5)
 [1] 58.30456 57.19882 60.26057 56.42902 54.13022 60.93984 58.67219       NA
 [9] 52.83235 53.68715
> 
> colMeans(tmp5)
 [1] 111.73131  69.85221  73.59309  71.42272  70.64064  69.01415  70.06267
 [8]  72.85809  68.00985  70.99086  69.68480  75.54482  70.98041  70.52409
[15]        NA  70.98202  71.52459  69.35465  74.18047  73.23377
> colSums(tmp5)
 [1] 1117.3131  698.5221  735.9309  714.2272  706.4064  690.1415  700.6267
 [8]  728.5809  680.0985  709.9086  696.8480  755.4482  709.8041  705.2409
[15]        NA  709.8202  715.2459  693.5465  741.8047  732.3377
> colVars(tmp5)
 [1] 15409.80122    31.27329    66.31150    97.85054    91.59920    38.58618
 [7]    88.19834    59.35278    61.96418    58.35516    66.15220    82.28695
[13]    29.68948   126.13885          NA    38.26321    55.86641    51.77588
[19]    46.51966    64.67823
> colSd(tmp5)
 [1] 124.136220   5.592253   8.143187   9.891943   9.570747   6.211777
 [7]   9.391397   7.704076   7.871733   7.639055   8.133401   9.071215
[13]   5.448805  11.231155         NA   6.185726   7.474383   7.195546
[19]   6.820532   8.042277
> colMax(tmp5)
 [1] 464.41934  78.24822  87.91484  90.63162  80.80496  78.44697  87.13999
 [8]  90.12795  78.73820  83.80986  85.11999  88.19178  79.28155  96.64589
[15]        NA  79.53836  84.19689  80.37867  83.88009  90.46441
> colMin(tmp5)
 [1] 63.12053 60.52082 60.62726 58.30456 53.68715 57.08543 58.67219 60.12069
 [9] 56.42902 57.19882 52.83235 58.95525 62.05489 56.20318       NA 60.93984
[17] 60.26057 58.52312 63.29606 64.50402
> 
> Max(tmp5,na.rm=TRUE)
[1] 464.4193
> Min(tmp5,na.rm=TRUE)
[1] 52.83235
> mean(tmp5,na.rm=TRUE)
[1] 73.24309
> Sum(tmp5,na.rm=TRUE)
[1] 14575.38
> Var(tmp5,na.rm=TRUE)
[1] 837.0256
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.17798 70.69753 74.95896 72.72412 69.26357 73.27135 69.87201 73.02392
 [9] 69.34682 68.08372
> rowSums(tmp5,na.rm=TRUE)
 [1] 1823.560 1413.951 1499.179 1454.482 1385.271 1465.427 1397.440 1387.454
 [9] 1386.936 1361.674
> rowVars(tmp5,na.rm=TRUE)
 [1] 7770.28522   46.75785   42.42443   86.91004   47.88860   69.51830
 [7]   37.49294   70.99305   63.16842   69.51078
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.149221  6.837971  6.513404  9.322556  6.920159  8.337763  6.123148
 [8]  8.425737  7.947856  8.337312
> rowMax(tmp5,na.rm=TRUE)
 [1] 464.41934  79.95694  87.91484  90.63162  85.11999  96.64589  80.80496
 [8]  90.46441  82.98526  88.19178
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.30456 57.19882 60.26057 56.42902 54.13022 60.93984 58.67219 57.08543
 [9] 52.83235 53.68715
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.73131  69.85221  73.59309  71.42272  70.64064  69.01415  70.06267
 [8]  72.85809  68.00985  70.99086  69.68480  75.54482  70.98041  70.52409
[15]  70.39149  70.98202  71.52459  69.35465  74.18047  73.23377
> colSums(tmp5,na.rm=TRUE)
 [1] 1117.3131  698.5221  735.9309  714.2272  706.4064  690.1415  700.6267
 [8]  728.5809  680.0985  709.9086  696.8480  755.4482  709.8041  705.2409
[15]  633.5234  709.8202  715.2459  693.5465  741.8047  732.3377
> colVars(tmp5,na.rm=TRUE)
 [1] 15409.80122    31.27329    66.31150    97.85054    91.59920    38.58618
 [7]    88.19834    59.35278    61.96418    58.35516    66.15220    82.28695
[13]    29.68948   126.13885    49.24778    38.26321    55.86641    51.77588
[19]    46.51966    64.67823
> colSd(tmp5,na.rm=TRUE)
 [1] 124.136220   5.592253   8.143187   9.891943   9.570747   6.211777
 [7]   9.391397   7.704076   7.871733   7.639055   8.133401   9.071215
[13]   5.448805  11.231155   7.017676   6.185726   7.474383   7.195546
[19]   6.820532   8.042277
> colMax(tmp5,na.rm=TRUE)
 [1] 464.41934  78.24822  87.91484  90.63162  80.80496  78.44697  87.13999
 [8]  90.12795  78.73820  83.80986  85.11999  88.19178  79.28155  96.64589
[15]  81.12454  79.53836  84.19689  80.37867  83.88009  90.46441
> colMin(tmp5,na.rm=TRUE)
 [1] 63.12053 60.52082 60.62726 58.30456 53.68715 57.08543 58.67219 60.12069
 [9] 56.42902 57.19882 52.83235 58.95525 62.05489 56.20318 58.64874 60.93984
[17] 60.26057 58.52312 63.29606 64.50402
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.17798 70.69753 74.95896 72.72412 69.26357 73.27135 69.87201      NaN
 [9] 69.34682 68.08372
> rowSums(tmp5,na.rm=TRUE)
 [1] 1823.560 1413.951 1499.179 1454.482 1385.271 1465.427 1397.440    0.000
 [9] 1386.936 1361.674
> rowVars(tmp5,na.rm=TRUE)
 [1] 7770.28522   46.75785   42.42443   86.91004   47.88860   69.51830
 [7]   37.49294         NA   63.16842   69.51078
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.149221  6.837971  6.513404  9.322556  6.920159  8.337763  6.123148
 [8]        NA  7.947856  8.337312
> rowMax(tmp5,na.rm=TRUE)
 [1] 464.41934  79.95694  87.91484  90.63162  85.11999  96.64589  80.80496
 [8]        NA  82.98526  88.19178
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.30456 57.19882 60.26057 56.42902 54.13022 60.93984 58.67219       NA
 [9] 52.83235 53.68715
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.34749  70.22188  74.15893  71.07013  69.77857  70.33957  70.07672
 [8]  73.11006  67.52515  70.78954  68.95402  74.73014  70.50649  70.38956
[15]       NaN  70.59256  72.67987  70.16683  74.17631  71.31925
> colSums(tmp5,na.rm=TRUE)
 [1] 1029.1274  631.9969  667.4303  639.6312  628.0071  633.0561  630.6905
 [8]  657.9906  607.7263  637.1059  620.5862  672.5713  634.5584  633.5061
[15]    0.0000  635.3330  654.1189  631.5014  667.5868  641.8733
> colVars(tmp5,na.rm=TRUE)
 [1] 17259.02656    33.64513    70.99848   108.68324    94.68859    23.64634
 [7]    99.22091    66.05762    67.06660    65.19362    68.41325    85.10613
[13]    30.87383   141.70262          NA    41.33968    47.83463    50.82707
[19]    52.33442    31.52757
> colSd(tmp5,na.rm=TRUE)
 [1] 131.373614   5.800442   8.426060  10.425125   9.730806   4.862751
 [7]   9.960969   8.127584   8.189420   8.074257   8.271230   9.225299
[13]   5.556422  11.903891         NA   6.429594   6.916258   7.129311
[19]   7.234254   5.614942
> colMax(tmp5,na.rm=TRUE)
 [1] 464.41934  78.24822  87.91484  90.63162  80.80496  78.44697  87.13999
 [8]  90.12795  78.73820  83.80986  85.11999  88.19178  79.28155  96.64589
[15]      -Inf  79.53836  84.19689  80.37867  83.88009  82.30823
> colMin(tmp5,na.rm=TRUE)
 [1] 63.12053 60.52082 60.62726 58.30456 53.68715 62.50630 58.67219 60.12069
 [9] 56.42902 57.19882 52.83235 58.95525 62.05489 56.20318      Inf 60.93984
[17] 60.26057 58.52312 63.29606 64.50402
> 
> 
> 
> 
> 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] 329.0917 176.4599 306.3059 247.2403 233.7156 342.8267 214.8643 273.1821
 [9] 197.2522 287.7686
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 329.0917 176.4599 306.3059 247.2403 233.7156 342.8267 214.8643 273.1821
 [9] 197.2522 287.7686
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -5.684342e-14  1.136868e-13 -5.684342e-14  2.842171e-14  5.684342e-14
 [6] -1.136868e-13  2.842171e-14  1.705303e-13 -1.136868e-13 -1.136868e-13
[11]  2.842171e-14  2.842171e-14  5.684342e-14  0.000000e+00 -7.105427e-15
[16] -2.842171e-14  0.000000e+00 -5.684342e-14  0.000000e+00  5.684342e-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)
+ }
2   20 
1   9 
5   16 
6   3 
9   13 
2   3 
9   4 
9   17 
3   14 
8   17 
6   7 
9   4 
3   4 
3   12 
8   9 
8   13 
3   14 
4   12 
10   6 
9   15 
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.166788
> Min(tmp)
[1] -2.376345
> mean(tmp)
[1] -0.025797
> Sum(tmp)
[1] -2.5797
> Var(tmp)
[1] 0.9807334
> 
> rowMeans(tmp)
[1] -0.025797
> rowSums(tmp)
[1] -2.5797
> rowVars(tmp)
[1] 0.9807334
> rowSd(tmp)
[1] 0.9903198
> rowMax(tmp)
[1] 2.166788
> rowMin(tmp)
[1] -2.376345
> 
> colMeans(tmp)
  [1]  0.702193186 -0.521402513 -0.775878314  0.222183990 -1.219836439
  [6]  0.229487890 -1.344296329 -0.113096443  2.008796643 -0.952707912
 [11]  2.152163492  0.716724724 -0.442323724 -0.121131820  1.934651509
 [16] -0.585063822 -0.318226056  1.838997759 -0.123727871  0.224661361
 [21]  0.539996312  0.148277850  0.196121471 -0.331367234  0.843580372
 [26] -0.727632342  0.689264449 -0.263867790  0.517438408 -0.707217228
 [31] -0.375451654 -1.437634975  0.978108581 -1.193986594 -1.454754954
 [36]  1.367046007 -0.596025076  0.233078418  0.853249111 -0.285822360
 [41]  0.486532999  1.186218849  0.632651896 -1.340651425  0.869184491
 [46] -0.773460454 -0.897107003  1.625212131  0.101241576 -1.037235396
 [51] -0.572655474  0.007281009  0.426810552 -0.518495434  0.114265920
 [56]  0.142004273  0.493977482 -1.451855794 -0.626590737  0.049274366
 [61] -0.706817575 -0.592081893 -0.094835348 -0.043309897 -0.264362552
 [66]  0.029344977  0.975351465  0.036456554 -1.310646102  0.984447037
 [71] -0.570136804  0.049756911  0.608219313 -0.080807626  1.453718122
 [76] -1.139939311  0.322247520 -2.200206836  1.157057735 -0.794121780
 [81] -0.168259537 -0.521008531 -1.521857333 -2.027906964 -2.376345057
 [86]  0.573422964  0.887490994  1.087546388  2.166787802 -1.829151667
 [91]  0.867032669 -0.845752571 -0.421414788 -1.543350626  1.582259892
 [96] -0.156058239  0.398309319 -0.460206501  1.158191391  1.330062993
> colSums(tmp)
  [1]  0.702193186 -0.521402513 -0.775878314  0.222183990 -1.219836439
  [6]  0.229487890 -1.344296329 -0.113096443  2.008796643 -0.952707912
 [11]  2.152163492  0.716724724 -0.442323724 -0.121131820  1.934651509
 [16] -0.585063822 -0.318226056  1.838997759 -0.123727871  0.224661361
 [21]  0.539996312  0.148277850  0.196121471 -0.331367234  0.843580372
 [26] -0.727632342  0.689264449 -0.263867790  0.517438408 -0.707217228
 [31] -0.375451654 -1.437634975  0.978108581 -1.193986594 -1.454754954
 [36]  1.367046007 -0.596025076  0.233078418  0.853249111 -0.285822360
 [41]  0.486532999  1.186218849  0.632651896 -1.340651425  0.869184491
 [46] -0.773460454 -0.897107003  1.625212131  0.101241576 -1.037235396
 [51] -0.572655474  0.007281009  0.426810552 -0.518495434  0.114265920
 [56]  0.142004273  0.493977482 -1.451855794 -0.626590737  0.049274366
 [61] -0.706817575 -0.592081893 -0.094835348 -0.043309897 -0.264362552
 [66]  0.029344977  0.975351465  0.036456554 -1.310646102  0.984447037
 [71] -0.570136804  0.049756911  0.608219313 -0.080807626  1.453718122
 [76] -1.139939311  0.322247520 -2.200206836  1.157057735 -0.794121780
 [81] -0.168259537 -0.521008531 -1.521857333 -2.027906964 -2.376345057
 [86]  0.573422964  0.887490994  1.087546388  2.166787802 -1.829151667
 [91]  0.867032669 -0.845752571 -0.421414788 -1.543350626  1.582259892
 [96] -0.156058239  0.398309319 -0.460206501  1.158191391  1.330062993
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.702193186 -0.521402513 -0.775878314  0.222183990 -1.219836439
  [6]  0.229487890 -1.344296329 -0.113096443  2.008796643 -0.952707912
 [11]  2.152163492  0.716724724 -0.442323724 -0.121131820  1.934651509
 [16] -0.585063822 -0.318226056  1.838997759 -0.123727871  0.224661361
 [21]  0.539996312  0.148277850  0.196121471 -0.331367234  0.843580372
 [26] -0.727632342  0.689264449 -0.263867790  0.517438408 -0.707217228
 [31] -0.375451654 -1.437634975  0.978108581 -1.193986594 -1.454754954
 [36]  1.367046007 -0.596025076  0.233078418  0.853249111 -0.285822360
 [41]  0.486532999  1.186218849  0.632651896 -1.340651425  0.869184491
 [46] -0.773460454 -0.897107003  1.625212131  0.101241576 -1.037235396
 [51] -0.572655474  0.007281009  0.426810552 -0.518495434  0.114265920
 [56]  0.142004273  0.493977482 -1.451855794 -0.626590737  0.049274366
 [61] -0.706817575 -0.592081893 -0.094835348 -0.043309897 -0.264362552
 [66]  0.029344977  0.975351465  0.036456554 -1.310646102  0.984447037
 [71] -0.570136804  0.049756911  0.608219313 -0.080807626  1.453718122
 [76] -1.139939311  0.322247520 -2.200206836  1.157057735 -0.794121780
 [81] -0.168259537 -0.521008531 -1.521857333 -2.027906964 -2.376345057
 [86]  0.573422964  0.887490994  1.087546388  2.166787802 -1.829151667
 [91]  0.867032669 -0.845752571 -0.421414788 -1.543350626  1.582259892
 [96] -0.156058239  0.398309319 -0.460206501  1.158191391  1.330062993
> colMin(tmp)
  [1]  0.702193186 -0.521402513 -0.775878314  0.222183990 -1.219836439
  [6]  0.229487890 -1.344296329 -0.113096443  2.008796643 -0.952707912
 [11]  2.152163492  0.716724724 -0.442323724 -0.121131820  1.934651509
 [16] -0.585063822 -0.318226056  1.838997759 -0.123727871  0.224661361
 [21]  0.539996312  0.148277850  0.196121471 -0.331367234  0.843580372
 [26] -0.727632342  0.689264449 -0.263867790  0.517438408 -0.707217228
 [31] -0.375451654 -1.437634975  0.978108581 -1.193986594 -1.454754954
 [36]  1.367046007 -0.596025076  0.233078418  0.853249111 -0.285822360
 [41]  0.486532999  1.186218849  0.632651896 -1.340651425  0.869184491
 [46] -0.773460454 -0.897107003  1.625212131  0.101241576 -1.037235396
 [51] -0.572655474  0.007281009  0.426810552 -0.518495434  0.114265920
 [56]  0.142004273  0.493977482 -1.451855794 -0.626590737  0.049274366
 [61] -0.706817575 -0.592081893 -0.094835348 -0.043309897 -0.264362552
 [66]  0.029344977  0.975351465  0.036456554 -1.310646102  0.984447037
 [71] -0.570136804  0.049756911  0.608219313 -0.080807626  1.453718122
 [76] -1.139939311  0.322247520 -2.200206836  1.157057735 -0.794121780
 [81] -0.168259537 -0.521008531 -1.521857333 -2.027906964 -2.376345057
 [86]  0.573422964  0.887490994  1.087546388  2.166787802 -1.829151667
 [91]  0.867032669 -0.845752571 -0.421414788 -1.543350626  1.582259892
 [96] -0.156058239  0.398309319 -0.460206501  1.158191391  1.330062993
> colMedians(tmp)
  [1]  0.702193186 -0.521402513 -0.775878314  0.222183990 -1.219836439
  [6]  0.229487890 -1.344296329 -0.113096443  2.008796643 -0.952707912
 [11]  2.152163492  0.716724724 -0.442323724 -0.121131820  1.934651509
 [16] -0.585063822 -0.318226056  1.838997759 -0.123727871  0.224661361
 [21]  0.539996312  0.148277850  0.196121471 -0.331367234  0.843580372
 [26] -0.727632342  0.689264449 -0.263867790  0.517438408 -0.707217228
 [31] -0.375451654 -1.437634975  0.978108581 -1.193986594 -1.454754954
 [36]  1.367046007 -0.596025076  0.233078418  0.853249111 -0.285822360
 [41]  0.486532999  1.186218849  0.632651896 -1.340651425  0.869184491
 [46] -0.773460454 -0.897107003  1.625212131  0.101241576 -1.037235396
 [51] -0.572655474  0.007281009  0.426810552 -0.518495434  0.114265920
 [56]  0.142004273  0.493977482 -1.451855794 -0.626590737  0.049274366
 [61] -0.706817575 -0.592081893 -0.094835348 -0.043309897 -0.264362552
 [66]  0.029344977  0.975351465  0.036456554 -1.310646102  0.984447037
 [71] -0.570136804  0.049756911  0.608219313 -0.080807626  1.453718122
 [76] -1.139939311  0.322247520 -2.200206836  1.157057735 -0.794121780
 [81] -0.168259537 -0.521008531 -1.521857333 -2.027906964 -2.376345057
 [86]  0.573422964  0.887490994  1.087546388  2.166787802 -1.829151667
 [91]  0.867032669 -0.845752571 -0.421414788 -1.543350626  1.582259892
 [96] -0.156058239  0.398309319 -0.460206501  1.158191391  1.330062993
> colRanges(tmp)
          [,1]       [,2]       [,3]     [,4]      [,5]      [,6]      [,7]
[1,] 0.7021932 -0.5214025 -0.7758783 0.222184 -1.219836 0.2294879 -1.344296
[2,] 0.7021932 -0.5214025 -0.7758783 0.222184 -1.219836 0.2294879 -1.344296
           [,8]     [,9]      [,10]    [,11]     [,12]      [,13]      [,14]
[1,] -0.1130964 2.008797 -0.9527079 2.152163 0.7167247 -0.4423237 -0.1211318
[2,] -0.1130964 2.008797 -0.9527079 2.152163 0.7167247 -0.4423237 -0.1211318
        [,15]      [,16]      [,17]    [,18]      [,19]     [,20]     [,21]
[1,] 1.934652 -0.5850638 -0.3182261 1.838998 -0.1237279 0.2246614 0.5399963
[2,] 1.934652 -0.5850638 -0.3182261 1.838998 -0.1237279 0.2246614 0.5399963
         [,22]     [,23]      [,24]     [,25]      [,26]     [,27]      [,28]
[1,] 0.1482779 0.1961215 -0.3313672 0.8435804 -0.7276323 0.6892644 -0.2638678
[2,] 0.1482779 0.1961215 -0.3313672 0.8435804 -0.7276323 0.6892644 -0.2638678
         [,29]      [,30]      [,31]     [,32]     [,33]     [,34]     [,35]
[1,] 0.5174384 -0.7072172 -0.3754517 -1.437635 0.9781086 -1.193987 -1.454755
[2,] 0.5174384 -0.7072172 -0.3754517 -1.437635 0.9781086 -1.193987 -1.454755
        [,36]      [,37]     [,38]     [,39]      [,40]    [,41]    [,42]
[1,] 1.367046 -0.5960251 0.2330784 0.8532491 -0.2858224 0.486533 1.186219
[2,] 1.367046 -0.5960251 0.2330784 0.8532491 -0.2858224 0.486533 1.186219
         [,43]     [,44]     [,45]      [,46]     [,47]    [,48]     [,49]
[1,] 0.6326519 -1.340651 0.8691845 -0.7734605 -0.897107 1.625212 0.1012416
[2,] 0.6326519 -1.340651 0.8691845 -0.7734605 -0.897107 1.625212 0.1012416
         [,50]      [,51]       [,52]     [,53]      [,54]     [,55]     [,56]
[1,] -1.037235 -0.5726555 0.007281009 0.4268106 -0.5184954 0.1142659 0.1420043
[2,] -1.037235 -0.5726555 0.007281009 0.4268106 -0.5184954 0.1142659 0.1420043
         [,57]     [,58]      [,59]      [,60]      [,61]      [,62]
[1,] 0.4939775 -1.451856 -0.6265907 0.04927437 -0.7068176 -0.5920819
[2,] 0.4939775 -1.451856 -0.6265907 0.04927437 -0.7068176 -0.5920819
           [,63]      [,64]      [,65]      [,66]     [,67]      [,68]
[1,] -0.09483535 -0.0433099 -0.2643626 0.02934498 0.9753515 0.03645655
[2,] -0.09483535 -0.0433099 -0.2643626 0.02934498 0.9753515 0.03645655
         [,69]    [,70]      [,71]      [,72]     [,73]       [,74]    [,75]
[1,] -1.310646 0.984447 -0.5701368 0.04975691 0.6082193 -0.08080763 1.453718
[2,] -1.310646 0.984447 -0.5701368 0.04975691 0.6082193 -0.08080763 1.453718
         [,76]     [,77]     [,78]    [,79]      [,80]      [,81]      [,82]
[1,] -1.139939 0.3222475 -2.200207 1.157058 -0.7941218 -0.1682595 -0.5210085
[2,] -1.139939 0.3222475 -2.200207 1.157058 -0.7941218 -0.1682595 -0.5210085
         [,83]     [,84]     [,85]    [,86]    [,87]    [,88]    [,89]
[1,] -1.521857 -2.027907 -2.376345 0.573423 0.887491 1.087546 2.166788
[2,] -1.521857 -2.027907 -2.376345 0.573423 0.887491 1.087546 2.166788
         [,90]     [,91]      [,92]      [,93]     [,94]   [,95]      [,96]
[1,] -1.829152 0.8670327 -0.8457526 -0.4214148 -1.543351 1.58226 -0.1560582
[2,] -1.829152 0.8670327 -0.8457526 -0.4214148 -1.543351 1.58226 -0.1560582
         [,97]      [,98]    [,99]   [,100]
[1,] 0.3983093 -0.4602065 1.158191 1.330063
[2,] 0.3983093 -0.4602065 1.158191 1.330063
> 
> 
> Max(tmp2)
[1] 2.583377
> Min(tmp2)
[1] -2.640924
> mean(tmp2)
[1] -0.04141773
> Sum(tmp2)
[1] -4.141773
> Var(tmp2)
[1] 1.073796
> 
> rowMeans(tmp2)
  [1]  0.0005958177 -0.1783948892 -1.7727487076  2.5726073828 -0.8985844998
  [6] -0.1852669868  0.6949295232  0.4666746279 -0.7341776529 -0.2339771375
 [11] -0.2138370573  0.1099870902  1.1032624703  0.8486687892 -0.3065165491
 [16] -1.6431485667  0.4006838366  1.4730513052 -0.2039456268  0.8539151274
 [21]  0.8952102570 -0.6981547015 -0.1460583970 -0.2038131613  0.8466916002
 [26]  0.5358976956 -0.2255228430 -0.7943601473  1.8554392742  0.5477212367
 [31] -0.5660264701  0.3636086183  1.2199801245 -0.3860475939  0.1298271410
 [36] -0.7457694478 -0.3196137582 -0.0504316774  0.4316881876  0.4792913741
 [41]  1.3264192773 -1.7712501019  1.0191741874 -0.4110636075 -1.5700500068
 [46]  0.2681906151  1.0802320113 -1.0861403763 -0.9891575032  1.3535303662
 [51]  1.9161723764 -0.8986883847 -0.0147490080  1.5264764293  0.6109832638
 [56]  0.3116303162 -0.0030286443  0.3689226441 -0.0482463520  0.1936610217
 [61] -1.2404842156 -0.1970792848 -0.7511817242 -0.5676327008  0.5533689029
 [66]  2.5833770476 -0.5824605690  0.0533873196 -0.7151681225  0.8959942690
 [71] -0.3555167493 -2.6380424162  0.6581251740 -1.5080884744 -0.4356500801
 [76]  0.5200274543 -1.2332112450 -2.1108058335 -0.7951473315 -0.8034956411
 [81]  0.6284618513 -0.2502784127  0.0989575154  0.9825767115 -0.3206653064
 [86]  1.6707090957  0.3580684384 -1.1514955308 -0.9537833066  0.6174041104
 [91]  0.2127124150 -0.7597529199 -0.0734344955 -1.3259630188  0.6792289272
 [96] -2.2646155720 -1.0560088863  1.8944019755 -2.6409240766 -0.3240427935
> rowSums(tmp2)
  [1]  0.0005958177 -0.1783948892 -1.7727487076  2.5726073828 -0.8985844998
  [6] -0.1852669868  0.6949295232  0.4666746279 -0.7341776529 -0.2339771375
 [11] -0.2138370573  0.1099870902  1.1032624703  0.8486687892 -0.3065165491
 [16] -1.6431485667  0.4006838366  1.4730513052 -0.2039456268  0.8539151274
 [21]  0.8952102570 -0.6981547015 -0.1460583970 -0.2038131613  0.8466916002
 [26]  0.5358976956 -0.2255228430 -0.7943601473  1.8554392742  0.5477212367
 [31] -0.5660264701  0.3636086183  1.2199801245 -0.3860475939  0.1298271410
 [36] -0.7457694478 -0.3196137582 -0.0504316774  0.4316881876  0.4792913741
 [41]  1.3264192773 -1.7712501019  1.0191741874 -0.4110636075 -1.5700500068
 [46]  0.2681906151  1.0802320113 -1.0861403763 -0.9891575032  1.3535303662
 [51]  1.9161723764 -0.8986883847 -0.0147490080  1.5264764293  0.6109832638
 [56]  0.3116303162 -0.0030286443  0.3689226441 -0.0482463520  0.1936610217
 [61] -1.2404842156 -0.1970792848 -0.7511817242 -0.5676327008  0.5533689029
 [66]  2.5833770476 -0.5824605690  0.0533873196 -0.7151681225  0.8959942690
 [71] -0.3555167493 -2.6380424162  0.6581251740 -1.5080884744 -0.4356500801
 [76]  0.5200274543 -1.2332112450 -2.1108058335 -0.7951473315 -0.8034956411
 [81]  0.6284618513 -0.2502784127  0.0989575154  0.9825767115 -0.3206653064
 [86]  1.6707090957  0.3580684384 -1.1514955308 -0.9537833066  0.6174041104
 [91]  0.2127124150 -0.7597529199 -0.0734344955 -1.3259630188  0.6792289272
 [96] -2.2646155720 -1.0560088863  1.8944019755 -2.6409240766 -0.3240427935
> 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.0005958177 -0.1783948892 -1.7727487076  2.5726073828 -0.8985844998
  [6] -0.1852669868  0.6949295232  0.4666746279 -0.7341776529 -0.2339771375
 [11] -0.2138370573  0.1099870902  1.1032624703  0.8486687892 -0.3065165491
 [16] -1.6431485667  0.4006838366  1.4730513052 -0.2039456268  0.8539151274
 [21]  0.8952102570 -0.6981547015 -0.1460583970 -0.2038131613  0.8466916002
 [26]  0.5358976956 -0.2255228430 -0.7943601473  1.8554392742  0.5477212367
 [31] -0.5660264701  0.3636086183  1.2199801245 -0.3860475939  0.1298271410
 [36] -0.7457694478 -0.3196137582 -0.0504316774  0.4316881876  0.4792913741
 [41]  1.3264192773 -1.7712501019  1.0191741874 -0.4110636075 -1.5700500068
 [46]  0.2681906151  1.0802320113 -1.0861403763 -0.9891575032  1.3535303662
 [51]  1.9161723764 -0.8986883847 -0.0147490080  1.5264764293  0.6109832638
 [56]  0.3116303162 -0.0030286443  0.3689226441 -0.0482463520  0.1936610217
 [61] -1.2404842156 -0.1970792848 -0.7511817242 -0.5676327008  0.5533689029
 [66]  2.5833770476 -0.5824605690  0.0533873196 -0.7151681225  0.8959942690
 [71] -0.3555167493 -2.6380424162  0.6581251740 -1.5080884744 -0.4356500801
 [76]  0.5200274543 -1.2332112450 -2.1108058335 -0.7951473315 -0.8034956411
 [81]  0.6284618513 -0.2502784127  0.0989575154  0.9825767115 -0.3206653064
 [86]  1.6707090957  0.3580684384 -1.1514955308 -0.9537833066  0.6174041104
 [91]  0.2127124150 -0.7597529199 -0.0734344955 -1.3259630188  0.6792289272
 [96] -2.2646155720 -1.0560088863  1.8944019755 -2.6409240766 -0.3240427935
> rowMin(tmp2)
  [1]  0.0005958177 -0.1783948892 -1.7727487076  2.5726073828 -0.8985844998
  [6] -0.1852669868  0.6949295232  0.4666746279 -0.7341776529 -0.2339771375
 [11] -0.2138370573  0.1099870902  1.1032624703  0.8486687892 -0.3065165491
 [16] -1.6431485667  0.4006838366  1.4730513052 -0.2039456268  0.8539151274
 [21]  0.8952102570 -0.6981547015 -0.1460583970 -0.2038131613  0.8466916002
 [26]  0.5358976956 -0.2255228430 -0.7943601473  1.8554392742  0.5477212367
 [31] -0.5660264701  0.3636086183  1.2199801245 -0.3860475939  0.1298271410
 [36] -0.7457694478 -0.3196137582 -0.0504316774  0.4316881876  0.4792913741
 [41]  1.3264192773 -1.7712501019  1.0191741874 -0.4110636075 -1.5700500068
 [46]  0.2681906151  1.0802320113 -1.0861403763 -0.9891575032  1.3535303662
 [51]  1.9161723764 -0.8986883847 -0.0147490080  1.5264764293  0.6109832638
 [56]  0.3116303162 -0.0030286443  0.3689226441 -0.0482463520  0.1936610217
 [61] -1.2404842156 -0.1970792848 -0.7511817242 -0.5676327008  0.5533689029
 [66]  2.5833770476 -0.5824605690  0.0533873196 -0.7151681225  0.8959942690
 [71] -0.3555167493 -2.6380424162  0.6581251740 -1.5080884744 -0.4356500801
 [76]  0.5200274543 -1.2332112450 -2.1108058335 -0.7951473315 -0.8034956411
 [81]  0.6284618513 -0.2502784127  0.0989575154  0.9825767115 -0.3206653064
 [86]  1.6707090957  0.3580684384 -1.1514955308 -0.9537833066  0.6174041104
 [91]  0.2127124150 -0.7597529199 -0.0734344955 -1.3259630188  0.6792289272
 [96] -2.2646155720 -1.0560088863  1.8944019755 -2.6409240766 -0.3240427935
> 
> colMeans(tmp2)
[1] -0.04141773
> colSums(tmp2)
[1] -4.141773
> colVars(tmp2)
[1] 1.073796
> colSd(tmp2)
[1] 1.036241
> colMax(tmp2)
[1] 2.583377
> colMin(tmp2)
[1] -2.640924
> colMedians(tmp2)
[1] -0.06193309
> colRanges(tmp2)
          [,1]
[1,] -2.640924
[2,]  2.583377
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.4041170  5.5137706 -4.8475741 -1.5025128 -3.9121849 -2.2760350
 [7]  4.5420144  0.4067960 -0.5780025 -0.5627931
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.64965026
[2,] -0.39044951
[3,] -0.02864551
[4,]  0.71161788
[5,]  2.42414337
> 
> rowApply(tmp,sum)
 [1]  1.1606537  0.3353231  5.0191743 -1.1651455 -3.1484385  0.6368650
 [7] -1.5443228  0.1993119 -0.3562357 -1.9495897
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    7    9   10    2    1    3    7    5    8     7
 [2,]   10    2    9   10    7    8   10    6   10     9
 [3,]    5    5    5    7    4    9    1    9    3     1
 [4,]    2    8    4    9    6    7    8    1    1     3
 [5,]    3    7    1    4    5    6    5    3    5     2
 [6,]    6    4    7    5    3    4    9    4    2     4
 [7,]    8    1    3    3   10   10    6    7    9    10
 [8,]    4   10    8    1    9    5    2    2    4     8
 [9,]    9    3    6    8    2    2    3    8    6     6
[10,]    1    6    2    6    8    1    4   10    7     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.29909582  1.24978475 -1.55367804 -0.08537035  0.12572905 -0.31444687
 [7]  1.42188813  1.20762796  1.80692761  4.30660641 -2.02107039  0.55962829
[13]  2.32285598  2.67496299  0.29344872 -1.39000987 -5.49218230 -0.85982696
[19] -0.05745992 -3.59927362
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.44707389
[2,] -0.56461880
[3,] -0.06779305
[4,]  0.25491445
[5,]  1.52547547
> 
> rowApply(tmp,sum)
[1]  1.81414319  4.50579385  0.63428410 -6.73885370  0.08167832
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   19   10    5   10
[2,]   15   11    2   11   17
[3,]   12    2    9    6   18
[4,]   18    4   12    7    6
[5,]   10    8    8   14   14
> 
> 
> as.matrix(tmp)
            [,1]         [,2]         [,3]       [,4]        [,5]       [,6]
[1,] -0.56461880  0.584601789 -0.001403865  1.5837818 -0.14161746  1.3020956
[2,]  1.52547547  0.374891604 -1.077298644 -0.6237435 -0.02104759  0.5611862
[3,] -0.06779305 -0.945945378 -0.420168816  0.1768797 -0.56243353 -0.6645191
[4,] -1.44707389 -0.004171475 -1.303096518 -0.9968807  0.29617187  0.4290787
[5,]  0.25491445  1.240408214  1.248289804 -0.2254076  0.55465576 -1.9422883
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -0.4815568 -0.1275911 -1.4243278  2.9767847 -0.4498972 -1.3997966
[2,]  0.2602438  1.0320625  1.7318907  1.1778612  0.7909763  0.4877441
[3,]  0.1080350 -0.8834520  0.2089759 -0.6473853 -0.6588161  0.4936099
[4,]  0.8322084  0.7229996  0.8653611 -0.4532947  0.2288196  1.0857729
[5,]  0.7029577  0.4636089  0.4250277  1.2526406 -1.9321530 -0.1077020
          [,13]      [,14]      [,15]      [,16]      [,17]       [,18]
[1,]  1.2777901  1.9938507  0.3901952 -0.8874497 -0.3214463 -1.57451080
[2,] -0.6005978 -0.6053674  0.1816262 -0.9981907 -1.2124038  0.48353744
[3,]  2.7453094  1.2053525  0.8540780  0.4354406 -0.8101149  0.37835333
[4,]  0.4640702 -0.5202976 -1.5337426 -1.8019816 -2.0334916 -0.07681371
[5,] -1.5637160  0.6014248  0.4012919  1.8621715 -1.1147258 -0.07039323
          [,19]       [,20]
[1,] -1.0183631  0.09762272
[2,]  1.4372277 -0.40027988
[3,]  1.4797357 -1.79085803
[4,]  0.1448329 -1.63732472
[5,] -2.1008931  0.13156629
> 
> 
> 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.4798539 -1.861981 1.104107 -0.2949884 0.7987685 0.6581588 -1.177619
           col8     col9    col10     col11      col12     col13     col14
row1 -0.1709075 -1.27908 1.528961 -2.110521 -0.2893533 0.5419736 0.7425861
          col15      col16     col17    col18     col19      col20
row1 -0.7816014 0.00408043 -1.233475 -2.07947 0.7785126 -0.6848915
> tmp[,"col10"]
          col10
row1  1.5289614
row2 -1.4829279
row3  1.1076216
row4 -0.7574108
row5  0.8436722
> tmp[c("row1","row5"),]
          col1       col2      col3       col4      col5      col6       col7
row1 0.4798539 -1.8619810  1.104107 -0.2949884 0.7987685 0.6581588 -1.1776193
row5 0.3449228  0.4636855 -1.713430 -0.8609984 0.3435009 1.3695878 -0.8348955
           col8       col9     col10     col11      col12      col13
row1 -0.1709075 -1.2790803 1.5289614 -2.110521 -0.2893533  0.5419736
row5  1.2683308 -0.5972268 0.8436722  1.336677  0.2958410 -0.9416810
           col14      col15       col16     col17      col18      col19
row1  0.74258608 -0.7816014  0.00408043 -1.233475 -2.0794698  0.7785126
row5 -0.06325642  0.4614977 -0.66659698 -1.192814  0.9984015 -0.7591346
          col20
row1 -0.6848915
row5 -1.6322757
> tmp[,c("col6","col20")]
           col6      col20
row1  0.6581588 -0.6848915
row2  0.2657643  0.2714601
row3  2.0623742 -0.4795124
row4 -2.3349575  0.4049219
row5  1.3695878 -1.6322757
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 0.6581588 -0.6848915
row5 1.3695878 -1.6322757
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.79013 48.98117 51.09912 48.77761 49.85957 104.6341 49.34799 49.51745
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.02523 48.81454 50.27519 48.89987 49.62617 49.06874 49.48358 50.59132
        col17   col18    col19    col20
row1 49.01921 49.8649 50.57816 104.0782
> tmp[,"col10"]
        col10
row1 48.81454
row2 30.82619
row3 28.30322
row4 30.25668
row5 50.46341
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.79013 48.98117 51.09912 48.77761 49.85957 104.6341 49.34799 49.51745
row5 48.68293 50.20048 51.23600 52.02482 49.40962 105.2748 48.86859 48.70196
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.02523 48.81454 50.27519 48.89987 49.62617 49.06874 49.48358 50.59132
row5 49.35687 50.46341 49.35939 49.91386 48.89174 48.52070 49.85918 50.50166
        col17    col18    col19    col20
row1 49.01921 49.86490 50.57816 104.0782
row5 50.80798 49.65872 50.13415 105.8860
> tmp[,c("col6","col20")]
          col6     col20
row1 104.63414 104.07824
row2  75.91864  75.12492
row3  74.74361  76.34525
row4  74.17345  74.91838
row5 105.27478 105.88596
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.6341 104.0782
row5 105.2748 105.8860
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.6341 104.0782
row5 105.2748 105.8860
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.2188867
[2,]  0.9069305
[3,]  0.4643199
[4,] -0.4166714
[5,] -0.2260295
> tmp[,c("col17","col7")]
          col17        col7
[1,]  0.5754140  1.70211380
[2,]  0.4905868 -1.74306553
[3,]  0.1149879 -0.05959012
[4,] -0.8563055 -0.18088579
[5,] -1.6524316  0.66085720
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -0.54304278  0.8180482
[2,] -0.09204923 -0.9593275
[3,] -0.99286318  0.5421834
[4,]  0.71692876 -1.4247501
[5,] -1.50633836 -2.8129067
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.5430428
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] -0.54304278
[2,] -0.09204923
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]       [,3]          [,4]      [,5]       [,6]
row3 -0.6689243 1.0039545  2.2161044 -0.0003085884 0.4176729 -0.3958038
row1  1.2956071 0.2717957 -0.2035364 -1.9867267159 0.0682616 -1.7140306
           [,7]       [,8]       [,9]      [,10]      [,11]     [,12]
row3 -0.3649508 -0.3837806  0.5852097 -1.8125702  0.4523783 0.1420507
row1  0.4695393  1.1072962 -0.4156020 -0.4177497 -0.2180680 0.3176841
          [,13]      [,14]      [,15]     [,16]      [,17]      [,18]
row3 -1.1696765 -0.3316184  0.2613119 1.4683451  0.2554522 -0.6353408
row1  0.7354161 -0.1281373 -0.1669947 0.4046768 -0.7032211  0.9463710
          [,19]    [,20]
row3 -2.1153964 1.442197
row1  0.9370413 0.344929
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]        [,3]       [,4]      [,5]       [,6]      [,7]
row2 -1.439327 0.814827 -0.09508605 -0.8434713 0.7283394 -0.7059927 0.7170654
          [,8]       [,9]     [,10]
row2 0.1933449 -0.7205954 0.4469513
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]      [,2]     [,3]      [,4]      [,5]      [,6]     [,7]
row5 0.334676 -2.419111 2.687235 0.7032046 -0.109436 0.1477899 2.501075
         [,8]      [,9]     [,10]     [,11]    [,12]     [,13]     [,14]
row5 1.490177 0.5728236 0.2821036 0.4772756 1.483873 0.6431976 0.7506901
        [,15]     [,16]    [,17]    [,18]      [,19]    [,20]
row5 1.537405 0.5899014 1.101532 -1.55327 -0.5145225 0.940872
> 
> 
> 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: 0x600003f7c060>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f36329132"
 [2] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f31da856a"
 [3] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f16d0bb8" 
 [4] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f1e1c5dc3"
 [5] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f584fbca6"
 [6] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f5aea6395"
 [7] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f522ff9d4"
 [8] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f4bbaf773"
 [9] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f5fcbc5dc"
[10] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f3b2b1fa6"
[11] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302fc2ae9a3" 
[12] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f5550d292"
[13] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f2d309b00"
[14] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f5210342d"
[15] "/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests/BM1302f25d1a072"
> 
> 
> ### 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: 0x600003f64120>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x600003f64120>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.23-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x600003f64120>
> rowMedians(tmp)
  [1]  1.893240e-01  2.866342e-01 -2.142198e-01 -2.747214e-02 -1.658451e-01
  [6] -3.865325e-02 -1.127909e-01  1.869250e-01 -1.225709e-01  4.495973e-01
 [11] -1.367074e-02 -1.684961e-01  6.363953e-05 -1.962311e-01  7.757554e-01
 [16]  3.084038e-01  1.377974e-01  2.502040e-02  1.209914e-01  2.589894e-01
 [21] -3.045594e-01 -1.084290e-02  2.029676e-01 -2.608903e-01  1.066794e-01
 [26]  1.186554e-01 -1.503665e-01  3.056944e-01  8.524216e-02 -2.124444e-01
 [31] -1.987144e-01  1.184355e-01 -8.185969e-01 -3.933075e-02 -6.702439e-01
 [36] -6.188559e-02  4.056276e-02 -4.978758e-01 -1.134676e-01  5.847423e-01
 [41] -4.160455e-01  1.244799e-01 -4.535889e-01 -1.922778e-01 -2.039095e-01
 [46]  8.114143e-02  3.870103e-01  3.564893e-02 -3.578244e-01  1.577858e-01
 [51] -4.345644e-01 -1.165453e-01  4.843419e-01 -2.637243e-01 -2.932953e-02
 [56]  4.766403e-01 -1.766861e-01 -2.171164e-01 -4.159689e-01  5.494499e-02
 [61]  9.605063e-03  6.883925e-01  5.197147e-01  1.025101e-01 -2.765217e-01
 [66]  4.968262e-01  1.493742e-01 -6.281512e-01 -4.813393e-02 -3.943242e-01
 [71] -4.857329e-01 -3.095269e-01  3.597039e-01  3.462654e-02 -1.394227e-01
 [76]  1.568093e-02  1.553615e-01  2.808511e-01 -1.718027e-01  6.383259e-01
 [81] -3.813510e-01 -4.087288e-01  1.315149e-01 -2.454087e-01 -5.171686e-02
 [86]  4.795008e-02  7.289056e-02 -2.411597e-01  1.173524e-01 -1.605993e-01
 [91]  3.071062e-01 -2.444526e-01  1.444891e-01  3.167182e-01  1.370239e-03
 [96] -1.531590e-01 -2.581495e-01 -2.778736e-02  2.216862e-01  1.101064e-01
[101] -1.127733e-01  1.333522e-01  1.975375e-01  5.424761e-01 -7.183572e-02
[106]  2.024524e-01  2.970502e-01 -7.947750e-02 -1.658824e-01  3.426550e-01
[111]  3.707075e-02 -2.176807e-01  2.046020e-01  3.741167e-01 -3.351972e-01
[116] -7.765441e-02 -2.052049e-01 -2.005257e-01  6.027649e-01  2.651288e-01
[121]  5.085352e-01  3.564536e-01  5.356795e-01  1.888011e-02  1.422479e-01
[126]  7.862511e-01  1.106362e-01 -2.470132e-02 -5.280404e-01  1.432971e-03
[131]  8.113518e-02 -4.548721e-01  1.476271e-01 -1.699866e-01  5.978304e-02
[136] -1.419458e-01  3.471517e-01  2.496124e-01  1.314644e-01  4.315054e-01
[141] -2.487883e-01  2.679460e-01 -3.573855e-01  4.704805e-01  3.214645e-01
[146]  7.169322e-02  2.511081e-01 -3.466562e-01  8.977845e-02 -1.549094e-01
[151] -2.014701e-01  3.548878e-02 -2.105005e-01 -1.586404e-01  1.259167e-01
[156]  9.241055e-02  3.163420e-01 -2.035438e-02 -3.035511e-01 -1.263446e-01
[161]  1.412374e-01 -1.054976e-01 -2.983471e-01  6.303885e-02  2.605327e-01
[166]  9.932782e-02  2.700924e-01  1.897924e-01 -1.039422e-01 -5.507745e-02
[171]  1.317646e-01  1.221254e-01  2.798614e-01 -6.112604e-02  1.583043e-01
[176] -1.932241e-01 -2.753957e-01  2.141949e-01  4.234395e-01  2.914723e-01
[181] -1.232179e-01  1.438738e-01 -4.609053e-03 -1.760592e-01 -1.993533e-01
[186] -1.918459e-01  7.521865e-03  2.870189e-01 -7.577779e-02  4.408777e-01
[191] -5.228422e-01 -9.625957e-02  5.431296e-01  3.594238e-01 -1.214177e-02
[196] -5.644397e-02 -3.170897e-01  3.068890e-01 -2.217946e-01  2.654352e-01
[201] -4.990512e-02 -1.972250e-01  1.711689e-01  3.286597e-01  1.844567e-01
[206]  5.242545e-01 -4.191620e-01 -5.356749e-01  3.308390e-01  1.599829e-01
[211]  1.053145e+00  6.321779e-01 -4.475101e-01 -1.227487e-01 -1.526663e-01
[216]  1.748648e-01  8.780269e-02  6.585544e-02  1.246557e-01  5.049555e-01
[221]  1.764534e-02 -3.593459e-01 -3.125592e-01  2.397291e-02  2.964059e-01
[226]  3.567492e-01 -3.109614e-01 -5.019357e-02  3.573899e-02  5.301111e-01
> 
> proc.time()
   user  system elapsed 
  2.720  15.337  18.555 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2025-10-21 r88958) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-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: 0x600003f3c0c0>
> .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: 0x600003f3c0c0>
> .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: 0x600003f3c0c0>
> .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: 0x600003f3c0c0>
> 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: 0x600003f60120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003f60120>
> .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: 0x600003f60120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003f60120>
> .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: 0x600003f60120>
> 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: 0x600003f2c000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003f2c000>
> .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: 0x600003f2c000>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x600003f2c000>
> .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: 0x600003f2c000>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x600003f2c000>
> .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: 0x600003f2c000>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x600003f2c000>
> .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: 0x600003f2c000>
> 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: 0x600003f2c180>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x600003f2c180>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003f2c180>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003f2c180>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile13a825196940b" "BufferedMatrixFile13a8274d18805"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile13a825196940b" "BufferedMatrixFile13a8274d18805"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003f2c420>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003f2c420>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x600003f2c420>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x600003f2c420>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x600003f2c420>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x600003f2c420>
> .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: 0x600003f2c600>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003f2c600>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x600003f2c600>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x600003f2c600>
> 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: 0x600003f28000>
> .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: 0x600003f28000>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.342   0.161   0.519 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2025-10-21 r88958) -- "Unsuffered Consequences"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-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.327   0.103   0.443 

Example timings