Back to Multiple platform build/check report for BioC 3.7
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

CHECK report for BufferedMatrix on tokay2

This page was generated on 2018-10-17 08:33:06 -0400 (Wed, 17 Oct 2018).

Package 172/1561HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.44.0
Ben Bolstad
Snapshot Date: 2018-10-15 16:45:08 -0400 (Mon, 15 Oct 2018)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_7
Last Commit: 6087ec6
Last Changed Date: 2018-04-30 10:35:06 -0400 (Mon, 30 Apr 2018)
malbec2 Linux (Ubuntu 16.04.1 LTS) / x86_64  OK  OK  OK UNNEEDED, same version exists in internal repository
tokay2 Windows Server 2012 R2 Standard / x64  OK  OK [ OK ] OK UNNEEDED, same version exists in internal repository
merida2 OS X 10.11.6 El Capitan / x86_64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.44.0
Command: C:\Users\biocbuild\bbs-3.7-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.7-bioc\R\library --no-vignettes --timings BufferedMatrix_1.44.0.tar.gz
StartedAt: 2018-10-17 00:51:18 -0400 (Wed, 17 Oct 2018)
EndedAt: 2018-10-17 00:52:22 -0400 (Wed, 17 Oct 2018)
EllapsedTime: 63.4 seconds
RetCode: 0
Status:  OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   C:\Users\biocbuild\bbs-3.7-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.7-bioc\R\library --no-vignettes --timings BufferedMatrix_1.44.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory 'C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck'
* using R version 3.5.1 Patched (2018-07-24 r75005)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* using option '--no-vignettes'
* checking for file 'BufferedMatrix/DESCRIPTION' ... OK
* this is package 'BufferedMatrix' version '1.44.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 whether package 'BufferedMatrix' can be installed ... OK
* 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 R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* loading checks for arch 'i386'
** 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
* loading checks for arch 'x64'
** 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
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 for i386 is not available
Note: information on .o files for x64 is not available
File 'C:/Users/biocbuild/bbs-3.7-bioc/R/library/BufferedMatrix/libs/i386/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)

Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console, nor use Fortran I/O
nor system RNGs. The detected symbols are linked into the code but
might come from libraries and not actually be called.

See 'Writing portable packages' in the 'Writing R Extensions' manual.
* checking files in 'vignettes' ... OK
* checking examples ... NONE
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
** running tests for arch 'i386' ...
  Running 'Rcodetesting.R'
  Running 'c_code_level_tests.R'
  Running 'objectTesting.R'
  Running 'rawCalltesting.R'
 OK
** running tests for arch 'x64' ...
  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 in 'inst/doc' ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 2 NOTEs
See
  'C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/00check.log'
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   C:\cygwin\bin\curl.exe -O https://malbec2.bioconductor.org/BBS/3.7/bioc/src/contrib/BufferedMatrix_1.44.0.tar.gz && rm -rf BufferedMatrix.buildbin-libdir && mkdir BufferedMatrix.buildbin-libdir && C:\Users\biocbuild\bbs-3.7-bioc\R\bin\R.exe CMD INSTALL --merge-multiarch --build --library=BufferedMatrix.buildbin-libdir BufferedMatrix_1.44.0.tar.gz && C:\Users\biocbuild\bbs-3.7-bioc\R\bin\R.exe CMD INSTALL BufferedMatrix_1.44.0.zip && rm BufferedMatrix_1.44.0.tar.gz BufferedMatrix_1.44.0.zip
###
##############################################################################
##############################################################################


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  201k  100  201k    0     0  3118k      0 --:--:-- --:--:-- --:--:-- 3532k

install for i386

* installing *source* package 'BufferedMatrix' ...
** libs
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c RBufferedMatrix.c -o RBufferedMatrix.o
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function 'dbm_ReadOnlyMode':
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '˜' [-Wparentheses]
   if (!(Matrix->readonly) & setting){
       ^
doubleBufferedMatrix.c: At top level:
doubleBufferedMatrix.c:3327:12: warning: 'sort_double' defined but not used [-Wunused-function]
 static int sort_double(const double *a1,const double *a2){
            ^
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O3 -Wall  -std=gnu99 -mtune=generic -c init_package.c -o init_package.o
C:/Rtools/mingw_32/bin/gcc -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/extsoft/lib/i386 -LC:/extsoft/lib -LC:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/bin/i386 -lR
installing to C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/i386
** 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
  converting help for package 'BufferedMatrix'
    finding HTML links ... done
    BufferedMatrix-class                    html  
    as.BufferedMatrix                       html  
    createBufferedMatrix                    html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
In R CMD INSTALL

install for x64

* installing *source* package 'BufferedMatrix' ...
** libs
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c RBufferedMatrix.c -o RBufferedMatrix.o
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function 'dbm_ReadOnlyMode':
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '˜' [-Wparentheses]
   if (!(Matrix->readonly) & setting){
       ^
doubleBufferedMatrix.c: At top level:
doubleBufferedMatrix.c:3327:12: warning: 'sort_double' defined but not used [-Wunused-function]
 static int sort_double(const double *a1,const double *a2){
            ^
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mtune=generic -c init_package.c -o init_package.o
C:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/extsoft/lib/x64 -LC:/extsoft/lib -LC:/Users/BIOCBU˜1/BBS-3˜1.7-B/R/bin/x64 -lR
installing to C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/x64
** testing if installed package can be loaded
* MD5 sums
packaged installation of 'BufferedMatrix' as BufferedMatrix_1.44.0.zip
* DONE (BufferedMatrix)
In R CMD INSTALL
In R CMD INSTALL
* installing to library 'C:/Users/biocbuild/bbs-3.7-bioc/R/library'
package 'BufferedMatrix' successfully unpacked and MD5 sums checked
In R CMD INSTALL

Tests output

BufferedMatrix.Rcheck/tests_i386/c_code_level_tests.Rout


R version 3.5.1 Patched (2018-07-24 r75005) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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.45    0.03    0.46 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R version 3.5.1 Patched (2018-07-24 r75005) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

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.48    0.09    0.56 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R version 3.5.1 Patched (2018-07-24 r75005) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 403329 12.4     838562 25.6   627611 19.2
Vcells 471075  3.6    8388608 64.0  1468487 11.3
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Oct 17 00:51:49 2018"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Oct 17 00:51:49 2018"
> 
> 
> 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: 0x01f29de0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Oct 17 00:51:52 2018"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Oct 17 00:51:53 2018"
> 
> ColMode(tmp2)
<pointer: 0x01f29de0>
> 
> 
> 
> ### 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.3212433 -0.9294247 -0.04442830 -1.10080604
[2,] -0.1218589 -0.7369502  0.77398322  1.22773030
[3,] -0.1584110 -1.0441870 -0.07337497  1.23024343
[4,] -0.7133699  0.6121352 -1.97777693  0.08039276
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
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.3212433 0.9294247 0.04442830 1.10080604
[2,]  0.1218589 0.7369502 0.77398322 1.22773030
[3,]  0.1584110 1.0441870 0.07337497 1.23024343
[4,]  0.7133699 0.6121352 1.97777693 0.08039276
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
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.9660044 0.9640667 0.2107802 1.0491930
[2,] 0.3490830 0.8584580 0.8797632 1.1080299
[3,] 0.3980088 1.0218547 0.2708781 1.1091634
[4,] 0.8446123 0.7823907 1.4063346 0.2835362
> 
> 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:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
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,] 223.98129 35.57009 27.15223 36.59274
[2,]  28.61269 34.32153 34.57161 37.30803
[3,]  29.13850 36.26273 27.78216 37.32188
[4,]  34.15949 33.43604 41.04112 27.91575
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x01d64fa0>
> exp(tmp5)
<pointer: 0x01d64fa0>
> log(tmp5,2)
<pointer: 0x01d64fa0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.1877
> Min(tmp5)
[1] 52.76734
> mean(tmp5)
[1] 72.40593
> Sum(tmp5)
[1] 14481.19
> Var(tmp5)
[1] 860.5852
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.28360 67.98415 69.24860 69.49812 71.32456 72.30861 67.84502 70.21572
 [9] 72.38345 72.96743
> rowSums(tmp5)
 [1] 1805.672 1359.683 1384.972 1389.962 1426.491 1446.172 1356.900 1404.314
 [9] 1447.669 1459.349
> rowVars(tmp5)
 [1] 7890.48644   79.33938   96.45416   97.12676   82.64398  104.74041
 [7]   87.07227   33.37892   75.97483   61.35284
> rowSd(tmp5)
 [1] 88.828410  8.907266  9.821108  9.855291  9.090874 10.234276  9.331252
 [8]  5.777449  8.716354  7.832806
> rowMax(tmp5)
 [1] 466.18770  81.06753  89.95332  90.25491  87.18877  91.90168  90.95210
 [8]  83.45919  89.19361  87.36779
> rowMin(tmp5)
 [1] 55.51212 54.08749 55.94784 55.86291 53.61578 52.76734 54.92777 58.07572
 [9] 59.37264 59.55858
> 
> colMeans(tmp5)
 [1] 106.95023  73.07067  69.14720  70.84946  69.86382  72.75770  77.40108
 [8]  68.18576  70.05351  70.21106  69.77828  67.97265  73.43476  67.09859
[15]  71.21470  75.95630  68.59027  67.92778  69.63398  68.02072
> colSums(tmp5)
 [1] 1069.5023  730.7067  691.4720  708.4946  698.6382  727.5770  774.0108
 [8]  681.8576  700.5351  702.1106  697.7828  679.7265  734.3476  670.9859
[15]  712.1470  759.5630  685.9027  679.2778  696.3398  680.2072
> colVars(tmp5)
 [1] 16005.53823    22.74365   121.34886    90.52160    72.48644    53.03687
 [7]    82.97730    48.38804   112.92280   138.76157    97.89527    37.14739
[13]   113.35375    48.06404    85.05136    93.72477    72.67952    71.44277
[19]    38.27958    68.98936
> colSd(tmp5)
 [1] 126.512996   4.769030  11.015846   9.514284   8.513897   7.282642
 [7]   9.109188   6.956151  10.626514  11.779710   9.894204   6.094866
[13]  10.646772   6.932823   9.222329   9.681156   8.525228   8.452382
[19]   6.187049   8.305983
> colMax(tmp5)
 [1] 466.18770  81.15784  86.85578  85.92946  84.45802  87.28191  90.95210
 [8]  78.51361  89.95332  86.85857  91.90168  78.17422  89.19361  81.62457
[15]  83.45919  90.25491  79.75511  78.50957  77.90727  78.89263
> colMin(tmp5)
 [1] 53.61578 64.19254 56.51381 55.41755 58.68040 63.77083 66.45106 58.33993
 [9] 54.91193 55.33593 55.51212 59.40224 59.03789 57.40097 56.16864 59.55858
[17] 52.76734 54.92777 55.86291 54.08749
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 90.28360 67.98415 69.24860 69.49812       NA 72.30861 67.84502 70.21572
 [9] 72.38345 72.96743
> rowSums(tmp5)
 [1] 1805.672 1359.683 1384.972 1389.962       NA 1446.172 1356.900 1404.314
 [9] 1447.669 1459.349
> rowVars(tmp5)
 [1] 7890.48644   79.33938   96.45416   97.12676   72.43806  104.74041
 [7]   87.07227   33.37892   75.97483   61.35284
> rowSd(tmp5)
 [1] 88.828410  8.907266  9.821108  9.855291  8.511055 10.234276  9.331252
 [8]  5.777449  8.716354  7.832806
> rowMax(tmp5)
 [1] 466.18770  81.06753  89.95332  90.25491        NA  91.90168  90.95210
 [8]  83.45919  89.19361  87.36779
> rowMin(tmp5)
 [1] 55.51212 54.08749 55.94784 55.86291       NA 52.76734 54.92777 58.07572
 [9] 59.37264 59.55858
> 
> colMeans(tmp5)
 [1] 106.95023  73.07067  69.14720        NA  69.86382  72.75770  77.40108
 [8]  68.18576  70.05351  70.21106  69.77828  67.97265  73.43476  67.09859
[15]  71.21470  75.95630  68.59027  67.92778  69.63398  68.02072
> colSums(tmp5)
 [1] 1069.5023  730.7067  691.4720        NA  698.6382  727.5770  774.0108
 [8]  681.8576  700.5351  702.1106  697.7828  679.7265  734.3476  670.9859
[15]  712.1470  759.5630  685.9027  679.2778  696.3398  680.2072
> colVars(tmp5)
 [1] 16005.53823    22.74365   121.34886          NA    72.48644    53.03687
 [7]    82.97730    48.38804   112.92280   138.76157    97.89527    37.14739
[13]   113.35375    48.06404    85.05136    93.72477    72.67952    71.44277
[19]    38.27958    68.98936
> colSd(tmp5)
 [1] 126.512996   4.769030  11.015846         NA   8.513897   7.282642
 [7]   9.109188   6.956151  10.626514  11.779710   9.894204   6.094866
[13]  10.646772   6.932823   9.222329   9.681156   8.525228   8.452382
[19]   6.187049   8.305983
> colMax(tmp5)
 [1] 466.18770  81.15784  86.85578        NA  84.45802  87.28191  90.95210
 [8]  78.51361  89.95332  86.85857  91.90168  78.17422  89.19361  81.62457
[15]  83.45919  90.25491  79.75511  78.50957  77.90727  78.89263
> colMin(tmp5)
 [1] 53.61578 64.19254 56.51381       NA 58.68040 63.77083 66.45106 58.33993
 [9] 54.91193 55.33593 55.51212 59.40224 59.03789 57.40097 56.16864 59.55858
[17] 52.76734 54.92777 55.86291 54.08749
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.1877
> Min(tmp5,na.rm=TRUE)
[1] 52.76734
> mean(tmp5,na.rm=TRUE)
[1] 72.49129
> Sum(tmp5,na.rm=TRUE)
[1] 14425.77
> Var(tmp5,na.rm=TRUE)
[1] 863.4666
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.28360 67.98415 69.24860 69.49812 72.16177 72.30861 67.84502 70.21572
 [9] 72.38345 72.96743
> rowSums(tmp5,na.rm=TRUE)
 [1] 1805.672 1359.683 1384.972 1389.962 1371.074 1446.172 1356.900 1404.314
 [9] 1447.669 1459.349
> rowVars(tmp5,na.rm=TRUE)
 [1] 7890.48644   79.33938   96.45416   97.12676   72.43806  104.74041
 [7]   87.07227   33.37892   75.97483   61.35284
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.828410  8.907266  9.821108  9.855291  8.511055 10.234276  9.331252
 [8]  5.777449  8.716354  7.832806
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.18770  81.06753  89.95332  90.25491  87.18877  91.90168  90.95210
 [8]  83.45919  89.19361  87.36779
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.51212 54.08749 55.94784 55.86291 53.61578 52.76734 54.92777 58.07572
 [9] 59.37264 59.55858
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 106.95023  73.07067  69.14720  72.56412  69.86382  72.75770  77.40108
 [8]  68.18576  70.05351  70.21106  69.77828  67.97265  73.43476  67.09859
[15]  71.21470  75.95630  68.59027  67.92778  69.63398  68.02072
> colSums(tmp5,na.rm=TRUE)
 [1] 1069.5023  730.7067  691.4720  653.0770  698.6382  727.5770  774.0108
 [8]  681.8576  700.5351  702.1106  697.7828  679.7265  734.3476  670.9859
[15]  712.1470  759.5630  685.9027  679.2778  696.3398  680.2072
> colVars(tmp5,na.rm=TRUE)
 [1] 16005.53823    22.74365   121.34886    68.76127    72.48644    53.03687
 [7]    82.97730    48.38804   112.92280   138.76157    97.89527    37.14739
[13]   113.35375    48.06404    85.05136    93.72477    72.67952    71.44277
[19]    38.27958    68.98936
> colSd(tmp5,na.rm=TRUE)
 [1] 126.512996   4.769030  11.015846   8.292242   8.513897   7.282642
 [7]   9.109188   6.956151  10.626514  11.779710   9.894204   6.094866
[13]  10.646772   6.932823   9.222329   9.681156   8.525228   8.452382
[19]   6.187049   8.305983
> colMax(tmp5,na.rm=TRUE)
 [1] 466.18770  81.15784  86.85578  85.92946  84.45802  87.28191  90.95210
 [8]  78.51361  89.95332  86.85857  91.90168  78.17422  89.19361  81.62457
[15]  83.45919  90.25491  79.75511  78.50957  77.90727  78.89263
> colMin(tmp5,na.rm=TRUE)
 [1] 53.61578 64.19254 56.51381 58.10299 58.68040 63.77083 66.45106 58.33993
 [9] 54.91193 55.33593 55.51212 59.40224 59.03789 57.40097 56.16864 59.55858
[17] 52.76734 54.92777 55.86291 54.08749
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.28360 67.98415 69.24860 69.49812      NaN 72.30861 67.84502 70.21572
 [9] 72.38345 72.96743
> rowSums(tmp5,na.rm=TRUE)
 [1] 1805.672 1359.683 1384.972 1389.962    0.000 1446.172 1356.900 1404.314
 [9] 1447.669 1459.349
> rowVars(tmp5,na.rm=TRUE)
 [1] 7890.48644   79.33938   96.45416   97.12676         NA  104.74041
 [7]   87.07227   33.37892   75.97483   61.35284
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.828410  8.907266  9.821108  9.855291        NA 10.234276  9.331252
 [8]  5.777449  8.716354  7.832806
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.18770  81.06753  89.95332  90.25491        NA  91.90168  90.95210
 [8]  83.45919  89.19361  87.36779
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.51212 54.08749 55.94784 55.86291       NA 52.76734 54.92777 58.07572
 [9] 59.37264 59.55858
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.87628  73.30436  68.92439       NaN  70.54832  73.29377  77.84397
 [8]  67.03822  69.11270  68.36134  70.28567  67.79106  71.90653  67.59209
[15]  70.71505  76.08983  67.34974  67.04760  69.17433  68.70218
> colSums(tmp5,na.rm=TRUE)
 [1] 1015.8865  659.7392  620.3195    0.0000  634.9349  659.6439  700.5958
 [8]  603.3440  622.0143  615.2520  632.5710  610.1196  647.1588  608.3288
[15]  636.4355  684.8085  606.1476  603.4284  622.5690  618.3197
> colVars(tmp5,na.rm=TRUE)
 [1] 17611.15219    24.97225   135.95896          NA    76.27613    56.43357
 [7]    91.14271    39.62203   117.08039   117.61515   107.23596    41.41988
[13]   101.24896    51.33222    92.87425   105.23977    64.45146    71.65749
[19]    40.68766    72.38860
> colSd(tmp5,na.rm=TRUE)
 [1] 132.707016   4.997224  11.660144         NA   8.733620   7.512228
 [7]   9.546869   6.294604  10.820369  10.845052  10.355480   6.435828
[13]  10.062254   7.164651   9.637129  10.258644   8.028167   8.465075
[19]   6.378688   8.508149
> colMax(tmp5,na.rm=TRUE)
 [1] 466.18770  81.15784  86.85578      -Inf  84.45802  87.28191  90.95210
 [8]  75.88926  89.95332  81.06753  91.90168  78.17422  89.19361  81.62457
[15]  83.45919  90.25491  77.72789  78.50957  77.90727  78.89263
> colMin(tmp5,na.rm=TRUE)
 [1] 59.55356 64.19254 56.51381      Inf 58.68040 63.77083 66.45106 58.33993
 [9] 54.91193 55.33593 55.51212 59.40224 59.03789 57.40097 56.16864 59.55858
[17] 52.76734 54.92777 55.86291 54.08749
> 
> 
> 
> 
> 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] 251.93772 237.45427 289.40240 199.61628 127.24428 246.54406 437.22960
 [8] 184.71120  98.15813 269.87924
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 251.93772 237.45427 289.40240 199.61628 127.24428 246.54406 437.22960
 [8] 184.71120  98.15813 269.87924
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -2.842171e-14 -5.684342e-14 -8.526513e-14  0.000000e+00  5.684342e-14
 [6]  8.526513e-14  5.684342e-14  0.000000e+00  8.526513e-14  0.000000e+00
[11]  1.136868e-13 -1.136868e-13  2.842171e-14  0.000000e+00 -1.705303e-13
[16]  1.989520e-13 -2.842171e-14  0.000000e+00 -1.705303e-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)
+ }
3   9 
2   15 
8   18 
8   8 
10   5 
2   9 
1   20 
6   5 
6   4 
6   17 
7   4 
2   8 
6   8 
10   7 
9   20 
3   20 
6   18 
8   17 
2   9 
3   18 
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] 1.801464
> Min(tmp)
[1] -2.732013
> mean(tmp)
[1] 0.0450221
> Sum(tmp)
[1] 4.50221
> Var(tmp)
[1] 1.021054
> 
> rowMeans(tmp)
[1] 0.0450221
> rowSums(tmp)
[1] 4.50221
> rowVars(tmp)
[1] 1.021054
> rowSd(tmp)
[1] 1.010472
> rowMax(tmp)
[1] 1.801464
> rowMin(tmp)
[1] -2.732013
> 
> colMeans(tmp)
  [1] -1.00368837  0.70556766  0.62505451  1.53445481 -0.34989947 -0.02318150
  [7]  1.11832711 -0.28883067 -0.79740761  0.07974269 -0.23705882  1.46457320
 [13]  0.25415435  1.80146408  1.46694571  0.10636131 -0.50472465  1.09485991
 [19] -0.53097343  1.74053057  0.32325848  1.07963390  0.72409198  0.89498937
 [25]  0.18574441  0.43250329 -0.38391515  0.92075269 -1.69054420  0.51805918
 [31]  1.02928187  0.27710687  0.75208038 -0.94054858 -0.39513363  0.90331954
 [37]  0.59889775 -0.79586145 -0.35813955  0.14119770 -0.49071813  1.78692503
 [43]  1.16461365  0.04972128  0.29275440 -1.12554830 -0.53548474 -0.62821839
 [49]  1.33325807 -0.73461308  0.05197468  0.36583274 -0.82239966 -1.26428129
 [55]  0.99504894  0.33251397  1.77387845 -1.14188978 -0.48230961  0.20015182
 [61]  1.13940027 -0.33867887 -0.30135623 -0.87919928 -0.83713170 -0.59735034
 [67] -2.22665747  1.13820815 -0.68023011  0.83783557  1.21969603 -1.13714609
 [73] -1.08476587  1.01683435 -2.20009876 -0.83974463 -0.52799651  1.00851224
 [79]  0.28080876  1.10351800  1.52062955  0.68663560  1.14836243 -0.40010634
 [85]  0.31428971 -2.57548287 -0.96996597  0.40423105 -0.63537911 -0.06364243
 [91]  1.44259519 -0.28487397  1.50336552 -1.30585253 -0.03249566 -1.32485998
 [97] -0.40725715 -1.23339482 -2.73201335 -0.24128888
> colSums(tmp)
  [1] -1.00368837  0.70556766  0.62505451  1.53445481 -0.34989947 -0.02318150
  [7]  1.11832711 -0.28883067 -0.79740761  0.07974269 -0.23705882  1.46457320
 [13]  0.25415435  1.80146408  1.46694571  0.10636131 -0.50472465  1.09485991
 [19] -0.53097343  1.74053057  0.32325848  1.07963390  0.72409198  0.89498937
 [25]  0.18574441  0.43250329 -0.38391515  0.92075269 -1.69054420  0.51805918
 [31]  1.02928187  0.27710687  0.75208038 -0.94054858 -0.39513363  0.90331954
 [37]  0.59889775 -0.79586145 -0.35813955  0.14119770 -0.49071813  1.78692503
 [43]  1.16461365  0.04972128  0.29275440 -1.12554830 -0.53548474 -0.62821839
 [49]  1.33325807 -0.73461308  0.05197468  0.36583274 -0.82239966 -1.26428129
 [55]  0.99504894  0.33251397  1.77387845 -1.14188978 -0.48230961  0.20015182
 [61]  1.13940027 -0.33867887 -0.30135623 -0.87919928 -0.83713170 -0.59735034
 [67] -2.22665747  1.13820815 -0.68023011  0.83783557  1.21969603 -1.13714609
 [73] -1.08476587  1.01683435 -2.20009876 -0.83974463 -0.52799651  1.00851224
 [79]  0.28080876  1.10351800  1.52062955  0.68663560  1.14836243 -0.40010634
 [85]  0.31428971 -2.57548287 -0.96996597  0.40423105 -0.63537911 -0.06364243
 [91]  1.44259519 -0.28487397  1.50336552 -1.30585253 -0.03249566 -1.32485998
 [97] -0.40725715 -1.23339482 -2.73201335 -0.24128888
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -1.00368837  0.70556766  0.62505451  1.53445481 -0.34989947 -0.02318150
  [7]  1.11832711 -0.28883067 -0.79740761  0.07974269 -0.23705882  1.46457320
 [13]  0.25415435  1.80146408  1.46694571  0.10636131 -0.50472465  1.09485991
 [19] -0.53097343  1.74053057  0.32325848  1.07963390  0.72409198  0.89498937
 [25]  0.18574441  0.43250329 -0.38391515  0.92075269 -1.69054420  0.51805918
 [31]  1.02928187  0.27710687  0.75208038 -0.94054858 -0.39513363  0.90331954
 [37]  0.59889775 -0.79586145 -0.35813955  0.14119770 -0.49071813  1.78692503
 [43]  1.16461365  0.04972128  0.29275440 -1.12554830 -0.53548474 -0.62821839
 [49]  1.33325807 -0.73461308  0.05197468  0.36583274 -0.82239966 -1.26428129
 [55]  0.99504894  0.33251397  1.77387845 -1.14188978 -0.48230961  0.20015182
 [61]  1.13940027 -0.33867887 -0.30135623 -0.87919928 -0.83713170 -0.59735034
 [67] -2.22665747  1.13820815 -0.68023011  0.83783557  1.21969603 -1.13714609
 [73] -1.08476587  1.01683435 -2.20009876 -0.83974463 -0.52799651  1.00851224
 [79]  0.28080876  1.10351800  1.52062955  0.68663560  1.14836243 -0.40010634
 [85]  0.31428971 -2.57548287 -0.96996597  0.40423105 -0.63537911 -0.06364243
 [91]  1.44259519 -0.28487397  1.50336552 -1.30585253 -0.03249566 -1.32485998
 [97] -0.40725715 -1.23339482 -2.73201335 -0.24128888
> colMin(tmp)
  [1] -1.00368837  0.70556766  0.62505451  1.53445481 -0.34989947 -0.02318150
  [7]  1.11832711 -0.28883067 -0.79740761  0.07974269 -0.23705882  1.46457320
 [13]  0.25415435  1.80146408  1.46694571  0.10636131 -0.50472465  1.09485991
 [19] -0.53097343  1.74053057  0.32325848  1.07963390  0.72409198  0.89498937
 [25]  0.18574441  0.43250329 -0.38391515  0.92075269 -1.69054420  0.51805918
 [31]  1.02928187  0.27710687  0.75208038 -0.94054858 -0.39513363  0.90331954
 [37]  0.59889775 -0.79586145 -0.35813955  0.14119770 -0.49071813  1.78692503
 [43]  1.16461365  0.04972128  0.29275440 -1.12554830 -0.53548474 -0.62821839
 [49]  1.33325807 -0.73461308  0.05197468  0.36583274 -0.82239966 -1.26428129
 [55]  0.99504894  0.33251397  1.77387845 -1.14188978 -0.48230961  0.20015182
 [61]  1.13940027 -0.33867887 -0.30135623 -0.87919928 -0.83713170 -0.59735034
 [67] -2.22665747  1.13820815 -0.68023011  0.83783557  1.21969603 -1.13714609
 [73] -1.08476587  1.01683435 -2.20009876 -0.83974463 -0.52799651  1.00851224
 [79]  0.28080876  1.10351800  1.52062955  0.68663560  1.14836243 -0.40010634
 [85]  0.31428971 -2.57548287 -0.96996597  0.40423105 -0.63537911 -0.06364243
 [91]  1.44259519 -0.28487397  1.50336552 -1.30585253 -0.03249566 -1.32485998
 [97] -0.40725715 -1.23339482 -2.73201335 -0.24128888
> colMedians(tmp)
  [1] -1.00368837  0.70556766  0.62505451  1.53445481 -0.34989947 -0.02318150
  [7]  1.11832711 -0.28883067 -0.79740761  0.07974269 -0.23705882  1.46457320
 [13]  0.25415435  1.80146408  1.46694571  0.10636131 -0.50472465  1.09485991
 [19] -0.53097343  1.74053057  0.32325848  1.07963390  0.72409198  0.89498937
 [25]  0.18574441  0.43250329 -0.38391515  0.92075269 -1.69054420  0.51805918
 [31]  1.02928187  0.27710687  0.75208038 -0.94054858 -0.39513363  0.90331954
 [37]  0.59889775 -0.79586145 -0.35813955  0.14119770 -0.49071813  1.78692503
 [43]  1.16461365  0.04972128  0.29275440 -1.12554830 -0.53548474 -0.62821839
 [49]  1.33325807 -0.73461308  0.05197468  0.36583274 -0.82239966 -1.26428129
 [55]  0.99504894  0.33251397  1.77387845 -1.14188978 -0.48230961  0.20015182
 [61]  1.13940027 -0.33867887 -0.30135623 -0.87919928 -0.83713170 -0.59735034
 [67] -2.22665747  1.13820815 -0.68023011  0.83783557  1.21969603 -1.13714609
 [73] -1.08476587  1.01683435 -2.20009876 -0.83974463 -0.52799651  1.00851224
 [79]  0.28080876  1.10351800  1.52062955  0.68663560  1.14836243 -0.40010634
 [85]  0.31428971 -2.57548287 -0.96996597  0.40423105 -0.63537911 -0.06364243
 [91]  1.44259519 -0.28487397  1.50336552 -1.30585253 -0.03249566 -1.32485998
 [97] -0.40725715 -1.23339482 -2.73201335 -0.24128888
> colRanges(tmp)
          [,1]      [,2]      [,3]     [,4]       [,5]       [,6]     [,7]
[1,] -1.003688 0.7055677 0.6250545 1.534455 -0.3498995 -0.0231815 1.118327
[2,] -1.003688 0.7055677 0.6250545 1.534455 -0.3498995 -0.0231815 1.118327
           [,8]       [,9]      [,10]      [,11]    [,12]     [,13]    [,14]
[1,] -0.2888307 -0.7974076 0.07974269 -0.2370588 1.464573 0.2541544 1.801464
[2,] -0.2888307 -0.7974076 0.07974269 -0.2370588 1.464573 0.2541544 1.801464
        [,15]     [,16]      [,17]   [,18]      [,19]    [,20]     [,21]
[1,] 1.466946 0.1063613 -0.5047247 1.09486 -0.5309734 1.740531 0.3232585
[2,] 1.466946 0.1063613 -0.5047247 1.09486 -0.5309734 1.740531 0.3232585
        [,22]    [,23]     [,24]     [,25]     [,26]      [,27]     [,28]
[1,] 1.079634 0.724092 0.8949894 0.1857444 0.4325033 -0.3839152 0.9207527
[2,] 1.079634 0.724092 0.8949894 0.1857444 0.4325033 -0.3839152 0.9207527
         [,29]     [,30]    [,31]     [,32]     [,33]      [,34]      [,35]
[1,] -1.690544 0.5180592 1.029282 0.2771069 0.7520804 -0.9405486 -0.3951336
[2,] -1.690544 0.5180592 1.029282 0.2771069 0.7520804 -0.9405486 -0.3951336
         [,36]     [,37]      [,38]      [,39]     [,40]      [,41]    [,42]
[1,] 0.9033195 0.5988977 -0.7958614 -0.3581395 0.1411977 -0.4907181 1.786925
[2,] 0.9033195 0.5988977 -0.7958614 -0.3581395 0.1411977 -0.4907181 1.786925
        [,43]      [,44]     [,45]     [,46]      [,47]      [,48]    [,49]
[1,] 1.164614 0.04972128 0.2927544 -1.125548 -0.5354847 -0.6282184 1.333258
[2,] 1.164614 0.04972128 0.2927544 -1.125548 -0.5354847 -0.6282184 1.333258
          [,50]      [,51]     [,52]      [,53]     [,54]     [,55]    [,56]
[1,] -0.7346131 0.05197468 0.3658327 -0.8223997 -1.264281 0.9950489 0.332514
[2,] -0.7346131 0.05197468 0.3658327 -0.8223997 -1.264281 0.9950489 0.332514
        [,57]    [,58]      [,59]     [,60]  [,61]      [,62]      [,63]
[1,] 1.773878 -1.14189 -0.4823096 0.2001518 1.1394 -0.3386789 -0.3013562
[2,] 1.773878 -1.14189 -0.4823096 0.2001518 1.1394 -0.3386789 -0.3013562
          [,64]      [,65]      [,66]     [,67]    [,68]      [,69]     [,70]
[1,] -0.8791993 -0.8371317 -0.5973503 -2.226657 1.138208 -0.6802301 0.8378356
[2,] -0.8791993 -0.8371317 -0.5973503 -2.226657 1.138208 -0.6802301 0.8378356
        [,71]     [,72]     [,73]    [,74]     [,75]      [,76]      [,77]
[1,] 1.219696 -1.137146 -1.084766 1.016834 -2.200099 -0.8397446 -0.5279965
[2,] 1.219696 -1.137146 -1.084766 1.016834 -2.200099 -0.8397446 -0.5279965
        [,78]     [,79]    [,80]   [,81]     [,82]    [,83]      [,84]
[1,] 1.008512 0.2808088 1.103518 1.52063 0.6866356 1.148362 -0.4001063
[2,] 1.008512 0.2808088 1.103518 1.52063 0.6866356 1.148362 -0.4001063
         [,85]     [,86]     [,87]    [,88]      [,89]       [,90]    [,91]
[1,] 0.3142897 -2.575483 -0.969966 0.404231 -0.6353791 -0.06364243 1.442595
[2,] 0.3142897 -2.575483 -0.969966 0.404231 -0.6353791 -0.06364243 1.442595
         [,92]    [,93]     [,94]       [,95]    [,96]      [,97]     [,98]
[1,] -0.284874 1.503366 -1.305853 -0.03249566 -1.32486 -0.4072571 -1.233395
[2,] -0.284874 1.503366 -1.305853 -0.03249566 -1.32486 -0.4072571 -1.233395
         [,99]     [,100]
[1,] -2.732013 -0.2412889
[2,] -2.732013 -0.2412889
> 
> 
> Max(tmp2)
[1] 2.913395
> Min(tmp2)
[1] -2.262053
> mean(tmp2)
[1] -0.01497635
> Sum(tmp2)
[1] -1.497635
> Var(tmp2)
[1] 1.135478
> 
> rowMeans(tmp2)
  [1]  0.94211693  0.46182869 -0.27662976  0.96609472  0.02961423 -0.45849352
  [7] -0.94240993  0.70576981 -0.03093382 -0.50293001 -1.31996460 -0.14220529
 [13] -1.51538023 -0.36789614 -1.09085015  0.22339940 -0.07345427 -0.16543297
 [19] -2.26205292 -0.61152410 -0.58415364 -1.72129570 -1.00266933 -0.28763962
 [25] -0.24859088  0.34788488 -0.97474578 -1.47026067  2.87255609  0.11893414
 [31]  0.15157754 -0.03113702 -0.35912155  0.20144704 -0.21709413  2.89694253
 [37]  2.55370260 -0.24006788  0.09247356  0.37794418  1.92633826  0.44229801
 [43] -0.58615196 -0.89326402  1.32065818  0.27222966  0.17602401  0.48856838
 [49]  0.32556642  0.96082365 -1.66593504 -0.36348145  1.10091009  0.49505882
 [55] -0.34516428  0.06282730  0.16089617  1.12834371 -0.81205945 -2.16963088
 [61] -1.21114290  1.10428471  0.26790873  0.18137640 -0.66930492  0.03299028
 [67] -0.71690240 -0.71546954  0.43521638 -0.34549391 -0.89093188 -1.42825510
 [73]  2.91339495  1.04684218  1.95333155 -0.72999242  2.22453530 -0.96098290
 [79] -0.68038240  1.33710252  0.24983245  0.63198420 -0.52007648  0.24380308
 [85] -0.55220468  0.21902234  1.58897019 -1.38851904 -0.52859191  0.41868989
 [91] -0.05799096  0.02675843 -0.10316845 -0.22398181 -0.92754430 -1.89326444
 [97] -2.06192680 -0.10150430  1.00630738  1.25743789
> rowSums(tmp2)
  [1]  0.94211693  0.46182869 -0.27662976  0.96609472  0.02961423 -0.45849352
  [7] -0.94240993  0.70576981 -0.03093382 -0.50293001 -1.31996460 -0.14220529
 [13] -1.51538023 -0.36789614 -1.09085015  0.22339940 -0.07345427 -0.16543297
 [19] -2.26205292 -0.61152410 -0.58415364 -1.72129570 -1.00266933 -0.28763962
 [25] -0.24859088  0.34788488 -0.97474578 -1.47026067  2.87255609  0.11893414
 [31]  0.15157754 -0.03113702 -0.35912155  0.20144704 -0.21709413  2.89694253
 [37]  2.55370260 -0.24006788  0.09247356  0.37794418  1.92633826  0.44229801
 [43] -0.58615196 -0.89326402  1.32065818  0.27222966  0.17602401  0.48856838
 [49]  0.32556642  0.96082365 -1.66593504 -0.36348145  1.10091009  0.49505882
 [55] -0.34516428  0.06282730  0.16089617  1.12834371 -0.81205945 -2.16963088
 [61] -1.21114290  1.10428471  0.26790873  0.18137640 -0.66930492  0.03299028
 [67] -0.71690240 -0.71546954  0.43521638 -0.34549391 -0.89093188 -1.42825510
 [73]  2.91339495  1.04684218  1.95333155 -0.72999242  2.22453530 -0.96098290
 [79] -0.68038240  1.33710252  0.24983245  0.63198420 -0.52007648  0.24380308
 [85] -0.55220468  0.21902234  1.58897019 -1.38851904 -0.52859191  0.41868989
 [91] -0.05799096  0.02675843 -0.10316845 -0.22398181 -0.92754430 -1.89326444
 [97] -2.06192680 -0.10150430  1.00630738  1.25743789
> 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.94211693  0.46182869 -0.27662976  0.96609472  0.02961423 -0.45849352
  [7] -0.94240993  0.70576981 -0.03093382 -0.50293001 -1.31996460 -0.14220529
 [13] -1.51538023 -0.36789614 -1.09085015  0.22339940 -0.07345427 -0.16543297
 [19] -2.26205292 -0.61152410 -0.58415364 -1.72129570 -1.00266933 -0.28763962
 [25] -0.24859088  0.34788488 -0.97474578 -1.47026067  2.87255609  0.11893414
 [31]  0.15157754 -0.03113702 -0.35912155  0.20144704 -0.21709413  2.89694253
 [37]  2.55370260 -0.24006788  0.09247356  0.37794418  1.92633826  0.44229801
 [43] -0.58615196 -0.89326402  1.32065818  0.27222966  0.17602401  0.48856838
 [49]  0.32556642  0.96082365 -1.66593504 -0.36348145  1.10091009  0.49505882
 [55] -0.34516428  0.06282730  0.16089617  1.12834371 -0.81205945 -2.16963088
 [61] -1.21114290  1.10428471  0.26790873  0.18137640 -0.66930492  0.03299028
 [67] -0.71690240 -0.71546954  0.43521638 -0.34549391 -0.89093188 -1.42825510
 [73]  2.91339495  1.04684218  1.95333155 -0.72999242  2.22453530 -0.96098290
 [79] -0.68038240  1.33710252  0.24983245  0.63198420 -0.52007648  0.24380308
 [85] -0.55220468  0.21902234  1.58897019 -1.38851904 -0.52859191  0.41868989
 [91] -0.05799096  0.02675843 -0.10316845 -0.22398181 -0.92754430 -1.89326444
 [97] -2.06192680 -0.10150430  1.00630738  1.25743789
> rowMin(tmp2)
  [1]  0.94211693  0.46182869 -0.27662976  0.96609472  0.02961423 -0.45849352
  [7] -0.94240993  0.70576981 -0.03093382 -0.50293001 -1.31996460 -0.14220529
 [13] -1.51538023 -0.36789614 -1.09085015  0.22339940 -0.07345427 -0.16543297
 [19] -2.26205292 -0.61152410 -0.58415364 -1.72129570 -1.00266933 -0.28763962
 [25] -0.24859088  0.34788488 -0.97474578 -1.47026067  2.87255609  0.11893414
 [31]  0.15157754 -0.03113702 -0.35912155  0.20144704 -0.21709413  2.89694253
 [37]  2.55370260 -0.24006788  0.09247356  0.37794418  1.92633826  0.44229801
 [43] -0.58615196 -0.89326402  1.32065818  0.27222966  0.17602401  0.48856838
 [49]  0.32556642  0.96082365 -1.66593504 -0.36348145  1.10091009  0.49505882
 [55] -0.34516428  0.06282730  0.16089617  1.12834371 -0.81205945 -2.16963088
 [61] -1.21114290  1.10428471  0.26790873  0.18137640 -0.66930492  0.03299028
 [67] -0.71690240 -0.71546954  0.43521638 -0.34549391 -0.89093188 -1.42825510
 [73]  2.91339495  1.04684218  1.95333155 -0.72999242  2.22453530 -0.96098290
 [79] -0.68038240  1.33710252  0.24983245  0.63198420 -0.52007648  0.24380308
 [85] -0.55220468  0.21902234  1.58897019 -1.38851904 -0.52859191  0.41868989
 [91] -0.05799096  0.02675843 -0.10316845 -0.22398181 -0.92754430 -1.89326444
 [97] -2.06192680 -0.10150430  1.00630738  1.25743789
> 
> colMeans(tmp2)
[1] -0.01497635
> colSums(tmp2)
[1] -1.497635
> colVars(tmp2)
[1] 1.135478
> colSd(tmp2)
[1] 1.065588
> colMax(tmp2)
[1] 2.913395
> colMin(tmp2)
[1] -2.262053
> colMedians(tmp2)
[1] -0.06572261
> colRanges(tmp2)
          [,1]
[1,] -2.262053
[2,]  2.913395
> 
> 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.0308009 -0.9103742 -0.7758046  2.8153088  4.2205314  2.9256068
 [7] -0.5606895 -3.4133601  4.7736783  3.4116259
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.9468490
[2,] -1.0521891
[3,] -0.1576915
[4,]  0.4819692
[5,]  1.5299883
> 
> rowApply(tmp,sum)
 [1]  1.7209099  0.4251605 -2.4519008  3.1720747  2.4994320 -2.2081219
 [7]  1.2264910  3.5175763  3.2625166 -0.7084163
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    8    9   10    5    9    6    2    1    1     1
 [2,]    2    1    2    6    4    1    5    9    3    10
 [3,]    5    6    3    4    2    2    7    7    8     7
 [4,]    6   10    6    8   10    4    4    3    4     3
 [5,]    3    3    5    9    8    9    6    6    6     8
 [6,]    7    8    4   10    6    7    1   10    7     2
 [7,]    1    4    8    7    3   10    8    2    2     9
 [8,]    4    5    9    3    1    3    3    4    5     6
 [9,]    9    7    7    1    5    8   10    8    9     4
[10,]   10    2    1    2    7    5    9    5   10     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.0832340  0.4083505  0.1810614 -0.2565906  3.0667902  1.0942879
 [7] -0.1302828 -1.8700469  0.3636345  1.7019901 -1.7361811  3.4751718
[13] -0.0554423  2.7733427  1.0645418  0.9336157 -1.8584923  0.4902663
[19]  1.4354354 -0.6110727
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.8094290
[2,] -0.4865238
[3,]  0.6050725
[4,]  0.7702089
[5,]  1.0039055
> 
> rowApply(tmp,sum)
[1]  2.2670462  6.8699468  0.4795777  3.5669342 -1.6298916
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   18   13    5   16    6
[2,]    8   12    2    6   19
[3,]   12   11   18    8    1
[4,]   19   16    4    2    3
[5,]   10    8   20   13   15
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]        [,5]       [,6]
[1,]  1.0039055 -0.1639954  0.2071708  1.1226058  0.10040182  0.1392559
[2,]  0.6050725  0.5289394  0.3135065  1.3992066 -0.04224973 -0.2254339
[3,] -0.4865238 -1.0828322  1.4376059 -0.5764219  1.72368877 -0.3247937
[4,]  0.7702089 -0.3107158 -0.0482800 -1.1025642  0.69031706  1.0104415
[5,] -0.8094290  1.4369545 -1.7289418 -1.0994169  0.59463225  0.4948182
           [,7]       [,8]       [,9]       [,10]      [,11]      [,12]
[1,] -0.8437795 -1.5781787 -0.4623171  0.71407341 -0.5960683  0.6339820
[2,] -0.2656356 -0.8591694  1.4553773 -0.78805731  0.7200986  1.8800671
[3,]  1.4838241 -0.4317804 -0.4220307  0.05250235  0.1457353 -0.3135376
[4,]  0.3017203  0.8682094  0.7671118  1.01616950 -1.7607946 -0.5838909
[5,] -0.8064120  0.1308722 -0.9745068  0.70730217 -0.2451522  1.8585510
          [,13]       [,14]       [,15]      [,16]      [,17]      [,18]
[1,]  0.6723494 -0.05254175  0.32204922 -0.2378205 -0.3857094  1.4819721
[2,]  0.1304314  0.88349117  0.09692688  1.5468424 -0.7935470 -0.4940974
[3,] -0.9846199  0.80038759 -1.88285228 -0.1386003  0.7263188  0.3609935
[4,] -0.1552298  0.75637599  1.78518628  0.3128310 -0.5446771 -0.5448282
[5,]  0.2816266  0.38562974  0.74323170 -0.5496368 -0.8608777 -0.3137738
          [,19]       [,20]
[1,]  0.7091912 -0.51950024
[2,] -0.6470625  1.42523985
[3,]  0.4257848 -0.03327043
[4,]  0.1931878  0.14615521
[5,]  0.7543341 -1.62969710
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
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:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  629  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  541  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
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.2850879 -0.6166518 0.01724934 0.595072 -1.034552 2.004017 0.2514941
           col8      col9     col10      col11      col12      col13      col14
row1 -0.7048524 0.8063529 0.8998846 -0.3576413 -0.8996102 -0.6586478 -0.5739105
         col15      col16     col17     col18      col19     col20
row1 0.9959259 -0.6397202 0.7704281 0.6826987 -0.9416243 -1.916301
> tmp[,"col10"]
         col10
row1 0.8998846
row2 0.3311127
row3 1.7627290
row4 0.5763505
row5 0.6558482
> tmp[c("row1","row5"),]
           col1       col2       col3       col4       col5      col6
row1 -0.2850879 -0.6166518 0.01724934 0.59507198 -1.0345517 2.0040168
row5  0.9458809 -0.4585103 0.19634924 0.04691651  0.3770209 0.1750349
            col7       col8       col9     col10       col11      col12
row1  0.25149407 -0.7048524  0.8063529 0.8998846 -0.35764128 -0.8996102
row5 -0.08855676 -0.8944066 -1.1039134 0.6558482 -0.05004362  0.6434634
          col13      col14      col15      col16     col17      col18
row1 -0.6586478 -0.5739105  0.9959259 -0.6397202 0.7704281  0.6826987
row5  1.7107673  0.8994958 -0.5641079  0.1634213 0.1507780 -0.4974813
          col19      col20
row1 -0.9416243 -1.9163007
row5 -1.0257774  0.3346197
> tmp[,c("col6","col20")]
          col6      col20
row1 2.0040168 -1.9163007
row2 0.4720957 -1.8356929
row3 0.9936958  1.0762071
row4 0.2189460 -0.2375070
row5 0.1750349  0.3346197
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 2.0040168 -1.9163007
row5 0.1750349  0.3346197
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5    col6     col7    col8
row1 50.84529 48.33802 48.44782 49.59428 50.44169 106.576 50.44489 50.1701
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.77274 50.41374 50.00417 50.85268 50.98088 50.16238 49.76864 50.35969
        col17    col18    col19    col20
row1 51.71035 49.63928 50.34057 103.2169
> tmp[,"col10"]
        col10
row1 50.41374
row2 29.09821
row3 29.07903
row4 31.54187
row5 49.29568
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.84529 48.33802 48.44782 49.59428 50.44169 106.5760 50.44489 50.17010
row5 49.80350 50.32101 49.56573 52.63363 48.21136 106.0057 49.65572 50.35725
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.77274 50.41374 50.00417 50.85268 50.98088 50.16238 49.76864 50.35969
row5 49.45678 49.29568 48.19572 48.82009 48.81609 48.54410 49.61458 49.71330
        col17    col18    col19    col20
row1 51.71035 49.63928 50.34057 103.2169
row5 50.41041 49.70069 49.88415 106.6470
> tmp[,c("col6","col20")]
          col6     col20
row1 106.57600 103.21685
row2  74.22624  77.12191
row3  74.28217  73.99898
row4  72.66297  75.42438
row5 106.00573 106.64702
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.5760 103.2169
row5 106.0057 106.6470
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.5760 103.2169
row5 106.0057 106.6470
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.4076673
[2,] -0.8170153
[3,]  1.0219611
[4,] -0.1301806
[5,] -0.6517425
> tmp[,c("col17","col7")]
           col17        col7
[1,]  0.57884511 -2.16598976
[2,] -0.03430508  0.07031875
[3,]  0.04753974 -1.58350430
[4,] -0.63526060 -0.21467800
[5,]  1.12990717 -0.73346373
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,]  1.36046500 -1.7489383
[2,] -0.20415196 -0.0705798
[3,] -0.84896638 -0.3436134
[4,] -0.09142581 -1.6620963
[5,] -0.68458051 -1.4557686
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.360465
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,]  1.360465
[2,] -0.204152
> 
> 
> 
> 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.3993195 0.914657 -1.3435261  1.669533 1.018866  0.7576878  1.076517
row1 -0.5816809 0.436192  0.1630572 -1.578244 1.860678 -0.2500150 -2.107826
          [,8]      [,9]      [,10]     [,11]      [,12]     [,13]
row3 -2.333668 0.4920228 -0.9570082 -1.160541 -1.6124968 0.1468259
row1  1.853161 0.4934560  0.7556481 -0.434197 -0.2493374 0.4357992
             [,14]      [,15]      [,16]      [,17]     [,18]      [,19]
row3 -0.2314478192 -0.4673641 -0.0629807 -0.2626823  1.760858  0.9836591
row1  0.0008139638 -0.9758742  0.2332606  0.5055155 -1.261252 -0.3712828
          [,20]
row3 -0.9821492
row1 -0.3188987
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]       [,2]      [,3]     [,4]      [,5]      [,6]      [,7]
row2 -0.1924263 -0.3870562 -1.497337 1.083512 0.7636734 0.2838089 -2.318966
           [,8]      [,9]     [,10]
row2 -0.5986179 0.3764702 -0.303888
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]      [,2]      [,3]       [,4]       [,5]     [,6]      [,7]
row5 2.651281 0.4402686 0.3073411 -0.9141612 -0.3723133 -1.23232 -1.255126
         [,8]      [,9]    [,10]      [,11]      [,12]     [,13]      [,14]
row5 -1.09067 0.8065425 2.004007 -0.9066228 -0.8110925 0.8555542 -0.2808537
          [,15]      [,16]     [,17]    [,18]      [,19]     [,20]
row5 -0.2017128 -0.2103269 0.1355358 -1.33466 -0.1399158 -1.057243
> 
> 
> 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: 0x01d92a90>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c15642470"
 [2] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c54c57f23"
 [3] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c24012c"  
 [4] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c7b591a0" 
 [5] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c140a678c"
 [6] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c3bda3bb" 
 [7] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c59019d8" 
 [8] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c71942b8a"
 [9] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c3aff2d76"
[10] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c2a554d4d"
[11] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c344d4952"
[12] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c21da1cf6"
[13] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c46bc6383"
[14] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c118818e9"
[15] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM17c68f1722b"
> 
> 
> ### 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: 0x0355d588>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x0355d588>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.7-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x0355d588>
> rowMedians(tmp)
  [1] -0.070610783 -0.076501168 -0.272381777 -0.064181004  0.052891375
  [6]  0.273263520  0.128709731 -0.569709250 -0.247850766 -0.001210824
 [11]  0.142045067 -0.479936163 -0.201072598 -0.036704396 -0.221943471
 [16]  0.013805101  0.387561069 -0.339804562  0.644988708  0.083087501
 [21]  0.378447148  0.482114192  0.163769412 -0.508275126  0.410329809
 [26] -0.091759588 -0.235034738  0.155259686  0.062792851 -0.063267016
 [31] -0.674369807 -0.162740763 -0.359610418  0.542739585  0.085722391
 [36]  0.318982571 -0.118216614 -0.575236435 -0.222342995 -0.098828214
 [41] -0.608556089 -0.188926160  0.344114014  0.131205968 -0.533302806
 [46]  0.495702264  0.052613017 -0.162569819  0.209571336  0.572716121
 [51]  0.522058727 -0.096125293 -0.338363404 -0.027878342 -0.138420863
 [56] -0.117512728 -0.608589246  0.012959239  0.333532537 -0.076960112
 [61] -0.221573442  0.080350704 -0.295772240 -0.214329078 -0.111635795
 [66]  0.016401986  0.232401069  0.278004596 -0.150727094  0.037505076
 [71] -0.089486945 -0.500222265 -0.162354205 -0.119306201 -0.054272257
 [76] -0.523314220 -0.249144751  0.613429764 -0.013712178 -0.500383143
 [81] -0.426173743 -0.125067769  0.220286011  0.008016561  0.314997256
 [86] -0.658148653 -0.072571963  0.396114493  0.239345921 -0.306028833
 [91] -0.015589270 -0.520368657  0.700161639  0.240294409  0.488154885
 [96] -0.015813180 -0.313975255  0.426866260  0.349305361 -0.435470716
[101] -0.134295405  0.095958157  0.351241906  0.116568748  0.214486318
[106]  0.154298767 -0.299428559  0.018790644 -0.181337329 -0.178885991
[111] -0.096602171  0.104631867  0.405382058 -0.085114646  0.123681775
[116] -0.035519801 -0.132663927 -0.429296069 -0.139799582 -0.123793430
[121]  0.131310266 -0.194395495 -0.486530968 -0.020539414 -0.504586483
[126]  0.289660426 -0.057039300  0.708082249 -0.238765442  0.270183934
[131] -0.620391960  0.172153696  0.043970278 -0.069086313 -0.218379021
[136] -0.785205767 -0.124920300  0.117808520 -0.278205317 -0.235698377
[141]  0.324290405  0.375831674  0.804707262 -0.719928126  0.198490554
[146] -0.539183440  0.064647001 -0.105697890  0.033954319 -0.348401919
[151]  0.270613490 -0.387766415  0.449357921 -0.258294408  0.194482169
[156]  0.296603992  0.592073481  0.235365609 -0.388661531 -0.100372285
[161]  0.370155764  0.285760149  0.130941193  0.142423800 -0.067098646
[166] -0.351261814 -0.619346303 -0.490863949  0.285876061  0.312618018
[171]  0.620026121  0.158840209  0.231827579 -0.619639326  0.112077934
[176] -0.138570635  0.477206626 -0.105001494 -0.477500904  0.475392239
[181]  0.372992588  0.364275981  0.053873204 -0.246193978 -0.003587581
[186]  0.109392990  0.291572298  0.425940966  0.542081003 -0.039726047
[191] -0.142165734  0.085962011 -0.026460016 -0.242672261  0.171355818
[196] -0.287352481  0.328064693 -0.185482925  0.255297376 -0.359727434
[201] -0.139697161  0.455891231 -0.286156306  0.060191852  0.020299442
[206]  0.068075009  0.081746560 -0.156882099 -0.515309845 -0.185243507
[211]  0.483435114 -0.029006273 -0.418043534 -0.004565803  0.130407752
[216] -0.118726163  0.017213437 -0.057944323 -0.085981737  0.281449381
[221]  0.122594294  0.016758907 -0.479834706 -0.430402525 -0.380385897
[226]  0.143600063  0.068684974  0.112763904  0.012774128  0.224135060
> 
> proc.time()
   user  system elapsed 
   3.64    9.12   13.75 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R version 3.5.1 Patched (2018-07-24 r75005) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

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] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 403330 21.6     838565 44.8   627611 33.6
Vcells 709884  5.5    8388608 64.0  1668139 12.8
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Oct 17 00:52:04 2018"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Oct 17 00:52:05 2018"
> 
> 
> 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: 0x0000000005eecfd0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Oct 17 00:52:07 2018"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Oct 17 00:52:08 2018"
> 
> ColMode(tmp2)
<pointer: 0x0000000005eecfd0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]       [,3]       [,4]
[1,] 100.7931875 -2.1499987 -0.4416072  0.6314798
[2,]   0.3764198  0.6854907 -0.9126349  1.1903530
[3,]  -2.0554418  1.3538851 -0.3126795 -0.4150676
[4,]   1.1617579  0.8897976  1.1407717 -2.0917428
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 100.7931875 2.1499987 0.4416072 0.6314798
[2,]   0.3764198 0.6854907 0.9126349 1.1903530
[3,]   2.0554418 1.3538851 0.3126795 0.4150676
[4,]   1.1617579 0.8897976 1.1407717 2.0917428
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0395810 1.4662874 0.6645353 0.7946570
[2,]  0.6135306 0.8279437 0.9553193 1.0910330
[3,]  1.4336812 1.1635657 0.5591776 0.6442574
[4,]  1.0778487 0.9432909 1.0680691 1.4462859
> 
> 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:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 226.18900 41.81287 32.08696 33.57805
[2,]  31.51173 33.96493 35.46583 37.10068
[3,]  41.39225 37.98954 30.90446 31.85764
[4,]  36.94024 35.32271 36.82146 41.55460
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x0000000005755fe0>
> exp(tmp5)
<pointer: 0x0000000005755fe0>
> log(tmp5,2)
<pointer: 0x0000000005755fe0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.7828
> Min(tmp5)
[1] 53.32176
> mean(tmp5)
[1] 72.251
> Sum(tmp5)
[1] 14450.2
> Var(tmp5)
[1] 869.2813
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.37930 72.66589 68.66068 72.52007 68.76694 70.28515 71.62882 69.44625
 [9] 68.45077 69.70612
> rowSums(tmp5)
 [1] 1807.586 1453.318 1373.214 1450.401 1375.339 1405.703 1432.576 1388.925
 [9] 1369.015 1394.122
> rowVars(tmp5)
 [1] 8071.62310   80.06444   83.15409   62.89010   62.87041   47.12915
 [7]  108.08575   44.03313   70.07550   67.34138
> rowSd(tmp5)
 [1] 89.842212  8.947874  9.118887  7.930328  7.929086  6.865068 10.396430
 [8]  6.635746  8.371111  8.206179
> rowMax(tmp5)
 [1] 470.78276  89.75034  86.15255  87.87864  88.92176  83.29299  87.38895
 [8]  84.48967  82.83177  86.23337
> rowMin(tmp5)
 [1] 58.21757 56.79416 54.15604 59.30006 55.47125 56.14880 54.72657 53.32176
 [9] 55.28051 56.43904
> 
> colMeans(tmp5)
 [1] 110.99394  74.41081  68.07508  71.71721  68.78662  66.62816  72.55256
 [8]  69.02008  70.37073  70.73979  69.67655  69.21377  73.32194  69.21696
[15]  71.21166  64.24813  73.18834  73.24632  71.04196  67.35936
> colSums(tmp5)
 [1] 1109.9394  744.1081  680.7508  717.1721  687.8662  666.2816  725.5256
 [8]  690.2008  703.7073  707.3979  696.7655  692.1377  733.2194  692.1696
[15]  712.1166  642.4813  731.8834  732.4632  710.4196  673.5936
> colVars(tmp5)
 [1] 16026.42594    58.64844    33.48510    72.28461    48.14326    64.79722
 [7]   102.05998    88.84794    38.32945    49.27473    57.28673    56.67930
[13]   119.81191    71.78338    49.37200    36.24888   106.53765    72.53677
[19]    98.08397    79.07084
> colSd(tmp5)
 [1] 126.595521   7.658227   5.786632   8.502036   6.938534   8.049672
 [7]  10.102474   9.425919   6.191078   7.019596   7.568800   7.528566
[13]  10.945863   8.472507   7.026521   6.020705  10.321707   8.516852
[19]   9.903735   8.892178
> colMax(tmp5)
 [1] 470.78276  87.02802  76.63905  86.49046  82.77850  78.19441  88.92176
 [8]  82.83177  80.64121  84.35148  81.33952  81.66647  89.75034  80.58134
[15]  79.35792  75.38316  86.23337  84.70655  87.87864  86.45557
> colMin(tmp5)
 [1] 64.24588 63.33953 56.89893 55.47125 57.86861 54.72657 58.21757 56.14880
 [9] 57.52540 58.77664 59.79968 56.20540 56.43904 54.15604 55.89213 56.79416
[17] 59.31862 59.03011 57.15400 53.32176
> 
> 
> ### 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]       NA 72.66589 68.66068 72.52007 68.76694 70.28515 71.62882 69.44625
 [9] 68.45077 69.70612
> rowSums(tmp5)
 [1]       NA 1453.318 1373.214 1450.401 1375.339 1405.703 1432.576 1388.925
 [9] 1369.015 1394.122
> rowVars(tmp5)
 [1] 8503.64815   80.06444   83.15409   62.89010   62.87041   47.12915
 [7]  108.08575   44.03313   70.07550   67.34138
> rowSd(tmp5)
 [1] 92.215227  8.947874  9.118887  7.930328  7.929086  6.865068 10.396430
 [8]  6.635746  8.371111  8.206179
> rowMax(tmp5)
 [1]       NA 89.75034 86.15255 87.87864 88.92176 83.29299 87.38895 84.48967
 [9] 82.83177 86.23337
> rowMin(tmp5)
 [1]       NA 56.79416 54.15604 59.30006 55.47125 56.14880 54.72657 53.32176
 [9] 55.28051 56.43904
> 
> colMeans(tmp5)
 [1] 110.99394  74.41081  68.07508  71.71721  68.78662  66.62816  72.55256
 [8]  69.02008  70.37073  70.73979  69.67655        NA  73.32194  69.21696
[15]  71.21166  64.24813  73.18834  73.24632  71.04196  67.35936
> colSums(tmp5)
 [1] 1109.9394  744.1081  680.7508  717.1721  687.8662  666.2816  725.5256
 [8]  690.2008  703.7073  707.3979  696.7655        NA  733.2194  692.1696
[15]  712.1166  642.4813  731.8834  732.4632  710.4196  673.5936
> colVars(tmp5)
 [1] 16026.42594    58.64844    33.48510    72.28461    48.14326    64.79722
 [7]   102.05998    88.84794    38.32945    49.27473    57.28673          NA
[13]   119.81191    71.78338    49.37200    36.24888   106.53765    72.53677
[19]    98.08397    79.07084
> colSd(tmp5)
 [1] 126.595521   7.658227   5.786632   8.502036   6.938534   8.049672
 [7]  10.102474   9.425919   6.191078   7.019596   7.568800         NA
[13]  10.945863   8.472507   7.026521   6.020705  10.321707   8.516852
[19]   9.903735   8.892178
> colMax(tmp5)
 [1] 470.78276  87.02802  76.63905  86.49046  82.77850  78.19441  88.92176
 [8]  82.83177  80.64121  84.35148  81.33952        NA  89.75034  80.58134
[15]  79.35792  75.38316  86.23337  84.70655  87.87864  86.45557
> colMin(tmp5)
 [1] 64.24588 63.33953 56.89893 55.47125 57.86861 54.72657 58.21757 56.14880
 [9] 57.52540 58.77664 59.79968       NA 56.43904 54.15604 55.89213 56.79416
[17] 59.31862 59.03011 57.15400 53.32176
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.7828
> Min(tmp5,na.rm=TRUE)
[1] 53.32176
> mean(tmp5,na.rm=TRUE)
[1] 72.24405
> Sum(tmp5,na.rm=TRUE)
[1] 14376.57
> Var(tmp5,na.rm=TRUE)
[1] 873.6619
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.26064 72.66589 68.66068 72.52007 68.76694 70.28515 71.62882 69.44625
 [9] 68.45077 69.70612
> rowSums(tmp5,na.rm=TRUE)
 [1] 1733.952 1453.318 1373.214 1450.401 1375.339 1405.703 1432.576 1388.925
 [9] 1369.015 1394.122
> rowVars(tmp5,na.rm=TRUE)
 [1] 8503.64815   80.06444   83.15409   62.89010   62.87041   47.12915
 [7]  108.08575   44.03313   70.07550   67.34138
> rowSd(tmp5,na.rm=TRUE)
 [1] 92.215227  8.947874  9.118887  7.930328  7.929086  6.865068 10.396430
 [8]  6.635746  8.371111  8.206179
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.78276  89.75034  86.15255  87.87864  88.92176  83.29299  87.38895
 [8]  84.48967  82.83177  86.23337
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.21757 56.79416 54.15604 59.30006 55.47125 56.14880 54.72657 53.32176
 [9] 55.28051 56.43904
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.99394  74.41081  68.07508  71.71721  68.78662  66.62816  72.55256
 [8]  69.02008  70.37073  70.73979  69.67655  68.72267  73.32194  69.21696
[15]  71.21166  64.24813  73.18834  73.24632  71.04196  67.35936
> colSums(tmp5,na.rm=TRUE)
 [1] 1109.9394  744.1081  680.7508  717.1721  687.8662  666.2816  725.5256
 [8]  690.2008  703.7073  707.3979  696.7655  618.5040  733.2194  692.1696
[15]  712.1166  642.4813  731.8834  732.4632  710.4196  673.5936
> colVars(tmp5,na.rm=TRUE)
 [1] 16026.42594    58.64844    33.48510    72.28461    48.14326    64.79722
 [7]   102.05998    88.84794    38.32945    49.27473    57.28673    61.05086
[13]   119.81191    71.78338    49.37200    36.24888   106.53765    72.53677
[19]    98.08397    79.07084
> colSd(tmp5,na.rm=TRUE)
 [1] 126.595521   7.658227   5.786632   8.502036   6.938534   8.049672
 [7]  10.102474   9.425919   6.191078   7.019596   7.568800   7.813505
[13]  10.945863   8.472507   7.026521   6.020705  10.321707   8.516852
[19]   9.903735   8.892178
> colMax(tmp5,na.rm=TRUE)
 [1] 470.78276  87.02802  76.63905  86.49046  82.77850  78.19441  88.92176
 [8]  82.83177  80.64121  84.35148  81.33952  81.66647  89.75034  80.58134
[15]  79.35792  75.38316  86.23337  84.70655  87.87864  86.45557
> colMin(tmp5,na.rm=TRUE)
 [1] 64.24588 63.33953 56.89893 55.47125 57.86861 54.72657 58.21757 56.14880
 [9] 57.52540 58.77664 59.79968 56.20540 56.43904 54.15604 55.89213 56.79416
[17] 59.31862 59.03011 57.15400 53.32176
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1]      NaN 72.66589 68.66068 72.52007 68.76694 70.28515 71.62882 69.44625
 [9] 68.45077 69.70612
> rowSums(tmp5,na.rm=TRUE)
 [1]    0.000 1453.318 1373.214 1450.401 1375.339 1405.703 1432.576 1388.925
 [9] 1369.015 1394.122
> rowVars(tmp5,na.rm=TRUE)
 [1]        NA  80.06444  83.15409  62.89010  62.87041  47.12915 108.08575
 [8]  44.03313  70.07550  67.34138
> rowSd(tmp5,na.rm=TRUE)
 [1]        NA  8.947874  9.118887  7.930328  7.929086  6.865068 10.396430
 [8]  6.635746  8.371111  8.206179
> rowMax(tmp5,na.rm=TRUE)
 [1]       NA 89.75034 86.15255 87.87864 88.92176 83.29299 87.38895 84.48967
 [9] 82.83177 86.23337
> rowMin(tmp5,na.rm=TRUE)
 [1]       NA 56.79416 54.15604 59.30006 55.47125 56.14880 54.72657 53.32176
 [9] 55.28051 56.43904
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 71.01740 73.00890 68.21844 71.92042 69.07759 65.34302 74.14534 69.78847
 [9] 69.22956 71.08223 68.38066      NaN 74.96694 68.95180 71.06444 64.15256
[17] 73.90347 73.62941 70.75341 67.37812
> colSums(tmp5,na.rm=TRUE)
 [1] 639.1566 657.0801 613.9660 647.2838 621.6983 588.0872 667.3081 628.0962
 [9] 623.0661 639.7401 615.4260   0.0000 674.7025 620.5662 639.5799 577.3731
[17] 665.1312 662.6647 636.7807 606.4031
> colVars(tmp5,na.rm=TRUE)
 [1]  50.84014  43.86923  37.43952  80.85562  53.20870  54.31657  86.27689
 [8]  93.31167  28.47025  54.11484  45.55523        NA 104.34565  79.96532
[15]  55.29964  40.67726 114.10142  79.95290 109.40776  88.95073
> colSd(tmp5,na.rm=TRUE)
 [1]  7.130227  6.623385  6.118784  8.991976  7.294430  7.369978  9.288536
 [8]  9.659797  5.335752  7.356279  6.749462        NA 10.214972  8.942333
[15]  7.436373  6.377873 10.681827  8.941639 10.459816  9.431369
> colMax(tmp5,na.rm=TRUE)
 [1] 86.15255 84.48967 76.63905 86.49046 82.77850 75.77204 88.92176 82.83177
 [9] 75.69825 84.35148 80.67654     -Inf 89.75034 80.58134 79.35792 75.38316
[17] 86.23337 84.70655 87.87864 86.45557
> colMin(tmp5,na.rm=TRUE)
 [1] 64.24588 63.33953 56.89893 55.47125 57.86861 54.72657 62.65081 56.14880
 [9] 57.52540 58.77664 59.79968      Inf 56.43904 54.15604 55.89213 56.79416
[17] 59.31862 59.03011 57.15400 53.32176
> 
> 
> 
> 
> 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] 338.86788 180.67092 143.88725 115.62999 174.19330 217.13365 322.44579
 [8] 172.30848 313.85469  92.26242
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 338.86788 180.67092 143.88725 115.62999 174.19330 217.13365 322.44579
 [8] 172.30848 313.85469  92.26242
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  2.842171e-14 -1.421085e-13  2.842171e-14  1.136868e-13 -4.263256e-14
 [6] -5.684342e-14  0.000000e+00  8.526513e-14 -5.684342e-14  0.000000e+00
[11]  5.684342e-14  5.684342e-14  0.000000e+00 -2.842171e-14  5.684342e-14
[16]  8.526513e-14  2.842171e-14  0.000000e+00 -2.842171e-13 -4.263256e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
10   2 
6   16 
4   6 
3   7 
3   20 
1   7 
9   13 
3   12 
6   7 
9   11 
5   19 
8   11 
4   16 
7   6 
5   9 
6   6 
2   2 
2   14 
1   9 
4   3 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.810854
> Min(tmp)
[1] -2.371485
> mean(tmp)
[1] 0.1280285
> Sum(tmp)
[1] 12.80285
> Var(tmp)
[1] 1.152784
> 
> rowMeans(tmp)
[1] 0.1280285
> rowSums(tmp)
[1] 12.80285
> rowVars(tmp)
[1] 1.152784
> rowSd(tmp)
[1] 1.073678
> rowMax(tmp)
[1] 2.810854
> rowMin(tmp)
[1] -2.371485
> 
> colMeans(tmp)
  [1] -1.81758735 -0.37631645  1.10107596 -0.80788793 -0.36184521 -0.81995991
  [7]  0.44028968  0.81382620 -0.09385300  2.28202789 -0.66664589  0.22528281
 [13]  0.67168953  0.44942433  1.52053732  0.91992127  1.68034107 -0.37287881
 [19]  0.09147145 -0.24643296  0.82702440  0.64623192  2.76668135  0.85769170
 [25]  0.72043752 -1.64952863  0.65846168  1.92123112 -0.23836755  2.81085416
 [31] -0.68751229  0.92683864  0.02791746 -1.44132287  0.50474358  0.59426266
 [37] -0.28083484  0.97468292  2.40117408  0.86448852 -0.59757913  0.95957426
 [43]  0.08700159  0.97198444 -2.37148541  0.05629480  0.08186099  0.69827339
 [49] -1.09459706  0.25220384 -1.76705618 -0.94740033 -1.47846820  0.04835885
 [55]  1.96201666  1.00134478  1.20703709 -0.66638763  0.39872687 -1.61970387
 [61] -0.22851478  0.47474696 -0.47515119  1.06515085 -0.09514412 -0.46352404
 [67] -0.39487473  0.26056262  0.73462650  2.13369420  0.22112939  0.50940059
 [73]  0.96975810 -1.03981790  1.47173976 -0.63366485 -1.14438359 -1.29905260
 [79]  1.41879337  0.38047829 -0.96151552 -0.88690628  0.05525780  0.67466076
 [85] -0.01443946  1.06523842  0.55766382 -1.48571668 -0.41000857 -0.04784583
 [91]  0.89758602 -1.97197249 -0.82297018 -0.96244370 -1.68081083 -0.99910416
 [97]  0.22574755  0.59904248 -0.56989865  0.65569286
> colSums(tmp)
  [1] -1.81758735 -0.37631645  1.10107596 -0.80788793 -0.36184521 -0.81995991
  [7]  0.44028968  0.81382620 -0.09385300  2.28202789 -0.66664589  0.22528281
 [13]  0.67168953  0.44942433  1.52053732  0.91992127  1.68034107 -0.37287881
 [19]  0.09147145 -0.24643296  0.82702440  0.64623192  2.76668135  0.85769170
 [25]  0.72043752 -1.64952863  0.65846168  1.92123112 -0.23836755  2.81085416
 [31] -0.68751229  0.92683864  0.02791746 -1.44132287  0.50474358  0.59426266
 [37] -0.28083484  0.97468292  2.40117408  0.86448852 -0.59757913  0.95957426
 [43]  0.08700159  0.97198444 -2.37148541  0.05629480  0.08186099  0.69827339
 [49] -1.09459706  0.25220384 -1.76705618 -0.94740033 -1.47846820  0.04835885
 [55]  1.96201666  1.00134478  1.20703709 -0.66638763  0.39872687 -1.61970387
 [61] -0.22851478  0.47474696 -0.47515119  1.06515085 -0.09514412 -0.46352404
 [67] -0.39487473  0.26056262  0.73462650  2.13369420  0.22112939  0.50940059
 [73]  0.96975810 -1.03981790  1.47173976 -0.63366485 -1.14438359 -1.29905260
 [79]  1.41879337  0.38047829 -0.96151552 -0.88690628  0.05525780  0.67466076
 [85] -0.01443946  1.06523842  0.55766382 -1.48571668 -0.41000857 -0.04784583
 [91]  0.89758602 -1.97197249 -0.82297018 -0.96244370 -1.68081083 -0.99910416
 [97]  0.22574755  0.59904248 -0.56989865  0.65569286
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -1.81758735 -0.37631645  1.10107596 -0.80788793 -0.36184521 -0.81995991
  [7]  0.44028968  0.81382620 -0.09385300  2.28202789 -0.66664589  0.22528281
 [13]  0.67168953  0.44942433  1.52053732  0.91992127  1.68034107 -0.37287881
 [19]  0.09147145 -0.24643296  0.82702440  0.64623192  2.76668135  0.85769170
 [25]  0.72043752 -1.64952863  0.65846168  1.92123112 -0.23836755  2.81085416
 [31] -0.68751229  0.92683864  0.02791746 -1.44132287  0.50474358  0.59426266
 [37] -0.28083484  0.97468292  2.40117408  0.86448852 -0.59757913  0.95957426
 [43]  0.08700159  0.97198444 -2.37148541  0.05629480  0.08186099  0.69827339
 [49] -1.09459706  0.25220384 -1.76705618 -0.94740033 -1.47846820  0.04835885
 [55]  1.96201666  1.00134478  1.20703709 -0.66638763  0.39872687 -1.61970387
 [61] -0.22851478  0.47474696 -0.47515119  1.06515085 -0.09514412 -0.46352404
 [67] -0.39487473  0.26056262  0.73462650  2.13369420  0.22112939  0.50940059
 [73]  0.96975810 -1.03981790  1.47173976 -0.63366485 -1.14438359 -1.29905260
 [79]  1.41879337  0.38047829 -0.96151552 -0.88690628  0.05525780  0.67466076
 [85] -0.01443946  1.06523842  0.55766382 -1.48571668 -0.41000857 -0.04784583
 [91]  0.89758602 -1.97197249 -0.82297018 -0.96244370 -1.68081083 -0.99910416
 [97]  0.22574755  0.59904248 -0.56989865  0.65569286
> colMin(tmp)
  [1] -1.81758735 -0.37631645  1.10107596 -0.80788793 -0.36184521 -0.81995991
  [7]  0.44028968  0.81382620 -0.09385300  2.28202789 -0.66664589  0.22528281
 [13]  0.67168953  0.44942433  1.52053732  0.91992127  1.68034107 -0.37287881
 [19]  0.09147145 -0.24643296  0.82702440  0.64623192  2.76668135  0.85769170
 [25]  0.72043752 -1.64952863  0.65846168  1.92123112 -0.23836755  2.81085416
 [31] -0.68751229  0.92683864  0.02791746 -1.44132287  0.50474358  0.59426266
 [37] -0.28083484  0.97468292  2.40117408  0.86448852 -0.59757913  0.95957426
 [43]  0.08700159  0.97198444 -2.37148541  0.05629480  0.08186099  0.69827339
 [49] -1.09459706  0.25220384 -1.76705618 -0.94740033 -1.47846820  0.04835885
 [55]  1.96201666  1.00134478  1.20703709 -0.66638763  0.39872687 -1.61970387
 [61] -0.22851478  0.47474696 -0.47515119  1.06515085 -0.09514412 -0.46352404
 [67] -0.39487473  0.26056262  0.73462650  2.13369420  0.22112939  0.50940059
 [73]  0.96975810 -1.03981790  1.47173976 -0.63366485 -1.14438359 -1.29905260
 [79]  1.41879337  0.38047829 -0.96151552 -0.88690628  0.05525780  0.67466076
 [85] -0.01443946  1.06523842  0.55766382 -1.48571668 -0.41000857 -0.04784583
 [91]  0.89758602 -1.97197249 -0.82297018 -0.96244370 -1.68081083 -0.99910416
 [97]  0.22574755  0.59904248 -0.56989865  0.65569286
> colMedians(tmp)
  [1] -1.81758735 -0.37631645  1.10107596 -0.80788793 -0.36184521 -0.81995991
  [7]  0.44028968  0.81382620 -0.09385300  2.28202789 -0.66664589  0.22528281
 [13]  0.67168953  0.44942433  1.52053732  0.91992127  1.68034107 -0.37287881
 [19]  0.09147145 -0.24643296  0.82702440  0.64623192  2.76668135  0.85769170
 [25]  0.72043752 -1.64952863  0.65846168  1.92123112 -0.23836755  2.81085416
 [31] -0.68751229  0.92683864  0.02791746 -1.44132287  0.50474358  0.59426266
 [37] -0.28083484  0.97468292  2.40117408  0.86448852 -0.59757913  0.95957426
 [43]  0.08700159  0.97198444 -2.37148541  0.05629480  0.08186099  0.69827339
 [49] -1.09459706  0.25220384 -1.76705618 -0.94740033 -1.47846820  0.04835885
 [55]  1.96201666  1.00134478  1.20703709 -0.66638763  0.39872687 -1.61970387
 [61] -0.22851478  0.47474696 -0.47515119  1.06515085 -0.09514412 -0.46352404
 [67] -0.39487473  0.26056262  0.73462650  2.13369420  0.22112939  0.50940059
 [73]  0.96975810 -1.03981790  1.47173976 -0.63366485 -1.14438359 -1.29905260
 [79]  1.41879337  0.38047829 -0.96151552 -0.88690628  0.05525780  0.67466076
 [85] -0.01443946  1.06523842  0.55766382 -1.48571668 -0.41000857 -0.04784583
 [91]  0.89758602 -1.97197249 -0.82297018 -0.96244370 -1.68081083 -0.99910416
 [97]  0.22574755  0.59904248 -0.56989865  0.65569286
> colRanges(tmp)
          [,1]       [,2]     [,3]       [,4]       [,5]       [,6]      [,7]
[1,] -1.817587 -0.3763164 1.101076 -0.8078879 -0.3618452 -0.8199599 0.4402897
[2,] -1.817587 -0.3763164 1.101076 -0.8078879 -0.3618452 -0.8199599 0.4402897
          [,8]      [,9]    [,10]      [,11]     [,12]     [,13]     [,14]
[1,] 0.8138262 -0.093853 2.282028 -0.6666459 0.2252828 0.6716895 0.4494243
[2,] 0.8138262 -0.093853 2.282028 -0.6666459 0.2252828 0.6716895 0.4494243
        [,15]     [,16]    [,17]      [,18]      [,19]     [,20]     [,21]
[1,] 1.520537 0.9199213 1.680341 -0.3728788 0.09147145 -0.246433 0.8270244
[2,] 1.520537 0.9199213 1.680341 -0.3728788 0.09147145 -0.246433 0.8270244
         [,22]    [,23]     [,24]     [,25]     [,26]     [,27]    [,28]
[1,] 0.6462319 2.766681 0.8576917 0.7204375 -1.649529 0.6584617 1.921231
[2,] 0.6462319 2.766681 0.8576917 0.7204375 -1.649529 0.6584617 1.921231
          [,29]    [,30]      [,31]     [,32]      [,33]     [,34]     [,35]
[1,] -0.2383676 2.810854 -0.6875123 0.9268386 0.02791746 -1.441323 0.5047436
[2,] -0.2383676 2.810854 -0.6875123 0.9268386 0.02791746 -1.441323 0.5047436
         [,36]      [,37]     [,38]    [,39]     [,40]      [,41]     [,42]
[1,] 0.5942627 -0.2808348 0.9746829 2.401174 0.8644885 -0.5975791 0.9595743
[2,] 0.5942627 -0.2808348 0.9746829 2.401174 0.8644885 -0.5975791 0.9595743
          [,43]     [,44]     [,45]     [,46]      [,47]     [,48]     [,49]
[1,] 0.08700159 0.9719844 -2.371485 0.0562948 0.08186099 0.6982734 -1.094597
[2,] 0.08700159 0.9719844 -2.371485 0.0562948 0.08186099 0.6982734 -1.094597
         [,50]     [,51]      [,52]     [,53]      [,54]    [,55]    [,56]
[1,] 0.2522038 -1.767056 -0.9474003 -1.478468 0.04835885 1.962017 1.001345
[2,] 0.2522038 -1.767056 -0.9474003 -1.478468 0.04835885 1.962017 1.001345
        [,57]      [,58]     [,59]     [,60]      [,61]    [,62]      [,63]
[1,] 1.207037 -0.6663876 0.3987269 -1.619704 -0.2285148 0.474747 -0.4751512
[2,] 1.207037 -0.6663876 0.3987269 -1.619704 -0.2285148 0.474747 -0.4751512
        [,64]       [,65]     [,66]      [,67]     [,68]     [,69]    [,70]
[1,] 1.065151 -0.09514412 -0.463524 -0.3948747 0.2605626 0.7346265 2.133694
[2,] 1.065151 -0.09514412 -0.463524 -0.3948747 0.2605626 0.7346265 2.133694
         [,71]     [,72]     [,73]     [,74]   [,75]      [,76]     [,77]
[1,] 0.2211294 0.5094006 0.9697581 -1.039818 1.47174 -0.6336648 -1.144384
[2,] 0.2211294 0.5094006 0.9697581 -1.039818 1.47174 -0.6336648 -1.144384
         [,78]    [,79]     [,80]      [,81]      [,82]     [,83]     [,84]
[1,] -1.299053 1.418793 0.3804783 -0.9615155 -0.8869063 0.0552578 0.6746608
[2,] -1.299053 1.418793 0.3804783 -0.9615155 -0.8869063 0.0552578 0.6746608
           [,85]    [,86]     [,87]     [,88]      [,89]       [,90]    [,91]
[1,] -0.01443946 1.065238 0.5576638 -1.485717 -0.4100086 -0.04784583 0.897586
[2,] -0.01443946 1.065238 0.5576638 -1.485717 -0.4100086 -0.04784583 0.897586
         [,92]      [,93]      [,94]     [,95]      [,96]     [,97]     [,98]
[1,] -1.971972 -0.8229702 -0.9624437 -1.680811 -0.9991042 0.2257476 0.5990425
[2,] -1.971972 -0.8229702 -0.9624437 -1.680811 -0.9991042 0.2257476 0.5990425
          [,99]    [,100]
[1,] -0.5698987 0.6556929
[2,] -0.5698987 0.6556929
> 
> 
> Max(tmp2)
[1] 2.393534
> Min(tmp2)
[1] -2.170584
> mean(tmp2)
[1] 0.04664353
> Sum(tmp2)
[1] 4.664353
> Var(tmp2)
[1] 1.052797
> 
> rowMeans(tmp2)
  [1]  0.09498011 -0.57201587 -0.46992287 -0.96368156  0.79554442 -1.27999092
  [7]  1.07263270 -1.69274244  1.67176797 -0.34646283 -0.10361239  0.34464763
 [13] -0.70088687 -0.21919248 -0.06408695 -0.35860443  0.52080356  0.73158310
 [19]  0.42369736 -0.01613864 -0.94622843 -0.51260876  0.45533124 -1.03174092
 [25]  1.21557349 -0.15240934 -0.32371662  0.08858951 -1.18639099  0.52943371
 [31] -1.73280878 -0.01730358  0.22754554 -0.49884835 -0.42709759 -1.04350675
 [37] -1.76488938 -0.06200558  0.42949553  0.95555534 -0.95593292 -0.11730765
 [43] -0.09902903 -1.69341119  0.45836821  1.14689528  1.70182363  1.34805797
 [49] -0.75578158  0.31671918 -0.38465290  2.01815412 -0.47248582  0.57543970
 [55]  0.98036400  0.23870180  0.77630762 -0.14165312 -0.33501876 -1.78617639
 [61]  2.00661856  0.95088266  2.25065667  0.41507188  0.99607056 -0.33807306
 [67]  0.22674791 -0.84212276  1.74617191 -1.13887815 -1.47956896  0.42699769
 [73]  0.33598710  1.56741773  0.48571355  0.24999473  0.58440630 -1.58718014
 [79] -0.59585322 -1.94614480 -0.03920133  1.49718612 -2.17058378  1.67405980
 [85]  2.39353418  1.03123971  0.94499162 -0.91306449  0.25214658  0.49008795
 [91] -0.29035316 -1.50635889  1.18205893  0.49311308  0.06534970  1.09641596
 [97] -0.24068444 -0.67010089 -1.78550545  0.95543606
> rowSums(tmp2)
  [1]  0.09498011 -0.57201587 -0.46992287 -0.96368156  0.79554442 -1.27999092
  [7]  1.07263270 -1.69274244  1.67176797 -0.34646283 -0.10361239  0.34464763
 [13] -0.70088687 -0.21919248 -0.06408695 -0.35860443  0.52080356  0.73158310
 [19]  0.42369736 -0.01613864 -0.94622843 -0.51260876  0.45533124 -1.03174092
 [25]  1.21557349 -0.15240934 -0.32371662  0.08858951 -1.18639099  0.52943371
 [31] -1.73280878 -0.01730358  0.22754554 -0.49884835 -0.42709759 -1.04350675
 [37] -1.76488938 -0.06200558  0.42949553  0.95555534 -0.95593292 -0.11730765
 [43] -0.09902903 -1.69341119  0.45836821  1.14689528  1.70182363  1.34805797
 [49] -0.75578158  0.31671918 -0.38465290  2.01815412 -0.47248582  0.57543970
 [55]  0.98036400  0.23870180  0.77630762 -0.14165312 -0.33501876 -1.78617639
 [61]  2.00661856  0.95088266  2.25065667  0.41507188  0.99607056 -0.33807306
 [67]  0.22674791 -0.84212276  1.74617191 -1.13887815 -1.47956896  0.42699769
 [73]  0.33598710  1.56741773  0.48571355  0.24999473  0.58440630 -1.58718014
 [79] -0.59585322 -1.94614480 -0.03920133  1.49718612 -2.17058378  1.67405980
 [85]  2.39353418  1.03123971  0.94499162 -0.91306449  0.25214658  0.49008795
 [91] -0.29035316 -1.50635889  1.18205893  0.49311308  0.06534970  1.09641596
 [97] -0.24068444 -0.67010089 -1.78550545  0.95543606
> 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.09498011 -0.57201587 -0.46992287 -0.96368156  0.79554442 -1.27999092
  [7]  1.07263270 -1.69274244  1.67176797 -0.34646283 -0.10361239  0.34464763
 [13] -0.70088687 -0.21919248 -0.06408695 -0.35860443  0.52080356  0.73158310
 [19]  0.42369736 -0.01613864 -0.94622843 -0.51260876  0.45533124 -1.03174092
 [25]  1.21557349 -0.15240934 -0.32371662  0.08858951 -1.18639099  0.52943371
 [31] -1.73280878 -0.01730358  0.22754554 -0.49884835 -0.42709759 -1.04350675
 [37] -1.76488938 -0.06200558  0.42949553  0.95555534 -0.95593292 -0.11730765
 [43] -0.09902903 -1.69341119  0.45836821  1.14689528  1.70182363  1.34805797
 [49] -0.75578158  0.31671918 -0.38465290  2.01815412 -0.47248582  0.57543970
 [55]  0.98036400  0.23870180  0.77630762 -0.14165312 -0.33501876 -1.78617639
 [61]  2.00661856  0.95088266  2.25065667  0.41507188  0.99607056 -0.33807306
 [67]  0.22674791 -0.84212276  1.74617191 -1.13887815 -1.47956896  0.42699769
 [73]  0.33598710  1.56741773  0.48571355  0.24999473  0.58440630 -1.58718014
 [79] -0.59585322 -1.94614480 -0.03920133  1.49718612 -2.17058378  1.67405980
 [85]  2.39353418  1.03123971  0.94499162 -0.91306449  0.25214658  0.49008795
 [91] -0.29035316 -1.50635889  1.18205893  0.49311308  0.06534970  1.09641596
 [97] -0.24068444 -0.67010089 -1.78550545  0.95543606
> rowMin(tmp2)
  [1]  0.09498011 -0.57201587 -0.46992287 -0.96368156  0.79554442 -1.27999092
  [7]  1.07263270 -1.69274244  1.67176797 -0.34646283 -0.10361239  0.34464763
 [13] -0.70088687 -0.21919248 -0.06408695 -0.35860443  0.52080356  0.73158310
 [19]  0.42369736 -0.01613864 -0.94622843 -0.51260876  0.45533124 -1.03174092
 [25]  1.21557349 -0.15240934 -0.32371662  0.08858951 -1.18639099  0.52943371
 [31] -1.73280878 -0.01730358  0.22754554 -0.49884835 -0.42709759 -1.04350675
 [37] -1.76488938 -0.06200558  0.42949553  0.95555534 -0.95593292 -0.11730765
 [43] -0.09902903 -1.69341119  0.45836821  1.14689528  1.70182363  1.34805797
 [49] -0.75578158  0.31671918 -0.38465290  2.01815412 -0.47248582  0.57543970
 [55]  0.98036400  0.23870180  0.77630762 -0.14165312 -0.33501876 -1.78617639
 [61]  2.00661856  0.95088266  2.25065667  0.41507188  0.99607056 -0.33807306
 [67]  0.22674791 -0.84212276  1.74617191 -1.13887815 -1.47956896  0.42699769
 [73]  0.33598710  1.56741773  0.48571355  0.24999473  0.58440630 -1.58718014
 [79] -0.59585322 -1.94614480 -0.03920133  1.49718612 -2.17058378  1.67405980
 [85]  2.39353418  1.03123971  0.94499162 -0.91306449  0.25214658  0.49008795
 [91] -0.29035316 -1.50635889  1.18205893  0.49311308  0.06534970  1.09641596
 [97] -0.24068444 -0.67010089 -1.78550545  0.95543606
> 
> colMeans(tmp2)
[1] 0.04664353
> colSums(tmp2)
[1] 4.664353
> colVars(tmp2)
[1] 1.052797
> colSd(tmp2)
[1] 1.026059
> colMax(tmp2)
[1] 2.393534
> colMin(tmp2)
[1] -2.170584
> colMedians(tmp2)
[1] 0.02460553
> colRanges(tmp2)
          [,1]
[1,] -2.170584
[2,]  2.393534
> 
> 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.2161350  1.7315336  0.8001179 -7.1926757  2.0582897 -1.3959376
 [7]  7.7868863 -2.5430608  2.3262693  2.0664249
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.65602038
[2,] -0.72669133
[3,] -0.06609442
[4,]  0.36475201
[5,]  0.63306898
> 
> rowApply(tmp,sum)
 [1] -2.318701642 -0.446064010  3.193700893  0.005309063  1.412736552
 [6]  4.852287302 -2.423755899 -0.057961028 -2.361745295  1.565906479
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    8    2    8    6    3    4    3    5     6
 [2,]   10    2    9    2    8    1    6   10    9     2
 [3,]    9    9    4    9    1    4    2    4    3    10
 [4,]    5    1    1    6    5    6    9    2    1     1
 [5,]    2    6    5    5    7    7   10    9    2     4
 [6,]    7    5    3    1    2    9    7    1    7     9
 [7,]    4   10   10    3   10    2    8    8   10     8
 [8,]    3    3    7    4    3   10    5    5    4     3
 [9,]    8    7    8    7    4    8    3    6    8     7
[10,]    6    4    6   10    9    5    1    7    6     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.4552034 -2.8693339  3.3236285  1.2279442 -3.5338661 -0.4186159
 [7] -0.2550368  1.3866285  1.7799896 -3.0557540 -1.2099717  1.0774435
[13] -0.3137691  0.3758056 -3.2106619 -1.2339204 -1.4570157 -0.0916356
[19] -3.0185095  0.8367274
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.2362070
[2,] -0.3596972
[3,]  0.6525189
[4,]  1.2606374
[5,]  2.1379512
> 
> rowApply(tmp,sum)
[1]  0.12872511 -3.74303232 -0.06262241 -4.29315560 -0.23463474
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    2   20   18   17    7
[2,]   10   14    5    8    2
[3,]   19    8   14   18   16
[4,]   13   16   13   11    6
[5,]   16   18    4    1    1
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]        [,4]       [,5]       [,6]
[1,] -1.2362070  0.09804684  1.2705026  0.39802054  0.5097001 -0.9916504
[2,]  2.1379512  0.31135007 -0.6002163  1.29791658  1.4626848 -0.2691237
[3,]  1.2606374 -0.80101551  0.6949494  0.35691503 -0.9463248 -0.1077221
[4,]  0.6525189 -0.60832243  1.2153777 -0.04959323 -2.4645253  2.4986805
[5,] -0.3596972 -1.86939291  0.7430151 -0.77531469 -2.0954008 -1.5488002
           [,7]        [,8]       [,9]     [,10]       [,11]      [,12]
[1,] -0.8845600  0.77911596  0.7481388 -1.533624 -0.09390434 -0.4589444
[2,] -0.3772220 -1.98058081 -1.0646744  1.319549 -0.95258557  1.6092093
[3,]  0.2850332  1.85625142 -0.7842375 -1.175497  0.77128389 -1.3763417
[4,]  0.5987714  0.05365856 -0.3018777 -2.223330 -0.64884899  0.1340215
[5,]  0.1229407  0.67818342  3.1826405  0.557148 -0.28591671  1.1694988
          [,13]      [,14]       [,15]      [,16]      [,17]      [,18]
[1,] -0.1548451  0.4668652 -1.07015269  0.4814281  1.6934263  0.2395147
[2,] -1.0941695 -1.9075250  0.39971660 -1.1403599 -0.5024990  0.2061945
[3,]  1.2664484  0.9338899 -0.67322063  0.1423131 -0.4789193 -0.1599596
[4,] -1.2094776  0.2726949 -1.83690852  0.2058654 -0.6594092 -1.3282994
[5,]  0.8782746  0.6098806 -0.03009671 -0.9231671 -1.5096145  0.9509142
           [,19]      [,20]
[1,] -0.42687029  0.2947240
[2,] -0.07062587 -2.5280225
[3,] -2.35603334  1.2289276
[4,] -0.14027402  1.5461222
[5,] -0.02470594  0.2949761
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  677  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  587  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  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.0187329 -1.036899 1.152749 -0.6346298 1.135472 0.1622916 0.1746834
          col8       col9    col10    col11     col12    col13     col14
row1 -1.103105 -0.5234235 1.808789 0.918559 0.4961412 1.011173 0.4892039
          col15      col16        col17      col18     col19      col20
row1 -0.8559666 -0.1166146 -0.002119961 -0.1656059 -1.286833 -0.4926622
> tmp[,"col10"]
          col10
row1  1.8087893
row2  1.0261120
row3 -1.0426298
row4  0.7617589
row5  0.1194737
> tmp[c("row1","row5"),]
           col1      col2      col3       col4      col5       col6       col7
row1 -0.0187329 -1.036899 1.1527494 -0.6346298 1.1354722  0.1622916  0.1746834
row5 -0.8477152 -1.320060 0.2148474 -0.8366659 0.1376391 -0.6376339 -0.4669184
           col8       col9     col10    col11      col12    col13      col14
row1 -1.1031049 -0.5234235 1.8087893 0.918559  0.4961412 1.011173  0.4892039
row5  0.2278536 -1.3408211 0.1194737 2.609122 -1.5734497 1.121178 -0.7695913
          col15      col16        col17      col18     col19      col20
row1 -0.8559666 -0.1166146 -0.002119961 -0.1656059 -1.286833 -0.4926622
row5  0.4457635 -1.5105325  0.126542024  0.4833603  1.604514 -0.8291992
> tmp[,c("col6","col20")]
           col6      col20
row1  0.1622916 -0.4926622
row2 -0.4889578  0.8358506
row3 -1.8147627  0.2839421
row4 -1.2794788  1.7074985
row5 -0.6376339 -0.8291992
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  0.1622916 -0.4926622
row5 -0.6376339 -0.8291992
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7    col8
row1 50.92634 48.21523 50.53261 50.84441 50.63894 104.8595 50.19245 50.9468
         col9   col10    col11    col12    col13    col14    col15    col16
row1 47.79223 49.7172 50.07684 49.79204 49.40815 50.51425 52.10877 49.21205
       col17    col18    col19    col20
row1 48.5702 49.69182 49.13453 105.0675
> tmp[,"col10"]
        col10
row1 49.71720
row2 28.67152
row3 29.69863
row4 28.87258
row5 51.49060
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.92634 48.21523 50.53261 50.84441 50.63894 104.8595 50.19245 50.94680
row5 49.08162 50.41284 49.39322 49.30375 50.00353 105.1232 51.22975 51.02031
         col9   col10    col11    col12    col13    col14    col15    col16
row1 47.79223 49.7172 50.07684 49.79204 49.40815 50.51425 52.10877 49.21205
row5 50.98279 51.4906 49.41909 49.82251 51.23598 50.91017 50.98648 51.39189
        col17    col18    col19    col20
row1 48.57020 49.69182 49.13453 105.0675
row5 50.77194 50.80797 50.94332 105.0406
> tmp[,c("col6","col20")]
          col6     col20
row1 104.85952 105.06746
row2  75.40893  74.79412
row3  75.29094  74.02047
row4  77.14936  72.54429
row5 105.12324 105.04058
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.8595 105.0675
row5 105.1232 105.0406
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.8595 105.0675
row5 105.1232 105.0406
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.7416403
[2,] -0.7524128
[3,] -1.6825985
[4,]  0.3087556
[5,] -0.1300852
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.1542997 -1.1112348
[2,]  1.9074967  0.7511658
[3,]  1.4037700  0.5650767
[4,]  0.6451973  0.4205331
[5,] -2.0964408 -0.9185816
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
             col6       col20
[1,]  0.551742679 -0.47095970
[2,] -0.005313644 -0.02470127
[3,]  1.885619069 -0.39940281
[4,]  2.685063265  2.40222718
[5,] -0.237431273  1.51132421
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.5517427
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
             col6
[1,]  0.551742679
[2,] -0.005313644
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]         [,3]       [,4]       [,5]      [,6]
row3 -0.1107887 -0.6941101 -0.009703601 -0.7489432 -0.6576432 -1.431203
row1 -1.6866174  0.5800103  0.600116377  1.7244722 -3.7150251  1.104416
           [,7]       [,8]       [,9]       [,10]      [,11]      [,12]
row3  0.1816296 -0.6485291  1.1662786  0.10271888  0.1450915 0.02988543
row1 -1.1812661 -0.3787254 -0.1841114 -0.05898536 -0.9154613 0.30671211
          [,13]     [,14]     [,15]      [,16]       [,17]     [,18]     [,19]
row3  0.4329095 -1.411377  2.756101 -0.2634495  0.04796337 -1.969332 0.5896061
row1 -0.5144763 -1.085959 -1.781109  0.3527333 -0.58171353 -1.156552 0.8364067
          [,20]
row3 -0.5569061
row1  0.3935459
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]      [,2]       [,3]      [,4]      [,5]      [,6]      [,7]
row2 -0.2009128 -3.262179 0.08552322 0.5260572 -1.404156 0.8257341 0.1836876
          [,8]     [,9]       [,10]
row2 0.2838725 2.375334 -0.08288451
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]    [,3]      [,4]       [,5]     [,6]     [,7]     [,8]
row5 -2.292824 0.216019 0.94166 -2.267814 -0.1049408 -1.64089 1.555276 1.110905
         [,9]        [,10]    [,11]      [,12]     [,13]     [,14]    [,15]
row5 1.010135 -0.007347607 1.486459 -0.4705826 0.1902621 0.2108129 1.085138
        [,16]    [,17]      [,18]     [,19]     [,20]
row5 1.803301 0.145334 0.07791255 0.7084501 -0.274696
> 
> 
> 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: 0x0000000005afa7e0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e41a805a36"
 [2] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e41964980" 
 [3] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e4effbfd"  
 [4] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e456b030c8"
 [5] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e43b8a601f"
 [6] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e43d4695"  
 [7] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e42c736adb"
 [8] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e450464ac0"
 [9] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e4403b4161"
[10] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e4766579b" 
[11] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e4695f6938"
[12] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e470345c77"
[13] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e4427456dd"
[14] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e45e06516a"
[15] "C:/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM12e428763fad"
> 
> 
> ### 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: 0x0000000005230cd8>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x0000000005230cd8>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.7-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x0000000005230cd8>
> rowMedians(tmp)
  [1]  0.068930305 -0.778446098  0.343767587  0.081687983  0.176667985
  [6] -0.022318398 -0.285390247 -0.559524172 -0.091399567  0.334357059
 [11] -0.015884221 -0.432441021 -0.123065842 -0.497208149 -0.518698595
 [16]  0.042595476  0.285687874  0.309972822 -0.136398877  0.229838822
 [21]  0.218477271  0.404428626 -0.189977821  0.032600771  0.199953795
 [26] -0.164655389 -0.249025555 -0.149759591  0.337433756  0.111564318
 [31] -0.281884518  0.416007710 -0.350031089  0.067445214 -0.356364172
 [36] -0.576358069  0.372131576  0.064495103 -0.107946195  0.331737662
 [41]  0.099418127  0.094720718  0.483521048  0.193197989 -0.225026316
 [46]  0.464354588 -0.625835677  0.035860451  0.013404564 -0.400454463
 [51] -0.149082824 -0.229310162  0.291231450  0.008312662  0.002540590
 [56] -0.369287162  0.244778848  0.288597331 -0.395050857 -0.283395709
 [61]  0.014081020  0.512777578 -0.656402409 -0.311677340  0.163476944
 [66]  0.140219097  0.461402781 -0.066032559  0.213762632 -0.528555425
 [71] -0.375149021 -0.073897481  0.091253413  0.565807706  0.379795600
 [76] -0.203296066  0.426677597  0.451906955  0.071610970  0.611764358
 [81]  0.523621090  0.363318552 -0.321070635 -0.247610642  0.516088930
 [86] -0.364785094 -0.312322388 -0.159871021 -0.027678601 -0.676389286
 [91]  0.354364270 -0.030727639 -0.215915421 -0.128060693  0.449517007
 [96] -0.347790226 -0.456442115  0.727055942 -0.435831244 -0.342662622
[101] -0.406274839  0.088070166  0.180063322  0.381889705  0.195556923
[106]  0.005089098  0.188154390  0.089048402  0.061474152 -0.182434445
[111] -0.145351923 -0.367069820  0.032987547 -0.136215944 -0.780976717
[116] -0.003976084  0.158295073  0.329057541 -0.141845522  0.148195917
[121]  0.557221893 -0.213235126  0.003795588 -0.184459924 -0.497641892
[126]  0.060363392 -0.486882330  0.228911169  0.712802801  0.532532102
[131] -0.162134389  0.224002602 -0.061125513  0.363933152  0.147187515
[136]  0.566344977  0.122709311 -0.009150408 -0.046621998  0.478267904
[141] -0.442467827 -0.018311145  0.441572625 -0.250865632 -0.196583664
[146] -0.121830217  0.167549743  0.473399093 -0.264349297  0.193017037
[151]  0.142554382 -0.492985396 -0.127815751  0.202587700  0.333275768
[156]  0.005120470  0.081663698 -0.358458357  0.025576027  0.461453512
[161] -0.185239358 -0.170384196  0.043594651 -0.016767526 -0.345040555
[166] -0.268714418  0.081001650  0.273830053  0.322029440  0.068802342
[171]  0.157549537 -0.497777567 -0.007803039 -0.416649337 -0.006933287
[176]  0.131377180 -0.111564576 -0.155127652 -0.242095321 -0.072412828
[181] -0.508361349 -0.363396343 -0.487207598 -0.014331681 -0.027523345
[186]  0.515222456  0.397291509  0.294666868 -0.088644934 -0.216296194
[191] -0.373085661 -0.517295087 -0.215894464 -0.231414157  0.384908985
[196] -0.183020039 -0.383620597  0.058427692  0.313458635 -0.471267472
[201]  0.079918092 -0.107119367 -0.068153933 -0.032511744  0.023367592
[206] -0.183445522  0.363743032 -0.260718506 -0.408544022 -0.025336125
[211]  0.224585170 -0.193659412 -0.196699601  0.565604829 -0.160390061
[216] -0.010230737  0.041334939 -0.623328882  0.711795835 -0.200218220
[221]  0.188133551 -0.232213992 -0.258020896 -0.134315204 -0.012967182
[226]  0.036429593  0.126416237 -0.201540392  0.168234680  0.143762431
> 
> proc.time()
   user  system elapsed 
   3.28    8.62   12.68 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R version 3.5.1 Patched (2018-07-24 r75005) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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: 0x035149f0>
> .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: 0x035149f0>
> .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: 0x035149f0>
> .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: 0x035149f0>
> 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: 0x0278cc30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0278cc30>
> .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: 0x0278cc30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0278cc30>
> .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: 0x0278cc30>
> 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: 0x0215fdd8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0215fdd8>
> .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: 0x0215fdd8>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0215fdd8>
> .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: 0x0215fdd8>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0215fdd8>
> .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: 0x0215fdd8>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0215fdd8>
> .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: 0x0215fdd8>
> 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: 0x03b13a30>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x03b13a30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x03b13a30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x03b13a30>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilee7014491eed" "BufferedMatrixFilee702b533a7" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilee7014491eed" "BufferedMatrixFilee702b533a7" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x01e611c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x01e611c0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x01e611c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x01e611c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x01e611c0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x01e611c0>
> .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: 0x02eaa500>
> .Call("R_bm_AddColumn",P)
<pointer: 0x02eaa500>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x02eaa500>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x02eaa500>
> 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: 0x02ea6cf0>
> .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: 0x02ea6cf0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.43    0.12    0.56 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R version 3.5.1 Patched (2018-07-24 r75005) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

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: 0x00000000056ed358>
> .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: 0x00000000056ed358>
> .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: 0x00000000056ed358>
> .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: 0x00000000056ed358>
> 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: 0x0000000005aefa38>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005aefa38>
> .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: 0x0000000005aefa38>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005aefa38>
> .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: 0x0000000005aefa38>
> 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: 0x0000000005b89e78>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005b89e78>
> .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: 0x0000000005b89e78>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000005b89e78>
> .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: 0x0000000005b89e78>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005b89e78>
> .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: 0x0000000005b89e78>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005b89e78>
> .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: 0x0000000005b89e78>
> 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: 0x000000000692ff60>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x000000000692ff60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x000000000692ff60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x000000000692ff60>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilee3c26d3378b" "BufferedMatrixFilee3c48ea3663"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilee3c26d3378b" "BufferedMatrixFilee3c48ea3663"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005c61e60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005c61e60>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005c61e60>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005c61e60>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005c61e60>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005c61e60>
> .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: 0x00000000078031a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000078031a0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x00000000078031a0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x00000000078031a0>
> 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: 0x00000000077a0eb8>
> .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: 0x00000000077a0eb8>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.45    0.09    0.53 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R version 3.5.1 Patched (2018-07-24 r75005) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

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.59    0.04    0.61 

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R version 3.5.1 Patched (2018-07-24 r75005) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

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.54    0.06    0.59 

Example timings