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

CHECK report for BufferedMatrix on merida2

This page was generated on 2019-04-09 13:23:42 -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: /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Versions/Current/Resources/library --no-vignettes --timings BufferedMatrix_1.47.0.tar.gz
StartedAt: 2019-04-08 23:36:41 -0400 (Mon, 08 Apr 2019)
EndedAt: 2019-04-08 23:37:25 -0400 (Mon, 08 Apr 2019)
EllapsedTime: 43.3 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2018-11-27 r75683)
* using platform: x86_64-apple-darwin15.6.0 (64-bit)
* using session charset: UTF-8
* 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 for sufficient/correct file permissions ... 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
* 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 is not available
* checking sizes of PDF files under ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes 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
  ‘/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ˜
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c init_package.c -o init_package.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.6/Resources/library/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R Under development (unstable) (2018-11-27 r75683) -- "Unsuffered Consequences"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.425   0.111   0.506 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2018-11-27 r75683) -- "Unsuffered Consequences"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
Ncells 413935 22.2     873778 46.7         NA   617785 33.0
Vcells 743535  5.7    8388608 64.0      65536  1814644 13.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Apr  8 23:37:03 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] "Mon Apr  8 23:37:03 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: 0x7f8924f31660>
> 
> 
> 
> 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] "Mon Apr  8 23:37:06 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] "Mon Apr  8 23:37:06 2019"
> 
> ColMode(tmp2)
<pointer: 0x7f8924f31660>
> 
> 
> 
> ### 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.4418130 0.7749462  1.7270268 -0.7309753
[2,]   0.4111563 2.0999978 -1.1393420  0.3819790
[3,]   0.4092103 0.1503174 -1.5758043  1.6999574
[4,]   0.2916226 1.9990947 -0.1282571 -0.2058364
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 100.4418130 0.7749462 1.7270268 0.7309753
[2,]   0.4111563 2.0999978 1.1393420 0.3819790
[3,]   0.4092103 0.1503174 1.5758043 1.6999574
[4,]   0.2916226 1.9990947 0.1282571 0.2058364
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]     [,3]      [,4]
[1,] 10.0220663 0.8803103 1.314164 0.8549709
[2,]  0.6412147 1.4491369 1.067400 0.6180445
[3,]  0.6396955 0.3877079 1.255310 1.3038241
[4,]  0.5400209 1.4138935 0.358130 0.4536919
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.66248 34.57805 39.86867 34.28068
[2,]  31.82330 41.59137 36.81334 31.56242
[3,]  31.80617 29.02740 39.12891 39.73820
[4,]  30.69183 41.13803 28.70956 29.74276
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7f892f10c5b0>
> exp(tmp5)
<pointer: 0x7f892f10c5b0>
> log(tmp5,2)
<pointer: 0x7f892f10c5b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.6869
> Min(tmp5)
[1] 54.19513
> mean(tmp5)
[1] 72.90323
> Sum(tmp5)
[1] 14580.65
> Var(tmp5)
[1] 849.0578
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.01564 72.74223 69.60116 70.10906 68.40834 70.98576 69.11489 71.30333
 [9] 73.67817 71.07367
> rowSums(tmp5)
 [1] 1840.313 1454.845 1392.023 1402.181 1368.167 1419.715 1382.298 1426.067
 [9] 1473.563 1421.473
> rowVars(tmp5)
 [1] 7994.29977   59.73964   49.80178   66.25200   57.57659   52.24282
 [7]   38.72702   36.08519   41.19795   45.51270
> rowSd(tmp5)
 [1] 89.410848  7.729142  7.057038  8.139533  7.587924  7.227919  6.223104
 [8]  6.007095  6.418563  6.746310
> rowMax(tmp5)
 [1] 469.68688  86.56698  82.70985  85.62342  86.15114  81.27084  85.91405
 [8]  80.59460  87.85096  86.05036
> rowMin(tmp5)
 [1] 54.26042 61.87669 59.89257 59.75518 54.19513 56.28150 56.38669 59.17862
 [9] 61.98525 61.60020
> 
> colMeans(tmp5)
 [1] 108.06520  75.45394  70.52420  68.93971  70.57525  70.83964  70.12528
 [8]  75.28683  69.53216  74.47129  70.50568  71.36073  69.94721  72.28243
[15]  68.69396  70.40601  66.90538  72.15751  71.50516  70.48696
> colSums(tmp5)
 [1] 1080.6520  754.5394  705.2420  689.3971  705.7525  708.3964  701.2528
 [8]  752.8683  695.3216  744.7129  705.0568  713.6073  699.4721  722.8243
[15]  686.9396  704.0601  669.0538  721.5751  715.0516  704.8696
> colVars(tmp5)
 [1] 16150.07084    56.51100    61.30370    88.02951    44.30641    78.18925
 [7]    21.71967    30.57213    94.06265    38.57468    83.73186    67.10916
[13]    25.97497    40.89930    59.10019    31.93168    61.32268    79.51014
[19]    70.63129    49.31834
> colSd(tmp5)
 [1] 127.082929   7.517380   7.829668   9.382404   6.656306   8.842468
 [7]   4.660437   5.529207   9.698590   6.210852   9.150511   8.192018
[13]   5.096564   6.395256   7.687665   5.650812   7.830880   8.916846
[19]   8.404242   7.022702
> colMax(tmp5)
 [1] 469.68688  86.56698  82.98140  82.70985  78.27728  87.85096  74.46983
 [8]  81.76643  86.15114  84.37214  85.91405  85.40917  80.13591  81.55796
[15]  81.27084  79.26235  80.13681  86.49559  86.05036  84.21809
> colMin(tmp5)
 [1] 63.88103 60.41672 59.75518 54.19513 56.38669 57.99019 60.86463 64.20413
 [9] 55.98345 65.47710 61.04256 59.17862 63.82455 62.98914 54.26042 61.66364
[17] 55.46596 56.28150 59.48263 61.60020
> 
> 
> ### 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] 92.01564 72.74223 69.60116 70.10906 68.40834 70.98576 69.11489       NA
 [9] 73.67817 71.07367
> rowSums(tmp5)
 [1] 1840.313 1454.845 1392.023 1402.181 1368.167 1419.715 1382.298       NA
 [9] 1473.563 1421.473
> rowVars(tmp5)
 [1] 7994.29977   59.73964   49.80178   66.25200   57.57659   52.24282
 [7]   38.72702   37.80132   41.19795   45.51270
> rowSd(tmp5)
 [1] 89.410848  7.729142  7.057038  8.139533  7.587924  7.227919  6.223104
 [8]  6.148278  6.418563  6.746310
> rowMax(tmp5)
 [1] 469.68688  86.56698  82.70985  85.62342  86.15114  81.27084  85.91405
 [8]        NA  87.85096  86.05036
> rowMin(tmp5)
 [1] 54.26042 61.87669 59.89257 59.75518 54.19513 56.28150 56.38669       NA
 [9] 61.98525 61.60020
> 
> colMeans(tmp5)
 [1] 108.06520  75.45394  70.52420  68.93971  70.57525  70.83964  70.12528
 [8]  75.28683  69.53216  74.47129  70.50568  71.36073  69.94721  72.28243
[15]        NA  70.40601  66.90538  72.15751  71.50516  70.48696
> colSums(tmp5)
 [1] 1080.6520  754.5394  705.2420  689.3971  705.7525  708.3964  701.2528
 [8]  752.8683  695.3216  744.7129  705.0568  713.6073  699.4721  722.8243
[15]        NA  704.0601  669.0538  721.5751  715.0516  704.8696
> colVars(tmp5)
 [1] 16150.07084    56.51100    61.30370    88.02951    44.30641    78.18925
 [7]    21.71967    30.57213    94.06265    38.57468    83.73186    67.10916
[13]    25.97497    40.89930          NA    31.93168    61.32268    79.51014
[19]    70.63129    49.31834
> colSd(tmp5)
 [1] 127.082929   7.517380   7.829668   9.382404   6.656306   8.842468
 [7]   4.660437   5.529207   9.698590   6.210852   9.150511   8.192018
[13]   5.096564   6.395256         NA   5.650812   7.830880   8.916846
[19]   8.404242   7.022702
> colMax(tmp5)
 [1] 469.68688  86.56698  82.98140  82.70985  78.27728  87.85096  74.46983
 [8]  81.76643  86.15114  84.37214  85.91405  85.40917  80.13591  81.55796
[15]        NA  79.26235  80.13681  86.49559  86.05036  84.21809
> colMin(tmp5)
 [1] 63.88103 60.41672 59.75518 54.19513 56.38669 57.99019 60.86463 64.20413
 [9] 55.98345 65.47710 61.04256 59.17862 63.82455 62.98914       NA 61.66364
[17] 55.46596 56.28150 59.48263 61.60020
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.6869
> Min(tmp5,na.rm=TRUE)
[1] 54.19513
> mean(tmp5,na.rm=TRUE)
[1] 72.92243
> Sum(tmp5,na.rm=TRUE)
[1] 14511.56
> Var(tmp5,na.rm=TRUE)
[1] 853.2718
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.01564 72.74223 69.60116 70.10906 68.40834 70.98576 69.11489 71.42025
 [9] 73.67817 71.07367
> rowSums(tmp5,na.rm=TRUE)
 [1] 1840.313 1454.845 1392.023 1402.181 1368.167 1419.715 1382.298 1356.985
 [9] 1473.563 1421.473
> rowVars(tmp5,na.rm=TRUE)
 [1] 7994.29977   59.73964   49.80178   66.25200   57.57659   52.24282
 [7]   38.72702   37.80132   41.19795   45.51270
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.410848  7.729142  7.057038  8.139533  7.587924  7.227919  6.223104
 [8]  6.148278  6.418563  6.746310
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.68688  86.56698  82.70985  85.62342  86.15114  81.27084  85.91405
 [8]  80.59460  87.85096  86.05036
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.26042 61.87669 59.89257 59.75518 54.19513 56.28150 56.38669 59.17862
 [9] 61.98525 61.60020
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 108.06520  75.45394  70.52420  68.93971  70.57525  70.83964  70.12528
 [8]  75.28683  69.53216  74.47129  70.50568  71.36073  69.94721  72.28243
[15]  68.65086  70.40601  66.90538  72.15751  71.50516  70.48696
> colSums(tmp5,na.rm=TRUE)
 [1] 1080.6520  754.5394  705.2420  689.3971  705.7525  708.3964  701.2528
 [8]  752.8683  695.3216  744.7129  705.0568  713.6073  699.4721  722.8243
[15]  617.8577  704.0601  669.0538  721.5751  715.0516  704.8696
> colVars(tmp5,na.rm=TRUE)
 [1] 16150.07084    56.51100    61.30370    88.02951    44.30641    78.18925
 [7]    21.71967    30.57213    94.06265    38.57468    83.73186    67.10916
[13]    25.97497    40.89930    66.46681    31.93168    61.32268    79.51014
[19]    70.63129    49.31834
> colSd(tmp5,na.rm=TRUE)
 [1] 127.082929   7.517380   7.829668   9.382404   6.656306   8.842468
 [7]   4.660437   5.529207   9.698590   6.210852   9.150511   8.192018
[13]   5.096564   6.395256   8.152718   5.650812   7.830880   8.916846
[19]   8.404242   7.022702
> colMax(tmp5,na.rm=TRUE)
 [1] 469.68688  86.56698  82.98140  82.70985  78.27728  87.85096  74.46983
 [8]  81.76643  86.15114  84.37214  85.91405  85.40917  80.13591  81.55796
[15]  81.27084  79.26235  80.13681  86.49559  86.05036  84.21809
> colMin(tmp5,na.rm=TRUE)
 [1] 63.88103 60.41672 59.75518 54.19513 56.38669 57.99019 60.86463 64.20413
 [9] 55.98345 65.47710 61.04256 59.17862 63.82455 62.98914 54.26042 61.66364
[17] 55.46596 56.28150 59.48263 61.60020
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.01564 72.74223 69.60116 70.10906 68.40834 70.98576 69.11489      NaN
 [9] 73.67817 71.07367
> rowSums(tmp5,na.rm=TRUE)
 [1] 1840.313 1454.845 1392.023 1402.181 1368.167 1419.715 1382.298    0.000
 [9] 1473.563 1421.473
> rowVars(tmp5,na.rm=TRUE)
 [1] 7994.29977   59.73964   49.80178   66.25200   57.57659   52.24282
 [7]   38.72702         NA   41.19795   45.51270
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.410848  7.729142  7.057038  8.139533  7.587924  7.227919  6.223104
 [8]        NA  6.418563  6.746310
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.68688  86.56698  82.70985  85.62342  86.15114  81.27084  85.91405
 [8]        NA  87.85096  86.05036
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.26042 61.87669 59.89257 59.75518 54.19513 56.28150 56.38669       NA
 [9] 61.98525 61.60020
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.21430  75.51407  70.78854  68.00357  69.71971  71.19543  71.15424
 [8]  75.40307  68.30300  75.02898  71.31274  72.71430  70.25360  71.61309
[15]       NaN  70.18160  66.81558  71.61067  71.05759  70.08491
> colSums(tmp5,na.rm=TRUE)
 [1] 1009.9287  679.6266  637.0968  612.0321  627.4774  640.7589  640.3882
 [8]  678.6277  614.7270  675.2608  641.8147  654.4287  632.2824  644.5178
[15]    0.0000  631.6344  601.3402  644.4960  639.5183  630.7642
> colVars(tmp5,na.rm=TRUE)
 [1] 17975.16081    63.53420    68.18059    89.17426    41.61023    86.53884
 [7]    12.52357    34.24163    88.82359    39.89756    86.87053    54.88617
[13]    28.16575    40.97148          NA    35.35660    68.89730    86.08478
[19]    77.20657    53.66462
> colSd(tmp5,na.rm=TRUE)
 [1] 134.071476   7.970834   8.257154   9.443212   6.450599   9.302625
 [7]   3.538866   5.851635   9.424627   6.316452   9.320436   7.408520
[13]   5.307141   6.400897         NA   5.946142   8.300440   9.278188
[19]   8.786727   7.325614
> colMax(tmp5,na.rm=TRUE)
 [1] 469.68688  86.56698  82.98140  82.70985  78.27728  87.85096  74.46983
 [8]  81.76643  86.15114  84.37214  85.91405  85.40917  80.13591  81.55796
[15]      -Inf  79.26235  80.13681  86.49559  86.05036  84.21809
> colMin(tmp5,na.rm=TRUE)
 [1] 63.88103 60.41672 59.75518 54.19513 56.38669 57.99019 64.67742 64.20413
 [9] 55.98345 65.47710 61.04256 63.93780 63.82455 62.98914      Inf 61.66364
[17] 55.46596 56.28150 59.48263 61.60020
> 
> 
> 
> 
> 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] 305.6357 389.0573 297.3821 190.1299 103.8058 242.2817 161.3228 356.5037
 [9] 241.3062 288.0597
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 305.6357 389.0573 297.3821 190.1299 103.8058 242.2817 161.3228 356.5037
 [9] 241.3062 288.0597
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14  1.421085e-14  2.842171e-14 -1.136868e-13  1.136868e-13
 [6]  2.842171e-14  2.273737e-13 -1.421085e-14  0.000000e+00  5.684342e-14
[11] -5.684342e-14 -1.705303e-13 -8.526513e-14  0.000000e+00 -1.989520e-13
[16] -1.989520e-13  0.000000e+00 -3.979039e-13 -1.705303e-13  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
8   8 
3   2 
2   19 
1   14 
10   12 
1   20 
7   14 
10   13 
3   7 
4   7 
2   2 
3   1 
8   18 
8   19 
4   8 
6   11 
4   7 
5   9 
7   15 
6   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.647727
> Min(tmp)
[1] -2.497764
> mean(tmp)
[1] -0.05611939
> Sum(tmp)
[1] -5.611939
> Var(tmp)
[1] 0.8649517
> 
> rowMeans(tmp)
[1] -0.05611939
> rowSums(tmp)
[1] -5.611939
> rowVars(tmp)
[1] 0.8649517
> rowSd(tmp)
[1] 0.9300278
> rowMax(tmp)
[1] 2.647727
> rowMin(tmp)
[1] -2.497764
> 
> colMeans(tmp)
  [1]  0.70133725 -0.40777132 -1.00429177 -0.71841388 -0.23480816 -0.60110739
  [7] -0.75615540  0.03508690 -0.81905116 -0.26554019 -0.74958639  1.22188619
 [13] -2.01598616 -0.07043171  0.23087320 -1.07518723  0.82389795  0.48882480
 [19] -1.42175392 -1.45136314  0.65836116  0.34763442 -0.51645758  0.66419349
 [25]  1.16347497 -0.64533148 -0.29292196  0.40264835  1.84893584 -0.13208826
 [31] -0.58691205  0.14596012  0.13874365 -0.19784475  2.28322894 -0.99319935
 [37]  0.75542828 -0.77961190 -0.94110360 -0.59015243  1.42999932  0.12534867
 [43] -2.49776411 -0.31083395 -1.38134889 -0.28667093 -0.79335802  1.38502112
 [49] -1.17477560  0.50735826 -0.27893814 -0.26388719  0.92112833  0.38280958
 [55]  0.56534283  0.62662336 -1.31627608  0.67478536  1.24829064 -1.54457288
 [61]  2.64772710  0.25054993 -1.42423789  0.87557579  0.40552404  0.56780320
 [67]  0.22701034  0.86242933 -1.68821900  0.64560396 -1.37365753 -1.00306902
 [73] -0.96340390  0.40284726 -0.04765508  0.35325328 -0.55010582  0.93281848
 [79] -0.48187830 -0.99082908  0.13990715 -0.56649240 -0.68614305 -0.36997213
 [85] -0.37066533  0.42015915 -0.16244483 -0.44482210  0.03347511  0.32228035
 [91]  0.52784558 -0.26022682  0.34611891  0.89249853  0.09755376 -0.46028252
 [97]  1.34313779  0.02859431 -0.92025774  2.16798467
> colSums(tmp)
  [1]  0.70133725 -0.40777132 -1.00429177 -0.71841388 -0.23480816 -0.60110739
  [7] -0.75615540  0.03508690 -0.81905116 -0.26554019 -0.74958639  1.22188619
 [13] -2.01598616 -0.07043171  0.23087320 -1.07518723  0.82389795  0.48882480
 [19] -1.42175392 -1.45136314  0.65836116  0.34763442 -0.51645758  0.66419349
 [25]  1.16347497 -0.64533148 -0.29292196  0.40264835  1.84893584 -0.13208826
 [31] -0.58691205  0.14596012  0.13874365 -0.19784475  2.28322894 -0.99319935
 [37]  0.75542828 -0.77961190 -0.94110360 -0.59015243  1.42999932  0.12534867
 [43] -2.49776411 -0.31083395 -1.38134889 -0.28667093 -0.79335802  1.38502112
 [49] -1.17477560  0.50735826 -0.27893814 -0.26388719  0.92112833  0.38280958
 [55]  0.56534283  0.62662336 -1.31627608  0.67478536  1.24829064 -1.54457288
 [61]  2.64772710  0.25054993 -1.42423789  0.87557579  0.40552404  0.56780320
 [67]  0.22701034  0.86242933 -1.68821900  0.64560396 -1.37365753 -1.00306902
 [73] -0.96340390  0.40284726 -0.04765508  0.35325328 -0.55010582  0.93281848
 [79] -0.48187830 -0.99082908  0.13990715 -0.56649240 -0.68614305 -0.36997213
 [85] -0.37066533  0.42015915 -0.16244483 -0.44482210  0.03347511  0.32228035
 [91]  0.52784558 -0.26022682  0.34611891  0.89249853  0.09755376 -0.46028252
 [97]  1.34313779  0.02859431 -0.92025774  2.16798467
> 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.70133725 -0.40777132 -1.00429177 -0.71841388 -0.23480816 -0.60110739
  [7] -0.75615540  0.03508690 -0.81905116 -0.26554019 -0.74958639  1.22188619
 [13] -2.01598616 -0.07043171  0.23087320 -1.07518723  0.82389795  0.48882480
 [19] -1.42175392 -1.45136314  0.65836116  0.34763442 -0.51645758  0.66419349
 [25]  1.16347497 -0.64533148 -0.29292196  0.40264835  1.84893584 -0.13208826
 [31] -0.58691205  0.14596012  0.13874365 -0.19784475  2.28322894 -0.99319935
 [37]  0.75542828 -0.77961190 -0.94110360 -0.59015243  1.42999932  0.12534867
 [43] -2.49776411 -0.31083395 -1.38134889 -0.28667093 -0.79335802  1.38502112
 [49] -1.17477560  0.50735826 -0.27893814 -0.26388719  0.92112833  0.38280958
 [55]  0.56534283  0.62662336 -1.31627608  0.67478536  1.24829064 -1.54457288
 [61]  2.64772710  0.25054993 -1.42423789  0.87557579  0.40552404  0.56780320
 [67]  0.22701034  0.86242933 -1.68821900  0.64560396 -1.37365753 -1.00306902
 [73] -0.96340390  0.40284726 -0.04765508  0.35325328 -0.55010582  0.93281848
 [79] -0.48187830 -0.99082908  0.13990715 -0.56649240 -0.68614305 -0.36997213
 [85] -0.37066533  0.42015915 -0.16244483 -0.44482210  0.03347511  0.32228035
 [91]  0.52784558 -0.26022682  0.34611891  0.89249853  0.09755376 -0.46028252
 [97]  1.34313779  0.02859431 -0.92025774  2.16798467
> colMin(tmp)
  [1]  0.70133725 -0.40777132 -1.00429177 -0.71841388 -0.23480816 -0.60110739
  [7] -0.75615540  0.03508690 -0.81905116 -0.26554019 -0.74958639  1.22188619
 [13] -2.01598616 -0.07043171  0.23087320 -1.07518723  0.82389795  0.48882480
 [19] -1.42175392 -1.45136314  0.65836116  0.34763442 -0.51645758  0.66419349
 [25]  1.16347497 -0.64533148 -0.29292196  0.40264835  1.84893584 -0.13208826
 [31] -0.58691205  0.14596012  0.13874365 -0.19784475  2.28322894 -0.99319935
 [37]  0.75542828 -0.77961190 -0.94110360 -0.59015243  1.42999932  0.12534867
 [43] -2.49776411 -0.31083395 -1.38134889 -0.28667093 -0.79335802  1.38502112
 [49] -1.17477560  0.50735826 -0.27893814 -0.26388719  0.92112833  0.38280958
 [55]  0.56534283  0.62662336 -1.31627608  0.67478536  1.24829064 -1.54457288
 [61]  2.64772710  0.25054993 -1.42423789  0.87557579  0.40552404  0.56780320
 [67]  0.22701034  0.86242933 -1.68821900  0.64560396 -1.37365753 -1.00306902
 [73] -0.96340390  0.40284726 -0.04765508  0.35325328 -0.55010582  0.93281848
 [79] -0.48187830 -0.99082908  0.13990715 -0.56649240 -0.68614305 -0.36997213
 [85] -0.37066533  0.42015915 -0.16244483 -0.44482210  0.03347511  0.32228035
 [91]  0.52784558 -0.26022682  0.34611891  0.89249853  0.09755376 -0.46028252
 [97]  1.34313779  0.02859431 -0.92025774  2.16798467
> colMedians(tmp)
  [1]  0.70133725 -0.40777132 -1.00429177 -0.71841388 -0.23480816 -0.60110739
  [7] -0.75615540  0.03508690 -0.81905116 -0.26554019 -0.74958639  1.22188619
 [13] -2.01598616 -0.07043171  0.23087320 -1.07518723  0.82389795  0.48882480
 [19] -1.42175392 -1.45136314  0.65836116  0.34763442 -0.51645758  0.66419349
 [25]  1.16347497 -0.64533148 -0.29292196  0.40264835  1.84893584 -0.13208826
 [31] -0.58691205  0.14596012  0.13874365 -0.19784475  2.28322894 -0.99319935
 [37]  0.75542828 -0.77961190 -0.94110360 -0.59015243  1.42999932  0.12534867
 [43] -2.49776411 -0.31083395 -1.38134889 -0.28667093 -0.79335802  1.38502112
 [49] -1.17477560  0.50735826 -0.27893814 -0.26388719  0.92112833  0.38280958
 [55]  0.56534283  0.62662336 -1.31627608  0.67478536  1.24829064 -1.54457288
 [61]  2.64772710  0.25054993 -1.42423789  0.87557579  0.40552404  0.56780320
 [67]  0.22701034  0.86242933 -1.68821900  0.64560396 -1.37365753 -1.00306902
 [73] -0.96340390  0.40284726 -0.04765508  0.35325328 -0.55010582  0.93281848
 [79] -0.48187830 -0.99082908  0.13990715 -0.56649240 -0.68614305 -0.36997213
 [85] -0.37066533  0.42015915 -0.16244483 -0.44482210  0.03347511  0.32228035
 [91]  0.52784558 -0.26022682  0.34611891  0.89249853  0.09755376 -0.46028252
 [97]  1.34313779  0.02859431 -0.92025774  2.16798467
> colRanges(tmp)
          [,1]       [,2]      [,3]       [,4]       [,5]       [,6]       [,7]
[1,] 0.7013372 -0.4077713 -1.004292 -0.7184139 -0.2348082 -0.6011074 -0.7561554
[2,] 0.7013372 -0.4077713 -1.004292 -0.7184139 -0.2348082 -0.6011074 -0.7561554
          [,8]       [,9]      [,10]      [,11]    [,12]     [,13]       [,14]
[1,] 0.0350869 -0.8190512 -0.2655402 -0.7495864 1.221886 -2.015986 -0.07043171
[2,] 0.0350869 -0.8190512 -0.2655402 -0.7495864 1.221886 -2.015986 -0.07043171
         [,15]     [,16]    [,17]     [,18]     [,19]     [,20]     [,21]
[1,] 0.2308732 -1.075187 0.823898 0.4888248 -1.421754 -1.451363 0.6583612
[2,] 0.2308732 -1.075187 0.823898 0.4888248 -1.421754 -1.451363 0.6583612
         [,22]      [,23]     [,24]    [,25]      [,26]     [,27]     [,28]
[1,] 0.3476344 -0.5164576 0.6641935 1.163475 -0.6453315 -0.292922 0.4026483
[2,] 0.3476344 -0.5164576 0.6641935 1.163475 -0.6453315 -0.292922 0.4026483
        [,29]      [,30]      [,31]     [,32]     [,33]      [,34]    [,35]
[1,] 1.848936 -0.1320883 -0.5869121 0.1459601 0.1387436 -0.1978447 2.283229
[2,] 1.848936 -0.1320883 -0.5869121 0.1459601 0.1387436 -0.1978447 2.283229
          [,36]     [,37]      [,38]      [,39]      [,40]    [,41]     [,42]
[1,] -0.9931993 0.7554283 -0.7796119 -0.9411036 -0.5901524 1.429999 0.1253487
[2,] -0.9931993 0.7554283 -0.7796119 -0.9411036 -0.5901524 1.429999 0.1253487
         [,43]      [,44]     [,45]      [,46]     [,47]    [,48]     [,49]
[1,] -2.497764 -0.3108339 -1.381349 -0.2866709 -0.793358 1.385021 -1.174776
[2,] -2.497764 -0.3108339 -1.381349 -0.2866709 -0.793358 1.385021 -1.174776
         [,50]      [,51]      [,52]     [,53]     [,54]     [,55]     [,56]
[1,] 0.5073583 -0.2789381 -0.2638872 0.9211283 0.3828096 0.5653428 0.6266234
[2,] 0.5073583 -0.2789381 -0.2638872 0.9211283 0.3828096 0.5653428 0.6266234
         [,57]     [,58]    [,59]     [,60]    [,61]     [,62]     [,63]
[1,] -1.316276 0.6747854 1.248291 -1.544573 2.647727 0.2505499 -1.424238
[2,] -1.316276 0.6747854 1.248291 -1.544573 2.647727 0.2505499 -1.424238
         [,64]    [,65]     [,66]     [,67]     [,68]     [,69]    [,70]
[1,] 0.8755758 0.405524 0.5678032 0.2270103 0.8624293 -1.688219 0.645604
[2,] 0.8755758 0.405524 0.5678032 0.2270103 0.8624293 -1.688219 0.645604
         [,71]     [,72]      [,73]     [,74]       [,75]     [,76]      [,77]
[1,] -1.373658 -1.003069 -0.9634039 0.4028473 -0.04765508 0.3532533 -0.5501058
[2,] -1.373658 -1.003069 -0.9634039 0.4028473 -0.04765508 0.3532533 -0.5501058
         [,78]      [,79]      [,80]     [,81]      [,82]      [,83]      [,84]
[1,] 0.9328185 -0.4818783 -0.9908291 0.1399072 -0.5664924 -0.6861431 -0.3699721
[2,] 0.9328185 -0.4818783 -0.9908291 0.1399072 -0.5664924 -0.6861431 -0.3699721
          [,85]     [,86]      [,87]      [,88]      [,89]     [,90]     [,91]
[1,] -0.3706653 0.4201592 -0.1624448 -0.4448221 0.03347511 0.3222803 0.5278456
[2,] -0.3706653 0.4201592 -0.1624448 -0.4448221 0.03347511 0.3222803 0.5278456
          [,92]     [,93]     [,94]      [,95]      [,96]    [,97]      [,98]
[1,] -0.2602268 0.3461189 0.8924985 0.09755376 -0.4602825 1.343138 0.02859431
[2,] -0.2602268 0.3461189 0.8924985 0.09755376 -0.4602825 1.343138 0.02859431
          [,99]   [,100]
[1,] -0.9202577 2.167985
[2,] -0.9202577 2.167985
> 
> 
> Max(tmp2)
[1] 2.203208
> Min(tmp2)
[1] -1.989466
> mean(tmp2)
[1] -0.1045287
> Sum(tmp2)
[1] -10.45287
> Var(tmp2)
[1] 0.7616532
> 
> rowMeans(tmp2)
  [1] -1.246119346 -0.538502553  0.848156578  0.392506646 -0.181517739
  [6] -0.437539817 -0.299053489 -0.951381088 -0.539692003 -0.209918984
 [11] -0.263471382 -0.558312310 -1.167676136 -0.491709893 -0.348903028
 [16] -1.086709481  0.564072777  0.133258377 -0.478832120  0.800783753
 [21] -0.078233757  0.618079753 -1.058892189  0.444263089 -0.611559712
 [26] -0.645604008 -0.447428950  0.847336223  1.524109137 -0.845954152
 [31] -0.051143692  1.001767778  0.318390988 -0.489215849  0.322579533
 [36]  1.229758657 -1.989466070 -0.732554010  0.212623980 -0.360735419
 [41]  0.890532053 -0.506608797 -0.611297458 -0.990211480  2.203208192
 [46] -1.307079536 -0.410754290 -0.864232132 -0.063980158 -0.364133690
 [51] -0.096725554  0.374084813  0.107064382  1.435587224 -0.760048230
 [56] -1.943224989  0.267564292  0.098488502 -1.077809701 -1.391920732
 [61] -1.892234148  0.329318942  0.007681211  0.949428115 -0.936186506
 [66] -0.413450122 -1.184284759 -1.177488768  0.368647003 -0.519957743
 [71] -0.710070673  1.403705863  1.649180804  0.426829578 -0.029215974
 [76]  1.243112816  1.938985399 -0.553624034  1.439304313 -1.391468320
 [81]  0.178501031  0.218723813 -0.604705045 -0.118855718 -0.019810092
 [86] -0.781758410 -0.324030586 -0.714407427  0.701071365  1.298079353
 [91] -1.038014180  0.872405426  0.351210810  0.783905223  1.048369836
 [96]  0.361407387  0.252018474  0.136969465 -1.091408661 -1.046814373
> rowSums(tmp2)
  [1] -1.246119346 -0.538502553  0.848156578  0.392506646 -0.181517739
  [6] -0.437539817 -0.299053489 -0.951381088 -0.539692003 -0.209918984
 [11] -0.263471382 -0.558312310 -1.167676136 -0.491709893 -0.348903028
 [16] -1.086709481  0.564072777  0.133258377 -0.478832120  0.800783753
 [21] -0.078233757  0.618079753 -1.058892189  0.444263089 -0.611559712
 [26] -0.645604008 -0.447428950  0.847336223  1.524109137 -0.845954152
 [31] -0.051143692  1.001767778  0.318390988 -0.489215849  0.322579533
 [36]  1.229758657 -1.989466070 -0.732554010  0.212623980 -0.360735419
 [41]  0.890532053 -0.506608797 -0.611297458 -0.990211480  2.203208192
 [46] -1.307079536 -0.410754290 -0.864232132 -0.063980158 -0.364133690
 [51] -0.096725554  0.374084813  0.107064382  1.435587224 -0.760048230
 [56] -1.943224989  0.267564292  0.098488502 -1.077809701 -1.391920732
 [61] -1.892234148  0.329318942  0.007681211  0.949428115 -0.936186506
 [66] -0.413450122 -1.184284759 -1.177488768  0.368647003 -0.519957743
 [71] -0.710070673  1.403705863  1.649180804  0.426829578 -0.029215974
 [76]  1.243112816  1.938985399 -0.553624034  1.439304313 -1.391468320
 [81]  0.178501031  0.218723813 -0.604705045 -0.118855718 -0.019810092
 [86] -0.781758410 -0.324030586 -0.714407427  0.701071365  1.298079353
 [91] -1.038014180  0.872405426  0.351210810  0.783905223  1.048369836
 [96]  0.361407387  0.252018474  0.136969465 -1.091408661 -1.046814373
> 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] -1.246119346 -0.538502553  0.848156578  0.392506646 -0.181517739
  [6] -0.437539817 -0.299053489 -0.951381088 -0.539692003 -0.209918984
 [11] -0.263471382 -0.558312310 -1.167676136 -0.491709893 -0.348903028
 [16] -1.086709481  0.564072777  0.133258377 -0.478832120  0.800783753
 [21] -0.078233757  0.618079753 -1.058892189  0.444263089 -0.611559712
 [26] -0.645604008 -0.447428950  0.847336223  1.524109137 -0.845954152
 [31] -0.051143692  1.001767778  0.318390988 -0.489215849  0.322579533
 [36]  1.229758657 -1.989466070 -0.732554010  0.212623980 -0.360735419
 [41]  0.890532053 -0.506608797 -0.611297458 -0.990211480  2.203208192
 [46] -1.307079536 -0.410754290 -0.864232132 -0.063980158 -0.364133690
 [51] -0.096725554  0.374084813  0.107064382  1.435587224 -0.760048230
 [56] -1.943224989  0.267564292  0.098488502 -1.077809701 -1.391920732
 [61] -1.892234148  0.329318942  0.007681211  0.949428115 -0.936186506
 [66] -0.413450122 -1.184284759 -1.177488768  0.368647003 -0.519957743
 [71] -0.710070673  1.403705863  1.649180804  0.426829578 -0.029215974
 [76]  1.243112816  1.938985399 -0.553624034  1.439304313 -1.391468320
 [81]  0.178501031  0.218723813 -0.604705045 -0.118855718 -0.019810092
 [86] -0.781758410 -0.324030586 -0.714407427  0.701071365  1.298079353
 [91] -1.038014180  0.872405426  0.351210810  0.783905223  1.048369836
 [96]  0.361407387  0.252018474  0.136969465 -1.091408661 -1.046814373
> rowMin(tmp2)
  [1] -1.246119346 -0.538502553  0.848156578  0.392506646 -0.181517739
  [6] -0.437539817 -0.299053489 -0.951381088 -0.539692003 -0.209918984
 [11] -0.263471382 -0.558312310 -1.167676136 -0.491709893 -0.348903028
 [16] -1.086709481  0.564072777  0.133258377 -0.478832120  0.800783753
 [21] -0.078233757  0.618079753 -1.058892189  0.444263089 -0.611559712
 [26] -0.645604008 -0.447428950  0.847336223  1.524109137 -0.845954152
 [31] -0.051143692  1.001767778  0.318390988 -0.489215849  0.322579533
 [36]  1.229758657 -1.989466070 -0.732554010  0.212623980 -0.360735419
 [41]  0.890532053 -0.506608797 -0.611297458 -0.990211480  2.203208192
 [46] -1.307079536 -0.410754290 -0.864232132 -0.063980158 -0.364133690
 [51] -0.096725554  0.374084813  0.107064382  1.435587224 -0.760048230
 [56] -1.943224989  0.267564292  0.098488502 -1.077809701 -1.391920732
 [61] -1.892234148  0.329318942  0.007681211  0.949428115 -0.936186506
 [66] -0.413450122 -1.184284759 -1.177488768  0.368647003 -0.519957743
 [71] -0.710070673  1.403705863  1.649180804  0.426829578 -0.029215974
 [76]  1.243112816  1.938985399 -0.553624034  1.439304313 -1.391468320
 [81]  0.178501031  0.218723813 -0.604705045 -0.118855718 -0.019810092
 [86] -0.781758410 -0.324030586 -0.714407427  0.701071365  1.298079353
 [91] -1.038014180  0.872405426  0.351210810  0.783905223  1.048369836
 [96]  0.361407387  0.252018474  0.136969465 -1.091408661 -1.046814373
> 
> colMeans(tmp2)
[1] -0.1045287
> colSums(tmp2)
[1] -10.45287
> colVars(tmp2)
[1] 0.7616532
> colSd(tmp2)
[1] 0.8727274
> colMax(tmp2)
[1] 2.203208
> colMin(tmp2)
[1] -1.989466
> colMedians(tmp2)
[1] -0.1957184
> colRanges(tmp2)
          [,1]
[1,] -1.989466
[2,]  2.203208
> 
> 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.7435006 -2.1477798  1.0164516 -1.9415310 -1.2177311 -0.4014171
 [7]  2.4902348 -1.6897083  5.2897796  2.8124478
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.0694057
[2,] -0.5931699
[3,]  0.2463144
[4,]  1.2952339
[5,]  2.2089091
> 
> rowApply(tmp,sum)
 [1]  1.8192624  2.7966328 -4.0775164 -0.4386734 -0.1286272  2.9410528
 [7]  4.2568362 -1.2101038 -1.2797488  3.2751324
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    1    9    9    2    6   10    2    3    10
 [2,]    1    3    2    8    6    1    3    4    9     6
 [3,]    8    8    4    4    3    4    5    8    2     8
 [4,]    3    5    7   10    1    3    2    5    4     3
 [5,]    4    9    3    2   10    8    1    6    6     5
 [6,]    2   10    1    6    5   10    8    7    8     1
 [7,]    7    7    6    7    9    7    4    3    7     9
 [8,]    5    4    8    1    4    9    7    1    5     2
 [9,]    6    2   10    5    7    5    6    9   10     7
[10,]   10    6    5    3    8    2    9   10    1     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.12515034 -1.73380090 -1.79624735 -4.06808943  0.02638786 -0.63926070
 [7] -1.50128614  2.81201274 -1.33212503 -0.38046966 -2.76864075 -4.38110388
[13] -1.52045469  1.44587538  0.45456018 -0.04513469  0.96882239 -2.12436546
[19]  2.15854710 -3.39197956
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.87157162
[2,] -0.22816517
[3,] -0.02337471
[4,]  0.29376034
[5,]  0.70420081
> 
> rowApply(tmp,sum)
[1]  0.03607194 -3.46794397 -9.57752021  0.29720088 -5.22971158
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    3   13   12    8   18
[2,]   18    3   14    9    8
[3,]   14    1    9   20    7
[4,]   16    8    5   12    1
[5,]    5    2   20   16   15
> 
> 
> as.matrix(tmp)
            [,1]         [,2]       [,3]       [,4]       [,5]        [,6]
[1,] -0.87157162  0.574996971  0.2878195  0.5076669 -0.3964465  0.17104765
[2,]  0.29376034 -1.510843694 -2.4448241 -0.5970120 -1.8542813  0.09397473
[3,] -0.22816517 -0.168841910 -0.7579470 -1.0487061  1.1993707 -0.91082540
[4,] -0.02337471 -0.003778279  1.8335853  0.1746241  0.5226431 -0.33312496
[5,]  0.70420081 -0.625333985 -0.7148810 -3.1046625  0.5551018  0.33966729
            [,7]       [,8]        [,9]       [,10]       [,11]        [,12]
[1,]  0.09952057 -0.4726213  0.52561824 -1.52911028  0.02647617 -0.901099454
[2,] -0.69103393  1.8432974  0.05197919  1.04428126 -0.99818231 -0.584713579
[3,] -1.61542498  0.6931361 -0.68933001 -0.23821110 -2.15658109 -0.003874103
[4,]  0.01733353 -0.7352707 -0.89491202  0.29306683  1.77125353 -2.557398914
[5,]  0.68831867  1.4834712 -0.32548043  0.04950363 -1.41160705 -0.334017827
           [,13]       [,14]      [,15]      [,16]      [,17]      [,18]
[1,]  0.03099256  0.90170044 -0.2601461 -0.1485225  0.4511155  0.1495624
[2,]  1.04342900 -0.32539004  1.2317662  0.3068028 -1.3393014  1.2788635
[3,] -0.19380883  0.48916804  0.1804352 -1.1127934 -0.8449955 -1.8703538
[4,] -1.40541291  0.08175718  0.4646413  0.3073661  1.6648366 -0.7043058
[5,] -0.99565451  0.29863977 -1.1621364  0.6020122  1.0371672 -0.9781317
          [,19]      [,20]
[1,]  1.0995837 -0.2105109
[2,]  0.7974085 -1.1079244
[3,] -0.7780995  0.4783276
[4,]  0.6946984 -0.8710268
[5,]  0.3449560 -1.6808450
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  644  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  557  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
         col1      col2     col3     col4       col5      col6     col7
row1 1.608951 -1.370022 1.660997 1.002864 -0.7275521 0.2777787 1.118884
           col8     col9     col10     col11     col12   col13      col14
row1 -0.6212624 -1.07825 0.3722482 0.1145722 0.7292831 1.68435 -0.5700924
        col15     col16    col17     col18      col19    col20
row1 1.267829 -1.958232 1.426565 0.1436162 -0.3008122 0.736084
> tmp[,"col10"]
           col10
row1  0.37224821
row2 -0.49394693
row3  0.81018100
row4 -0.94062162
row5  0.09940407
> tmp[c("row1","row5"),]
          col1       col2      col3     col4       col5       col6       col7
row1  1.608951 -1.3700224  1.660997 1.002864 -0.7275521  0.2777787  1.1188837
row5 -1.114342 -0.2982367 -1.337582 1.086744  0.4521023 -0.1088653 -0.5164682
           col8      col9      col10       col11      col12     col13
row1 -0.6212624 -1.078250 0.37224821  0.11457219  0.7292831  1.684350
row5 -0.5204260  1.052373 0.09940407 -0.09130324 -0.7053640 -1.641222
          col14      col15      col16      col17      col18       col19
row1 -0.5700924  1.2678285 -1.9582315  1.4265653  0.1436162 -0.30081221
row5 -0.9331492 -0.7094629 -0.1682138 -0.1711418 -0.7448618  0.04730264
        col20
row1 0.736084
row5 1.444865
> tmp[,c("col6","col20")]
           col6      col20
row1  0.2777787  0.7360840
row2 -0.9984935  0.3442880
row3 -0.6581536 -1.5618995
row4  1.7204577 -0.9567654
row5 -0.1088653  1.4448650
> tmp[c("row1","row5"),c("col6","col20")]
           col6    col20
row1  0.2777787 0.736084
row5 -0.1088653 1.444865
> 
> 
> 
> 
> 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 52.40225 49.91585 50.86302 48.81336 50.25927 104.4278 49.62519 48.34668
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.52346 49.01566 49.63682 50.47251 51.16666 49.90435 49.88618 50.30792
        col17    col18    col19    col20
row1 49.84231 50.26794 49.25969 105.8305
> tmp[,"col10"]
        col10
row1 49.01566
row2 30.59438
row3 30.92731
row4 29.90896
row5 50.25807
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 52.40225 49.91585 50.86302 48.81336 50.25927 104.4278 49.62519 48.34668
row5 50.19799 51.17406 47.60965 50.87505 49.06877 105.0635 48.49629 50.18402
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.52346 49.01566 49.63682 50.47251 51.16666 49.90435 49.88618 50.30792
row5 49.89632 50.25807 48.95779 50.26825 50.26867 50.12116 50.42667 50.89429
        col17    col18    col19    col20
row1 49.84231 50.26794 49.25969 105.8305
row5 50.13713 49.65043 50.96595 107.5210
> tmp[,c("col6","col20")]
          col6     col20
row1 104.42782 105.83052
row2  75.98653  75.40099
row3  75.48813  77.03620
row4  73.75445  73.76151
row5 105.06349 107.52100
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.4278 105.8305
row5 105.0635 107.5210
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.4278 105.8305
row5 105.0635 107.5210
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.8188854
[2,] -0.8878802
[3,] -1.3135926
[4,]  0.1382827
[5,]  0.4410397
> tmp[,c("col17","col7")]
          col17       col7
[1,]  1.6295394 -1.1633516
[2,]  0.5108033  0.6342645
[3,] -2.4823151  0.7173575
[4,] -0.1673356 -0.1496910
[5,] -0.5139743 -0.2632341
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,] 0.16058373 -1.54623562
[2,] 0.29627004  0.68505822
[3,] 1.44659303 -0.07404814
[4,] 0.06166562  0.24222426
[5,] 0.77025051 -0.12868570
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.1605837
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.1605837
[2,] 0.2962700
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]       [,3]      [,4]       [,5]        [,6]
row3 -0.2776470 0.3545175  0.6552357 -1.011682 -0.3983301  0.33369877
row1  0.2141289 1.5420072 -0.6566408  1.648651 -1.5733495 -0.08690212
           [,7]       [,8]      [,9]     [,10]      [,11]       [,12]
row3 -0.4176531 -0.5630251 1.5717563 -0.336576 -0.5359038  0.04822562
row1  0.8319676  1.8775942 0.3631185  1.046036 -1.4233236 -1.98312729
          [,13]      [,14]     [,15]      [,16]      [,17]     [,18]      [,19]
row3  1.0113137 -0.9603006 -0.771252 -1.6930121  0.4682274  2.100416 -0.1968869
row1 -0.6367171 -0.2289892 -0.723986 -0.7230822 -1.0893244 -1.145118 -0.4012154
          [,20]
row3  0.8584042
row1 -0.4086115
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]       [,3]     [,4]       [,5]      [,6]   [,7]
row2 -1.098006 -0.2546677 -0.3697781 1.340667 -0.1836817 0.4822961 1.5079
         [,8]       [,9]   [,10]
row2 2.064078 -0.5112884 1.36588
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]        [,2]       [,3]      [,4]       [,5]      [,6]
row5 -0.6945731 -0.04759507 -0.1757595 -1.318432 -0.8466188 -2.240869
           [,7]        [,8]      [,9]     [,10]     [,11]     [,12]    [,13]
row5 -0.4081626 -0.05646753 0.1892649 -1.841017 0.4444189 -1.470957 1.137033
          [,14]    [,15]     [,16]   [,17]      [,18]      [,19]     [,20]
row5 -0.4210993 1.554703 0.4734264 1.54105 -0.1730304 -0.7133994 -1.249891
> 
> 
> 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: 0x7f8922e29080>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5fedec2f4" 
 [2] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f42d128cc"
 [3] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f31cd8b59"
 [4] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f2d77999a"
 [5] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f70564c8" 
 [6] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f731b8a11"
 [7] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f15059d21"
 [8] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f238eec4f"
 [9] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f7c3c48c5"
[10] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f59cdbd3b"
[11] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f52429a8c"
[12] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f12b08785"
[13] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f3913659" 
[14] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f32870ee3"
[15] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc5f40e272ff"
> 
> 
> ### 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: 0x7f8929d148f0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7f8929d148f0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7f8929d148f0>
> rowMedians(tmp)
  [1] -0.2272954604 -0.0209699864  0.2591483738 -0.0156227737 -0.2201796046
  [6]  0.5704390068  0.0360702632  0.3449374322  0.3501636487  0.1865711851
 [11] -0.1324309616  0.4670976900 -0.0553841514  0.0558004332 -0.1153765691
 [16] -0.2225761142  0.3525677501  0.2231391328  0.0081789053 -0.2265267276
 [21]  0.2010695332  0.3538832576 -0.0503787594 -0.3580308529 -0.5040571659
 [26]  0.3483371329  0.0582982364 -0.5294569795  0.9434065900 -0.0091181862
 [31]  0.2374631063  0.5594345379 -0.3464547542 -0.4670711215  0.2347619177
 [36]  0.0353976780 -0.6596623622 -0.2051049475  0.2590961149  0.3180048802
 [41]  0.5839759873 -0.5719084324 -0.1643534413  0.0809459007 -0.1714967076
 [46] -0.0043236418  0.1814223377  0.1917636425 -0.2336320535 -0.1352564800
 [51]  0.8854803107 -0.2417497172 -0.2672793269  0.0708361783  0.4564189087
 [56]  0.3106912197 -0.1219592717 -0.3288548490 -0.3364181774 -0.8841531512
 [61]  0.1767002290 -0.3013422862 -1.1661656187  0.0031027184  0.0906820842
 [66]  0.2639599708 -0.2076907167 -0.0633854725  0.3336259700  0.1722108979
 [71]  0.0461514835  0.0330758797  0.9740271341 -0.5459499401  0.8033168203
 [76]  0.0079257327  0.1475415833  0.3182818266  0.0022088029 -0.0978740686
 [81] -0.6351213972  0.3501004618 -0.5175277722 -0.1511071470  0.0714512752
 [86]  0.4831800138  0.0915328773 -0.2383065487 -0.2546102932 -0.3476591443
 [91] -0.1356068738  0.2059451175 -0.3622649477  0.2131200766  0.0424923698
 [96] -0.2134456730  0.1482980087  0.0401175298  0.5324374243 -0.0785147637
[101]  0.0181130094  0.0294305996  0.0812950828  0.4730382012  0.0480358685
[106] -0.0452374223 -0.0815861390 -0.4298676751  0.2593880563  0.1042214122
[111] -0.3488490495 -0.1068180046  0.6859683764  0.3688461329  0.0316822070
[116] -0.0266465563 -0.3221068613  0.0991986813 -0.2252275785  0.0006877512
[121] -0.2748027387  0.1543223899 -0.2443169386  0.1360525402 -0.2214684435
[126]  0.5833382136 -0.6612105322  0.1535038394 -0.2409080758 -0.0624540166
[131] -0.3165146833 -0.1368650583 -0.4208189768 -0.5230141025  0.1960234974
[136]  0.6662875268 -0.4351753075  0.2054783448  0.4100336289  0.2835582661
[141] -0.2091300899 -0.2617012519  0.1102446057 -0.4253001796 -0.2264382485
[146] -0.1997549428  0.1738142374  0.1150214062 -0.1946608800 -0.2032820257
[151] -0.3685787027 -0.0141052603 -0.2905807564 -0.2819850068 -0.1866322810
[156] -0.0082285899 -0.3081379936 -0.5437281086 -0.1910748858  0.3321689292
[161] -0.0877192163 -0.5796334452  0.1432709950  0.0617356325 -0.1518167701
[166] -0.2442190078  0.0058443566 -0.1168319044  0.5979357790  0.5129748812
[171]  0.1080893050 -0.2042678494  0.1665392237 -0.2369974833  0.1100499592
[176] -0.0201895937 -0.1424450000  0.2145472255  0.1553435210  0.1613845239
[181]  0.3201613087  0.0714894853 -0.2589448016 -0.3451018624 -0.1936113959
[186] -0.0811809207  0.3357336957  0.2312253794 -0.3777129692 -0.2578369729
[191]  0.2110724662  0.5256892420 -0.0022267461 -0.1099925017  0.2014406043
[196]  0.1159114016  0.3536314180  0.3477223641 -0.0478361630 -0.5375354654
[201]  0.0337907385 -0.1023719631  0.2685743841 -0.6273583264  0.1921554882
[206] -0.2977779967 -0.0459468610  0.3958387236  0.5077615060  0.4808643685
[211] -0.0980846310 -0.3629372693  0.3902191075  0.2128584346  0.1884714817
[216] -0.2267540430 -0.1005121423 -0.3142123819 -0.0163074778  0.2696953003
[221]  0.0123496352  0.0373643783 -0.1311163097 -0.0252421346 -0.5168344877
[226] -0.1247569759  0.2319524078  0.2625262101 -0.2203191405  0.0651318269
> 
> proc.time()
   user  system elapsed 
  4.106   6.885  11.303 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2018-11-27 r75683) -- "Unsuffered Consequences"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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: 0x7fa5a0400250>
> .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: 0x7fa5a0400250>
> .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: 0x7fa5a0400250>
> .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: 0x7fa5a0400250>
> 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: 0x7fa5a0624320>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa5a0624320>
> .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: 0x7fa5a0624320>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa5a0624320>
> .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: 0x7fa5a0624320>
> 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: 0x7fa5a6d2a1f0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa5a6d2a1f0>
> .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: 0x7fa5a6d2a1f0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fa5a6d2a1f0>
> .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: 0x7fa5a6d2a1f0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7fa5a6d2a1f0>
> .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: 0x7fa5a6d2a1f0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7fa5a6d2a1f0>
> .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: 0x7fa5a6d2a1f0>
> 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: 0x7fa5a051faa0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7fa5a051faa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa5a051faa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa5a051faa0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilee05e565502f4" "BufferedMatrixFilee05e67350d73"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilee05e565502f4" "BufferedMatrixFilee05e67350d73"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa5aa1039c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa5aa1039c0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fa5aa1039c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fa5aa1039c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7fa5aa1039c0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7fa5aa1039c0>
> .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: 0x7fa5a6f09b40>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa5a6f09b40>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fa5a6f09b40>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7fa5a6f09b40>
> 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: 0x7fa5a6f09eb0>
> .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: 0x7fa5a6f09eb0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.456   0.118   0.543 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2018-11-27 r75683) -- "Unsuffered Consequences"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (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.398   0.082   0.455 

Example timings