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

This page was generated on 2024-05-10 11:37:36 -0400 (Fri, 10 May 2024).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 22.04.3 LTS)x86_644.4.0 (2024-04-24) -- "Puppy Cup" 4751
palomino3Windows Server 2022 Datacenterx644.4.0 (2024-04-24 ucrt) -- "Puppy Cup" 4485
lconwaymacOS 12.7.1 Montereyx86_644.4.0 (2024-04-24) -- "Puppy Cup" 4515
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 249/2300HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.68.0  (landing page)
Ben Bolstad
Snapshot Date: 2024-05-09 14:00:17 -0400 (Thu, 09 May 2024)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_19
git_last_commit: af6c73d
git_last_commit_date: 2024-04-30 10:16:21 -0400 (Tue, 30 Apr 2024)
nebbiolo1Linux (Ubuntu 22.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino3Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
lconwaymacOS 12.7.1 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.6.5 Ventura / arm64see weekly results here

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.68.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.68.0.tar.gz
StartedAt: 2024-05-09 19:30:37 -0400 (Thu, 09 May 2024)
EndedAt: 2024-05-09 19:31:32 -0400 (Thu, 09 May 2024)
EllapsedTime: 55.2 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.68.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.4.0 (2024-04-24)
* using platform: x86_64-apple-darwin20
* R was compiled by
    Apple clang version 14.0.0 (clang-1400.0.29.202)
    GNU Fortran (GCC) 12.2.0
* running under: macOS Monterey 12.7.1
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.68.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.19-bioc/meat/BufferedMatrix.Rcheck/00install.out’ for details.
* used C compiler: ‘Apple clang version 14.0.0 (clang-1400.0.29.202)’
* used SDK: ‘MacOSX11.3.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 ... NOTE
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, 2 NOTEs
See
  ‘/Users/biocbuild/bbs-3.19-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.4-x86_64/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘Apple clang version 14.0.0 (clang-1400.0.29.202)’
using SDK: ‘MacOSX11.3.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 -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.4-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 version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 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.356   0.155   0.513 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 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.19-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 474174 25.4    1035461 55.3         NA   638642 34.2
Vcells 877658  6.7    8388608 64.0      98304  2071719 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu May  9 19:31:03 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu May  9 19:31:04 2024"
> 
> 
> 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: 0x600002c24000>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Thu May  9 19:31:08 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu May  9 19:31:10 2024"
> 
> ColMode(tmp2)
<pointer: 0x600002c24000>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]       [,3]       [,4]
[1,] 99.7786927 -0.9164091  1.1633446 -1.2568260
[2,] -0.2316318 -1.0737098  2.6592684  0.3740892
[3,]  0.7054800 -0.1217849 -1.9809419  0.6290023
[4,]  0.4903326 -0.8756645  0.4642764 -2.0748882
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 99.7786927 0.9164091 1.1633446 1.2568260
[2,]  0.2316318 1.0737098 2.6592684 0.3740892
[3,]  0.7054800 0.1217849 1.9809419 0.6290023
[4,]  0.4903326 0.8756645 0.4642764 2.0748882
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9889285 0.9572926 1.0785845 1.1210825
[2,] 0.4812814 1.0361997 1.6307263 0.6116283
[3,] 0.8399285 0.3489769 1.4074594 0.7930967
[4,] 0.7002375 0.9357695 0.6813783 1.4404472
> 
> 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.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.66798 35.48933 36.94919 37.46765
[2,]  30.04445 36.43571 43.96653 31.49037
[3,]  34.10477 28.61155 41.05554 33.55997
[4,]  32.49271 35.23336 32.27806 41.47936
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x600002c641e0>
> exp(tmp5)
<pointer: 0x600002c641e0>
> log(tmp5,2)
<pointer: 0x600002c641e0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.617
> Min(tmp5)
[1] 53.28379
> mean(tmp5)
[1] 72.09125
> Sum(tmp5)
[1] 14418.25
> Var(tmp5)
[1] 866.0326
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.24224 68.81782 73.29212 72.49985 68.99026 69.71259 71.29032 67.56768
 [9] 67.67344 69.82622
> rowSums(tmp5)
 [1] 1824.845 1376.356 1465.842 1449.997 1379.805 1394.252 1425.806 1351.354
 [9] 1353.469 1396.524
> rowVars(tmp5)
 [1] 7921.38361   99.56941  101.56833   71.67117   55.11688   67.86081
 [7]   89.59765   58.97130   89.94095   51.59740
> rowSd(tmp5)
 [1] 89.002155  9.978447 10.078112  8.465883  7.424074  8.237768  9.465603
 [8]  7.679277  9.483720  7.183133
> rowMax(tmp5)
 [1] 467.61696  91.51058  92.89400  87.16976  88.79220  82.13080  91.71293
 [8]  82.50014  89.40322  82.01936
> rowMin(tmp5)
 [1] 56.29201 54.98302 59.55120 58.63978 53.95601 55.09630 53.28379 58.73159
 [9] 55.20057 54.86864
> 
> colMeans(tmp5)
 [1] 109.71541  70.23097  75.26009  73.92095  70.54227  70.47745  73.58605
 [8]  76.15715  67.91707  72.05932  69.04467  68.09724  67.19127  64.21211
[15]  71.58973  65.78483  69.08476  67.69552  73.99429  65.26394
> colSums(tmp5)
 [1] 1097.1541  702.3097  752.6009  739.2095  705.4227  704.7745  735.8605
 [8]  761.5715  679.1707  720.5932  690.4467  680.9724  671.9127  642.1211
[15]  715.8973  657.8483  690.8476  676.9552  739.9429  652.6394
> colVars(tmp5)
 [1] 15846.02399    41.20700    68.35823   121.32045    70.63142    36.98918
 [7]    56.66477   109.34552    92.61914    69.47986    55.73005   108.79667
[13]    59.67572    53.58305    79.15547    86.29911   122.94468   101.52614
[19]    43.91221    31.83088
> colSd(tmp5)
 [1] 125.880991   6.419268   8.267904  11.014556   8.404250   6.081873
 [7]   7.527600  10.456841   9.623884   8.335458   7.465256  10.430564
[13]   7.725006   7.320044   8.896936   9.289732  11.088042  10.076018
[19]   6.626629   5.641886
> colMax(tmp5)
 [1] 467.61696  80.73365  91.51058  89.40322  89.33307  78.59589  84.12260
 [8]  92.89400  85.65389  84.41371  82.13080  91.71293  78.65614  81.34696
[15]  80.63554  81.46078  87.16976  85.95629  85.02551  74.16734
> colMin(tmp5)
 [1] 62.53358 59.55120 66.08642 60.11489 60.88963 59.55848 64.62045 55.09630
 [9] 53.95601 59.79649 59.55882 55.76608 54.98302 54.86864 55.52780 53.28379
[17] 55.20057 55.63309 65.62944 58.39557
> 
> 
> ### 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.24224 68.81782 73.29212 72.49985 68.99026       NA 71.29032 67.56768
 [9] 67.67344 69.82622
> rowSums(tmp5)
 [1] 1824.845 1376.356 1465.842 1449.997 1379.805       NA 1425.806 1351.354
 [9] 1353.469 1396.524
> rowVars(tmp5)
 [1] 7921.38361   99.56941  101.56833   71.67117   55.11688   70.22334
 [7]   89.59765   58.97130   89.94095   51.59740
> rowSd(tmp5)
 [1] 89.002155  9.978447 10.078112  8.465883  7.424074  8.379937  9.465603
 [8]  7.679277  9.483720  7.183133
> rowMax(tmp5)
 [1] 467.61696  91.51058  92.89400  87.16976  88.79220        NA  91.71293
 [8]  82.50014  89.40322  82.01936
> rowMin(tmp5)
 [1] 56.29201 54.98302 59.55120 58.63978 53.95601       NA 53.28379 58.73159
 [9] 55.20057 54.86864
> 
> colMeans(tmp5)
 [1] 109.71541  70.23097  75.26009  73.92095  70.54227  70.47745  73.58605
 [8]  76.15715  67.91707  72.05932  69.04467  68.09724  67.19127  64.21211
[15]  71.58973  65.78483  69.08476  67.69552  73.99429        NA
> colSums(tmp5)
 [1] 1097.1541  702.3097  752.6009  739.2095  705.4227  704.7745  735.8605
 [8]  761.5715  679.1707  720.5932  690.4467  680.9724  671.9127  642.1211
[15]  715.8973  657.8483  690.8476  676.9552  739.9429        NA
> colVars(tmp5)
 [1] 15846.02399    41.20700    68.35823   121.32045    70.63142    36.98918
 [7]    56.66477   109.34552    92.61914    69.47986    55.73005   108.79667
[13]    59.67572    53.58305    79.15547    86.29911   122.94468   101.52614
[19]    43.91221          NA
> colSd(tmp5)
 [1] 125.880991   6.419268   8.267904  11.014556   8.404250   6.081873
 [7]   7.527600  10.456841   9.623884   8.335458   7.465256  10.430564
[13]   7.725006   7.320044   8.896936   9.289732  11.088042  10.076018
[19]   6.626629         NA
> colMax(tmp5)
 [1] 467.61696  80.73365  91.51058  89.40322  89.33307  78.59589  84.12260
 [8]  92.89400  85.65389  84.41371  82.13080  91.71293  78.65614  81.34696
[15]  80.63554  81.46078  87.16976  85.95629  85.02551        NA
> colMin(tmp5)
 [1] 62.53358 59.55120 66.08642 60.11489 60.88963 59.55848 64.62045 55.09630
 [9] 53.95601 59.79649 59.55882 55.76608 54.98302 54.86864 55.52780 53.28379
[17] 55.20057 55.63309 65.62944       NA
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.617
> Min(tmp5,na.rm=TRUE)
[1] 53.28379
> mean(tmp5,na.rm=TRUE)
[1] 72.12786
> Sum(tmp5,na.rm=TRUE)
[1] 14353.44
> Var(tmp5,na.rm=TRUE)
[1] 870.1371
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.24224 68.81782 73.29212 72.49985 68.99026 69.97080 71.29032 67.56768
 [9] 67.67344 69.82622
> rowSums(tmp5,na.rm=TRUE)
 [1] 1824.845 1376.356 1465.842 1449.997 1379.805 1329.445 1425.806 1351.354
 [9] 1353.469 1396.524
> rowVars(tmp5,na.rm=TRUE)
 [1] 7921.38361   99.56941  101.56833   71.67117   55.11688   70.22334
 [7]   89.59765   58.97130   89.94095   51.59740
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.002155  9.978447 10.078112  8.465883  7.424074  8.379937  9.465603
 [8]  7.679277  9.483720  7.183133
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.61696  91.51058  92.89400  87.16976  88.79220  82.13080  91.71293
 [8]  82.50014  89.40322  82.01936
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.29201 54.98302 59.55120 58.63978 53.95601 55.09630 53.28379 58.73159
 [9] 55.20057 54.86864
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.71541  70.23097  75.26009  73.92095  70.54227  70.47745  73.58605
 [8]  76.15715  67.91707  72.05932  69.04467  68.09724  67.19127  64.21211
[15]  71.58973  65.78483  69.08476  67.69552  73.99429  65.31475
> colSums(tmp5,na.rm=TRUE)
 [1] 1097.1541  702.3097  752.6009  739.2095  705.4227  704.7745  735.8605
 [8]  761.5715  679.1707  720.5932  690.4467  680.9724  671.9127  642.1211
[15]  715.8973  657.8483  690.8476  676.9552  739.9429  587.8328
> colVars(tmp5,na.rm=TRUE)
 [1] 15846.02399    41.20700    68.35823   121.32045    70.63142    36.98918
 [7]    56.66477   109.34552    92.61914    69.47986    55.73005   108.79667
[13]    59.67572    53.58305    79.15547    86.29911   122.94468   101.52614
[19]    43.91221    35.78069
> colSd(tmp5,na.rm=TRUE)
 [1] 125.880991   6.419268   8.267904  11.014556   8.404250   6.081873
 [7]   7.527600  10.456841   9.623884   8.335458   7.465256  10.430564
[13]   7.725006   7.320044   8.896936   9.289732  11.088042  10.076018
[19]   6.626629   5.981697
> colMax(tmp5,na.rm=TRUE)
 [1] 467.61696  80.73365  91.51058  89.40322  89.33307  78.59589  84.12260
 [8]  92.89400  85.65389  84.41371  82.13080  91.71293  78.65614  81.34696
[15]  80.63554  81.46078  87.16976  85.95629  85.02551  74.16734
> colMin(tmp5,na.rm=TRUE)
 [1] 62.53358 59.55120 66.08642 60.11489 60.88963 59.55848 64.62045 55.09630
 [9] 53.95601 59.79649 59.55882 55.76608 54.98302 54.86864 55.52780 53.28379
[17] 55.20057 55.63309 65.62944 58.39557
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.24224 68.81782 73.29212 72.49985 68.99026      NaN 71.29032 67.56768
 [9] 67.67344 69.82622
> rowSums(tmp5,na.rm=TRUE)
 [1] 1824.845 1376.356 1465.842 1449.997 1379.805    0.000 1425.806 1351.354
 [9] 1353.469 1396.524
> rowVars(tmp5,na.rm=TRUE)
 [1] 7921.38361   99.56941  101.56833   71.67117   55.11688         NA
 [7]   89.59765   58.97130   89.94095   51.59740
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.002155  9.978447 10.078112  8.465883  7.424074        NA  9.465603
 [8]  7.679277  9.483720  7.183133
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.61696  91.51058  92.89400  87.16976  88.79220        NA  91.71293
 [8]  82.50014  89.40322  82.01936
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.29201 54.98302 59.55120 58.63978 53.95601       NA 53.28379 58.73159
 [9] 55.20057 54.86864
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.52799  69.95106  74.94176  75.45496  70.49278  69.57541  73.22512
 [8]  78.49724  67.20306  73.42186  67.59066  68.62132  67.00433  62.30824
[15]  71.30021  66.79267  68.66641  68.33611  73.88506       NaN
> colSums(tmp5,na.rm=TRUE)
 [1] 1030.7519  629.5595  674.4758  679.0946  634.4350  626.1787  659.0261
 [8]  706.4752  604.8275  660.7968  608.3159  617.5919  603.0390  560.7741
[15]  641.7019  601.1341  617.9977  615.0250  664.9655    0.0000
> colVars(tmp5,na.rm=TRUE)
 [1] 17566.21677    45.47641    75.76297   110.01229    79.43279    32.45880
 [7]    62.28233    61.40825    98.46124    57.27913    38.91205   119.30624
[13]    66.74206    19.50274    88.10692    85.65940   136.34389   109.60030
[19]    49.26700          NA
> colSd(tmp5,na.rm=TRUE)
 [1] 132.537605   6.743620   8.704193  10.488674   8.912508   5.697263
 [7]   7.891915   7.836341   9.922764   7.568298   6.237952  10.922739
[13]   8.169581   4.416190   9.386529   9.255237  11.676638  10.469016
[19]   7.019045         NA
> colMax(tmp5,na.rm=TRUE)
 [1] 467.61696  80.73365  91.51058  89.40322  89.33307  75.51831  84.12260
 [8]  92.89400  85.65389  84.41371  80.59284  91.71293  78.65614  67.89172
[15]  80.63554  81.46078  87.16976  85.95629  85.02551      -Inf
> colMin(tmp5,na.rm=TRUE)
 [1] 62.53358 59.55120 66.08642 62.39314 60.88963 59.55848 64.62045 64.68655
 [9] 53.95601 63.71037 59.55882 55.76608 54.98302 54.86864 55.52780 53.28379
[17] 55.20057 55.63309 65.62944      Inf
> 
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 3
> which.col  <- 1
> cat(which.row," ",which.col,"\n")
3   1 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> rowVars(tmp5,na.rm=TRUE)
 [1]  83.58175 324.67553 205.27004 276.80910 189.61890 130.83152 279.22705
 [8] 190.73812 286.80746 182.16541
> apply(copymatrix,1,var,na.rm=TRUE)
 [1]  83.58175 324.67553 205.27004 276.80910 189.61890 130.83152 279.22705
 [8] 190.73812 286.80746 182.16541
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -1.136868e-13 -9.947598e-14 -8.526513e-14 -1.421085e-13  0.000000e+00
 [6] -5.684342e-14  0.000000e+00 -5.684342e-14  1.705303e-13 -4.263256e-14
[11]  1.136868e-13  0.000000e+00  8.526513e-14 -2.842171e-14  5.684342e-14
[16] -1.421085e-13  1.989520e-13 -2.273737e-13  2.273737e-13 -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)
+ }
1   18 
8   8 
1   7 
2   11 
9   6 
4   9 
5   1 
8   16 
2   4 
10   19 
10   10 
4   13 
2   12 
9   19 
2   7 
1   18 
2   19 
1   16 
5   20 
6   12 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 3.141309
> Min(tmp)
[1] -2.909095
> mean(tmp)
[1] 0.1096039
> Sum(tmp)
[1] 10.96039
> Var(tmp)
[1] 1.223398
> 
> rowMeans(tmp)
[1] 0.1096039
> rowSums(tmp)
[1] 10.96039
> rowVars(tmp)
[1] 1.223398
> rowSd(tmp)
[1] 1.106073
> rowMax(tmp)
[1] 3.141309
> rowMin(tmp)
[1] -2.909095
> 
> colMeans(tmp)
  [1]  0.40689847  3.14130910  0.37177278  0.40286302 -2.88494724  1.01096647
  [7]  2.88372492 -0.03806166 -1.43085934  1.15090072  1.00585718 -0.09967717
 [13]  1.89245355  1.43803706 -0.63336487  0.86692571  1.92400365  0.67485310
 [19]  0.78877369  0.08896871  0.85994494  1.77657216 -0.34488670  0.44291040
 [25] -0.02026313  0.38552475  0.46991006  1.61154722 -0.10408419  0.62007271
 [31]  0.80989919 -1.55405363  0.31835491  0.35517210 -0.57310879  2.29331309
 [37] -0.11535740  0.36694618  0.72306683 -0.40315416 -0.22942879 -0.89888377
 [43]  1.48380708 -1.59176290  0.97138821 -0.19388787  0.35171021 -0.99889251
 [49]  1.37291399 -0.18549150 -0.39439091 -0.44831073  0.37146180  0.73748020
 [55] -1.53849619 -0.68539479  1.56568615  0.07389661 -1.35484292  0.90551941
 [61] -0.42942941 -0.79086432 -0.39444144  0.31801490  0.71367187  0.95586420
 [67] -1.24918128 -0.04700922  1.69807854 -0.66367796  0.35227497 -0.36746386
 [73]  1.44551817 -1.49030512  0.73588567 -1.33028833 -0.95906062  0.20638389
 [79] -0.99543385 -0.29518622 -0.34505517 -0.97312320 -0.22069612 -1.27226076
 [85] -0.51440416 -0.09535646 -0.03058337 -1.29014905 -0.03541041  0.15736115
 [91]  0.58971868  1.33622224 -0.01729363 -1.47113829  1.13744142 -2.90909497
 [97]  1.18918308  0.98615083 -2.10114033 -0.76713942
> colSums(tmp)
  [1]  0.40689847  3.14130910  0.37177278  0.40286302 -2.88494724  1.01096647
  [7]  2.88372492 -0.03806166 -1.43085934  1.15090072  1.00585718 -0.09967717
 [13]  1.89245355  1.43803706 -0.63336487  0.86692571  1.92400365  0.67485310
 [19]  0.78877369  0.08896871  0.85994494  1.77657216 -0.34488670  0.44291040
 [25] -0.02026313  0.38552475  0.46991006  1.61154722 -0.10408419  0.62007271
 [31]  0.80989919 -1.55405363  0.31835491  0.35517210 -0.57310879  2.29331309
 [37] -0.11535740  0.36694618  0.72306683 -0.40315416 -0.22942879 -0.89888377
 [43]  1.48380708 -1.59176290  0.97138821 -0.19388787  0.35171021 -0.99889251
 [49]  1.37291399 -0.18549150 -0.39439091 -0.44831073  0.37146180  0.73748020
 [55] -1.53849619 -0.68539479  1.56568615  0.07389661 -1.35484292  0.90551941
 [61] -0.42942941 -0.79086432 -0.39444144  0.31801490  0.71367187  0.95586420
 [67] -1.24918128 -0.04700922  1.69807854 -0.66367796  0.35227497 -0.36746386
 [73]  1.44551817 -1.49030512  0.73588567 -1.33028833 -0.95906062  0.20638389
 [79] -0.99543385 -0.29518622 -0.34505517 -0.97312320 -0.22069612 -1.27226076
 [85] -0.51440416 -0.09535646 -0.03058337 -1.29014905 -0.03541041  0.15736115
 [91]  0.58971868  1.33622224 -0.01729363 -1.47113829  1.13744142 -2.90909497
 [97]  1.18918308  0.98615083 -2.10114033 -0.76713942
> 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.40689847  3.14130910  0.37177278  0.40286302 -2.88494724  1.01096647
  [7]  2.88372492 -0.03806166 -1.43085934  1.15090072  1.00585718 -0.09967717
 [13]  1.89245355  1.43803706 -0.63336487  0.86692571  1.92400365  0.67485310
 [19]  0.78877369  0.08896871  0.85994494  1.77657216 -0.34488670  0.44291040
 [25] -0.02026313  0.38552475  0.46991006  1.61154722 -0.10408419  0.62007271
 [31]  0.80989919 -1.55405363  0.31835491  0.35517210 -0.57310879  2.29331309
 [37] -0.11535740  0.36694618  0.72306683 -0.40315416 -0.22942879 -0.89888377
 [43]  1.48380708 -1.59176290  0.97138821 -0.19388787  0.35171021 -0.99889251
 [49]  1.37291399 -0.18549150 -0.39439091 -0.44831073  0.37146180  0.73748020
 [55] -1.53849619 -0.68539479  1.56568615  0.07389661 -1.35484292  0.90551941
 [61] -0.42942941 -0.79086432 -0.39444144  0.31801490  0.71367187  0.95586420
 [67] -1.24918128 -0.04700922  1.69807854 -0.66367796  0.35227497 -0.36746386
 [73]  1.44551817 -1.49030512  0.73588567 -1.33028833 -0.95906062  0.20638389
 [79] -0.99543385 -0.29518622 -0.34505517 -0.97312320 -0.22069612 -1.27226076
 [85] -0.51440416 -0.09535646 -0.03058337 -1.29014905 -0.03541041  0.15736115
 [91]  0.58971868  1.33622224 -0.01729363 -1.47113829  1.13744142 -2.90909497
 [97]  1.18918308  0.98615083 -2.10114033 -0.76713942
> colMin(tmp)
  [1]  0.40689847  3.14130910  0.37177278  0.40286302 -2.88494724  1.01096647
  [7]  2.88372492 -0.03806166 -1.43085934  1.15090072  1.00585718 -0.09967717
 [13]  1.89245355  1.43803706 -0.63336487  0.86692571  1.92400365  0.67485310
 [19]  0.78877369  0.08896871  0.85994494  1.77657216 -0.34488670  0.44291040
 [25] -0.02026313  0.38552475  0.46991006  1.61154722 -0.10408419  0.62007271
 [31]  0.80989919 -1.55405363  0.31835491  0.35517210 -0.57310879  2.29331309
 [37] -0.11535740  0.36694618  0.72306683 -0.40315416 -0.22942879 -0.89888377
 [43]  1.48380708 -1.59176290  0.97138821 -0.19388787  0.35171021 -0.99889251
 [49]  1.37291399 -0.18549150 -0.39439091 -0.44831073  0.37146180  0.73748020
 [55] -1.53849619 -0.68539479  1.56568615  0.07389661 -1.35484292  0.90551941
 [61] -0.42942941 -0.79086432 -0.39444144  0.31801490  0.71367187  0.95586420
 [67] -1.24918128 -0.04700922  1.69807854 -0.66367796  0.35227497 -0.36746386
 [73]  1.44551817 -1.49030512  0.73588567 -1.33028833 -0.95906062  0.20638389
 [79] -0.99543385 -0.29518622 -0.34505517 -0.97312320 -0.22069612 -1.27226076
 [85] -0.51440416 -0.09535646 -0.03058337 -1.29014905 -0.03541041  0.15736115
 [91]  0.58971868  1.33622224 -0.01729363 -1.47113829  1.13744142 -2.90909497
 [97]  1.18918308  0.98615083 -2.10114033 -0.76713942
> colMedians(tmp)
  [1]  0.40689847  3.14130910  0.37177278  0.40286302 -2.88494724  1.01096647
  [7]  2.88372492 -0.03806166 -1.43085934  1.15090072  1.00585718 -0.09967717
 [13]  1.89245355  1.43803706 -0.63336487  0.86692571  1.92400365  0.67485310
 [19]  0.78877369  0.08896871  0.85994494  1.77657216 -0.34488670  0.44291040
 [25] -0.02026313  0.38552475  0.46991006  1.61154722 -0.10408419  0.62007271
 [31]  0.80989919 -1.55405363  0.31835491  0.35517210 -0.57310879  2.29331309
 [37] -0.11535740  0.36694618  0.72306683 -0.40315416 -0.22942879 -0.89888377
 [43]  1.48380708 -1.59176290  0.97138821 -0.19388787  0.35171021 -0.99889251
 [49]  1.37291399 -0.18549150 -0.39439091 -0.44831073  0.37146180  0.73748020
 [55] -1.53849619 -0.68539479  1.56568615  0.07389661 -1.35484292  0.90551941
 [61] -0.42942941 -0.79086432 -0.39444144  0.31801490  0.71367187  0.95586420
 [67] -1.24918128 -0.04700922  1.69807854 -0.66367796  0.35227497 -0.36746386
 [73]  1.44551817 -1.49030512  0.73588567 -1.33028833 -0.95906062  0.20638389
 [79] -0.99543385 -0.29518622 -0.34505517 -0.97312320 -0.22069612 -1.27226076
 [85] -0.51440416 -0.09535646 -0.03058337 -1.29014905 -0.03541041  0.15736115
 [91]  0.58971868  1.33622224 -0.01729363 -1.47113829  1.13744142 -2.90909497
 [97]  1.18918308  0.98615083 -2.10114033 -0.76713942
> colRanges(tmp)
          [,1]     [,2]      [,3]     [,4]      [,5]     [,6]     [,7]
[1,] 0.4068985 3.141309 0.3717728 0.402863 -2.884947 1.010966 2.883725
[2,] 0.4068985 3.141309 0.3717728 0.402863 -2.884947 1.010966 2.883725
            [,8]      [,9]    [,10]    [,11]       [,12]    [,13]    [,14]
[1,] -0.03806166 -1.430859 1.150901 1.005857 -0.09967717 1.892454 1.438037
[2,] -0.03806166 -1.430859 1.150901 1.005857 -0.09967717 1.892454 1.438037
          [,15]     [,16]    [,17]     [,18]     [,19]      [,20]     [,21]
[1,] -0.6333649 0.8669257 1.924004 0.6748531 0.7887737 0.08896871 0.8599449
[2,] -0.6333649 0.8669257 1.924004 0.6748531 0.7887737 0.08896871 0.8599449
        [,22]      [,23]     [,24]       [,25]     [,26]     [,27]    [,28]
[1,] 1.776572 -0.3448867 0.4429104 -0.02026313 0.3855248 0.4699101 1.611547
[2,] 1.776572 -0.3448867 0.4429104 -0.02026313 0.3855248 0.4699101 1.611547
          [,29]     [,30]     [,31]     [,32]     [,33]     [,34]      [,35]
[1,] -0.1040842 0.6200727 0.8098992 -1.554054 0.3183549 0.3551721 -0.5731088
[2,] -0.1040842 0.6200727 0.8098992 -1.554054 0.3183549 0.3551721 -0.5731088
        [,36]      [,37]     [,38]     [,39]      [,40]      [,41]      [,42]
[1,] 2.293313 -0.1153574 0.3669462 0.7230668 -0.4031542 -0.2294288 -0.8988838
[2,] 2.293313 -0.1153574 0.3669462 0.7230668 -0.4031542 -0.2294288 -0.8988838
        [,43]     [,44]     [,45]      [,46]     [,47]      [,48]    [,49]
[1,] 1.483807 -1.591763 0.9713882 -0.1938879 0.3517102 -0.9988925 1.372914
[2,] 1.483807 -1.591763 0.9713882 -0.1938879 0.3517102 -0.9988925 1.372914
          [,50]      [,51]      [,52]     [,53]     [,54]     [,55]      [,56]
[1,] -0.1854915 -0.3943909 -0.4483107 0.3714618 0.7374802 -1.538496 -0.6853948
[2,] -0.1854915 -0.3943909 -0.4483107 0.3714618 0.7374802 -1.538496 -0.6853948
        [,57]      [,58]     [,59]     [,60]      [,61]      [,62]      [,63]
[1,] 1.565686 0.07389661 -1.354843 0.9055194 -0.4294294 -0.7908643 -0.3944414
[2,] 1.565686 0.07389661 -1.354843 0.9055194 -0.4294294 -0.7908643 -0.3944414
         [,64]     [,65]     [,66]     [,67]       [,68]    [,69]     [,70]
[1,] 0.3180149 0.7136719 0.9558642 -1.249181 -0.04700922 1.698079 -0.663678
[2,] 0.3180149 0.7136719 0.9558642 -1.249181 -0.04700922 1.698079 -0.663678
        [,71]      [,72]    [,73]     [,74]     [,75]     [,76]      [,77]
[1,] 0.352275 -0.3674639 1.445518 -1.490305 0.7358857 -1.330288 -0.9590606
[2,] 0.352275 -0.3674639 1.445518 -1.490305 0.7358857 -1.330288 -0.9590606
         [,78]      [,79]      [,80]      [,81]      [,82]      [,83]     [,84]
[1,] 0.2063839 -0.9954338 -0.2951862 -0.3450552 -0.9731232 -0.2206961 -1.272261
[2,] 0.2063839 -0.9954338 -0.2951862 -0.3450552 -0.9731232 -0.2206961 -1.272261
          [,85]       [,86]       [,87]     [,88]       [,89]     [,90]
[1,] -0.5144042 -0.09535646 -0.03058337 -1.290149 -0.03541041 0.1573612
[2,] -0.5144042 -0.09535646 -0.03058337 -1.290149 -0.03541041 0.1573612
         [,91]    [,92]       [,93]     [,94]    [,95]     [,96]    [,97]
[1,] 0.5897187 1.336222 -0.01729363 -1.471138 1.137441 -2.909095 1.189183
[2,] 0.5897187 1.336222 -0.01729363 -1.471138 1.137441 -2.909095 1.189183
         [,98]    [,99]     [,100]
[1,] 0.9861508 -2.10114 -0.7671394
[2,] 0.9861508 -2.10114 -0.7671394
> 
> 
> Max(tmp2)
[1] 2.359761
> Min(tmp2)
[1] -2.743123
> mean(tmp2)
[1] 0.003968145
> Sum(tmp2)
[1] 0.3968145
> Var(tmp2)
[1] 0.9588095
> 
> rowMeans(tmp2)
  [1] -0.53448240 -2.74312330 -1.27089452 -0.54623810  0.36864555 -1.08888574
  [7]  0.82121137  0.42899906 -0.53719301  0.62897778 -0.90525670 -0.23549201
 [13]  1.08734827  0.67302062  1.11586801 -1.73188444 -0.77300508 -1.22061129
 [19] -1.40583242  1.02237693 -0.48665579 -0.61083740  0.81057631 -0.31967085
 [25] -1.27096358 -1.87908466  0.33802706 -1.16437112 -0.80957879 -0.74424124
 [31] -0.39915935  1.28569794 -0.88054261  2.35976144 -1.05639921  0.24566596
 [37]  0.20844185  0.73118544  0.57133587  1.02779413  0.88518707  1.02125361
 [43] -0.14509804 -0.02814121 -1.07684982  0.96375589 -1.55291964  0.28647627
 [49] -0.22588939  1.12168147  0.79655816  0.79655666  0.11806717  1.50597049
 [55] -0.22661203  1.27561727  0.94827610  0.49410662  0.37685646 -0.31149404
 [61]  0.51343727  1.15931624 -0.72148743  0.09375604  0.33098935  0.41535074
 [67] -0.31328896  0.19847565  0.82303604 -0.82572160 -2.04101943  0.67547996
 [73]  0.32574972 -1.24202097 -0.14694885  0.70161960 -1.36336903 -0.53837879
 [79] -0.12836839 -0.02503965 -0.41927502 -0.56859402  1.61850875  1.11569397
 [85] -0.54456212 -1.29232080  0.91672527  1.05538737 -0.85546343 -1.08205960
 [91] -1.43259329  0.69671836  0.32366040  0.39094312  1.76718350  0.79387261
 [97]  1.18356359  0.34372823  1.67118732 -1.31094628
> rowSums(tmp2)
  [1] -0.53448240 -2.74312330 -1.27089452 -0.54623810  0.36864555 -1.08888574
  [7]  0.82121137  0.42899906 -0.53719301  0.62897778 -0.90525670 -0.23549201
 [13]  1.08734827  0.67302062  1.11586801 -1.73188444 -0.77300508 -1.22061129
 [19] -1.40583242  1.02237693 -0.48665579 -0.61083740  0.81057631 -0.31967085
 [25] -1.27096358 -1.87908466  0.33802706 -1.16437112 -0.80957879 -0.74424124
 [31] -0.39915935  1.28569794 -0.88054261  2.35976144 -1.05639921  0.24566596
 [37]  0.20844185  0.73118544  0.57133587  1.02779413  0.88518707  1.02125361
 [43] -0.14509804 -0.02814121 -1.07684982  0.96375589 -1.55291964  0.28647627
 [49] -0.22588939  1.12168147  0.79655816  0.79655666  0.11806717  1.50597049
 [55] -0.22661203  1.27561727  0.94827610  0.49410662  0.37685646 -0.31149404
 [61]  0.51343727  1.15931624 -0.72148743  0.09375604  0.33098935  0.41535074
 [67] -0.31328896  0.19847565  0.82303604 -0.82572160 -2.04101943  0.67547996
 [73]  0.32574972 -1.24202097 -0.14694885  0.70161960 -1.36336903 -0.53837879
 [79] -0.12836839 -0.02503965 -0.41927502 -0.56859402  1.61850875  1.11569397
 [85] -0.54456212 -1.29232080  0.91672527  1.05538737 -0.85546343 -1.08205960
 [91] -1.43259329  0.69671836  0.32366040  0.39094312  1.76718350  0.79387261
 [97]  1.18356359  0.34372823  1.67118732 -1.31094628
> 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.53448240 -2.74312330 -1.27089452 -0.54623810  0.36864555 -1.08888574
  [7]  0.82121137  0.42899906 -0.53719301  0.62897778 -0.90525670 -0.23549201
 [13]  1.08734827  0.67302062  1.11586801 -1.73188444 -0.77300508 -1.22061129
 [19] -1.40583242  1.02237693 -0.48665579 -0.61083740  0.81057631 -0.31967085
 [25] -1.27096358 -1.87908466  0.33802706 -1.16437112 -0.80957879 -0.74424124
 [31] -0.39915935  1.28569794 -0.88054261  2.35976144 -1.05639921  0.24566596
 [37]  0.20844185  0.73118544  0.57133587  1.02779413  0.88518707  1.02125361
 [43] -0.14509804 -0.02814121 -1.07684982  0.96375589 -1.55291964  0.28647627
 [49] -0.22588939  1.12168147  0.79655816  0.79655666  0.11806717  1.50597049
 [55] -0.22661203  1.27561727  0.94827610  0.49410662  0.37685646 -0.31149404
 [61]  0.51343727  1.15931624 -0.72148743  0.09375604  0.33098935  0.41535074
 [67] -0.31328896  0.19847565  0.82303604 -0.82572160 -2.04101943  0.67547996
 [73]  0.32574972 -1.24202097 -0.14694885  0.70161960 -1.36336903 -0.53837879
 [79] -0.12836839 -0.02503965 -0.41927502 -0.56859402  1.61850875  1.11569397
 [85] -0.54456212 -1.29232080  0.91672527  1.05538737 -0.85546343 -1.08205960
 [91] -1.43259329  0.69671836  0.32366040  0.39094312  1.76718350  0.79387261
 [97]  1.18356359  0.34372823  1.67118732 -1.31094628
> rowMin(tmp2)
  [1] -0.53448240 -2.74312330 -1.27089452 -0.54623810  0.36864555 -1.08888574
  [7]  0.82121137  0.42899906 -0.53719301  0.62897778 -0.90525670 -0.23549201
 [13]  1.08734827  0.67302062  1.11586801 -1.73188444 -0.77300508 -1.22061129
 [19] -1.40583242  1.02237693 -0.48665579 -0.61083740  0.81057631 -0.31967085
 [25] -1.27096358 -1.87908466  0.33802706 -1.16437112 -0.80957879 -0.74424124
 [31] -0.39915935  1.28569794 -0.88054261  2.35976144 -1.05639921  0.24566596
 [37]  0.20844185  0.73118544  0.57133587  1.02779413  0.88518707  1.02125361
 [43] -0.14509804 -0.02814121 -1.07684982  0.96375589 -1.55291964  0.28647627
 [49] -0.22588939  1.12168147  0.79655816  0.79655666  0.11806717  1.50597049
 [55] -0.22661203  1.27561727  0.94827610  0.49410662  0.37685646 -0.31149404
 [61]  0.51343727  1.15931624 -0.72148743  0.09375604  0.33098935  0.41535074
 [67] -0.31328896  0.19847565  0.82303604 -0.82572160 -2.04101943  0.67547996
 [73]  0.32574972 -1.24202097 -0.14694885  0.70161960 -1.36336903 -0.53837879
 [79] -0.12836839 -0.02503965 -0.41927502 -0.56859402  1.61850875  1.11569397
 [85] -0.54456212 -1.29232080  0.91672527  1.05538737 -0.85546343 -1.08205960
 [91] -1.43259329  0.69671836  0.32366040  0.39094312  1.76718350  0.79387261
 [97]  1.18356359  0.34372823  1.67118732 -1.31094628
> 
> colMeans(tmp2)
[1] 0.003968145
> colSums(tmp2)
[1] 0.3968145
> colVars(tmp2)
[1] 0.9588095
> colSd(tmp2)
[1] 0.9791882
> colMax(tmp2)
[1] 2.359761
> colMin(tmp2)
[1] -2.743123
> colMedians(tmp2)
[1] 0.1582714
> colRanges(tmp2)
          [,1]
[1,] -2.743123
[2,]  2.359761
> 
> 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.038143036  2.161608160 -0.817783792 -0.996737635  2.138312239
 [6] -5.929546901 -3.927887277 -0.136093299  0.001489514  1.925548005
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8783600
[2,] -0.8540888
[3,] -0.1429356
[4,]  0.6851394
[5,]  1.3414105
> 
> rowApply(tmp,sum)
 [1]  0.7311486  1.7977133 -1.3897499 -4.1465524  2.0451338 -7.1170069
 [7]  3.6627986 -2.3264926  3.4398054 -4.3160318
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1   10    7    3    2    5    6    9    7     1
 [2,]    9    8    3    2    5    2   10    7   10     4
 [3,]    7    1    2    9    6    9    5    4    6    10
 [4,]   10    7    6    1    7    6    3    8    1     5
 [5,]    2    6   10    5    8    3    9    1    9     6
 [6,]    4    4    1   10    3    1    1    5    4     8
 [7,]    8    2    5    7    1    7    2    2    2     9
 [8,]    3    9    9    6    4    4    4   10    8     2
 [9,]    5    3    8    4    9    8    8    6    3     3
[10,]    6    5    4    8   10   10    7    3    5     7
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.01375341 -2.03407945 -3.08390967 -4.21884682  0.39271919 -0.44275355
 [7]  1.62653092  0.70974219  3.20220117  0.23537118 -1.00361615 -0.73275435
[13]  1.14228498 -0.50005568 -6.75144895  0.78132441  0.20576030 -0.32238008
[19]  0.75259137  2.22602037
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.15851804
[2,] -0.49723436
[3,] -0.34385002
[4,]  0.01999221
[5,]  1.99336362
> 
> rowApply(tmp,sum)
[1]  7.3157041 -5.6007415 -5.7179356  0.9482491 -4.7468213
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   19    2    9    6   14
[2,]    6    4    4   11    9
[3,]    4   17   10    7    2
[4,]   13   20    2    1    7
[5,]    5   16   18    9   16
> 
> 
> as.matrix(tmp)
            [,1]        [,2]       [,3]       [,4]        [,5]       [,6]
[1,]  1.99336362  0.09993282 -0.9989919  0.6373741 -0.45235808  0.1406867
[2,] -1.15851804 -0.82165449  0.2979459  0.8119383  0.27029541  0.1510893
[3,] -0.34385002 -1.14184097 -0.2595696 -2.3983053  0.39658995 -0.1375246
[4,] -0.49723436  0.16326413 -0.4665397 -2.8895248 -0.08102237 -0.8620591
[5,]  0.01999221 -0.33378095 -1.6567544 -0.3803291  0.25921428  0.2650542
            [,7]        [,8]       [,9]      [,10]      [,11]      [,12]
[1,]  0.58928561  0.34573648  2.0184733  1.2355836  0.6058366  1.3889274
[2,] -0.28188776 -0.71946419 -0.6355012 -0.7053920  0.5775640 -1.3777841
[3,] -0.43143378 -0.62882966 -0.7850842 -0.1342459 -1.2200479  0.2927464
[4,]  1.78719391  1.79702702  1.6392974  0.1410784  0.2795518 -0.6290275
[5,] -0.03662707 -0.08472746  0.9650159 -0.3016529 -1.2465206 -0.4076166
          [,13]      [,14]      [,15]       [,16]      [,17]      [,18]
[1,]  0.6541298 -1.2838001 -1.7005363  0.48480376  0.7845461 -1.0242431
[2,]  0.1985294  0.4571766 -0.7776120  0.08247832 -0.8226617 -0.2323745
[3,]  0.2767239  1.1790086 -2.5485488 -0.19294115 -0.9294236  0.1818759
[4,]  0.3166795 -0.5169824 -0.9714813  0.95729714 -0.1047837  0.5337654
[5,] -0.3037776 -0.3354585 -0.7532705 -0.55031366  1.2780831  0.2185963
          [,19]      [,20]
[1,]  0.3971158  1.3998378
[2,] -0.7508901 -0.1640185
[3,]  0.1886844  2.9180807
[4,]  0.1684590  0.1832908
[5,]  0.7492223 -2.1111704
> 
> 
> 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.19-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.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  650  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  563  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.19-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.979714 1.973115 -0.7371795 -0.3282628 0.2607989 1.17419 1.087823
         col8      col9     col10     col11    col12    col13      col14
row1 1.335119 -2.137027 0.3482812 -1.938213 1.485487 1.319329 0.09749017
          col15   col16     col17      col18      col19     col20
row1 -0.3699238 -1.3512 -2.046831 -0.7357016 -0.9389319 0.6120565
> tmp[,"col10"]
          col10
row1  0.3482812
row2 -0.9739796
row3  1.0277144
row4 -0.4286561
row5 -0.2992001
> tmp[c("row1","row5"),]
           col1      col2       col3        col4       col5    col6       col7
row1 -0.9797140  1.973115 -0.7371795 -0.32826281  0.2607989 1.17419  1.0878235
row5  0.6009639 -1.690591 -0.9910759  0.09794024 -0.1069211 1.05800 -0.7451568
           col8       col9      col10      col11      col12      col13
row1  1.3351188 -2.1370274  0.3482812 -1.9382128  1.4854869 1.31932945
row5 -0.0379285  0.1734519 -0.2992001  0.5517953 -0.9333287 0.03319928
          col14      col15      col16       col17      col18      col19
row1 0.09749017 -0.3699238 -1.3512003 -2.04683085 -0.7357016 -0.9389319
row5 0.17502872  0.3275003  0.6859483  0.01006674 -1.4857541 -1.0469115
         col20
row1 0.6120565
row5 0.1177354
> tmp[,c("col6","col20")]
           col6      col20
row1  1.1741899  0.6120565
row2 -0.2877931 -1.2638454
row3  2.0316783  0.2353746
row4 -1.4635415  0.7780192
row5  1.0579999  0.1177354
> tmp[c("row1","row5"),c("col6","col20")]
        col6     col20
row1 1.17419 0.6120565
row5 1.05800 0.1177354
> 
> 
> 
> 
> 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 48.9814 52.36711 50.26893 49.94581 50.99643 106.1677 51.08372 51.30958
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.57378 48.97241 50.80322 49.25809 49.21714 49.48074 52.05422 50.75067
        col17    col18    col19    col20
row1 48.02748 49.81941 50.66643 106.2919
> tmp[,"col10"]
        col10
row1 48.97241
row2 29.21559
row3 30.79496
row4 29.65719
row5 51.83076
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.98140 52.36711 50.26893 49.94581 50.99643 106.1677 51.08372 51.30958
row5 50.03095 50.44214 48.03592 52.19535 50.29021 106.2645 49.84543 51.41729
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.57378 48.97241 50.80322 49.25809 49.21714 49.48074 52.05422 50.75067
row5 50.45594 51.83076 49.02164 49.15850 48.52205 48.34297 50.21235 48.98133
        col17    col18    col19    col20
row1 48.02748 49.81941 50.66643 106.2919
row5 48.30820 50.14147 51.22460 104.5908
> tmp[,c("col6","col20")]
          col6     col20
row1 106.16772 106.29186
row2  74.40871  75.18579
row3  74.66469  75.37388
row4  77.12125  73.52647
row5 106.26447 104.59077
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.1677 106.2919
row5 106.2645 104.5908
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.1677 106.2919
row5 106.2645 104.5908
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  1.74244262
[2,] -0.65871528
[3,]  0.07540238
[4,] -1.53883117
[5,]  1.68791111
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.9193061  0.2893267
[2,] -0.6279261  0.5909574
[3,]  0.1288984 -0.1470679
[4,]  0.2878357  1.2746990
[5,]  1.4257696  0.3352009
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.0498677  0.6602365
[2,]  1.2219473  0.7269425
[3,] -0.3618195  0.2911228
[4,]  0.3390302  0.4956325
[5,] -0.1480620 -1.2805062
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.0498677
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.0498677
[2,]  1.2219473
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]       [,3]       [,4]      [,5]       [,6]       [,7]
row3  0.3098337 2.5323301  0.5784456 -0.8061145 -1.170465 -0.4354838 -1.3793180
row1 -1.9183093 0.4947287 -1.2032003  1.4416927 -1.263639 -0.6198482 -0.3862111
           [,8]      [,9]     [,10]      [,11]      [,12]      [,13]      [,14]
row3 -1.5965776 -1.632826 0.9842295 0.05821965 -0.2936825 -0.8491813 1.57101544
row1 -0.4816127 -0.521626 0.6071731 0.94153718  0.9575735  0.6638517 0.09037622
          [,15]     [,16]      [,17]     [,18]      [,19]     [,20]
row3  0.4561473 -1.683320  1.3303420 0.4237737 -1.0755468 -0.276591
row1 -2.0388534  2.100311 -0.3151348 0.2466855  0.5332375  1.138681
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]      [,2]       [,3]     [,4]      [,5]      [,6]       [,7]
row2 -0.1939987 0.2782809 -0.9486304 1.793609 0.6831086 0.3317293 -0.8197682
           [,8]     [,9]       [,10]
row2 -0.1309485 1.750543 -0.08181413
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]       [,2]       [,3]      [,4]     [,5]       [,6]       [,7]
row5 -0.3767914 -0.1506564 -0.6498068 -1.218852 1.224166 -0.1568856 -0.4890611
         [,8]       [,9]      [,10]     [,11]      [,12]     [,13]       [,14]
row5 1.235136 0.08086852 -0.2452088 0.7595766 -0.8584444 0.1833478 -0.08789639
           [,15]    [,16]    [,17]     [,18]     [,19]     [,20]
row5 0.003812388 0.784022 1.354252 0.1750641 0.3803504 -0.449938
> 
> 
> 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: 0x600002c48060>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15006b1c0374"
 [2] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15007c26eb9b"
 [3] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15005f364cca"
 [4] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM150065eb929b"
 [5] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15004ce63263"
 [6] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15001cf62906"
 [7] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM150064ff57c4"
 [8] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM150037db38a9"
 [9] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15001964fbe5"
[10] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM150034d58469"
[11] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15002de82498"
[12] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM150063ba8eb3"
[13] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15006ceebceb"
[14] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15002db5202c"
[15] "/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM15004e534025"
> 
> 
> ### 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: 0x600002cc8060>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x600002cc8060>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x600002cc8060>
> rowMedians(tmp)
  [1] -0.235145362 -0.345760858  0.390279398 -0.053457202  0.028038936
  [6] -0.191944706 -0.099564952  0.316895837 -0.619848571  0.081577064
 [11]  0.604906113 -0.395413124  0.286570232  0.003380058 -0.275766738
 [16] -0.121932003 -0.252299512 -0.442360646  0.066397429  0.087645178
 [21]  0.269442777  0.246730984  0.350754406 -0.205144616 -0.034117906
 [26] -0.048985123 -0.342491648  0.074440321  0.086890397  0.455620636
 [31] -0.105510451  0.104541636  0.574730077  0.140992498  0.359709943
 [36] -0.077518481  0.013420022 -0.326646159 -0.110323172 -0.101151497
 [41] -0.474066217  0.115029260  0.086079871 -0.489167114  0.142438033
 [46] -0.199024197 -0.072372220 -0.052776793  0.037624731 -0.624840691
 [51] -0.241620527 -0.216705278  0.211637233 -0.651591396 -0.192220624
 [56]  0.279727845  0.095211488 -0.231010832 -0.461478440 -0.474864036
 [61] -0.039031519 -0.426739387 -0.454005145  0.376618219 -0.192694974
 [66] -0.259842821  0.057601530  0.108120449 -0.300747016 -0.298531983
 [71] -0.027643135 -0.543268966 -0.441836003 -0.049161733 -0.181528486
 [76] -0.397531759 -0.645917329  0.179494367 -0.027469098 -0.075026814
 [81] -0.106183325  0.477352495 -0.319672303 -0.173439051 -0.365183781
 [86] -0.187570503 -0.537867566  0.407613479  0.275103468  0.661960585
 [91] -0.361572185  0.015041652 -0.149365544  0.047466570 -0.130294384
 [96] -0.561608575 -0.033400161  0.515023464  0.255063104 -0.206434372
[101]  0.722451798 -0.060260661 -0.339619642 -0.558945346  0.394536525
[106]  0.084683507  0.305601442  0.110515373 -0.238091311 -0.818069755
[111] -0.150591252 -0.348737473  0.084722545 -0.157296842 -0.554693605
[116]  0.630963516  0.757241579  0.062039352  0.333300139 -0.571484691
[121] -0.017717510  0.015756689  0.194078459 -0.296184456  0.196086221
[126]  0.615521450 -0.002636320 -0.296561556  0.040121310  0.097174619
[131]  0.519323728 -0.594616038 -0.580028420 -0.165933919  0.119816923
[136]  0.817962825  0.018409654 -0.436082296  0.091651888  0.020762553
[141] -0.808438873 -0.060065291 -0.413432148 -0.288336769 -0.252320402
[146]  0.287724021  0.494186378 -0.089113265  0.066894686 -0.183574494
[151]  0.805328511 -0.058199509 -0.110821956  0.002795709  0.257519543
[156]  0.121271553  0.124521952  0.133754731  0.576588841  0.551424099
[161] -0.205973186  0.683787923 -0.572910198 -0.482241040  0.214365104
[166]  0.125321677 -0.165864785  0.422739435 -0.477110942  0.303371823
[171] -0.120740065 -0.234295227  0.043015439 -0.422262621  0.500805792
[176]  0.125366302  0.117008360  0.307428896 -0.075713004 -0.280806213
[181]  0.288920790 -0.557798816  0.137413820  0.049764664  0.415589212
[186] -0.022369039 -0.025057276 -0.051106624  0.278460341 -0.058365348
[191]  0.282401347 -0.452247678  0.512863042 -0.186117500  0.170179607
[196] -0.071546788 -0.385093622 -0.611244954  0.308578958 -0.511793020
[201] -0.199976060  0.288454251 -0.576494135 -0.150752503  0.208601020
[206] -0.166129900  0.646647320  0.905396138 -0.144203140  0.376572415
[211]  0.471771257 -0.025691748 -0.365090616 -0.049954663 -0.194816395
[216] -0.172351766  0.070906433  0.235283525  0.349388874  0.043161041
[221]  0.383387008  0.003545751  0.780093238 -0.582146384  0.195205944
[226] -0.079625572  0.403832412 -0.043769905 -0.085213170  0.458583957
> 
> proc.time()
   user  system elapsed 
  2.739  15.279  20.501 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 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: 0x600001104180>
> .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: 0x600001104180>
> .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: 0x600001104180>
> .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: 0x600001104180>
> 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: 0x600001144000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001144000>
> .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: 0x600001144000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001144000>
> .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: 0x600001144000>
> 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: 0x600001140000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001140000>
> .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: 0x600001140000>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x600001140000>
> .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: 0x600001140000>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x600001140000>
> .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: 0x600001140000>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x600001140000>
> .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: 0x600001140000>
> 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: 0x60000114c060>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x60000114c060>
> .Call("R_bm_AddColumn",P)
<pointer: 0x60000114c060>
> .Call("R_bm_AddColumn",P)
<pointer: 0x60000114c060>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1d3943d1c0f"  "BufferedMatrixFile1d3947fd1ef5"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1d3943d1c0f"  "BufferedMatrixFile1d3947fd1ef5"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x60000114c300>
> .Call("R_bm_AddColumn",P)
<pointer: 0x60000114c300>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x60000114c300>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x60000114c300>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x60000114c300>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x60000114c300>
> .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: 0x600001148000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600001148000>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x600001148000>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x600001148000>
> 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: 0x600001150000>
> .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: 0x600001150000>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.334   0.149   0.508 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 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.362   0.102   0.471 

Example timings