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

CHECK report for BufferedMatrix on tokay2

This page was generated on 2019-04-09 11:55:32 -0400 (Tue, 09 Apr 2019).

Package 190/1703HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.47.0
Ben Bolstad
Snapshot Date: 2019-04-08 17:01:18 -0400 (Mon, 08 Apr 2019)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: master
Last Commit: eca2e36
Last Changed Date: 2018-10-30 11:54:27 -0400 (Tue, 30 Oct 2018)
malbec2 Linux (Ubuntu 18.04.2 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
celaya2 OS X 10.11.6 El Capitan / x86_64  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 

Summary

Package: BufferedMatrix
Version: 1.47.0
Command: C:\Users\biocbuild\bbs-3.9-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:BufferedMatrix.install-out.txt --library=C:\Users\biocbuild\bbs-3.9-bioc\R\library --no-vignettes --timings BufferedMatrix_1.47.0.tar.gz
StartedAt: 2019-04-09 01:29:35 -0400 (Tue, 09 Apr 2019)
EndedAt: 2019-04-09 01:30:37 -0400 (Tue, 09 Apr 2019)
EllapsedTime: 62.2 seconds
RetCode: 0
Status:  OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory 'C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck'
* using R Under development (unstable) (2019-03-09 r76216)
* 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.47.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.9-bioc/R/library/BufferedMatrix/libs/i386/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)
File 'C:/Users/biocbuild/bbs-3.9-bioc/R/library/BufferedMatrix/libs/x64/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.9-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.9/bioc/src/contrib/BufferedMatrix_1.47.0.tar.gz && rm -rf BufferedMatrix.buildbin-libdir && mkdir BufferedMatrix.buildbin-libdir && C:\Users\biocbuild\bbs-3.9-bioc\R\bin\R.exe CMD INSTALL --merge-multiarch --build --library=BufferedMatrix.buildbin-libdir BufferedMatrix_1.47.0.tar.gz && C:\Users\biocbuild\bbs-3.9-bioc\R\bin\R.exe CMD INSTALL BufferedMatrix_1.47.0.zip && rm BufferedMatrix_1.47.0.tar.gz BufferedMatrix_1.47.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  3870k      0 --:--:-- --:--:-- --:--:-- 4377k

install for i386

* installing *source* package 'BufferedMatrix' ...
** libs
C:/Rtools/mingw_32/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.9-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.9-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.9-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.9-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.9-B/R/bin/i386 -lR
installing to C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.buildbin-libdir/00LOCK-BufferedMatrix/00new/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 from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path

install for x64

* installing *source* package 'BufferedMatrix' ...
** libs
C:/Rtools/mingw_64/bin/gcc  -I"C:/Users/BIOCBU˜1/BBS-3˜1.9-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.9-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.9-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.9-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.9-B/R/bin/x64 -lR
installing to C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.buildbin-libdir/BufferedMatrix/libs/x64
** testing if installed package can be loaded
* MD5 sums
packaged installation of 'BufferedMatrix' as BufferedMatrix_1.47.0.zip
* DONE (BufferedMatrix)
* installing to library 'C:/Users/biocbuild/bbs-3.9-bioc/R/library'
package 'BufferedMatrix' successfully unpacked and MD5 sums checked

Tests output

BufferedMatrix.Rcheck/tests_i386/c_code_level_tests.Rout


R Under development (unstable) (2019-03-09 r76216) -- "Unsuffered Consequences"
Copyright (C) 2019 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.48    0.09    0.56 

BufferedMatrix.Rcheck/tests_x64/c_code_level_tests.Rout


R Under development (unstable) (2019-03-09 r76216) -- "Unsuffered Consequences"
Copyright (C) 2019 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.06    0.53 

BufferedMatrix.Rcheck/tests_i386/objectTesting.Rout


R Under development (unstable) (2019-03-09 r76216) -- "Unsuffered Consequences"
Copyright (C) 2019 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.9-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 406204 12.4     843631 25.8   633902 19.4
Vcells 461263  3.6    8388608 64.0  1444655 11.1
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Apr 09 01:30:07 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Apr 09 01:30:07 2019"
> 
> 
> 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: 0x0350e438>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Apr 09 01:30:10 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Apr 09 01:30:11 2019"
> 
> ColMode(tmp2)
<pointer: 0x0350e438>
> 
> 
> 
> ### 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.9418987 -0.2394817 -0.343767106 -1.0072137
[2,]  -0.5856183 -0.3748648  0.007802693  1.0146208
[3,]   0.8720396  0.6683828 -0.906075835 -0.4996621
[4,]   0.5553655 -0.7215628 -0.860752499 -0.5840320
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
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.9418987 0.2394817 0.343767106 1.0072137
[2,]   0.5856183 0.3748648 0.007802693 1.0146208
[3,]   0.8720396 0.6683828 0.906075835 0.4996621
[4,]   0.5553655 0.7215628 0.860752499 0.5840320
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
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.0469846 0.4893687 0.58631656 1.0036004
[2,]  0.7652570 0.6122621 0.08833286 1.0072839
[3,]  0.9338306 0.8175468 0.95188016 0.7068678
[4,]  0.7452285 0.8494485 0.92776748 0.7642199
> 
> 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.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
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.41174 30.13317 31.20693 36.04322
[2,]  33.23819 31.49749 25.89113 36.08746
[3,]  35.21035 33.84385 35.42488 32.56834
[4,]  33.00765 34.21605 35.13843 33.22623
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x02c8adf8>
> exp(tmp5)
<pointer: 0x02c8adf8>
> log(tmp5,2)
<pointer: 0x02c8adf8>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.2464
> Min(tmp5)
[1] 53.889
> mean(tmp5)
[1] 73.70547
> Sum(tmp5)
[1] 14741.09
> Var(tmp5)
[1] 863.1224
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.73721 70.62778 70.48600 71.29639 73.17528 71.45798 71.93369 73.52780
 [9] 69.86289 74.94968
> rowSums(tmp5)
 [1] 1794.744 1412.556 1409.720 1425.928 1463.506 1429.160 1438.674 1470.556
 [9] 1397.258 1498.994
> rowVars(tmp5)
 [1] 8117.82884   76.65804   52.39034   58.69210   75.59487   76.78871
 [7]   85.51190   49.53013   43.57137   79.84824
> rowSd(tmp5)
 [1] 90.098995  8.755458  7.238117  7.661077  8.694531  8.762917  9.247265
 [8]  7.037764  6.600861  8.935784
> rowMax(tmp5)
 [1] 471.24638  89.02108  85.60840  84.66920  86.71282  85.31906  89.70790
 [8]  84.93844  80.00303  96.90702
> rowMin(tmp5)
 [1] 59.19470 53.88900 58.01875 54.43457 57.39639 54.46275 57.13893 62.34532
 [9] 59.63830 56.76708
> 
> colMeans(tmp5)
 [1] 114.01595  69.20757  71.12213  73.78554  70.64346  72.20419  71.49668
 [8]  69.03913  74.63422  70.04595  72.38399  74.60640  72.01425  72.45217
[15]  75.04244  67.20937  69.92657  72.53416  69.39374  72.35151
> colSums(tmp5)
 [1] 1140.1595  692.0757  711.2213  737.8554  706.4346  722.0419  714.9668
 [8]  690.3913  746.3422  700.4595  723.8399  746.0640  720.1425  724.5217
[15]  750.4244  672.0937  699.2657  725.3416  693.9374  723.5151
> colVars(tmp5)
 [1] 15805.52289    44.92069   161.86804    44.82280   109.65405    74.65377
 [7]    34.06995    48.10281    34.59675    60.40063    95.17144    29.15390
[13]    97.86470    65.84343    37.12545    57.58831   109.46022    35.37320
[19]    53.14789    94.77046
> colSd(tmp5)
 [1] 125.720018   6.702290  12.722737   6.694983  10.471583   8.640241
 [7]   5.836947   6.935619   5.881900   7.771785   9.755585   5.399435
[13]   9.892659   8.114397   6.093066   7.588696  10.462324   5.947537
[19]   7.290260   9.735012
> colMax(tmp5)
 [1] 471.24638  80.70323  96.90702  83.41684  85.60840  81.10426  80.89049
 [8]  80.07025  79.25293  82.24223  89.02108  82.34249  89.70790  87.10182
[15]  83.14948  81.59658  84.93844  80.13589  81.78115  86.71282
> colMin(tmp5)
 [1] 64.60301 60.93580 53.88900 63.07088 56.76708 56.65598 62.34532 58.73089
 [9] 61.69008 59.65463 59.63830 66.67394 54.43457 59.19470 64.11696 54.46275
[17] 57.39639 63.91636 60.26641 59.80018
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 89.73721       NA 70.48600 71.29639 73.17528 71.45798 71.93369 73.52780
 [9] 69.86289 74.94968
> rowSums(tmp5)
 [1] 1794.744       NA 1409.720 1425.928 1463.506 1429.160 1438.674 1470.556
 [9] 1397.258 1498.994
> rowVars(tmp5)
 [1] 8117.82884   72.15625   52.39034   58.69210   75.59487   76.78871
 [7]   85.51190   49.53013   43.57137   79.84824
> rowSd(tmp5)
 [1] 90.098995  8.494484  7.238117  7.661077  8.694531  8.762917  9.247265
 [8]  7.037764  6.600861  8.935784
> rowMax(tmp5)
 [1] 471.24638        NA  85.60840  84.66920  86.71282  85.31906  89.70790
 [8]  84.93844  80.00303  96.90702
> rowMin(tmp5)
 [1] 59.19470       NA 58.01875 54.43457 57.39639 54.46275 57.13893 62.34532
 [9] 59.63830 56.76708
> 
> colMeans(tmp5)
 [1] 114.01595  69.20757  71.12213  73.78554  70.64346  72.20419  71.49668
 [8]  69.03913  74.63422  70.04595  72.38399  74.60640  72.01425  72.45217
[15]  75.04244  67.20937  69.92657  72.53416  69.39374        NA
> colSums(tmp5)
 [1] 1140.1595  692.0757  711.2213  737.8554  706.4346  722.0419  714.9668
 [8]  690.3913  746.3422  700.4595  723.8399  746.0640  720.1425  724.5217
[15]  750.4244  672.0937  699.2657  725.3416  693.9374        NA
> colVars(tmp5)
 [1] 15805.52289    44.92069   161.86804    44.82280   109.65405    74.65377
 [7]    34.06995    48.10281    34.59675    60.40063    95.17144    29.15390
[13]    97.86470    65.84343    37.12545    57.58831   109.46022    35.37320
[19]    53.14789          NA
> colSd(tmp5)
 [1] 125.720018   6.702290  12.722737   6.694983  10.471583   8.640241
 [7]   5.836947   6.935619   5.881900   7.771785   9.755585   5.399435
[13]   9.892659   8.114397   6.093066   7.588696  10.462324   5.947537
[19]   7.290260         NA
> colMax(tmp5)
 [1] 471.24638  80.70323  96.90702  83.41684  85.60840  81.10426  80.89049
 [8]  80.07025  79.25293  82.24223  89.02108  82.34249  89.70790  87.10182
[15]  83.14948  81.59658  84.93844  80.13589  81.78115        NA
> colMin(tmp5)
 [1] 64.60301 60.93580 53.88900 63.07088 56.76708 56.65598 62.34532 58.73089
 [9] 61.69008 59.65463 59.63830 66.67394 54.43457 59.19470 64.11696 54.46275
[17] 57.39639 63.91636 60.26641       NA
> 
> Max(tmp5,na.rm=TRUE)
[1] 471.2464
> Min(tmp5,na.rm=TRUE)
[1] 53.889
> mean(tmp5,na.rm=TRUE)
[1] 73.65943
> Sum(tmp5,na.rm=TRUE)
[1] 14658.23
> Var(tmp5,na.rm=TRUE)
[1] 867.0556
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.73721 69.98359 70.48600 71.29639 73.17528 71.45798 71.93369 73.52780
 [9] 69.86289 74.94968
> rowSums(tmp5,na.rm=TRUE)
 [1] 1794.744 1329.688 1409.720 1425.928 1463.506 1429.160 1438.674 1470.556
 [9] 1397.258 1498.994
> rowVars(tmp5,na.rm=TRUE)
 [1] 8117.82884   72.15625   52.39034   58.69210   75.59487   76.78871
 [7]   85.51190   49.53013   43.57137   79.84824
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.098995  8.494484  7.238117  7.661077  8.694531  8.762917  9.247265
 [8]  7.037764  6.600861  8.935784
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.24638  89.02108  85.60840  84.66920  86.71282  85.31906  89.70790
 [8]  84.93844  80.00303  96.90702
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.19470 53.88900 58.01875 54.43457 57.39639 54.46275 57.13893 62.34532
 [9] 59.63830 56.76708
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.01595  69.20757  71.12213  73.78554  70.64346  72.20419  71.49668
 [8]  69.03913  74.63422  70.04595  72.38399  74.60640  72.01425  72.45217
[15]  75.04244  67.20937  69.92657  72.53416  69.39374  71.18309
> colSums(tmp5,na.rm=TRUE)
 [1] 1140.1595  692.0757  711.2213  737.8554  706.4346  722.0419  714.9668
 [8]  690.3913  746.3422  700.4595  723.8399  746.0640  720.1425  724.5217
[15]  750.4244  672.0937  699.2657  725.3416  693.9374  640.6478
> colVars(tmp5,na.rm=TRUE)
 [1] 15805.52289    44.92069   161.86804    44.82280   109.65405    74.65377
 [7]    34.06995    48.10281    34.59675    60.40063    95.17144    29.15390
[13]    97.86470    65.84343    37.12545    57.58831   109.46022    35.37320
[19]    53.14789    91.25819
> colSd(tmp5,na.rm=TRUE)
 [1] 125.720018   6.702290  12.722737   6.694983  10.471583   8.640241
 [7]   5.836947   6.935619   5.881900   7.771785   9.755585   5.399435
[13]   9.892659   8.114397   6.093066   7.588696  10.462324   5.947537
[19]   7.290260   9.552915
> colMax(tmp5,na.rm=TRUE)
 [1] 471.24638  80.70323  96.90702  83.41684  85.60840  81.10426  80.89049
 [8]  80.07025  79.25293  82.24223  89.02108  82.34249  89.70790  87.10182
[15]  83.14948  81.59658  84.93844  80.13589  81.78115  86.71282
> colMin(tmp5,na.rm=TRUE)
 [1] 64.60301 60.93580 53.88900 63.07088 56.76708 56.65598 62.34532 58.73089
 [9] 61.69008 59.65463 59.63830 66.67394 54.43457 59.19470 64.11696 54.46275
[17] 57.39639 63.91636 60.26641 59.80018
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.73721      NaN 70.48600 71.29639 73.17528 71.45798 71.93369 73.52780
 [9] 69.86289 74.94968
> rowSums(tmp5,na.rm=TRUE)
 [1] 1794.744    0.000 1409.720 1425.928 1463.506 1429.160 1438.674 1470.556
 [9] 1397.258 1498.994
> rowVars(tmp5,na.rm=TRUE)
 [1] 8117.82884         NA   52.39034   58.69210   75.59487   76.78871
 [7]   85.51190   49.53013   43.57137   79.84824
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.098995        NA  7.238117  7.661077  8.694531  8.762917  9.247265
 [8]  7.037764  6.600861  8.935784
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.24638        NA  85.60840  84.66920  86.71282  85.31906  89.70790
 [8]  84.93844  80.00303  96.90702
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.19470       NA 58.01875 54.43457 57.39639 54.46275 57.13893 62.34532
 [9] 59.63830 56.76708
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 118.99762  69.61309  73.03692  73.63823  71.70193  71.66575  71.59180
 [8]  68.39548  74.12103  68.70264  70.53542  75.48778  73.08376  72.52201
[15]  75.36085  67.00416  71.17227  73.25928  69.87558       NaN
> colSums(tmp5,na.rm=TRUE)
 [1] 1070.9785  626.5178  657.3323  662.7441  645.3174  644.9917  644.3262
 [8]  615.5593  667.0892  618.3238  634.8188  679.3900  657.7538  652.6981
[15]  678.2477  603.0374  640.5504  659.3335  628.8803    0.0000
> colVars(tmp5,na.rm=TRUE)
 [1] 17502.02180    48.68575   140.85420    50.18153   110.75661    80.72391
 [7]    38.22690    49.45494    35.95850    47.65041    68.62440    24.05871
[13]    97.22939    74.01898    40.62552    64.31312   105.68528    33.87963
[19]    57.17939          NA
> colSd(tmp5,na.rm=TRUE)
 [1] 132.295207   6.977517  11.868201   7.083892  10.524097   8.984649
 [7]   6.182791   7.032421   5.996541   6.902928   8.283985   4.904968
[13]   9.860497   8.603429   6.373815   8.019546  10.280335   5.820621
[19]   7.561706         NA
> colMax(tmp5,na.rm=TRUE)
 [1] 471.24638  80.70323  96.90702  83.41684  85.60840  81.10426  80.89049
 [8]  80.07025  79.15431  82.24223  82.10595  82.34249  89.70790  87.10182
[15]  83.14948  81.59658  84.93844  80.13589  81.78115      -Inf
> colMin(tmp5,na.rm=TRUE)
 [1] 64.60301 60.93580 57.13893 63.07088 56.76708 56.65598 62.34532 58.73089
 [9] 61.69008 59.65463 59.63830 67.77133 54.43457 59.19470 64.11696 54.46275
[17] 57.39639 63.91636 60.26641      Inf
> 
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 3
> which.col  <- 1
> cat(which.row," ",which.col,"\n")
3   1 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> rowVars(tmp5,na.rm=TRUE)
 [1] 190.0765 253.4853 136.1727 306.0635 187.6638 119.7895 161.2572 280.4941
 [9] 243.4055 197.3398
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 190.0765 253.4853 136.1727 306.0635 187.6638 119.7895 161.2572 280.4941
 [9] 243.4055 197.3398
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  1.989520e-13  1.136868e-13  5.684342e-14 -1.421085e-14 -5.684342e-14
 [6] -5.684342e-14  0.000000e+00 -1.421085e-13  2.842171e-14  8.526513e-14
[11]  1.705303e-13  1.989520e-13  9.947598e-14  8.526513e-14  3.410605e-13
[16]  1.421085e-13 -2.842171e-14  0.000000e+00 -2.131628e-13  1.989520e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
9   15 
8   2 
4   3 
5   10 
9   5 
7   2 
8   12 
5   15 
3   9 
10   20 
4   12 
1   7 
10   2 
5   12 
9   13 
6   13 
2   4 
4   18 
5   14 
5   15 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 3.044354
> Min(tmp)
[1] -2.960411
> mean(tmp)
[1] 0.1242969
> Sum(tmp)
[1] 12.42969
> Var(tmp)
[1] 1.313446
> 
> rowMeans(tmp)
[1] 0.1242969
> rowSums(tmp)
[1] 12.42969
> rowVars(tmp)
[1] 1.313446
> rowSd(tmp)
[1] 1.146057
> rowMax(tmp)
[1] 3.044354
> rowMin(tmp)
[1] -2.960411
> 
> colMeans(tmp)
  [1]  0.294610153  1.152418866 -0.779203858 -0.983696815  0.448449889
  [6]  0.237043860  0.281099879  1.427223842  2.281858829 -0.126608368
 [11]  1.011262430  0.162079643  0.838185182 -0.050531840  0.958285350
 [16] -0.254941074  0.313179083  0.253601754 -0.895028299  1.447364101
 [21]  2.515039485  1.189414145 -0.183433226  0.726922008  0.317423565
 [26] -2.323564000  0.749295302  0.616613972 -1.142938740  0.663223761
 [31]  0.764708149  1.820097694 -0.411702798  1.721711658  1.235915797
 [36]  0.690655062 -1.972186842 -1.343567360 -2.023833212  0.139185310
 [41] -0.801139083 -0.610013107 -1.286435809 -0.685345609 -0.385113129
 [46] -0.773298135  1.279622354 -2.960410638 -0.734526790 -1.302057213
 [51] -0.069880253  0.557201635  0.898414011  1.066866434 -0.435022098
 [56] -0.549454272  0.340898189  0.205850067 -0.704502780 -1.285806741
 [61]  0.021870556  0.333962255 -2.077489251  1.332011473  2.676204945
 [66] -2.305383181  1.770254143  0.332977857  0.778684956 -0.361429741
 [71] -0.781643941 -0.722587515  0.347895221  1.075572702  0.483454881
 [76]  3.044354159  0.601473399  0.531475858  0.428310642 -0.480213993
 [81] -1.028053973  0.508484492 -1.017131269  0.223238172 -1.615898303
 [86]  1.361719868 -1.261399699  2.844359156 -0.459281098 -1.502752918
 [91]  0.179060500 -0.059369841 -0.145055269  1.012886208  0.146158258
 [96]  1.376542294 -0.002875487  0.625098716  0.401906264  0.280823952
> colSums(tmp)
  [1]  0.294610153  1.152418866 -0.779203858 -0.983696815  0.448449889
  [6]  0.237043860  0.281099879  1.427223842  2.281858829 -0.126608368
 [11]  1.011262430  0.162079643  0.838185182 -0.050531840  0.958285350
 [16] -0.254941074  0.313179083  0.253601754 -0.895028299  1.447364101
 [21]  2.515039485  1.189414145 -0.183433226  0.726922008  0.317423565
 [26] -2.323564000  0.749295302  0.616613972 -1.142938740  0.663223761
 [31]  0.764708149  1.820097694 -0.411702798  1.721711658  1.235915797
 [36]  0.690655062 -1.972186842 -1.343567360 -2.023833212  0.139185310
 [41] -0.801139083 -0.610013107 -1.286435809 -0.685345609 -0.385113129
 [46] -0.773298135  1.279622354 -2.960410638 -0.734526790 -1.302057213
 [51] -0.069880253  0.557201635  0.898414011  1.066866434 -0.435022098
 [56] -0.549454272  0.340898189  0.205850067 -0.704502780 -1.285806741
 [61]  0.021870556  0.333962255 -2.077489251  1.332011473  2.676204945
 [66] -2.305383181  1.770254143  0.332977857  0.778684956 -0.361429741
 [71] -0.781643941 -0.722587515  0.347895221  1.075572702  0.483454881
 [76]  3.044354159  0.601473399  0.531475858  0.428310642 -0.480213993
 [81] -1.028053973  0.508484492 -1.017131269  0.223238172 -1.615898303
 [86]  1.361719868 -1.261399699  2.844359156 -0.459281098 -1.502752918
 [91]  0.179060500 -0.059369841 -0.145055269  1.012886208  0.146158258
 [96]  1.376542294 -0.002875487  0.625098716  0.401906264  0.280823952
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.294610153  1.152418866 -0.779203858 -0.983696815  0.448449889
  [6]  0.237043860  0.281099879  1.427223842  2.281858829 -0.126608368
 [11]  1.011262430  0.162079643  0.838185182 -0.050531840  0.958285350
 [16] -0.254941074  0.313179083  0.253601754 -0.895028299  1.447364101
 [21]  2.515039485  1.189414145 -0.183433226  0.726922008  0.317423565
 [26] -2.323564000  0.749295302  0.616613972 -1.142938740  0.663223761
 [31]  0.764708149  1.820097694 -0.411702798  1.721711658  1.235915797
 [36]  0.690655062 -1.972186842 -1.343567360 -2.023833212  0.139185310
 [41] -0.801139083 -0.610013107 -1.286435809 -0.685345609 -0.385113129
 [46] -0.773298135  1.279622354 -2.960410638 -0.734526790 -1.302057213
 [51] -0.069880253  0.557201635  0.898414011  1.066866434 -0.435022098
 [56] -0.549454272  0.340898189  0.205850067 -0.704502780 -1.285806741
 [61]  0.021870556  0.333962255 -2.077489251  1.332011473  2.676204945
 [66] -2.305383181  1.770254143  0.332977857  0.778684956 -0.361429741
 [71] -0.781643941 -0.722587515  0.347895221  1.075572702  0.483454881
 [76]  3.044354159  0.601473399  0.531475858  0.428310642 -0.480213993
 [81] -1.028053973  0.508484492 -1.017131269  0.223238172 -1.615898303
 [86]  1.361719868 -1.261399699  2.844359156 -0.459281098 -1.502752918
 [91]  0.179060500 -0.059369841 -0.145055269  1.012886208  0.146158258
 [96]  1.376542294 -0.002875487  0.625098716  0.401906264  0.280823952
> colMin(tmp)
  [1]  0.294610153  1.152418866 -0.779203858 -0.983696815  0.448449889
  [6]  0.237043860  0.281099879  1.427223842  2.281858829 -0.126608368
 [11]  1.011262430  0.162079643  0.838185182 -0.050531840  0.958285350
 [16] -0.254941074  0.313179083  0.253601754 -0.895028299  1.447364101
 [21]  2.515039485  1.189414145 -0.183433226  0.726922008  0.317423565
 [26] -2.323564000  0.749295302  0.616613972 -1.142938740  0.663223761
 [31]  0.764708149  1.820097694 -0.411702798  1.721711658  1.235915797
 [36]  0.690655062 -1.972186842 -1.343567360 -2.023833212  0.139185310
 [41] -0.801139083 -0.610013107 -1.286435809 -0.685345609 -0.385113129
 [46] -0.773298135  1.279622354 -2.960410638 -0.734526790 -1.302057213
 [51] -0.069880253  0.557201635  0.898414011  1.066866434 -0.435022098
 [56] -0.549454272  0.340898189  0.205850067 -0.704502780 -1.285806741
 [61]  0.021870556  0.333962255 -2.077489251  1.332011473  2.676204945
 [66] -2.305383181  1.770254143  0.332977857  0.778684956 -0.361429741
 [71] -0.781643941 -0.722587515  0.347895221  1.075572702  0.483454881
 [76]  3.044354159  0.601473399  0.531475858  0.428310642 -0.480213993
 [81] -1.028053973  0.508484492 -1.017131269  0.223238172 -1.615898303
 [86]  1.361719868 -1.261399699  2.844359156 -0.459281098 -1.502752918
 [91]  0.179060500 -0.059369841 -0.145055269  1.012886208  0.146158258
 [96]  1.376542294 -0.002875487  0.625098716  0.401906264  0.280823952
> colMedians(tmp)
  [1]  0.294610153  1.152418866 -0.779203858 -0.983696815  0.448449889
  [6]  0.237043860  0.281099879  1.427223842  2.281858829 -0.126608368
 [11]  1.011262430  0.162079643  0.838185182 -0.050531840  0.958285350
 [16] -0.254941074  0.313179083  0.253601754 -0.895028299  1.447364101
 [21]  2.515039485  1.189414145 -0.183433226  0.726922008  0.317423565
 [26] -2.323564000  0.749295302  0.616613972 -1.142938740  0.663223761
 [31]  0.764708149  1.820097694 -0.411702798  1.721711658  1.235915797
 [36]  0.690655062 -1.972186842 -1.343567360 -2.023833212  0.139185310
 [41] -0.801139083 -0.610013107 -1.286435809 -0.685345609 -0.385113129
 [46] -0.773298135  1.279622354 -2.960410638 -0.734526790 -1.302057213
 [51] -0.069880253  0.557201635  0.898414011  1.066866434 -0.435022098
 [56] -0.549454272  0.340898189  0.205850067 -0.704502780 -1.285806741
 [61]  0.021870556  0.333962255 -2.077489251  1.332011473  2.676204945
 [66] -2.305383181  1.770254143  0.332977857  0.778684956 -0.361429741
 [71] -0.781643941 -0.722587515  0.347895221  1.075572702  0.483454881
 [76]  3.044354159  0.601473399  0.531475858  0.428310642 -0.480213993
 [81] -1.028053973  0.508484492 -1.017131269  0.223238172 -1.615898303
 [86]  1.361719868 -1.261399699  2.844359156 -0.459281098 -1.502752918
 [91]  0.179060500 -0.059369841 -0.145055269  1.012886208  0.146158258
 [96]  1.376542294 -0.002875487  0.625098716  0.401906264  0.280823952
> colRanges(tmp)
          [,1]     [,2]       [,3]       [,4]      [,5]      [,6]      [,7]
[1,] 0.2946102 1.152419 -0.7792039 -0.9836968 0.4484499 0.2370439 0.2810999
[2,] 0.2946102 1.152419 -0.7792039 -0.9836968 0.4484499 0.2370439 0.2810999
         [,8]     [,9]      [,10]    [,11]     [,12]     [,13]       [,14]
[1,] 1.427224 2.281859 -0.1266084 1.011262 0.1620796 0.8381852 -0.05053184
[2,] 1.427224 2.281859 -0.1266084 1.011262 0.1620796 0.8381852 -0.05053184
         [,15]      [,16]     [,17]     [,18]      [,19]    [,20]    [,21]
[1,] 0.9582854 -0.2549411 0.3131791 0.2536018 -0.8950283 1.447364 2.515039
[2,] 0.9582854 -0.2549411 0.3131791 0.2536018 -0.8950283 1.447364 2.515039
        [,22]      [,23]    [,24]     [,25]     [,26]     [,27]    [,28]
[1,] 1.189414 -0.1834332 0.726922 0.3174236 -2.323564 0.7492953 0.616614
[2,] 1.189414 -0.1834332 0.726922 0.3174236 -2.323564 0.7492953 0.616614
         [,29]     [,30]     [,31]    [,32]      [,33]    [,34]    [,35]
[1,] -1.142939 0.6632238 0.7647081 1.820098 -0.4117028 1.721712 1.235916
[2,] -1.142939 0.6632238 0.7647081 1.820098 -0.4117028 1.721712 1.235916
         [,36]     [,37]     [,38]     [,39]     [,40]      [,41]      [,42]
[1,] 0.6906551 -1.972187 -1.343567 -2.023833 0.1391853 -0.8011391 -0.6100131
[2,] 0.6906551 -1.972187 -1.343567 -2.023833 0.1391853 -0.8011391 -0.6100131
         [,43]      [,44]      [,45]      [,46]    [,47]     [,48]      [,49]
[1,] -1.286436 -0.6853456 -0.3851131 -0.7732981 1.279622 -2.960411 -0.7345268
[2,] -1.286436 -0.6853456 -0.3851131 -0.7732981 1.279622 -2.960411 -0.7345268
         [,50]       [,51]     [,52]    [,53]    [,54]      [,55]      [,56]
[1,] -1.302057 -0.06988025 0.5572016 0.898414 1.066866 -0.4350221 -0.5494543
[2,] -1.302057 -0.06988025 0.5572016 0.898414 1.066866 -0.4350221 -0.5494543
         [,57]     [,58]      [,59]     [,60]      [,61]     [,62]     [,63]
[1,] 0.3408982 0.2058501 -0.7045028 -1.285807 0.02187056 0.3339623 -2.077489
[2,] 0.3408982 0.2058501 -0.7045028 -1.285807 0.02187056 0.3339623 -2.077489
        [,64]    [,65]     [,66]    [,67]     [,68]    [,69]      [,70]
[1,] 1.332011 2.676205 -2.305383 1.770254 0.3329779 0.778685 -0.3614297
[2,] 1.332011 2.676205 -2.305383 1.770254 0.3329779 0.778685 -0.3614297
          [,71]      [,72]     [,73]    [,74]     [,75]    [,76]     [,77]
[1,] -0.7816439 -0.7225875 0.3478952 1.075573 0.4834549 3.044354 0.6014734
[2,] -0.7816439 -0.7225875 0.3478952 1.075573 0.4834549 3.044354 0.6014734
         [,78]     [,79]     [,80]     [,81]     [,82]     [,83]     [,84]
[1,] 0.5314759 0.4283106 -0.480214 -1.028054 0.5084845 -1.017131 0.2232382
[2,] 0.5314759 0.4283106 -0.480214 -1.028054 0.5084845 -1.017131 0.2232382
         [,85]   [,86]   [,87]    [,88]      [,89]     [,90]     [,91]
[1,] -1.615898 1.36172 -1.2614 2.844359 -0.4592811 -1.502753 0.1790605
[2,] -1.615898 1.36172 -1.2614 2.844359 -0.4592811 -1.502753 0.1790605
           [,92]      [,93]    [,94]     [,95]    [,96]        [,97]     [,98]
[1,] -0.05936984 -0.1450553 1.012886 0.1461583 1.376542 -0.002875487 0.6250987
[2,] -0.05936984 -0.1450553 1.012886 0.1461583 1.376542 -0.002875487 0.6250987
         [,99]   [,100]
[1,] 0.4019063 0.280824
[2,] 0.4019063 0.280824
> 
> 
> Max(tmp2)
[1] 2.660747
> Min(tmp2)
[1] -2.284759
> mean(tmp2)
[1] -0.02997734
> Sum(tmp2)
[1] -2.997734
> Var(tmp2)
[1] 1.119619
> 
> rowMeans(tmp2)
  [1]  0.063029645  0.475434573 -0.352435128 -0.244169122  1.591275943
  [6]  0.824961068  0.270486692  0.526963563  0.004728777  2.048537411
 [11] -0.478580630 -0.919274063  0.820665158  1.268467846 -0.541962079
 [16]  1.022336974 -0.857814299 -1.239439590 -1.176102411  0.230804737
 [21]  1.133062039 -1.341483768  0.277975538 -0.591014369 -2.284758695
 [26] -0.033517059  1.447829784  2.071938030 -0.187410629  0.475620897
 [31] -1.385957300  1.370019413  0.191440643  0.522976502  0.503055861
 [36] -0.207956498 -0.589020361 -0.759630551 -0.461786274  0.855511306
 [41] -1.587466338 -0.399064345  1.112842042  0.808168882  1.999832900
 [46]  1.241461356 -0.560862600 -0.533225376  2.660746857 -0.921255337
 [51]  0.685772861 -0.116011475 -0.180996906 -1.500018642  0.182040275
 [56] -0.538141531  0.072271263  0.043971159 -1.116373717  0.499348340
 [61]  1.125372206 -1.496093752  0.272310738  2.123012321  0.868331242
 [66] -0.080481238  0.096183210 -0.906485174  0.034191581  0.283780858
 [71]  0.369496047  0.461610345 -2.150074609 -2.181963339 -2.139108417
 [76] -0.537360885  0.568903038 -0.768613147  0.880803980  0.673695723
 [81] -1.552764733 -1.361803870  0.878386284  2.115437921  1.477894152
 [86] -1.226571028  0.654140492 -0.895812756 -0.424540388 -1.210445636
 [91]  0.419058954 -1.730014944 -1.119115576 -0.150453624 -0.492010126
 [96] -0.522168057 -1.336942932  0.221617569 -0.219228036 -0.217757728
> rowSums(tmp2)
  [1]  0.063029645  0.475434573 -0.352435128 -0.244169122  1.591275943
  [6]  0.824961068  0.270486692  0.526963563  0.004728777  2.048537411
 [11] -0.478580630 -0.919274063  0.820665158  1.268467846 -0.541962079
 [16]  1.022336974 -0.857814299 -1.239439590 -1.176102411  0.230804737
 [21]  1.133062039 -1.341483768  0.277975538 -0.591014369 -2.284758695
 [26] -0.033517059  1.447829784  2.071938030 -0.187410629  0.475620897
 [31] -1.385957300  1.370019413  0.191440643  0.522976502  0.503055861
 [36] -0.207956498 -0.589020361 -0.759630551 -0.461786274  0.855511306
 [41] -1.587466338 -0.399064345  1.112842042  0.808168882  1.999832900
 [46]  1.241461356 -0.560862600 -0.533225376  2.660746857 -0.921255337
 [51]  0.685772861 -0.116011475 -0.180996906 -1.500018642  0.182040275
 [56] -0.538141531  0.072271263  0.043971159 -1.116373717  0.499348340
 [61]  1.125372206 -1.496093752  0.272310738  2.123012321  0.868331242
 [66] -0.080481238  0.096183210 -0.906485174  0.034191581  0.283780858
 [71]  0.369496047  0.461610345 -2.150074609 -2.181963339 -2.139108417
 [76] -0.537360885  0.568903038 -0.768613147  0.880803980  0.673695723
 [81] -1.552764733 -1.361803870  0.878386284  2.115437921  1.477894152
 [86] -1.226571028  0.654140492 -0.895812756 -0.424540388 -1.210445636
 [91]  0.419058954 -1.730014944 -1.119115576 -0.150453624 -0.492010126
 [96] -0.522168057 -1.336942932  0.221617569 -0.219228036 -0.217757728
> 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.063029645  0.475434573 -0.352435128 -0.244169122  1.591275943
  [6]  0.824961068  0.270486692  0.526963563  0.004728777  2.048537411
 [11] -0.478580630 -0.919274063  0.820665158  1.268467846 -0.541962079
 [16]  1.022336974 -0.857814299 -1.239439590 -1.176102411  0.230804737
 [21]  1.133062039 -1.341483768  0.277975538 -0.591014369 -2.284758695
 [26] -0.033517059  1.447829784  2.071938030 -0.187410629  0.475620897
 [31] -1.385957300  1.370019413  0.191440643  0.522976502  0.503055861
 [36] -0.207956498 -0.589020361 -0.759630551 -0.461786274  0.855511306
 [41] -1.587466338 -0.399064345  1.112842042  0.808168882  1.999832900
 [46]  1.241461356 -0.560862600 -0.533225376  2.660746857 -0.921255337
 [51]  0.685772861 -0.116011475 -0.180996906 -1.500018642  0.182040275
 [56] -0.538141531  0.072271263  0.043971159 -1.116373717  0.499348340
 [61]  1.125372206 -1.496093752  0.272310738  2.123012321  0.868331242
 [66] -0.080481238  0.096183210 -0.906485174  0.034191581  0.283780858
 [71]  0.369496047  0.461610345 -2.150074609 -2.181963339 -2.139108417
 [76] -0.537360885  0.568903038 -0.768613147  0.880803980  0.673695723
 [81] -1.552764733 -1.361803870  0.878386284  2.115437921  1.477894152
 [86] -1.226571028  0.654140492 -0.895812756 -0.424540388 -1.210445636
 [91]  0.419058954 -1.730014944 -1.119115576 -0.150453624 -0.492010126
 [96] -0.522168057 -1.336942932  0.221617569 -0.219228036 -0.217757728
> rowMin(tmp2)
  [1]  0.063029645  0.475434573 -0.352435128 -0.244169122  1.591275943
  [6]  0.824961068  0.270486692  0.526963563  0.004728777  2.048537411
 [11] -0.478580630 -0.919274063  0.820665158  1.268467846 -0.541962079
 [16]  1.022336974 -0.857814299 -1.239439590 -1.176102411  0.230804737
 [21]  1.133062039 -1.341483768  0.277975538 -0.591014369 -2.284758695
 [26] -0.033517059  1.447829784  2.071938030 -0.187410629  0.475620897
 [31] -1.385957300  1.370019413  0.191440643  0.522976502  0.503055861
 [36] -0.207956498 -0.589020361 -0.759630551 -0.461786274  0.855511306
 [41] -1.587466338 -0.399064345  1.112842042  0.808168882  1.999832900
 [46]  1.241461356 -0.560862600 -0.533225376  2.660746857 -0.921255337
 [51]  0.685772861 -0.116011475 -0.180996906 -1.500018642  0.182040275
 [56] -0.538141531  0.072271263  0.043971159 -1.116373717  0.499348340
 [61]  1.125372206 -1.496093752  0.272310738  2.123012321  0.868331242
 [66] -0.080481238  0.096183210 -0.906485174  0.034191581  0.283780858
 [71]  0.369496047  0.461610345 -2.150074609 -2.181963339 -2.139108417
 [76] -0.537360885  0.568903038 -0.768613147  0.880803980  0.673695723
 [81] -1.552764733 -1.361803870  0.878386284  2.115437921  1.477894152
 [86] -1.226571028  0.654140492 -0.895812756 -0.424540388 -1.210445636
 [91]  0.419058954 -1.730014944 -1.119115576 -0.150453624 -0.492010126
 [96] -0.522168057 -1.336942932  0.221617569 -0.219228036 -0.217757728
> 
> colMeans(tmp2)
[1] -0.02997734
> colSums(tmp2)
[1] -2.997734
> colVars(tmp2)
[1] 1.119619
> colSd(tmp2)
[1] 1.05812
> colMax(tmp2)
[1] 2.660747
> colMin(tmp2)
[1] -2.284759
> colMedians(tmp2)
[1] -0.01439414
> colRanges(tmp2)
          [,1]
[1,] -2.284759
[2,]  2.660747
> 
> 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]  3.4525821  1.6616017  1.1066723 -0.3076806 -2.0072552 -1.4637005
 [7] -0.6569276 -4.0548118  2.1117671  1.1636300
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.0782005
[2,] -0.2433978
[3,]  0.5159004
[4,]  1.1234885
[5,]  1.2350012
> 
> rowApply(tmp,sum)
 [1] -0.06404391 -1.50837753  2.20496378 -4.61344627 -2.16183028  3.52914171
 [7] -2.79006546  1.19000992 -1.44597538  6.66550073
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    8   10    5    6   10    8    4    7    2     6
 [2,]   10    2    6    3    6    6    9    9    1     4
 [3,]    7    9    3   10    2    2    7    4   10     5
 [4,]    5    5    1    9    9    4   10    2    6     2
 [5,]    6    3    4    2    3   10    8    1    9     7
 [6,]    3    4    9    8    7    7    2    3    5     3
 [7,]    9    8    2    4    4    1    1    6    4    10
 [8,]    1    6   10    1    5    3    3    8    3     1
 [9,]    4    7    7    5    1    9    6    5    7     9
[10,]    2    1    8    7    8    5    5   10    8     8
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.7953211  6.2749931  0.2988696  1.0506680 -0.1023363 -3.0458136
 [7] -1.4117774 -1.3385112 -0.2841389 -0.3644165 -3.0390202 -0.9680779
[13]  1.5906692 -2.4572609  0.8872866 -2.1574579  1.9862230 -4.1751088
[19] -1.0917568  0.2082732
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.92768224
[2,] -0.89823126
[3,] -0.04196928
[4,]  0.62511638
[5,]  2.03808746
> 
> rowApply(tmp,sum)
[1] -4.5785776  0.9241884 -1.1205131  0.7478370 -3.3163073
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   12    4   16   20    5
[2,]   19   18   17   12   20
[3,]   18   14    8   14    3
[4,]    1   16    9   18   17
[5,]    9   12    1   15   18
> 
> 
> as.matrix(tmp)
            [,1]      [,2]       [,3]       [,4]       [,5]        [,6]
[1,] -0.04196928 1.5709342  0.5458840 -1.6395714 -0.3119997  0.08579223
[2,] -0.89823126 1.0830716  0.7315070  0.8532191  0.2841854 -2.44959119
[3,]  0.62511638 0.8562727 -0.3424784 -0.2365615 -1.8962016  0.61365030
[4,]  2.03808746 0.4571310  0.5955976  1.2765777  0.8085430 -0.80030529
[5,] -0.92768224 2.3075836 -1.2316407  0.7970041  1.0131365 -0.49535966
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -0.1788837 -1.1279634 -1.5463307 -0.5829691 -1.3850997  0.4697372
[2,] -0.4130463  0.8932610  0.6576960  1.1440849  0.7382039 -0.1409193
[3,] -1.0702385 -1.0492092  1.0135442  0.1184713 -1.1939252  0.2946214
[4,]  1.6922647 -0.3182613 -1.1840681  1.1439205 -1.6930619 -1.1159652
[5,] -1.4418737  0.2636617  0.7750196 -2.1879240  0.4948628 -0.4755521
          [,13]      [,14]      [,15]       [,16]     [,17]      [,18]
[1,] -0.9027816 -1.2477003  0.5081661 -0.61252357  2.019626 -0.2844378
[2,]  2.3345375 -0.1320554  0.1215689  0.17121170 -1.190928 -1.6267955
[3,]  1.8063469  0.3531860 -0.7849945 -0.03622771 -1.103061 -0.4557339
[4,] -1.1447541 -1.2149593  0.5341328 -1.07759258  1.056011 -0.6120674
[5,] -0.5026794 -0.2157320  0.5084133 -0.60232570  1.204574 -1.1960743
           [,19]       [,20]
[1,]  0.04832788  0.03518444
[2,] -0.72248652 -0.51430564
[3,]  0.25154121  1.11536751
[4,]  0.18558441  0.12102205
[5,] -0.85472377 -0.54899513
> 
> 
> 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.9-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.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  633  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.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  544  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.9-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.02150094 -0.2904133 0.7475422 -0.2713794 3.11179 -0.5228039 -0.2192261
          col8     col9     col10     col11     col12      col13    col14
row1 0.8441244 1.774674 0.4983188 0.8322897 0.9474619 0.04073569 -1.44431
         col15       col16     col17       col18     col19     col20
row1 -1.324016 -0.06574631 -1.702086 -0.04168893 -1.745212 -1.706266
> tmp[,"col10"]
          col10
row1  0.4983188
row2 -1.9183628
row3  0.2089247
row4  0.1735211
row5  0.3438326
> tmp[c("row1","row5"),]
            col1       col2      col3       col4       col5       col6
row1 -0.02150094 -0.2904133 0.7475422 -0.2713794  3.1117899 -0.5228039
row5 -0.59281477 -0.6433799 0.8117210  0.3732589 -0.1741005  0.7482524
           col7      col8      col9     col10     col11     col12      col13
row1 -0.2192261 0.8441244 1.7746741 0.4983188 0.8322897 0.9474619 0.04073569
row5  2.0030677 0.7533417 0.4113992 0.3438326 0.3003741 1.7246873 0.92256077
          col14     col15       col16      col17       col18      col19
row1 -1.4443098 -1.324016 -0.06574631 -1.7020860 -0.04168893 -1.7452122
row5 -0.9949281 -1.931927  0.60570845  0.3622709  0.76867691  0.3161864
         col20
row1 -1.706266
row5 -1.121467
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.5228039 -1.7062656
row2 -0.0398631  1.6349771
row3  0.8503051  0.3619388
row4  0.7699596  1.8340318
row5  0.7482524 -1.1214673
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1 -0.5228039 -1.706266
row5  0.7482524 -1.121467
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6    col7    col8
row1 49.16109 49.98969 48.83973 49.99661 50.86108 104.5659 49.0565 49.6943
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.12515 48.60882 50.51753 47.73347 49.87874 49.37759 52.21617 49.50765
        col17    col18    col19    col20
row1 48.44309 51.36696 49.55187 105.2485
> tmp[,"col10"]
        col10
row1 48.60882
row2 31.21845
row3 30.72374
row4 29.78033
row5 51.89615
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.16109 49.98969 48.83973 49.99661 50.86108 104.5659 49.05650 49.69430
row5 48.85606 51.08934 49.14238 49.08632 50.21990 106.0125 50.97139 50.89437
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.12515 48.60882 50.51753 47.73347 49.87874 49.37759 52.21617 49.50765
row5 50.70204 51.89615 50.00187 49.66782 50.62231 49.52144 47.46894 50.28195
        col17    col18    col19    col20
row1 48.44309 51.36696 49.55187 105.2485
row5 49.52443 49.48525 51.79294 106.4932
> tmp[,c("col6","col20")]
          col6     col20
row1 104.56587 105.24851
row2  74.36813  74.65538
row3  76.58179  75.18124
row4  74.95861  74.17239
row5 106.01252 106.49324
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.5659 105.2485
row5 106.0125 106.4932
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.5659 105.2485
row5 106.0125 106.4932
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.6617790
[2,] -0.3498817
[3,]  2.0810460
[4,]  0.1423811
[5,] -0.3008159
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.1352289  1.0746089
[2,]  0.1984564  0.8461539
[3,]  1.3502728 -0.8785379
[4,] -1.4981735  1.5519643
[5,] -0.1316783 -0.0552906
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,]  0.4762895 -1.08051135
[2,]  0.2686948 -0.98265233
[3,] -0.7037199  1.49373024
[4,]  0.1939670  0.06097526
[5,]  0.9178367 -1.82011374
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.4762895
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.4762895
[2,] 0.2686948
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]      [,3]       [,4]      [,5]      [,6]       [,7]
row3 -1.056114 -0.2193934 0.5533883 -0.2131966 -1.217122  1.748665 -0.5598889
row1  2.332961 -0.8005179 0.2082957  1.0996432  0.662279 -1.078738 -0.5287515
           [,8]       [,9]     [,10]     [,11]      [,12]     [,13]       [,14]
row3 -0.8970268  1.3009879 0.1917797 0.3316624 -0.9025574 1.0654458 -0.03413915
row1 -0.2409498 -0.5771704 2.1204946 1.2632354 -0.7249611 0.5653822  1.54235825
          [,15]     [,16]      [,17]     [,18]     [,19]      [,20]
row3  1.4105391 -1.026773 -1.5428087 -1.304378 1.7253249 -0.4367486
row1 -0.7358892 -1.285978  0.6795651 -1.235927 0.9640771  1.3714412
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]     [,3]       [,4]     [,5]       [,6]       [,7]
row2 0.5421426 -1.791016 1.215997 -0.9445439 1.666804 -0.5552223 -0.4609636
          [,8]       [,9]      [,10]
row2 0.2082382 -0.1170384 -0.3137818
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]    [,2]     [,3]      [,4]      [,5]     [,6]       [,7]
row5 1.261411 -1.8772 -0.73769 0.6996326 -1.241674 1.789783 -0.3847476
          [,8]       [,9]      [,10]     [,11]    [,12]      [,13]      [,14]
row5 0.7549676 -0.3565207 0.02084376 0.9882765 2.864043 -0.5647548 -0.9222932
        [,15]    [,16]     [,17]     [,18]      [,19]      [,20]
row5 1.862593 0.102379 -1.662031 0.5582716 -0.6412792 0.05681639
> 
> 
> 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: 0x034bacc8>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec23b3c1c" 
 [2] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec5e225c24"
 [3] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16eca3e1b6a" 
 [4] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec31c8386e"
 [5] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec632b1e29"
 [6] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec2bef7b63"
 [7] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ecfb461e2" 
 [8] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec282a63ec"
 [9] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec3d9e4aee"
[10] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec65131846"
[11] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec58034989"
[12] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec1b3663b3"
[13] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec75552528"
[14] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec7b2a7c70"
[15] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_i386\\BM16ec66a0120d"
> 
> 
> ### 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: 0x01f76430>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x01f76430>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.9-bioc\meat\BufferedMatrix.Rcheck\tests_i386' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x01f76430>
> rowMedians(tmp)
  [1] -0.230998972 -0.118093343 -0.199021656 -0.037927800  0.309625484
  [6] -0.112740619  0.346256074  0.237077185 -0.138232322  0.519952425
 [11] -0.304816698 -0.548178286  0.508777150 -0.796340676 -0.841709651
 [16] -0.340249646 -0.015593775  0.297000608  0.048016048  0.570855957
 [21]  0.015275455 -0.058796168  0.082246840  0.238425756  0.083849354
 [26]  0.081005379  0.031711297  0.031072552  0.196191047  0.066792054
 [31] -0.265871828 -0.059130278 -0.021509755  0.168558718 -0.376099183
 [36] -0.145541769  0.035544486  0.281351102  0.888631092 -0.138238667
 [41]  0.041842302  0.164769610  0.335063590  0.126596880 -0.388279168
 [46]  0.053295902 -0.207198146 -0.169773871 -0.165786932  0.306918911
 [51]  0.200161481 -0.035083180  0.040495478 -0.378761346  0.480183958
 [56] -0.016226685  0.068557083  0.122616199 -0.296214051  0.474608708
 [61]  0.154253056  0.356299747  0.600186551  0.101678441  0.199709322
 [66]  0.245678047 -0.150984843  0.435087413 -0.346943118  0.005506282
 [71] -0.285632382  0.114066335  0.032563598 -0.371185920  0.464662943
 [76] -0.183057440  0.220670750  0.152030116  0.267086226 -0.198254615
 [81] -0.572839723  0.066858952 -0.143555496  0.094657658  0.621061518
 [86] -0.120271985  0.282354661 -0.004665900  0.287078566  0.424450692
 [91]  0.097181559  0.519121285 -0.012170080 -0.089340141 -0.297352963
 [96]  0.213808584 -0.063945656  0.011010737  0.430216486  0.370424842
[101]  0.121732288 -0.148641034  0.079630010 -0.023786755 -0.020697280
[106]  0.148585252 -0.127411381  0.135047612  0.074570193 -0.926303006
[111]  0.106513519  0.237221036 -0.136608045 -0.077462486  0.527575630
[116]  0.194626249 -0.179480299  0.396530664 -0.124261345  0.125403309
[121]  0.385994900 -0.393437424 -0.311708354  0.126204861  0.457247379
[126] -0.041494631  0.346631896 -0.139618290 -0.171104700  0.023788257
[131]  0.164000835  0.270344522 -0.098767907 -0.074698060 -0.261057565
[136] -0.763586367 -0.530339204 -0.340650242 -0.103104533 -0.332544160
[141] -0.017203754  0.248434510 -0.288861890  0.415772507 -0.034142743
[146]  0.147939533  0.151282618  0.460916418 -0.387499483  0.526769970
[151]  0.578090264 -0.364838404 -0.337468174  0.321138893  0.385381422
[156]  0.263834810  0.035865265 -0.194011871  0.280375423 -0.186525623
[161] -0.040133459  0.094806652 -0.555100092 -0.364366695 -0.087980530
[166] -0.014529790  0.325783265 -0.479459056 -0.237642566 -0.432692127
[171] -0.176702965  0.025446969 -0.108876546 -0.169116532  0.109013498
[176]  0.175692286 -0.288560152  0.207092496 -0.386694840 -0.047349383
[181] -0.604133583  0.120917933 -0.248566146 -0.173188926  0.001669923
[186] -0.382005250  0.443297437  0.143285125  0.355768896 -0.640140624
[191] -0.201234362  0.188807200 -0.445787002  0.151042300 -0.098973801
[196] -0.035700579  0.063029619 -0.287100144  0.596079109  0.384751250
[201] -0.045012013 -0.021703932 -0.214722953  0.401297559  0.026255078
[206]  0.418065044  0.179085497  0.576195384  0.002823242  0.110871983
[211]  0.552871118  0.140403836 -0.326679334 -0.167974271 -0.049689441
[216]  0.314225373 -0.494061734  0.166688622  0.352181720  0.220433113
[221]  0.047831172 -0.417430472  0.152279545 -0.223098198 -0.006537916
[226]  0.439551156 -0.112722465  0.440437934 -0.121919060  0.418742551
> 
> proc.time()
   user  system elapsed 
   3.50    7.45   11.40 

BufferedMatrix.Rcheck/tests_x64/objectTesting.Rout


R Under development (unstable) (2019-03-09 r76216) -- "Unsuffered Consequences"
Copyright (C) 2019 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.9-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 406205 21.7     843634 45.1   633902 33.9
Vcells 699015  5.4    8388608 64.0  1644631 12.6
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Apr 09 01:30:20 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Apr 09 01:30:21 2019"
> 
> 
> 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: 0x0000000005b47120>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Apr 09 01:30:23 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Apr 09 01:30:24 2019"
> 
> ColMode(tmp2)
<pointer: 0x0000000005b47120>
> 
> 
> 
> ### 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.6162111 1.8313694 -0.2469245  1.7847934
[2,]   1.7176742 0.9582072  0.4819515  0.9647294
[3,]   0.4107792 0.6964609 -0.2003150  2.2381164
[4,]  -1.2095639 1.4515773  1.4999891 -0.9885560
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.9-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.6162111 1.8313694 0.2469245 1.7847934
[2,]   1.7176742 0.9582072 0.4819515 0.9647294
[3,]   0.4107792 0.6964609 0.2003150 2.2381164
[4,]   1.2095639 1.4515773 1.4999891 0.9885560
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    C:/Users/biocbuild/bbs-3.9-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.0307632 1.3532810 0.4969150 1.3359616
[2,]  1.3106007 0.9788806 0.6942273 0.9822064
[3,]  0.6409206 0.8345423 0.4475656 1.4960336
[4,]  1.0998018 1.2048142 1.2247404 0.9942615
> 
> 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.9-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,] 225.92384 40.36418 30.21607 40.14441
[2,]  39.82368 35.74701 32.42422 35.78679
[3,]  31.81999 34.04188 29.67597 42.19845
[4,]  37.20758 38.49972 38.74739 35.93117
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x0000000005f6c9c0>
> exp(tmp5)
<pointer: 0x0000000005f6c9c0>
> log(tmp5,2)
<pointer: 0x0000000005f6c9c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.2309
> Min(tmp5)
[1] 53.11546
> mean(tmp5)
[1] 72.51425
> Sum(tmp5)
[1] 14502.85
> Var(tmp5)
[1] 871.9699
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 93.28009 71.73369 67.72243 73.03833 72.79818 67.18775 68.70683 71.47878
 [9] 70.47707 68.71932
> rowSums(tmp5)
 [1] 1865.602 1434.674 1354.449 1460.767 1455.964 1343.755 1374.137 1429.576
 [9] 1409.541 1374.386
> rowVars(tmp5)
 [1] 7928.56423  109.67176   59.39206   96.29534   55.12120   73.28605
 [7]   67.33787   71.42415   62.81667   63.94629
> rowSd(tmp5)
 [1] 89.042486 10.472428  7.706624  9.813019  7.424365  8.560727  8.205965
 [8]  8.451281  7.925697  7.996643
> rowMax(tmp5)
 [1] 470.23088  89.68967  87.83055  89.00798  85.44488  82.99385  82.42931
 [8]  86.32084  88.08714  82.44129
> rowMin(tmp5)
 [1] 62.89080 53.83215 57.81162 58.12919 56.50081 53.39587 53.11546 55.35819
 [9] 60.42605 57.48307
> 
> colMeans(tmp5)
 [1] 115.24086  73.05145  69.63079  76.08830  67.63022  70.83582  67.86731
 [8]  67.02839  71.36074  72.82036  70.36917  67.38892  70.48635  69.29140
[15]  72.14838  68.50362  64.98307  69.79349  69.91175  75.85453
> colSums(tmp5)
 [1] 1152.4086  730.5145  696.3079  760.8830  676.3022  708.3582  678.6731
 [8]  670.2839  713.6074  728.2036  703.6917  673.8892  704.8635  692.9140
[15]  721.4838  685.0362  649.8307  697.9349  699.1175  758.5453
> colVars(tmp5)
 [1] 15587.41906    44.28770    62.20434    72.33613    69.35490   130.87732
 [7]    64.04584    76.59202    86.77004   114.91417    67.95310    67.04968
[13]    51.02378    19.76199   135.32989    74.92313    69.85546    54.42492
[19]    30.29984   100.39644
> colSd(tmp5)
 [1] 124.849586   6.654900   7.886973   8.505065   8.327959  11.440162
 [7]   8.002864   8.751687   9.315044  10.719803   8.243367   8.188387
[13]   7.143093   4.445446  11.633137   8.655815   8.357958   7.377325
[19]   5.504529  10.019802
> colMax(tmp5)
 [1] 470.23088  84.01275  80.64762  87.83055  80.96574  88.08714  79.92157
 [8]  82.01018  86.32084  89.68967  82.37926  82.99385  78.75654  75.22675
[15]  89.00798  82.85273  83.96017  82.93490  79.35588  91.01513
> colMin(tmp5)
 [1] 66.22913 63.57424 56.45140 63.60317 53.83215 57.53114 57.48307 55.32593
 [9] 53.11546 55.35819 59.19297 57.81162 60.22911 60.42605 54.14987 57.18110
[17] 53.39587 58.39146 61.00547 59.24347
> 
> 
> ### 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] 93.28009 71.73369 67.72243 73.03833 72.79818 67.18775 68.70683       NA
 [9] 70.47707 68.71932
> rowSums(tmp5)
 [1] 1865.602 1434.674 1354.449 1460.767 1455.964 1343.755 1374.137       NA
 [9] 1409.541 1374.386
> rowVars(tmp5)
 [1] 7928.56423  109.67176   59.39206   96.29534   55.12120   73.28605
 [7]   67.33787   75.32422   62.81667   63.94629
> rowSd(tmp5)
 [1] 89.042486 10.472428  7.706624  9.813019  7.424365  8.560727  8.205965
 [8]  8.678953  7.925697  7.996643
> rowMax(tmp5)
 [1] 470.23088  89.68967  87.83055  89.00798  85.44488  82.99385  82.42931
 [8]        NA  88.08714  82.44129
> rowMin(tmp5)
 [1] 62.89080 53.83215 57.81162 58.12919 56.50081 53.39587 53.11546       NA
 [9] 60.42605 57.48307
> 
> colMeans(tmp5)
 [1]       NA 73.05145 69.63079 76.08830 67.63022 70.83582 67.86731 67.02839
 [9] 71.36074 72.82036 70.36917 67.38892 70.48635 69.29140 72.14838 68.50362
[17] 64.98307 69.79349 69.91175 75.85453
> colSums(tmp5)
 [1]       NA 730.5145 696.3079 760.8830 676.3022 708.3582 678.6731 670.2839
 [9] 713.6074 728.2036 703.6917 673.8892 704.8635 692.9140 721.4838 685.0362
[17] 649.8307 697.9349 699.1175 758.5453
> colVars(tmp5)
 [1]        NA  44.28770  62.20434  72.33613  69.35490 130.87732  64.04584
 [8]  76.59202  86.77004 114.91417  67.95310  67.04968  51.02378  19.76199
[15] 135.32989  74.92313  69.85546  54.42492  30.29984 100.39644
> colSd(tmp5)
 [1]        NA  6.654900  7.886973  8.505065  8.327959 11.440162  8.002864
 [8]  8.751687  9.315044 10.719803  8.243367  8.188387  7.143093  4.445446
[15] 11.633137  8.655815  8.357958  7.377325  5.504529 10.019802
> colMax(tmp5)
 [1]       NA 84.01275 80.64762 87.83055 80.96574 88.08714 79.92157 82.01018
 [9] 86.32084 89.68967 82.37926 82.99385 78.75654 75.22675 89.00798 82.85273
[17] 83.96017 82.93490 79.35588 91.01513
> colMin(tmp5)
 [1]       NA 63.57424 56.45140 63.60317 53.83215 57.53114 57.48307 55.32593
 [9] 53.11546 55.35819 59.19297 57.81162 60.22911 60.42605 54.14987 57.18110
[17] 53.39587 58.39146 61.00547 59.24347
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.2309
> Min(tmp5,na.rm=TRUE)
[1] 53.11546
> mean(tmp5,na.rm=TRUE)
[1] 72.52487
> Sum(tmp5,na.rm=TRUE)
[1] 14432.45
> Var(tmp5,na.rm=TRUE)
[1] 876.3512
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.28009 71.73369 67.72243 73.03833 72.79818 67.18775 68.70683 71.53551
 [9] 70.47707 68.71932
> rowSums(tmp5,na.rm=TRUE)
 [1] 1865.602 1434.674 1354.449 1460.767 1455.964 1343.755 1374.137 1359.175
 [9] 1409.541 1374.386
> rowVars(tmp5,na.rm=TRUE)
 [1] 7928.56423  109.67176   59.39206   96.29534   55.12120   73.28605
 [7]   67.33787   75.32422   62.81667   63.94629
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.042486 10.472428  7.706624  9.813019  7.424365  8.560727  8.205965
 [8]  8.678953  7.925697  7.996643
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.23088  89.68967  87.83055  89.00798  85.44488  82.99385  82.42931
 [8]  86.32084  88.08714  82.44129
> rowMin(tmp5,na.rm=TRUE)
 [1] 62.89080 53.83215 57.81162 58.12919 56.50081 53.39587 53.11546 55.35819
 [9] 60.42605 57.48307
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 120.22308  73.05145  69.63079  76.08830  67.63022  70.83582  67.86731
 [8]  67.02839  71.36074  72.82036  70.36917  67.38892  70.48635  69.29140
[15]  72.14838  68.50362  64.98307  69.79349  69.91175  75.85453
> colSums(tmp5,na.rm=TRUE)
 [1] 1082.0077  730.5145  696.3079  760.8830  676.3022  708.3582  678.6731
 [8]  670.2839  713.6074  728.2036  703.6917  673.8892  704.8635  692.9140
[15]  721.4838  685.0362  649.8307  697.9349  699.1175  758.5453
> colVars(tmp5,na.rm=TRUE)
 [1] 17256.59358    44.28770    62.20434    72.33613    69.35490   130.87732
 [7]    64.04584    76.59202    86.77004   114.91417    67.95310    67.04968
[13]    51.02378    19.76199   135.32989    74.92313    69.85546    54.42492
[19]    30.29984   100.39644
> colSd(tmp5,na.rm=TRUE)
 [1] 131.364354   6.654900   7.886973   8.505065   8.327959  11.440162
 [7]   8.002864   8.751687   9.315044  10.719803   8.243367   8.188387
[13]   7.143093   4.445446  11.633137   8.655815   8.357958   7.377325
[19]   5.504529  10.019802
> colMax(tmp5,na.rm=TRUE)
 [1] 470.23088  84.01275  80.64762  87.83055  80.96574  88.08714  79.92157
 [8]  82.01018  86.32084  89.68967  82.37926  82.99385  78.75654  75.22675
[15]  89.00798  82.85273  83.96017  82.93490  79.35588  91.01513
> colMin(tmp5,na.rm=TRUE)
 [1] 66.22913 63.57424 56.45140 63.60317 53.83215 57.53114 57.48307 55.32593
 [9] 53.11546 55.35819 59.19297 57.81162 60.22911 60.42605 54.14987 57.18110
[17] 53.39587 58.39146 61.00547 59.24347
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.28009 71.73369 67.72243 73.03833 72.79818 67.18775 68.70683      NaN
 [9] 70.47707 68.71932
> rowSums(tmp5,na.rm=TRUE)
 [1] 1865.602 1434.674 1354.449 1460.767 1455.964 1343.755 1374.137    0.000
 [9] 1409.541 1374.386
> rowVars(tmp5,na.rm=TRUE)
 [1] 7928.56423  109.67176   59.39206   96.29534   55.12120   73.28605
 [7]   67.33787         NA   62.81667   63.94629
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.042486 10.472428  7.706624  9.813019  7.424365  8.560727  8.205965
 [8]        NA  7.925697  7.996643
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.23088  89.68967  87.83055  89.00798  85.44488  82.99385  82.42931
 [8]        NA  88.08714  82.44129
> rowMin(tmp5,na.rm=TRUE)
 [1] 62.89080 53.83215 57.81162 58.12919 56.50081 53.39587 53.11546       NA
 [9] 60.42605 57.48307
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1]      NaN 73.93294 68.66348 76.77099 67.09341 71.59047 68.65687 65.36375
 [9] 69.69851 74.76060 71.61097 67.76329 69.81910 69.01445 70.94147 67.11618
[17] 64.67487 69.10215 69.85137 75.93805
> colSums(tmp5,na.rm=TRUE)
 [1]   0.0000 665.3965 617.9713 690.9389 603.8407 644.3142 617.9118 588.2737
 [9] 627.2866 672.8454 644.4987 609.8696 628.3719 621.1301 638.4732 604.0456
[17] 582.0738 621.9193 628.6623 683.4424
> colVars(tmp5,na.rm=TRUE)
 [1]        NA  41.08211  59.45327  76.13491  74.78237 140.83014  65.03834
 [8]  54.99187  66.53235  86.92743  59.09898  73.85421  52.39299  21.36935
[15] 135.85885  62.63252  77.51878  55.85095  34.04630 112.86753
> colSd(tmp5,na.rm=TRUE)
 [1]        NA  6.409533  7.710595  8.725532  8.647680 11.867188  8.064635
 [8]  7.415651  8.156737  9.323488  7.687586  8.593847  7.238300  4.622699
[15] 11.655850  7.914071  8.804475  7.473349  5.834921 10.623913
> colMax(tmp5,na.rm=TRUE)
 [1]     -Inf 84.01275 80.64762 87.83055 80.96574 88.08714 79.92157 80.94555
 [9] 79.89325 89.68967 82.37926 82.99385 78.75654 75.22675 89.00798 82.85273
[17] 83.96017 82.93490 79.35588 91.01513
> colMin(tmp5,na.rm=TRUE)
 [1]      Inf 63.57424 56.45140 63.60317 53.83215 57.53114 57.48307 55.32593
 [9] 53.11546 58.31456 60.86933 57.81162 60.22911 60.42605 54.14987 57.18110
[17] 53.39587 58.39146 61.00547 59.24347
> 
> 
> 
> 
> 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] 292.0172 284.4690 243.9764 109.0202 144.5950 150.0647 292.0506 144.1971
 [9] 201.2296 207.9308
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 292.0172 284.4690 243.9764 109.0202 144.5950 150.0647 292.0506 144.1971
 [9] 201.2296 207.9308
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14 -2.842171e-13 -5.684342e-14 -5.684342e-14 -8.526513e-14
 [6] -1.705303e-13  0.000000e+00  5.684342e-14  2.842171e-13  2.842171e-14
[11]  4.263256e-14 -1.421085e-13 -1.705303e-13 -2.273737e-13  1.136868e-13
[16] -1.136868e-13  1.989520e-13  2.842171e-14  2.273737e-13 -1.989520e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## 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)
+ }
6   7 
3   6 
3   13 
4   17 
7   12 
1   6 
8   8 
10   12 
7   11 
8   7 
10   6 
7   19 
10   3 
10   7 
5   4 
3   19 
10   18 
6   14 
7   12 
4   15 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.718597
> Min(tmp)
[1] -2.124447
> mean(tmp)
[1] 0.05635757
> Sum(tmp)
[1] 5.635757
> Var(tmp)
[1] 0.9009438
> 
> rowMeans(tmp)
[1] 0.05635757
> rowSums(tmp)
[1] 5.635757
> rowVars(tmp)
[1] 0.9009438
> rowSd(tmp)
[1] 0.9491806
> rowMax(tmp)
[1] 2.718597
> rowMin(tmp)
[1] -2.124447
> 
> colMeans(tmp)
  [1]  0.397120247  0.271656445  0.034419224 -0.927864771  0.451074690
  [6]  0.792506865  1.013283307  0.561158116  1.566929771  2.718597360
 [11] -0.425337901  0.446098760 -0.581009463 -0.766354177 -0.337502669
 [16] -0.613333719 -0.718835322  0.895621743  0.951421085 -1.029499601
 [21] -1.450578944  0.001323189 -0.986935875  0.563682243  1.626055789
 [26]  0.112417754 -0.828451181 -0.152588006 -0.368485988 -0.250513220
 [31] -0.401078608 -1.401268248 -0.514225746  1.685465027 -0.335511592
 [36]  0.458518237 -0.819680870  0.460710330  1.332008787  0.451897597
 [41] -0.129320651  0.377891639 -0.227394422 -0.426900455 -0.051524027
 [46] -0.229464608 -0.805175450 -0.107303717 -0.212378219  0.118725511
 [51]  0.245007795 -0.819593389  0.170685164  0.895341063 -0.487545201
 [56] -1.452325391  1.444079146  1.014682279 -0.450200129  1.079291879
 [61] -0.496427061  0.961335025 -1.776989184  0.154336594 -0.996247073
 [66]  0.714157852 -2.124447355 -0.020442286  0.117994750 -0.867388623
 [71]  2.031601181 -0.119821464  0.553829907  1.106365788  1.839990897
 [76]  0.474561858  0.081279124  1.345992775 -1.996835658 -1.736787546
 [81] -0.380061811  1.865757583 -1.462236137  0.491752651 -0.082485206
 [86]  0.267653351  0.975960210  0.424019113 -1.868975233  1.422380418
 [91] -0.221033637  0.939294723 -0.063345955  0.283555211 -0.084842842
 [96]  1.359892337 -0.391630107  0.130897371 -1.164016301  0.117672710
> colSums(tmp)
  [1]  0.397120247  0.271656445  0.034419224 -0.927864771  0.451074690
  [6]  0.792506865  1.013283307  0.561158116  1.566929771  2.718597360
 [11] -0.425337901  0.446098760 -0.581009463 -0.766354177 -0.337502669
 [16] -0.613333719 -0.718835322  0.895621743  0.951421085 -1.029499601
 [21] -1.450578944  0.001323189 -0.986935875  0.563682243  1.626055789
 [26]  0.112417754 -0.828451181 -0.152588006 -0.368485988 -0.250513220
 [31] -0.401078608 -1.401268248 -0.514225746  1.685465027 -0.335511592
 [36]  0.458518237 -0.819680870  0.460710330  1.332008787  0.451897597
 [41] -0.129320651  0.377891639 -0.227394422 -0.426900455 -0.051524027
 [46] -0.229464608 -0.805175450 -0.107303717 -0.212378219  0.118725511
 [51]  0.245007795 -0.819593389  0.170685164  0.895341063 -0.487545201
 [56] -1.452325391  1.444079146  1.014682279 -0.450200129  1.079291879
 [61] -0.496427061  0.961335025 -1.776989184  0.154336594 -0.996247073
 [66]  0.714157852 -2.124447355 -0.020442286  0.117994750 -0.867388623
 [71]  2.031601181 -0.119821464  0.553829907  1.106365788  1.839990897
 [76]  0.474561858  0.081279124  1.345992775 -1.996835658 -1.736787546
 [81] -0.380061811  1.865757583 -1.462236137  0.491752651 -0.082485206
 [86]  0.267653351  0.975960210  0.424019113 -1.868975233  1.422380418
 [91] -0.221033637  0.939294723 -0.063345955  0.283555211 -0.084842842
 [96]  1.359892337 -0.391630107  0.130897371 -1.164016301  0.117672710
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.397120247  0.271656445  0.034419224 -0.927864771  0.451074690
  [6]  0.792506865  1.013283307  0.561158116  1.566929771  2.718597360
 [11] -0.425337901  0.446098760 -0.581009463 -0.766354177 -0.337502669
 [16] -0.613333719 -0.718835322  0.895621743  0.951421085 -1.029499601
 [21] -1.450578944  0.001323189 -0.986935875  0.563682243  1.626055789
 [26]  0.112417754 -0.828451181 -0.152588006 -0.368485988 -0.250513220
 [31] -0.401078608 -1.401268248 -0.514225746  1.685465027 -0.335511592
 [36]  0.458518237 -0.819680870  0.460710330  1.332008787  0.451897597
 [41] -0.129320651  0.377891639 -0.227394422 -0.426900455 -0.051524027
 [46] -0.229464608 -0.805175450 -0.107303717 -0.212378219  0.118725511
 [51]  0.245007795 -0.819593389  0.170685164  0.895341063 -0.487545201
 [56] -1.452325391  1.444079146  1.014682279 -0.450200129  1.079291879
 [61] -0.496427061  0.961335025 -1.776989184  0.154336594 -0.996247073
 [66]  0.714157852 -2.124447355 -0.020442286  0.117994750 -0.867388623
 [71]  2.031601181 -0.119821464  0.553829907  1.106365788  1.839990897
 [76]  0.474561858  0.081279124  1.345992775 -1.996835658 -1.736787546
 [81] -0.380061811  1.865757583 -1.462236137  0.491752651 -0.082485206
 [86]  0.267653351  0.975960210  0.424019113 -1.868975233  1.422380418
 [91] -0.221033637  0.939294723 -0.063345955  0.283555211 -0.084842842
 [96]  1.359892337 -0.391630107  0.130897371 -1.164016301  0.117672710
> colMin(tmp)
  [1]  0.397120247  0.271656445  0.034419224 -0.927864771  0.451074690
  [6]  0.792506865  1.013283307  0.561158116  1.566929771  2.718597360
 [11] -0.425337901  0.446098760 -0.581009463 -0.766354177 -0.337502669
 [16] -0.613333719 -0.718835322  0.895621743  0.951421085 -1.029499601
 [21] -1.450578944  0.001323189 -0.986935875  0.563682243  1.626055789
 [26]  0.112417754 -0.828451181 -0.152588006 -0.368485988 -0.250513220
 [31] -0.401078608 -1.401268248 -0.514225746  1.685465027 -0.335511592
 [36]  0.458518237 -0.819680870  0.460710330  1.332008787  0.451897597
 [41] -0.129320651  0.377891639 -0.227394422 -0.426900455 -0.051524027
 [46] -0.229464608 -0.805175450 -0.107303717 -0.212378219  0.118725511
 [51]  0.245007795 -0.819593389  0.170685164  0.895341063 -0.487545201
 [56] -1.452325391  1.444079146  1.014682279 -0.450200129  1.079291879
 [61] -0.496427061  0.961335025 -1.776989184  0.154336594 -0.996247073
 [66]  0.714157852 -2.124447355 -0.020442286  0.117994750 -0.867388623
 [71]  2.031601181 -0.119821464  0.553829907  1.106365788  1.839990897
 [76]  0.474561858  0.081279124  1.345992775 -1.996835658 -1.736787546
 [81] -0.380061811  1.865757583 -1.462236137  0.491752651 -0.082485206
 [86]  0.267653351  0.975960210  0.424019113 -1.868975233  1.422380418
 [91] -0.221033637  0.939294723 -0.063345955  0.283555211 -0.084842842
 [96]  1.359892337 -0.391630107  0.130897371 -1.164016301  0.117672710
> colMedians(tmp)
  [1]  0.397120247  0.271656445  0.034419224 -0.927864771  0.451074690
  [6]  0.792506865  1.013283307  0.561158116  1.566929771  2.718597360
 [11] -0.425337901  0.446098760 -0.581009463 -0.766354177 -0.337502669
 [16] -0.613333719 -0.718835322  0.895621743  0.951421085 -1.029499601
 [21] -1.450578944  0.001323189 -0.986935875  0.563682243  1.626055789
 [26]  0.112417754 -0.828451181 -0.152588006 -0.368485988 -0.250513220
 [31] -0.401078608 -1.401268248 -0.514225746  1.685465027 -0.335511592
 [36]  0.458518237 -0.819680870  0.460710330  1.332008787  0.451897597
 [41] -0.129320651  0.377891639 -0.227394422 -0.426900455 -0.051524027
 [46] -0.229464608 -0.805175450 -0.107303717 -0.212378219  0.118725511
 [51]  0.245007795 -0.819593389  0.170685164  0.895341063 -0.487545201
 [56] -1.452325391  1.444079146  1.014682279 -0.450200129  1.079291879
 [61] -0.496427061  0.961335025 -1.776989184  0.154336594 -0.996247073
 [66]  0.714157852 -2.124447355 -0.020442286  0.117994750 -0.867388623
 [71]  2.031601181 -0.119821464  0.553829907  1.106365788  1.839990897
 [76]  0.474561858  0.081279124  1.345992775 -1.996835658 -1.736787546
 [81] -0.380061811  1.865757583 -1.462236137  0.491752651 -0.082485206
 [86]  0.267653351  0.975960210  0.424019113 -1.868975233  1.422380418
 [91] -0.221033637  0.939294723 -0.063345955  0.283555211 -0.084842842
 [96]  1.359892337 -0.391630107  0.130897371 -1.164016301  0.117672710
> colRanges(tmp)
          [,1]      [,2]       [,3]       [,4]      [,5]      [,6]     [,7]
[1,] 0.3971202 0.2716564 0.03441922 -0.9278648 0.4510747 0.7925069 1.013283
[2,] 0.3971202 0.2716564 0.03441922 -0.9278648 0.4510747 0.7925069 1.013283
          [,8]    [,9]    [,10]      [,11]     [,12]      [,13]      [,14]
[1,] 0.5611581 1.56693 2.718597 -0.4253379 0.4460988 -0.5810095 -0.7663542
[2,] 0.5611581 1.56693 2.718597 -0.4253379 0.4460988 -0.5810095 -0.7663542
          [,15]      [,16]      [,17]     [,18]     [,19]   [,20]     [,21]
[1,] -0.3375027 -0.6133337 -0.7188353 0.8956217 0.9514211 -1.0295 -1.450579
[2,] -0.3375027 -0.6133337 -0.7188353 0.8956217 0.9514211 -1.0295 -1.450579
           [,22]      [,23]     [,24]    [,25]     [,26]      [,27]     [,28]
[1,] 0.001323189 -0.9869359 0.5636822 1.626056 0.1124178 -0.8284512 -0.152588
[2,] 0.001323189 -0.9869359 0.5636822 1.626056 0.1124178 -0.8284512 -0.152588
         [,29]      [,30]      [,31]     [,32]      [,33]    [,34]      [,35]
[1,] -0.368486 -0.2505132 -0.4010786 -1.401268 -0.5142257 1.685465 -0.3355116
[2,] -0.368486 -0.2505132 -0.4010786 -1.401268 -0.5142257 1.685465 -0.3355116
         [,36]      [,37]     [,38]    [,39]     [,40]      [,41]     [,42]
[1,] 0.4585182 -0.8196809 0.4607103 1.332009 0.4518976 -0.1293207 0.3778916
[2,] 0.4585182 -0.8196809 0.4607103 1.332009 0.4518976 -0.1293207 0.3778916
          [,43]      [,44]       [,45]      [,46]      [,47]      [,48]
[1,] -0.2273944 -0.4269005 -0.05152403 -0.2294646 -0.8051755 -0.1073037
[2,] -0.2273944 -0.4269005 -0.05152403 -0.2294646 -0.8051755 -0.1073037
          [,49]     [,50]     [,51]      [,52]     [,53]     [,54]      [,55]
[1,] -0.2123782 0.1187255 0.2450078 -0.8195934 0.1706852 0.8953411 -0.4875452
[2,] -0.2123782 0.1187255 0.2450078 -0.8195934 0.1706852 0.8953411 -0.4875452
         [,56]    [,57]    [,58]      [,59]    [,60]      [,61]    [,62]
[1,] -1.452325 1.444079 1.014682 -0.4502001 1.079292 -0.4964271 0.961335
[2,] -1.452325 1.444079 1.014682 -0.4502001 1.079292 -0.4964271 0.961335
         [,63]     [,64]      [,65]     [,66]     [,67]       [,68]     [,69]
[1,] -1.776989 0.1543366 -0.9962471 0.7141579 -2.124447 -0.02044229 0.1179947
[2,] -1.776989 0.1543366 -0.9962471 0.7141579 -2.124447 -0.02044229 0.1179947
          [,70]    [,71]      [,72]     [,73]    [,74]    [,75]     [,76]
[1,] -0.8673886 2.031601 -0.1198215 0.5538299 1.106366 1.839991 0.4745619
[2,] -0.8673886 2.031601 -0.1198215 0.5538299 1.106366 1.839991 0.4745619
          [,77]    [,78]     [,79]     [,80]      [,81]    [,82]     [,83]
[1,] 0.08127912 1.345993 -1.996836 -1.736788 -0.3800618 1.865758 -1.462236
[2,] 0.08127912 1.345993 -1.996836 -1.736788 -0.3800618 1.865758 -1.462236
         [,84]       [,85]     [,86]     [,87]     [,88]     [,89]   [,90]
[1,] 0.4917527 -0.08248521 0.2676534 0.9759602 0.4240191 -1.868975 1.42238
[2,] 0.4917527 -0.08248521 0.2676534 0.9759602 0.4240191 -1.868975 1.42238
          [,91]     [,92]       [,93]     [,94]       [,95]    [,96]      [,97]
[1,] -0.2210336 0.9392947 -0.06334596 0.2835552 -0.08484284 1.359892 -0.3916301
[2,] -0.2210336 0.9392947 -0.06334596 0.2835552 -0.08484284 1.359892 -0.3916301
         [,98]     [,99]    [,100]
[1,] 0.1308974 -1.164016 0.1176727
[2,] 0.1308974 -1.164016 0.1176727
> 
> 
> Max(tmp2)
[1] 2.793489
> Min(tmp2)
[1] -2.77111
> mean(tmp2)
[1] -0.04101966
> Sum(tmp2)
[1] -4.101966
> Var(tmp2)
[1] 0.9916988
> 
> rowMeans(tmp2)
  [1]  0.70203096 -0.41828081  0.54742103  2.37790440  1.89121575 -0.33622599
  [7]  0.24509505 -1.84169198 -0.19754842 -2.77111041 -0.77551214 -0.34379909
 [13] -0.04062589 -0.48307029 -1.02563877 -1.04277382 -0.86841729  1.06621097
 [19] -0.48299694 -0.38042333 -0.58592177 -0.10181475 -1.24478648  1.10595106
 [25]  0.56941059  1.42856462 -0.43548526 -0.51630987  0.83765508  1.14189599
 [31] -0.45535557 -0.92100462 -0.94409402  0.33108341 -0.78016526 -0.24425090
 [37]  0.58739534 -0.99167304  1.87444214 -1.73863496 -0.54022974  0.46989150
 [43]  0.55972817 -0.63570914  2.79348860 -0.96279869 -1.06127300  0.38812211
 [49]  0.34647873  1.51030211  0.46888506  1.16663623 -0.92527965 -0.69550844
 [55] -0.72651980  0.12028649 -0.33689149 -0.37210419  1.67245572  0.09342507
 [61]  0.80735886 -0.86319469  2.59452979 -0.03718546 -0.44822088  0.73237228
 [67]  1.04816225  1.20115333  0.14154111  0.13183796 -0.27512065  0.39942846
 [73]  0.44492361 -0.59288523 -0.61848064 -0.86338800 -1.30838825 -0.42029994
 [79] -1.64227295  0.09875351  0.23179093  0.85285225  1.33259332  0.41618075
 [85] -1.39610268 -0.72445779 -0.90314612  0.79954093 -0.13533477 -1.54119384
 [91]  0.27182845 -0.15181910  0.56807327 -0.21274999 -1.58046124 -0.38648838
 [97] -0.15096030  1.13655808 -1.16832203  0.03697751
> rowSums(tmp2)
  [1]  0.70203096 -0.41828081  0.54742103  2.37790440  1.89121575 -0.33622599
  [7]  0.24509505 -1.84169198 -0.19754842 -2.77111041 -0.77551214 -0.34379909
 [13] -0.04062589 -0.48307029 -1.02563877 -1.04277382 -0.86841729  1.06621097
 [19] -0.48299694 -0.38042333 -0.58592177 -0.10181475 -1.24478648  1.10595106
 [25]  0.56941059  1.42856462 -0.43548526 -0.51630987  0.83765508  1.14189599
 [31] -0.45535557 -0.92100462 -0.94409402  0.33108341 -0.78016526 -0.24425090
 [37]  0.58739534 -0.99167304  1.87444214 -1.73863496 -0.54022974  0.46989150
 [43]  0.55972817 -0.63570914  2.79348860 -0.96279869 -1.06127300  0.38812211
 [49]  0.34647873  1.51030211  0.46888506  1.16663623 -0.92527965 -0.69550844
 [55] -0.72651980  0.12028649 -0.33689149 -0.37210419  1.67245572  0.09342507
 [61]  0.80735886 -0.86319469  2.59452979 -0.03718546 -0.44822088  0.73237228
 [67]  1.04816225  1.20115333  0.14154111  0.13183796 -0.27512065  0.39942846
 [73]  0.44492361 -0.59288523 -0.61848064 -0.86338800 -1.30838825 -0.42029994
 [79] -1.64227295  0.09875351  0.23179093  0.85285225  1.33259332  0.41618075
 [85] -1.39610268 -0.72445779 -0.90314612  0.79954093 -0.13533477 -1.54119384
 [91]  0.27182845 -0.15181910  0.56807327 -0.21274999 -1.58046124 -0.38648838
 [97] -0.15096030  1.13655808 -1.16832203  0.03697751
> 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.70203096 -0.41828081  0.54742103  2.37790440  1.89121575 -0.33622599
  [7]  0.24509505 -1.84169198 -0.19754842 -2.77111041 -0.77551214 -0.34379909
 [13] -0.04062589 -0.48307029 -1.02563877 -1.04277382 -0.86841729  1.06621097
 [19] -0.48299694 -0.38042333 -0.58592177 -0.10181475 -1.24478648  1.10595106
 [25]  0.56941059  1.42856462 -0.43548526 -0.51630987  0.83765508  1.14189599
 [31] -0.45535557 -0.92100462 -0.94409402  0.33108341 -0.78016526 -0.24425090
 [37]  0.58739534 -0.99167304  1.87444214 -1.73863496 -0.54022974  0.46989150
 [43]  0.55972817 -0.63570914  2.79348860 -0.96279869 -1.06127300  0.38812211
 [49]  0.34647873  1.51030211  0.46888506  1.16663623 -0.92527965 -0.69550844
 [55] -0.72651980  0.12028649 -0.33689149 -0.37210419  1.67245572  0.09342507
 [61]  0.80735886 -0.86319469  2.59452979 -0.03718546 -0.44822088  0.73237228
 [67]  1.04816225  1.20115333  0.14154111  0.13183796 -0.27512065  0.39942846
 [73]  0.44492361 -0.59288523 -0.61848064 -0.86338800 -1.30838825 -0.42029994
 [79] -1.64227295  0.09875351  0.23179093  0.85285225  1.33259332  0.41618075
 [85] -1.39610268 -0.72445779 -0.90314612  0.79954093 -0.13533477 -1.54119384
 [91]  0.27182845 -0.15181910  0.56807327 -0.21274999 -1.58046124 -0.38648838
 [97] -0.15096030  1.13655808 -1.16832203  0.03697751
> rowMin(tmp2)
  [1]  0.70203096 -0.41828081  0.54742103  2.37790440  1.89121575 -0.33622599
  [7]  0.24509505 -1.84169198 -0.19754842 -2.77111041 -0.77551214 -0.34379909
 [13] -0.04062589 -0.48307029 -1.02563877 -1.04277382 -0.86841729  1.06621097
 [19] -0.48299694 -0.38042333 -0.58592177 -0.10181475 -1.24478648  1.10595106
 [25]  0.56941059  1.42856462 -0.43548526 -0.51630987  0.83765508  1.14189599
 [31] -0.45535557 -0.92100462 -0.94409402  0.33108341 -0.78016526 -0.24425090
 [37]  0.58739534 -0.99167304  1.87444214 -1.73863496 -0.54022974  0.46989150
 [43]  0.55972817 -0.63570914  2.79348860 -0.96279869 -1.06127300  0.38812211
 [49]  0.34647873  1.51030211  0.46888506  1.16663623 -0.92527965 -0.69550844
 [55] -0.72651980  0.12028649 -0.33689149 -0.37210419  1.67245572  0.09342507
 [61]  0.80735886 -0.86319469  2.59452979 -0.03718546 -0.44822088  0.73237228
 [67]  1.04816225  1.20115333  0.14154111  0.13183796 -0.27512065  0.39942846
 [73]  0.44492361 -0.59288523 -0.61848064 -0.86338800 -1.30838825 -0.42029994
 [79] -1.64227295  0.09875351  0.23179093  0.85285225  1.33259332  0.41618075
 [85] -1.39610268 -0.72445779 -0.90314612  0.79954093 -0.13533477 -1.54119384
 [91]  0.27182845 -0.15181910  0.56807327 -0.21274999 -1.58046124 -0.38648838
 [97] -0.15096030  1.13655808 -1.16832203  0.03697751
> 
> colMeans(tmp2)
[1] -0.04101966
> colSums(tmp2)
[1] -4.101966
> colVars(tmp2)
[1] 0.9916988
> colSd(tmp2)
[1] 0.9958407
> colMax(tmp2)
[1] 2.793489
> colMin(tmp2)
[1] -2.77111
> colMedians(tmp2)
[1] -0.1746838
> colRanges(tmp2)
          [,1]
[1,] -2.771110
[2,]  2.793489
> 
> 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] -0.6689309  4.5923486 -4.5641377  1.1939372 -0.9758522 -3.4454270
 [7] -1.1173951  1.1904598 -1.4863064  0.1916905
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.30280403
[2,] -0.44350012
[3,] -0.08102138
[4,]  0.46963618
[5,]  0.95159132
> 
> rowApply(tmp,sum)
 [1] -2.7793220 -0.2962742  0.1840324 -2.5533994  0.9890925 -5.9475543
 [7]  2.0813990  1.2544030  0.3522377  1.6257721
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    6    8    4    8    9    7    7    1    4     4
 [2,]    9    4    5   10    2    9    8    6    7     6
 [3,]    1    6    6    5    8    2    1    3    6     8
 [4,]    7    2    1    2    7    5    2   10   10    10
 [5,]   10    3    2    7   10    6    4    9    2     1
 [6,]    5    1    7    1    4    4   10    5    8     3
 [7,]    2    5    3    4    1   10    5    7    5     5
 [8,]    4   10   10    3    3    8    9    8    1     7
 [9,]    3    9    8    6    5    1    3    2    9     9
[10,]    8    7    9    9    6    3    6    4    3     2
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.9346906 -2.4566452 -2.8446312  0.5881732  3.5252055  1.9426912
 [7]  1.4874036 -2.4216007  1.5320801 -3.6335714 -0.8270993  1.7612556
[13]  2.1894134  0.2930934 -1.5485516  1.2354242  1.3960705 -4.4030408
[19] -1.4221045 -2.0957523
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.73377292
[2,] -0.09074539
[3,]  1.19262372
[4,]  1.19447505
[5,]  1.37211011
> 
> rowApply(tmp,sum)
[1]  1.5384373 -0.2033503 -4.3130671 -1.2696553  1.4801395
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   18   12   18   19    7
[2,]    2    8    6    5   18
[3,]   20    1    3    2   11
[4,]   17   13   13   14    5
[5,]   13   16   12   17   19
> 
> 
> as.matrix(tmp)
            [,1]       [,2]      [,3]        [,4]      [,5]       [,6]
[1,]  1.19262372 -1.1608181  1.937646  0.89742966 0.4323685  0.7516454
[2,] -0.09074539 -0.5076225 -1.399170  0.02530504 0.9623820 -0.7220085
[3,]  1.37211011 -1.1685667 -1.797057  0.16522985 0.0814576  1.6849454
[4,]  1.19447505 -0.7851678 -1.786610  0.30922661 0.8562798  1.0997490
[5,] -0.73377292  1.1655299  0.200559 -0.80901793 1.1927176 -0.8716400
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,]  1.2061622  0.8938545  0.7734347 -1.3682172 -0.8807270 -0.7002852
[2,]  0.7717964 -0.9963175 -1.2414784 -0.1350620  0.4938250  1.4542048
[3,]  0.2906918 -1.5016973 -0.3144091 -1.3306109  0.5209626  0.5229186
[4,] -1.9303841  0.1929295 -0.4168410 -0.2201933 -0.1324905  0.1635286
[5,]  1.1491373 -1.0103699  2.7313739 -0.5794880 -0.8286693  0.3208888
           [,13]       [,14]      [,15]      [,16]        [,17]      [,18]
[1,] -0.19324484 -0.62322836 -0.4878631  0.3701592 -0.005037802 -0.6449731
[2,] -0.12848677 -0.83369334 -0.6094303  1.1277143  1.348034667 -1.0731728
[3,]  2.12948590 -0.07965053 -0.1455711 -2.0963693  0.862959549 -1.7975704
[4,]  0.06568444  1.43701999 -0.7867806  0.7860377  0.714894163 -0.6774066
[5,]  0.31597463  0.39264566  0.4810935  1.0478823 -1.524780052 -0.2099180
          [,19]      [,20]
[1,] -0.4154702 -0.4370219
[2,]  1.6255895 -0.2750148
[3,] -1.0791252 -0.6332009
[4,] -0.8184766 -0.5351296
[5,] -0.7346221 -0.2153850
> 
> 
> 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.9-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.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  679  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.9-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.9-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.2327517 -0.2231568 -0.4705044 -2.532784 0.3206439 0.3618033 1.198973
          col8     col9      col10     col11     col12      col13     col14
row1 -1.712606 1.444423 -0.1767836 0.9276966 -2.264682 -0.6318881 0.3532127
          col15    col16       col17     col18     col19     col20
row1 -0.1850125 1.386311 -0.09740129 0.6416086 0.9482467 -1.146023
> tmp[,"col10"]
          col10
row1 -0.1767836
row2  1.2392675
row3 -1.4240015
row4  0.2297550
row5 -0.5195527
> tmp[c("row1","row5"),]
          col1       col2       col3        col4       col5      col6      col7
row1 0.2327517 -0.2231568 -0.4705044 -2.53278378  0.3206439 0.3618033  1.198973
row5 0.5849189  0.7748054 -0.2759836 -0.08759283 -0.1251700 1.5356895 -2.330997
            col8     col9      col10     col11     col12      col13     col14
row1 -1.71260561 1.444423 -0.1767836 0.9276966 -2.264682 -0.6318881 0.3532127
row5  0.08241155 1.189233 -0.5195527 0.2931176  1.685508  1.6817549 1.4889269
          col15    col16       col17     col18     col19      col20
row1 -0.1850125 1.386311 -0.09740129 0.6416086 0.9482467 -1.1460227
row5  0.0711635 1.158349  2.14974929 0.4261994 0.1778779  0.3838016
> tmp[,c("col6","col20")]
          col6       col20
row1 0.3618033 -1.14602266
row2 1.2911922 -0.09890373
row3 0.4259398  0.45364208
row4 0.7428402 -0.73850496
row5 1.5356895  0.38380155
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 0.3618033 -1.1460227
row5 1.5356895  0.3838016
> 
> 
> 
> 
> 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 51.33282 49.31695 49.32569 51.65989 50.78601 105.2092 49.97899 49.48499
         col9    col10    col11   col12    col13    col14    col15    col16
row1 50.11469 49.77131 50.65639 49.7459 50.66864 49.96427 50.13922 48.70027
        col17    col18    col19    col20
row1 49.89024 50.73548 50.23727 104.7068
> tmp[,"col10"]
        col10
row1 49.77131
row2 31.97066
row3 28.00480
row4 29.72328
row5 49.53203
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.33282 49.31695 49.32569 51.65989 50.78601 105.2092 49.97899 49.48499
row5 48.46418 49.98501 50.36521 50.60059 50.36056 104.1316 51.90301 50.96484
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.11469 49.77131 50.65639 49.74590 50.66864 49.96427 50.13922 48.70027
row5 51.09076 49.53203 51.38075 49.90149 48.29205 50.10417 50.49646 50.06223
        col17    col18    col19    col20
row1 49.89024 50.73548 50.23727 104.7068
row5 49.25113 49.67770 49.53267 104.8125
> tmp[,c("col6","col20")]
          col6     col20
row1 105.20924 104.70677
row2  75.31357  74.15149
row3  73.66915  73.67974
row4  75.05684  74.29409
row5 104.13158 104.81252
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.2092 104.7068
row5 104.1316 104.8125
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.2092 104.7068
row5 104.1316 104.8125
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
            col13
[1,]  1.520503372
[2,]  0.004979752
[3,] -0.432348120
[4,] -0.101264944
[5,] -0.710026282
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.5231836 -2.1531088
[2,] -0.5579404 -1.2932790
[3,]  0.4095041  0.6222233
[4,] -0.7178322  0.7674453
[5,]  0.2596517 -0.6491762
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.8671610  0.4604846
[2,]  1.2281539 -1.7185673
[3,]  0.4827324  1.6470272
[4,] -1.6444345 -2.6368303
[5,]  0.1413020  0.9915021
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 0.867161
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
         col6
[1,] 0.867161
[2,] 1.228154
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]     [,2]      [,3]       [,4]     [,5]       [,6]       [,7]
row3  1.4710035 1.306287 0.3094822  1.4994290 1.941492 -1.3215931  0.1337215
row1 -0.3213974 1.076793 0.6502030 -0.4547996 0.735751 -0.5590936 -0.3370374
           [,8]       [,9]     [,10]      [,11]      [,12]    [,13]     [,14]
row3 -0.1506534  1.9479795 0.3704457  0.2056059  0.9216758 -1.34236 0.8257642
row1 -0.4128162 -0.9485654 0.1096110 -0.1642196 -1.5309038 -0.64009 0.3607116
         [,15]      [,16]      [,17]     [,18]      [,19]     [,20]
row3  1.553648 2.14726629 -0.6898234 0.5273120  0.1642857  1.959788
row1 -1.677560 0.01157776  0.3847271 0.8158925 -0.1115331 -1.106290
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]      [,3]      [,4]       [,5]        [,6]       [,7]
row2 0.3930253 -0.981617 0.1804017 0.2871397 -0.3531202 0.008388901 -0.4846858
         [,8]       [,9]      [,10]
row2 2.076071 -0.2388618 -0.1535572
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]      [,3]       [,4]       [,5]       [,6]      [,7]
row5 0.9016184 1.789618 -1.200187 0.07103615 -0.1315169 0.03698302 0.3394691
          [,8]        [,9]     [,10]     [,11]     [,12]      [,13]      [,14]
row5 0.5437718 -0.09421897 0.6357107 -1.952386 -2.387514 0.02764645 -0.1053073
          [,15]     [,16]      [,17]      [,18]     [,19]    [,20]
row5 -0.1871945 -1.194181 -0.1311776 -0.2451842 0.2689185 1.611629
> 
> 
> 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: 0x00000000074c2d28>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f4115a1078"
 [2] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f477065192"
 [3] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f473e7845" 
 [4] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f474b72656"
 [5] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f48bf4777" 
 [6] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f47bd67ec2"
 [7] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f46d8a131" 
 [8] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f4366e1cad"
 [9] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f434d628a0"
[10] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f424924440"
[11] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f416717dd" 
[12] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f4324f39fc"
[13] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f46bce1e10"
[14] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f469df61fe"
[15] "C:/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests_x64\\BM11f4663e38db"
> 
> 
> ### 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: 0x0000000004fd11c8>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x0000000004fd11c8>
Warning message:
In dir.create(new.directory) :
  'C:\Users\biocbuild\bbs-3.9-bioc\meat\BufferedMatrix.Rcheck\tests_x64' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x0000000004fd11c8>
> rowMedians(tmp)
  [1] -0.0718086002  0.3854369575 -0.3742856934 -0.2400688737  0.5994829710
  [6]  0.0331623175 -0.3190214027 -0.2742244134  0.1812454530  0.2341492344
 [11] -0.1575958390 -0.4256069692 -0.4443331675  0.3564054009  0.0431795031
 [16]  0.4780247661 -0.4823307476  0.1338339819 -0.1573837661 -0.4738705576
 [21] -0.7133499967 -0.2994406581  0.2160447184 -0.2902666261  0.1673020518
 [26] -0.0942819121  0.0001720034  0.1532907813 -0.3261181345 -0.3852720223
 [31]  0.4750375508 -0.0705520068  0.1046483615  0.1300640907 -0.0124797188
 [36]  0.4657596034 -0.2953109679  0.4413972294 -0.3252247907 -0.2630029553
 [41]  0.5774958646 -0.5079936187 -0.1325010856  0.2352583476 -0.4120232799
 [46]  0.1281823811  0.2292079742  0.4853935074 -0.2670189289  0.2689464434
 [51] -0.2142118960  0.1370574994 -0.1185474142 -0.2750088381  0.0674711670
 [56]  0.8930944415  0.3645018445  0.4435438236 -0.2343393321 -0.4610460250
 [61]  0.2069052095  0.2575706647 -0.3715227044 -0.1017562034  0.4579777141
 [66]  0.0159452278  0.2924854540  0.0805796533 -0.2237209979  0.2007544245
 [71]  0.0307619476 -0.0785803799  0.2750236962 -0.0562663185 -0.0339521190
 [76] -0.0333545557  0.1385248405  0.1705893607  0.1103406639  0.1280403975
 [81]  0.2757923562 -0.5917360376 -0.6895683147  0.0588276529  0.5885284091
 [86] -0.0770755811 -0.3937694263 -0.5265573065  0.4049529106  0.1390670175
 [91]  0.1306785166  0.3249684714 -0.2685331096  0.5206662386  0.5713929127
 [96]  0.6321626617 -0.3835001752 -0.2144579057 -0.2357520028  0.0967701472
[101]  0.2156127763  0.4809361623  0.2734774641  0.1644533742 -0.0511736642
[106] -0.2019815378  0.1310072284  0.3893562291  0.1231978185 -0.5632477981
[111]  0.4253713128 -0.1211116277 -0.2466261529 -0.1228636220 -0.3817084256
[116] -0.1656962429 -0.5875223347 -0.2713522610 -0.0432460973  0.6465061592
[121]  0.4082032224  0.0563936049 -0.2179439609 -0.3018575459 -0.6344409821
[126]  0.0507065452 -0.4004891542  0.1389421105 -0.1958996298 -0.0334556992
[131]  0.3004312068 -0.1595548288 -0.2512497631  0.0250432105 -0.2402871212
[136]  0.5926109077 -0.0799556578  0.0427399890  0.2221653470  0.0033113089
[141] -0.0306654024 -0.1959535435 -0.1181495692 -0.2468822082 -0.4073766707
[146]  0.7309705819 -0.1206581856 -0.6341606474  0.2486482647  0.1670731737
[151]  0.1642012047 -0.2199149739 -0.1679093680 -0.3215848718 -0.1390147399
[156] -0.0952574845 -0.1975420481  0.1488703863 -0.2953607074 -0.1080439023
[161]  0.5409310239 -0.5081841475 -0.0964405155  0.0636506935  0.2526425122
[166] -0.1338040386 -0.0687319756 -0.2030083551  0.3392355278  0.1689652830
[171]  0.1850976466  0.0646162602  0.0731513333  0.4583257958  0.0068305778
[176]  0.1123532983 -0.3492039058  0.1973010991 -0.4998982936  0.2233414745
[181] -0.0760959466 -0.1148108448  0.0859004261  0.1935990669  0.0566645280
[186]  0.8960987797  0.4221550787  0.5557057010 -0.2672877672  0.5483677197
[191]  0.0841750057  0.0240789408  0.0282813283  0.0215825152  0.5911561901
[196] -0.4981033155 -0.2684458888  0.2984264043 -0.0261557951  0.5716023477
[201]  0.0665841552 -0.2406182802 -0.2603783049  0.6260753625 -0.7337221202
[206] -0.0047936361  0.4513942142 -0.2509063580  0.2361718563 -0.3512433245
[211]  0.2761897468  0.2988709728 -0.1716677790 -0.3267964183 -0.1977769383
[216]  0.1343576118  0.4757339262  0.6298101235  0.5479549927 -0.3066013696
[221]  0.2064564758 -0.3373723176  0.0567751084 -0.1150978648  0.0222407162
[226] -0.6546676163  0.2580776196 -0.0617193160  0.2471764999  0.1208594637
> 
> proc.time()
   user  system elapsed 
   3.51    8.12   12.03 

BufferedMatrix.Rcheck/tests_i386/rawCalltesting.Rout


R Under development (unstable) (2019-03-09 r76216) -- "Unsuffered Consequences"
Copyright (C) 2019 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: 0x029c2820>
> .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: 0x029c2820>
> .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: 0x029c2820>
> .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: 0x029c2820>
> 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: 0x029a3200>
> .Call("R_bm_AddColumn",P)
<pointer: 0x029a3200>
> .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: 0x029a3200>
> .Call("R_bm_AddColumn",P)
<pointer: 0x029a3200>
> .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: 0x029a3200>
> 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: 0x038ac648>
> .Call("R_bm_AddColumn",P)
<pointer: 0x038ac648>
> .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: 0x038ac648>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x038ac648>
> .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: 0x038ac648>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x038ac648>
> .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: 0x038ac648>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x038ac648>
> .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: 0x038ac648>
> 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: 0x0276f820>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0276f820>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0276f820>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0276f820>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1bc023aa4f87" "BufferedMatrixFile1bc051fa6fcb"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1bc023aa4f87" "BufferedMatrixFile1bc051fa6fcb"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x027a3510>
> .Call("R_bm_AddColumn",P)
<pointer: 0x027a3510>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x027a3510>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x027a3510>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x027a3510>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x027a3510>
> .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: 0x028b4450>
> .Call("R_bm_AddColumn",P)
<pointer: 0x028b4450>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x028b4450>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x028b4450>
> 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: 0x02a43938>
> .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: 0x02a43938>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.48    0.09    0.56 

BufferedMatrix.Rcheck/tests_x64/rawCalltesting.Rout


R Under development (unstable) (2019-03-09 r76216) -- "Unsuffered Consequences"
Copyright (C) 2019 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: 0x0000000006066d38>
> .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: 0x0000000006066d38>
> .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: 0x0000000006066d38>
> .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: 0x0000000006066d38>
> 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: 0x0000000007962cc8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007962cc8>
> .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: 0x0000000007962cc8>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000007962cc8>
> .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: 0x0000000007962cc8>
> 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: 0x0000000005090028>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005090028>
> .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: 0x0000000005090028>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000000005090028>
> .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: 0x0000000005090028>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005090028>
> .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: 0x0000000005090028>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005090028>
> .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: 0x0000000005090028>
> 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: 0x00000000052418b0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x00000000052418b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000052418b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000052418b0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilec703b534b93" "BufferedMatrixFilec70e7d18a0" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilec703b534b93" "BufferedMatrixFilec70e7d18a0" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005b8d4a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000000005b8d4a0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005b8d4a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000000005b8d4a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000000005b8d4a0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000000005b8d4a0>
> .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: 0x00000000075213a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x00000000075213a0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x00000000075213a0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x00000000075213a0>
> 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: 0x00000000074a8908>
> .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: 0x00000000074a8908>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.46    0.09    0.54 

BufferedMatrix.Rcheck/tests_i386/Rcodetesting.Rout


R Under development (unstable) (2019-03-09 r76216) -- "Unsuffered Consequences"
Copyright (C) 2019 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.34    0.04    0.37 

BufferedMatrix.Rcheck/tests_x64/Rcodetesting.Rout


R Under development (unstable) (2019-03-09 r76216) -- "Unsuffered Consequences"
Copyright (C) 2019 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.46    0.06    0.51 

Example timings