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

CHECK report for BufferedMatrix on celaya2

This page was generated on 2019-04-09 12:53:00 -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-09 00:19:24 -0400 (Tue, 09 Apr 2019)
EndedAt: 2019-04-09 00:20:25 -0400 (Tue, 09 Apr 2019)
EllapsedTime: 61.2 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) (2019-03-18 r76245)
* 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’ ...
** using staged installation
** 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/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R Under development (unstable) (2019-03-18 r76245) -- "Unsuffered Consequences"
Copyright (C) 2019 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.504   0.209   0.662 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2019-03-18 r76245) -- "Unsuffered Consequences"
Copyright (C) 2019 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 414490 22.2     875445 46.8         NA   617622 33.0
Vcells 745592  5.7    8388608 64.0      57344  1816447 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] "Tue Apr  9 00:19:54 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Apr  9 00:19:55 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: 0x7fb6cd300180>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Apr  9 00:20:00 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Apr  9 00:20:02 2019"
> 
> ColMode(tmp2)
<pointer: 0x7fb6cd300180>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
          [,1]       [,2]        [,3]       [,4]
[1,] 98.288500  0.9808941 -0.04700253  0.8961255
[2,] -1.888465 -0.9743595 -0.74275519  2.5167847
[3,]  2.627225  1.8139640  0.94128900 -1.3138863
[4,]  1.133381 -0.9147736 -1.21229712  0.1350726
> 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,] 98.288500 0.9808941 0.04700253 0.8961255
[2,]  1.888465 0.9743595 0.74275519 2.5167847
[3,]  2.627225 1.8139640 0.94128900 1.3138863
[4,]  1.133381 0.9147736 1.21229712 0.1350726
> 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,] 9.914056 0.9904010 0.2168007 0.9466391
[2,] 1.374214 0.9870965 0.8618325 1.5864378
[3,] 1.620872 1.3468348 0.9702005 1.1462488
[4,] 1.064604 0.9564380 1.1010436 0.3675222
> 
> 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,] 222.42906 35.88490 27.21501 35.36252
[2,]  40.63061 35.84532 34.36108 43.38116
[3,]  43.83594 40.28231 35.64329 37.77637
[4,]  36.77942 35.47915 37.22273 28.81029
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7fb6c8fd6500>
> exp(tmp5)
<pointer: 0x7fb6c8fd6500>
> log(tmp5,2)
<pointer: 0x7fb6c8fd6500>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 462.9569
> Min(tmp5)
[1] 53.87189
> mean(tmp5)
[1] 72.66982
> Sum(tmp5)
[1] 14533.96
> Var(tmp5)
[1] 840.8899
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.50311 74.27395 74.27175 66.71006 71.89139 70.22046 66.82452 71.31080
 [9] 70.29714 71.39507
> rowSums(tmp5)
 [1] 1790.062 1485.479 1485.435 1334.201 1437.828 1404.409 1336.490 1426.216
 [9] 1405.943 1427.901
> rowVars(tmp5)
 [1] 7809.44435   67.38155  102.52330   48.76081   91.98797   78.68124
 [7]   25.06386   80.74447   53.60715   55.45008
> rowSd(tmp5)
 [1] 88.371061  8.208626 10.125379  6.982894  9.591036  8.870245  5.006382
 [8]  8.985793  7.321690  7.446481
> rowMax(tmp5)
 [1] 462.95694  90.29221  91.23877  78.22113  87.17170  88.86445  74.24625
 [8]  84.40938  87.56506  89.59556
> rowMin(tmp5)
 [1] 55.27765 58.87370 56.06899 57.92582 53.87383 54.79210 57.24660 53.87189
 [9] 59.13332 60.53703
> 
> colMeans(tmp5)
 [1] 114.27416  72.78816  72.82713  73.07616  69.81651  68.70443  74.43546
 [8]  72.96526  69.63435  71.95669  69.62472  69.12015  71.82118  65.51447
[15]  66.26452  67.97374  68.06872  71.55340  71.81517  71.16208
> colSums(tmp5)
 [1] 1142.7416  727.8816  728.2713  730.7616  698.1651  687.0443  744.3546
 [8]  729.6526  696.3435  719.5669  696.2472  691.2015  718.2118  655.1447
[15]  662.6452  679.7374  680.6872  715.5340  718.1517  711.6208
> colVars(tmp5)
 [1] 15082.08145    33.97409    94.22804   142.93383    64.19483    60.59921
 [7]   121.97807   106.59684    60.54533    41.97225    73.09783   132.02642
[13]    19.89370    28.21366    43.12257    59.36026    62.38220    71.43020
[19]    81.33645    68.36425
> colSd(tmp5)
 [1] 122.809126   5.828729   9.707113  11.955494   8.012168   7.784550
 [7]  11.044368  10.324575   7.781088   6.478600   8.549727  11.490275
[13]   4.460235   5.311654   6.566777   7.704561   7.898240   8.451639
[19]   9.018672   8.268267
> colMax(tmp5)
 [1] 462.95694  83.84236  87.17170  90.29221  82.01377  80.90385  88.86445
 [8]  87.03294  82.70479  84.40938  80.61005  84.25708  81.30570  77.18651
[15]  77.40797  82.35882  84.09530  87.56506  89.59556  82.84014
> colMin(tmp5)
 [1] 63.19554 62.21938 56.64448 53.87383 58.87370 57.92582 55.27765 53.87189
 [9] 59.81491 59.84822 56.06899 53.87826 64.49271 60.79068 56.13071 57.24660
[17] 58.89307 60.72540 59.69290 58.28549
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 89.50311 74.27395       NA 66.71006 71.89139 70.22046 66.82452 71.31080
 [9] 70.29714 71.39507
> rowSums(tmp5)
 [1] 1790.062 1485.479       NA 1334.201 1437.828 1404.409 1336.490 1426.216
 [9] 1405.943 1427.901
> rowVars(tmp5)
 [1] 7809.44435   67.38155  107.57668   48.76081   91.98797   78.68124
 [7]   25.06386   80.74447   53.60715   55.45008
> rowSd(tmp5)
 [1] 88.371061  8.208626 10.371918  6.982894  9.591036  8.870245  5.006382
 [8]  8.985793  7.321690  7.446481
> rowMax(tmp5)
 [1] 462.95694  90.29221        NA  78.22113  87.17170  88.86445  74.24625
 [8]  84.40938  87.56506  89.59556
> rowMin(tmp5)
 [1] 55.27765 58.87370       NA 57.92582 53.87383 54.79210 57.24660 53.87189
 [9] 59.13332 60.53703
> 
> colMeans(tmp5)
 [1] 114.27416  72.78816  72.82713  73.07616  69.81651  68.70443  74.43546
 [8]  72.96526  69.63435  71.95669  69.62472  69.12015        NA  65.51447
[15]  66.26452  67.97374  68.06872  71.55340  71.81517  71.16208
> colSums(tmp5)
 [1] 1142.7416  727.8816  728.2713  730.7616  698.1651  687.0443  744.3546
 [8]  729.6526  696.3435  719.5669  696.2472  691.2015        NA  655.1447
[15]  662.6452  679.7374  680.6872  715.5340  718.1517  711.6208
> colVars(tmp5)
 [1] 15082.08145    33.97409    94.22804   142.93383    64.19483    60.59921
 [7]   121.97807   106.59684    60.54533    41.97225    73.09783   132.02642
[13]          NA    28.21366    43.12257    59.36026    62.38220    71.43020
[19]    81.33645    68.36425
> colSd(tmp5)
 [1] 122.809126   5.828729   9.707113  11.955494   8.012168   7.784550
 [7]  11.044368  10.324575   7.781088   6.478600   8.549727  11.490275
[13]         NA   5.311654   6.566777   7.704561   7.898240   8.451639
[19]   9.018672   8.268267
> colMax(tmp5)
 [1] 462.95694  83.84236  87.17170  90.29221  82.01377  80.90385  88.86445
 [8]  87.03294  82.70479  84.40938  80.61005  84.25708        NA  77.18651
[15]  77.40797  82.35882  84.09530  87.56506  89.59556  82.84014
> colMin(tmp5)
 [1] 63.19554 62.21938 56.64448 53.87383 58.87370 57.92582 55.27765 53.87189
 [9] 59.81491 59.84822 56.06899 53.87826       NA 60.79068 56.13071 57.24660
[17] 58.89307 60.72540 59.69290 58.28549
> 
> Max(tmp5,na.rm=TRUE)
[1] 462.9569
> Min(tmp5,na.rm=TRUE)
[1] 53.87189
> mean(tmp5,na.rm=TRUE)
[1] 72.67843
> Sum(tmp5,na.rm=TRUE)
[1] 14463.01
> Var(tmp5,na.rm=TRUE)
[1] 845.122
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.50311 74.27395 74.44619 66.71006 71.89139 70.22046 66.82452 71.31080
 [9] 70.29714 71.39507
> rowSums(tmp5,na.rm=TRUE)
 [1] 1790.062 1485.479 1414.478 1334.201 1437.828 1404.409 1336.490 1426.216
 [9] 1405.943 1427.901
> rowVars(tmp5,na.rm=TRUE)
 [1] 7809.44435   67.38155  107.57668   48.76081   91.98797   78.68124
 [7]   25.06386   80.74447   53.60715   55.45008
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.371061  8.208626 10.371918  6.982894  9.591036  8.870245  5.006382
 [8]  8.985793  7.321690  7.446481
> rowMax(tmp5,na.rm=TRUE)
 [1] 462.95694  90.29221  91.23877  78.22113  87.17170  88.86445  74.24625
 [8]  84.40938  87.56506  89.59556
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.27765 58.87370 56.06899 57.92582 53.87383 54.79210 57.24660 53.87189
 [9] 59.13332 60.53703
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.27416  72.78816  72.82713  73.07616  69.81651  68.70443  74.43546
 [8]  72.96526  69.63435  71.95669  69.62472  69.12015  71.91715  65.51447
[15]  66.26452  67.97374  68.06872  71.55340  71.81517  71.16208
> colSums(tmp5,na.rm=TRUE)
 [1] 1142.7416  727.8816  728.2713  730.7616  698.1651  687.0443  744.3546
 [8]  729.6526  696.3435  719.5669  696.2472  691.2015  647.2544  655.1447
[15]  662.6452  679.7374  680.6872  715.5340  718.1517  711.6208
> colVars(tmp5,na.rm=TRUE)
 [1] 15082.08145    33.97409    94.22804   142.93383    64.19483    60.59921
 [7]   121.97807   106.59684    60.54533    41.97225    73.09783   132.02642
[13]    22.27680    28.21366    43.12257    59.36026    62.38220    71.43020
[19]    81.33645    68.36425
> colSd(tmp5,na.rm=TRUE)
 [1] 122.809126   5.828729   9.707113  11.955494   8.012168   7.784550
 [7]  11.044368  10.324575   7.781088   6.478600   8.549727  11.490275
[13]   4.719831   5.311654   6.566777   7.704561   7.898240   8.451639
[19]   9.018672   8.268267
> colMax(tmp5,na.rm=TRUE)
 [1] 462.95694  83.84236  87.17170  90.29221  82.01377  80.90385  88.86445
 [8]  87.03294  82.70479  84.40938  80.61005  84.25708  81.30570  77.18651
[15]  77.40797  82.35882  84.09530  87.56506  89.59556  82.84014
> colMin(tmp5,na.rm=TRUE)
 [1] 63.19554 62.21938 56.64448 53.87383 58.87370 57.92582 55.27765 53.87189
 [9] 59.81491 59.84822 56.06899 53.87826 64.49271 60.79068 56.13071 57.24660
[17] 58.89307 60.72540 59.69290 58.28549
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.50311 74.27395      NaN 66.71006 71.89139 70.22046 66.82452 71.31080
 [9] 70.29714 71.39507
> rowSums(tmp5,na.rm=TRUE)
 [1] 1790.062 1485.479    0.000 1334.201 1437.828 1404.409 1336.490 1426.216
 [9] 1405.943 1427.901
> rowVars(tmp5,na.rm=TRUE)
 [1] 7809.44435   67.38155         NA   48.76081   91.98797   78.68124
 [7]   25.06386   80.74447   53.60715   55.45008
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.371061  8.208626        NA  6.982894  9.591036  8.870245  5.006382
 [8]  8.985793  7.321690  7.446481
> rowMax(tmp5,na.rm=TRUE)
 [1] 462.95694  90.29221        NA  78.22113  87.17170  88.86445  74.24625
 [8]  84.40938  87.56506  89.59556
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.27765 58.87370       NA 57.92582 53.87383 54.79210 57.24660 53.87189
 [9] 59.13332 60.53703
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.83365  71.55991  72.67605  72.45945  68.46126  69.83700  74.24764
 [8]  71.40219  68.45661  71.38439  71.13091  67.63218       NaN  65.56192
[15]  66.48559  69.04534  67.24902  70.37579  71.15478  71.96581
> colSums(tmp5,na.rm=TRUE)
 [1] 1051.5029  644.0392  654.0844  652.1350  616.1513  628.5330  668.2288
 [8]  642.6197  616.1095  642.4595  640.1782  608.6897    0.0000  590.0573
[15]  598.3703  621.4081  605.2412  633.3821  640.3930  647.6923
> colVars(tmp5,na.rm=TRUE)
 [1] 16893.64314    21.24928   105.74976   156.52180    51.55626    53.74370
 [7]   136.82846    92.43540    52.50897    43.53401    56.71315   123.62167
[13]          NA    31.71504    47.96308    53.86163    62.62105    64.75792
[19]    86.59710    69.64253
> colSd(tmp5,na.rm=TRUE)
 [1] 129.975548   4.609694  10.283470  12.510867   7.180269   7.331009
 [7]  11.697370   9.614333   7.246307   6.598031   7.530813  11.118528
[13]         NA   5.631611   6.925538   7.339048   7.913346   8.047231
[19]   9.305756   8.345210
> colMax(tmp5,na.rm=TRUE)
 [1] 462.95694  77.15294  87.17170  90.29221  81.71534  80.90385  88.86445
 [8]  83.82682  82.70479  84.40938  80.61005  84.25708      -Inf  77.18651
[15]  77.40797  82.35882  84.09530  87.56506  89.59556  82.84014
> colMin(tmp5,na.rm=TRUE)
 [1] 63.19554 62.21938 56.64448 53.87383 58.87370 57.92582 55.27765 53.87189
 [9] 59.81491 59.84822 59.36954 53.87826      Inf 60.79068 56.13071 57.24660
[17] 58.89307 60.72540 59.69290 58.28549
> 
> 
> 
> 
> 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] 314.8743 254.5871 170.6176 268.7847 286.5535 243.5041 279.9598 151.7423
 [9] 207.1813 142.0792
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 314.8743 254.5871 170.6176 268.7847 286.5535 243.5041 279.9598 151.7423
 [9] 207.1813 142.0792
> 
> 
> 
> 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]  0.000000e+00 -5.684342e-14 -1.136868e-13  0.000000e+00 -4.263256e-14
 [6] -2.842171e-14  4.263256e-14 -5.684342e-14  2.842171e-14 -7.105427e-14
[11] -1.136868e-13 -8.526513e-14  1.989520e-13 -8.526513e-14 -2.842171e-14
[16]  5.684342e-14 -5.684342e-14  0.000000e+00  5.684342e-14 -1.421085e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
4   18 
9   15 
6   5 
7   12 
9   4 
7   10 
6   15 
10   5 
4   4 
3   6 
9   14 
5   7 
5   18 
7   19 
7   7 
2   14 
5   7 
5   2 
2   9 
6   6 
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.663956
> Min(tmp)
[1] -3.172449
> mean(tmp)
[1] -0.1048769
> Sum(tmp)
[1] -10.48769
> Var(tmp)
[1] 1.130384
> 
> rowMeans(tmp)
[1] -0.1048769
> rowSums(tmp)
[1] -10.48769
> rowVars(tmp)
[1] 1.130384
> rowSd(tmp)
[1] 1.063195
> rowMax(tmp)
[1] 2.663956
> rowMin(tmp)
[1] -3.172449
> 
> colMeans(tmp)
  [1]  0.42588760 -2.23248594 -0.75977372 -0.49613803  0.53618051 -0.80635241
  [7] -0.62809653  1.20470442 -1.51099715  2.66395604  0.62535126 -1.05293395
 [13]  0.18151117  0.60094929  0.02988397  0.06033790 -1.24822955 -1.31170392
 [19] -0.01220440 -1.77098915  2.32285927  0.28907246 -0.09113477  2.29116521
 [25] -1.84056515 -1.00497881  0.34968095  0.31571385  0.68274482  0.59341988
 [31] -0.75458633  0.05010318 -0.14163608  1.51025268  0.01929071 -0.57234866
 [37] -0.28902152 -0.80530032 -0.37537915 -0.23112276  0.43554565  0.78706886
 [43] -0.42110250 -0.82638191  0.10168533 -0.04777946  0.63059857 -0.24118999
 [49]  0.09514602 -1.67341962 -0.26069152  1.50717877 -1.86436211 -0.42946962
 [55] -1.03503608 -1.53044786 -0.12339763  0.16545060  0.22320987 -0.72139008
 [61] -1.29973812 -1.31700454 -0.29893407 -1.17183160  0.14551160  1.50541803
 [67]  0.50006910 -0.99138966 -1.48747878  0.42359872 -0.21139277  0.43991529
 [73] -0.46747065  0.37857236 -1.22327225  0.59368532  0.81915906  0.67537092
 [79] -0.20830137 -3.17244906 -1.60250477  2.10430600 -0.20000963 -0.17667263
 [85] -0.43463278 -0.46211278 -0.75229681  0.09493190  1.11576984 -1.08576236
 [91]  0.11728060  2.15698512  1.17162467 -0.82109200 -1.28743391  2.02304575
 [97] -0.52278092  0.23712247  1.08412701  1.53207568
> colSums(tmp)
  [1]  0.42588760 -2.23248594 -0.75977372 -0.49613803  0.53618051 -0.80635241
  [7] -0.62809653  1.20470442 -1.51099715  2.66395604  0.62535126 -1.05293395
 [13]  0.18151117  0.60094929  0.02988397  0.06033790 -1.24822955 -1.31170392
 [19] -0.01220440 -1.77098915  2.32285927  0.28907246 -0.09113477  2.29116521
 [25] -1.84056515 -1.00497881  0.34968095  0.31571385  0.68274482  0.59341988
 [31] -0.75458633  0.05010318 -0.14163608  1.51025268  0.01929071 -0.57234866
 [37] -0.28902152 -0.80530032 -0.37537915 -0.23112276  0.43554565  0.78706886
 [43] -0.42110250 -0.82638191  0.10168533 -0.04777946  0.63059857 -0.24118999
 [49]  0.09514602 -1.67341962 -0.26069152  1.50717877 -1.86436211 -0.42946962
 [55] -1.03503608 -1.53044786 -0.12339763  0.16545060  0.22320987 -0.72139008
 [61] -1.29973812 -1.31700454 -0.29893407 -1.17183160  0.14551160  1.50541803
 [67]  0.50006910 -0.99138966 -1.48747878  0.42359872 -0.21139277  0.43991529
 [73] -0.46747065  0.37857236 -1.22327225  0.59368532  0.81915906  0.67537092
 [79] -0.20830137 -3.17244906 -1.60250477  2.10430600 -0.20000963 -0.17667263
 [85] -0.43463278 -0.46211278 -0.75229681  0.09493190  1.11576984 -1.08576236
 [91]  0.11728060  2.15698512  1.17162467 -0.82109200 -1.28743391  2.02304575
 [97] -0.52278092  0.23712247  1.08412701  1.53207568
> 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.42588760 -2.23248594 -0.75977372 -0.49613803  0.53618051 -0.80635241
  [7] -0.62809653  1.20470442 -1.51099715  2.66395604  0.62535126 -1.05293395
 [13]  0.18151117  0.60094929  0.02988397  0.06033790 -1.24822955 -1.31170392
 [19] -0.01220440 -1.77098915  2.32285927  0.28907246 -0.09113477  2.29116521
 [25] -1.84056515 -1.00497881  0.34968095  0.31571385  0.68274482  0.59341988
 [31] -0.75458633  0.05010318 -0.14163608  1.51025268  0.01929071 -0.57234866
 [37] -0.28902152 -0.80530032 -0.37537915 -0.23112276  0.43554565  0.78706886
 [43] -0.42110250 -0.82638191  0.10168533 -0.04777946  0.63059857 -0.24118999
 [49]  0.09514602 -1.67341962 -0.26069152  1.50717877 -1.86436211 -0.42946962
 [55] -1.03503608 -1.53044786 -0.12339763  0.16545060  0.22320987 -0.72139008
 [61] -1.29973812 -1.31700454 -0.29893407 -1.17183160  0.14551160  1.50541803
 [67]  0.50006910 -0.99138966 -1.48747878  0.42359872 -0.21139277  0.43991529
 [73] -0.46747065  0.37857236 -1.22327225  0.59368532  0.81915906  0.67537092
 [79] -0.20830137 -3.17244906 -1.60250477  2.10430600 -0.20000963 -0.17667263
 [85] -0.43463278 -0.46211278 -0.75229681  0.09493190  1.11576984 -1.08576236
 [91]  0.11728060  2.15698512  1.17162467 -0.82109200 -1.28743391  2.02304575
 [97] -0.52278092  0.23712247  1.08412701  1.53207568
> colMin(tmp)
  [1]  0.42588760 -2.23248594 -0.75977372 -0.49613803  0.53618051 -0.80635241
  [7] -0.62809653  1.20470442 -1.51099715  2.66395604  0.62535126 -1.05293395
 [13]  0.18151117  0.60094929  0.02988397  0.06033790 -1.24822955 -1.31170392
 [19] -0.01220440 -1.77098915  2.32285927  0.28907246 -0.09113477  2.29116521
 [25] -1.84056515 -1.00497881  0.34968095  0.31571385  0.68274482  0.59341988
 [31] -0.75458633  0.05010318 -0.14163608  1.51025268  0.01929071 -0.57234866
 [37] -0.28902152 -0.80530032 -0.37537915 -0.23112276  0.43554565  0.78706886
 [43] -0.42110250 -0.82638191  0.10168533 -0.04777946  0.63059857 -0.24118999
 [49]  0.09514602 -1.67341962 -0.26069152  1.50717877 -1.86436211 -0.42946962
 [55] -1.03503608 -1.53044786 -0.12339763  0.16545060  0.22320987 -0.72139008
 [61] -1.29973812 -1.31700454 -0.29893407 -1.17183160  0.14551160  1.50541803
 [67]  0.50006910 -0.99138966 -1.48747878  0.42359872 -0.21139277  0.43991529
 [73] -0.46747065  0.37857236 -1.22327225  0.59368532  0.81915906  0.67537092
 [79] -0.20830137 -3.17244906 -1.60250477  2.10430600 -0.20000963 -0.17667263
 [85] -0.43463278 -0.46211278 -0.75229681  0.09493190  1.11576984 -1.08576236
 [91]  0.11728060  2.15698512  1.17162467 -0.82109200 -1.28743391  2.02304575
 [97] -0.52278092  0.23712247  1.08412701  1.53207568
> colMedians(tmp)
  [1]  0.42588760 -2.23248594 -0.75977372 -0.49613803  0.53618051 -0.80635241
  [7] -0.62809653  1.20470442 -1.51099715  2.66395604  0.62535126 -1.05293395
 [13]  0.18151117  0.60094929  0.02988397  0.06033790 -1.24822955 -1.31170392
 [19] -0.01220440 -1.77098915  2.32285927  0.28907246 -0.09113477  2.29116521
 [25] -1.84056515 -1.00497881  0.34968095  0.31571385  0.68274482  0.59341988
 [31] -0.75458633  0.05010318 -0.14163608  1.51025268  0.01929071 -0.57234866
 [37] -0.28902152 -0.80530032 -0.37537915 -0.23112276  0.43554565  0.78706886
 [43] -0.42110250 -0.82638191  0.10168533 -0.04777946  0.63059857 -0.24118999
 [49]  0.09514602 -1.67341962 -0.26069152  1.50717877 -1.86436211 -0.42946962
 [55] -1.03503608 -1.53044786 -0.12339763  0.16545060  0.22320987 -0.72139008
 [61] -1.29973812 -1.31700454 -0.29893407 -1.17183160  0.14551160  1.50541803
 [67]  0.50006910 -0.99138966 -1.48747878  0.42359872 -0.21139277  0.43991529
 [73] -0.46747065  0.37857236 -1.22327225  0.59368532  0.81915906  0.67537092
 [79] -0.20830137 -3.17244906 -1.60250477  2.10430600 -0.20000963 -0.17667263
 [85] -0.43463278 -0.46211278 -0.75229681  0.09493190  1.11576984 -1.08576236
 [91]  0.11728060  2.15698512  1.17162467 -0.82109200 -1.28743391  2.02304575
 [97] -0.52278092  0.23712247  1.08412701  1.53207568
> colRanges(tmp)
          [,1]      [,2]       [,3]      [,4]      [,5]       [,6]       [,7]
[1,] 0.4258876 -2.232486 -0.7597737 -0.496138 0.5361805 -0.8063524 -0.6280965
[2,] 0.4258876 -2.232486 -0.7597737 -0.496138 0.5361805 -0.8063524 -0.6280965
         [,8]      [,9]    [,10]     [,11]     [,12]     [,13]     [,14]
[1,] 1.204704 -1.510997 2.663956 0.6253513 -1.052934 0.1815112 0.6009493
[2,] 1.204704 -1.510997 2.663956 0.6253513 -1.052934 0.1815112 0.6009493
          [,15]     [,16]    [,17]     [,18]      [,19]     [,20]    [,21]
[1,] 0.02988397 0.0603379 -1.24823 -1.311704 -0.0122044 -1.770989 2.322859
[2,] 0.02988397 0.0603379 -1.24823 -1.311704 -0.0122044 -1.770989 2.322859
         [,22]       [,23]    [,24]     [,25]     [,26]     [,27]     [,28]
[1,] 0.2890725 -0.09113477 2.291165 -1.840565 -1.004979 0.3496809 0.3157139
[2,] 0.2890725 -0.09113477 2.291165 -1.840565 -1.004979 0.3496809 0.3157139
         [,29]     [,30]      [,31]      [,32]      [,33]    [,34]      [,35]
[1,] 0.6827448 0.5934199 -0.7545863 0.05010318 -0.1416361 1.510253 0.01929071
[2,] 0.6827448 0.5934199 -0.7545863 0.05010318 -0.1416361 1.510253 0.01929071
          [,36]      [,37]      [,38]      [,39]      [,40]     [,41]     [,42]
[1,] -0.5723487 -0.2890215 -0.8053003 -0.3753791 -0.2311228 0.4355456 0.7870689
[2,] -0.5723487 -0.2890215 -0.8053003 -0.3753791 -0.2311228 0.4355456 0.7870689
          [,43]      [,44]     [,45]       [,46]     [,47]    [,48]      [,49]
[1,] -0.4211025 -0.8263819 0.1016853 -0.04777946 0.6305986 -0.24119 0.09514602
[2,] -0.4211025 -0.8263819 0.1016853 -0.04777946 0.6305986 -0.24119 0.09514602
        [,50]      [,51]    [,52]     [,53]      [,54]     [,55]     [,56]
[1,] -1.67342 -0.2606915 1.507179 -1.864362 -0.4294696 -1.035036 -1.530448
[2,] -1.67342 -0.2606915 1.507179 -1.864362 -0.4294696 -1.035036 -1.530448
          [,57]     [,58]     [,59]      [,60]     [,61]     [,62]      [,63]
[1,] -0.1233976 0.1654506 0.2232099 -0.7213901 -1.299738 -1.317005 -0.2989341
[2,] -0.1233976 0.1654506 0.2232099 -0.7213901 -1.299738 -1.317005 -0.2989341
         [,64]     [,65]    [,66]     [,67]      [,68]     [,69]     [,70]
[1,] -1.171832 0.1455116 1.505418 0.5000691 -0.9913897 -1.487479 0.4235987
[2,] -1.171832 0.1455116 1.505418 0.5000691 -0.9913897 -1.487479 0.4235987
          [,71]     [,72]      [,73]     [,74]     [,75]     [,76]     [,77]
[1,] -0.2113928 0.4399153 -0.4674706 0.3785724 -1.223272 0.5936853 0.8191591
[2,] -0.2113928 0.4399153 -0.4674706 0.3785724 -1.223272 0.5936853 0.8191591
         [,78]      [,79]     [,80]     [,81]    [,82]      [,83]      [,84]
[1,] 0.6753709 -0.2083014 -3.172449 -1.602505 2.104306 -0.2000096 -0.1766726
[2,] 0.6753709 -0.2083014 -3.172449 -1.602505 2.104306 -0.2000096 -0.1766726
          [,85]      [,86]      [,87]     [,88]   [,89]     [,90]     [,91]
[1,] -0.4346328 -0.4621128 -0.7522968 0.0949319 1.11577 -1.085762 0.1172806
[2,] -0.4346328 -0.4621128 -0.7522968 0.0949319 1.11577 -1.085762 0.1172806
        [,92]    [,93]     [,94]     [,95]    [,96]      [,97]     [,98]
[1,] 2.156985 1.171625 -0.821092 -1.287434 2.023046 -0.5227809 0.2371225
[2,] 2.156985 1.171625 -0.821092 -1.287434 2.023046 -0.5227809 0.2371225
        [,99]   [,100]
[1,] 1.084127 1.532076
[2,] 1.084127 1.532076
> 
> 
> Max(tmp2)
[1] 2.004066
> Min(tmp2)
[1] -2.464072
> mean(tmp2)
[1] -0.1735756
> Sum(tmp2)
[1] -17.35756
> Var(tmp2)
[1] 1.042121
> 
> rowMeans(tmp2)
  [1]  1.11820103 -2.14528634  1.26253922  1.00111306  1.01829841  0.48960064
  [7]  2.00406642  0.27315598  0.56372427  0.13493742  0.25832754 -0.95998418
 [13]  0.78629136 -1.71557378 -1.78742380  0.38229641  0.14333718 -2.17854826
 [19] -0.08393134 -0.29792356 -0.29947184  1.61591407  0.46998250 -0.08667514
 [25] -0.47323871 -0.42945226 -0.22115244 -0.69815131 -2.08435714  0.22754303
 [31] -2.46407242 -1.00906737  0.99379334  1.37023161  0.50289832 -1.57198241
 [37]  0.38987893 -1.42389143 -0.50140673 -0.23411005 -0.20338444  0.39684034
 [43] -1.72706616  0.78749371 -0.44038728 -0.82459527 -1.35863377 -0.85905096
 [49] -0.75760357 -1.42346018 -1.59277590  1.01542002  1.43794315 -0.79181924
 [55] -0.58237503 -0.02618831 -0.91615317 -1.34965162  0.39286676 -1.63885691
 [61]  1.55180816 -1.32045005 -1.24029256  1.44502266  1.06545503 -1.30803558
 [67]  1.05831363 -1.47483302  1.21899198 -0.28462994 -1.15138475  0.27183992
 [73]  0.41719182  0.32386524  0.22998511 -1.54339589 -1.00195540 -1.26201228
 [79]  0.43511204 -0.32296452  0.17336498  0.85815966 -1.83723571 -0.06872148
 [85] -0.24897214  0.92912377 -0.45240660 -0.57804744  1.43317924 -0.61014964
 [91]  0.80668720 -0.24026232  0.27908205  0.56093154  0.19602453 -0.19378407
 [97]  1.29135680  0.19897999 -0.18249342 -0.65899916
> rowSums(tmp2)
  [1]  1.11820103 -2.14528634  1.26253922  1.00111306  1.01829841  0.48960064
  [7]  2.00406642  0.27315598  0.56372427  0.13493742  0.25832754 -0.95998418
 [13]  0.78629136 -1.71557378 -1.78742380  0.38229641  0.14333718 -2.17854826
 [19] -0.08393134 -0.29792356 -0.29947184  1.61591407  0.46998250 -0.08667514
 [25] -0.47323871 -0.42945226 -0.22115244 -0.69815131 -2.08435714  0.22754303
 [31] -2.46407242 -1.00906737  0.99379334  1.37023161  0.50289832 -1.57198241
 [37]  0.38987893 -1.42389143 -0.50140673 -0.23411005 -0.20338444  0.39684034
 [43] -1.72706616  0.78749371 -0.44038728 -0.82459527 -1.35863377 -0.85905096
 [49] -0.75760357 -1.42346018 -1.59277590  1.01542002  1.43794315 -0.79181924
 [55] -0.58237503 -0.02618831 -0.91615317 -1.34965162  0.39286676 -1.63885691
 [61]  1.55180816 -1.32045005 -1.24029256  1.44502266  1.06545503 -1.30803558
 [67]  1.05831363 -1.47483302  1.21899198 -0.28462994 -1.15138475  0.27183992
 [73]  0.41719182  0.32386524  0.22998511 -1.54339589 -1.00195540 -1.26201228
 [79]  0.43511204 -0.32296452  0.17336498  0.85815966 -1.83723571 -0.06872148
 [85] -0.24897214  0.92912377 -0.45240660 -0.57804744  1.43317924 -0.61014964
 [91]  0.80668720 -0.24026232  0.27908205  0.56093154  0.19602453 -0.19378407
 [97]  1.29135680  0.19897999 -0.18249342 -0.65899916
> 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.11820103 -2.14528634  1.26253922  1.00111306  1.01829841  0.48960064
  [7]  2.00406642  0.27315598  0.56372427  0.13493742  0.25832754 -0.95998418
 [13]  0.78629136 -1.71557378 -1.78742380  0.38229641  0.14333718 -2.17854826
 [19] -0.08393134 -0.29792356 -0.29947184  1.61591407  0.46998250 -0.08667514
 [25] -0.47323871 -0.42945226 -0.22115244 -0.69815131 -2.08435714  0.22754303
 [31] -2.46407242 -1.00906737  0.99379334  1.37023161  0.50289832 -1.57198241
 [37]  0.38987893 -1.42389143 -0.50140673 -0.23411005 -0.20338444  0.39684034
 [43] -1.72706616  0.78749371 -0.44038728 -0.82459527 -1.35863377 -0.85905096
 [49] -0.75760357 -1.42346018 -1.59277590  1.01542002  1.43794315 -0.79181924
 [55] -0.58237503 -0.02618831 -0.91615317 -1.34965162  0.39286676 -1.63885691
 [61]  1.55180816 -1.32045005 -1.24029256  1.44502266  1.06545503 -1.30803558
 [67]  1.05831363 -1.47483302  1.21899198 -0.28462994 -1.15138475  0.27183992
 [73]  0.41719182  0.32386524  0.22998511 -1.54339589 -1.00195540 -1.26201228
 [79]  0.43511204 -0.32296452  0.17336498  0.85815966 -1.83723571 -0.06872148
 [85] -0.24897214  0.92912377 -0.45240660 -0.57804744  1.43317924 -0.61014964
 [91]  0.80668720 -0.24026232  0.27908205  0.56093154  0.19602453 -0.19378407
 [97]  1.29135680  0.19897999 -0.18249342 -0.65899916
> rowMin(tmp2)
  [1]  1.11820103 -2.14528634  1.26253922  1.00111306  1.01829841  0.48960064
  [7]  2.00406642  0.27315598  0.56372427  0.13493742  0.25832754 -0.95998418
 [13]  0.78629136 -1.71557378 -1.78742380  0.38229641  0.14333718 -2.17854826
 [19] -0.08393134 -0.29792356 -0.29947184  1.61591407  0.46998250 -0.08667514
 [25] -0.47323871 -0.42945226 -0.22115244 -0.69815131 -2.08435714  0.22754303
 [31] -2.46407242 -1.00906737  0.99379334  1.37023161  0.50289832 -1.57198241
 [37]  0.38987893 -1.42389143 -0.50140673 -0.23411005 -0.20338444  0.39684034
 [43] -1.72706616  0.78749371 -0.44038728 -0.82459527 -1.35863377 -0.85905096
 [49] -0.75760357 -1.42346018 -1.59277590  1.01542002  1.43794315 -0.79181924
 [55] -0.58237503 -0.02618831 -0.91615317 -1.34965162  0.39286676 -1.63885691
 [61]  1.55180816 -1.32045005 -1.24029256  1.44502266  1.06545503 -1.30803558
 [67]  1.05831363 -1.47483302  1.21899198 -0.28462994 -1.15138475  0.27183992
 [73]  0.41719182  0.32386524  0.22998511 -1.54339589 -1.00195540 -1.26201228
 [79]  0.43511204 -0.32296452  0.17336498  0.85815966 -1.83723571 -0.06872148
 [85] -0.24897214  0.92912377 -0.45240660 -0.57804744  1.43317924 -0.61014964
 [91]  0.80668720 -0.24026232  0.27908205  0.56093154  0.19602453 -0.19378407
 [97]  1.29135680  0.19897999 -0.18249342 -0.65899916
> 
> colMeans(tmp2)
[1] -0.1735756
> colSums(tmp2)
[1] -17.35756
> colVars(tmp2)
[1] 1.042121
> colSd(tmp2)
[1] 1.020843
> colMax(tmp2)
[1] 2.004066
> colMin(tmp2)
[1] -2.464072
> colMedians(tmp2)
[1] -0.1881387
> colRanges(tmp2)
          [,1]
[1,] -2.464072
[2,]  2.004066
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.9502213 -1.9024663  2.2657478  2.2767552  0.7934448 -6.8769024
 [7] -2.8492098 -5.6433335 -0.4804894  0.8494200
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.1194717
[2,] -0.2096842
[3,]  0.2188379
[4,]  0.3504487
[5,]  1.3915128
> 
> rowApply(tmp,sum)
 [1] -4.8223529  4.7282312  5.6747089 -7.1556921 -2.7819472 -2.3458003
 [7]  3.3111178  0.8209522 -4.8613739 -3.1846560
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    3    5    2    6    8   10    7   10     5
 [2,]    3    9    4    5    5   10    8    5    3     1
 [3,]    6   10    2   10    4    2    7    8    7     3
 [4,]    7    8    9    7   10    7    6    3    1     8
 [5,]    2    7    6    8    2    5    9   10    2     4
 [6,]    1    2    1    1    7    3    4    9    5     2
 [7,]    4    4    8    9    3    4    1    6    6     6
 [8,]    5    6    7    3    1    1    3    1    8     7
 [9,]   10    1   10    4    9    6    5    4    4     9
[10,]    8    5    3    6    8    9    2    2    9    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.68204432  1.30221623 -0.19924266 -0.35674313 -3.59834291 -4.65354749
 [7] -3.73291546 -0.97269021 -1.56131132  5.25937588 -0.91903018  0.60592761
[13]  0.07351182  0.22381654  0.20567689  2.76741375  5.30237547 -1.56153301
[19] -1.50570858  2.13412534
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5448131
[2,]  0.6557160
[3,]  0.8763071
[4,]  1.2988238
[5,]  1.3960105
> 
> rowApply(tmp,sum)
[1] -1.69432675 -2.21658635  0.93523464 -0.08288053  4.55397791
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    4   18   17   19   15
[2,]   12   19    8   14    6
[3,]   10   13   12    3   13
[4,]    2    5   15   17   11
[5,]    3    7    5    6   16
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -1.5448131 -0.01097433 -0.1618442 -1.9133775 -1.7482837 -0.2899817
[2,]  0.8763071  1.56168503  0.3850332 -0.8463862 -0.5265465 -1.6567527
[3,]  1.2988238 -0.30071807  0.3248084  0.8467162 -1.2397867  0.2877281
[4,]  1.3960105  0.47232945 -1.2785833  1.1461890 -0.7884184 -1.4972382
[5,]  0.6557160 -0.42010586  0.5313432  0.4101153  0.7046925 -1.4973030
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -0.5037330  0.3139460 -1.0727957 -0.1571320 -2.0111866  0.9916706
[2,] -0.8013314  0.5121541 -0.3023175  0.4561253 -0.1144124 -0.2347737
[3,] -1.3451300 -1.7274542  1.9988396  2.6000881  1.0957585 -0.2470191
[4,] -0.5602734 -0.5358657 -1.0383312  0.6169564 -1.3017065 -0.8785553
[5,] -0.5224477  0.4645296 -1.1467066  1.7433382  1.4125168  0.9746050
          [,13]      [,14]       [,15]      [,16]     [,17]      [,18]
[1,] -0.4025851  0.8084923  1.11490447  2.3581404 0.9861253  0.5683579
[2,]  0.5181420  1.6954846  0.81307769 -1.0916584 0.3234975 -1.3300192
[3,] -0.5886097 -2.1188879 -2.26085321  0.7361690 1.6493952 -0.9117334
[4,]  1.1837189 -0.4962118  0.46668141  0.4267628 1.7701391  0.5830599
[5,] -0.6371543  0.3349394  0.07186653  0.3380000 0.5732183 -0.4711982
          [,19]      [,20]
[1,] -0.4189184  1.3996615
[2,] -1.9432694 -0.5106255
[3,]  0.3130369  0.5240632
[4,]  0.3425582 -0.1121025
[5,]  0.2008841  0.8331286
> 
> 
> 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 :  558  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 0.9867351 -0.1572972 -0.7398504 -1.10079 -2.113512 1.146055 0.1296722
            col8    col9    col10      col11      col12     col13    col14
row1 -0.07141885 2.31966 1.215659 0.09679109 -0.3571098 0.1121948 0.522653
        col15    col16      col17      col18    col19      col20
row1 0.892627 2.396756 0.00404484 -0.4627571 1.112394 0.05600396
> tmp[,"col10"]
          col10
row1  1.2156593
row2  0.6705291
row3 -1.9946112
row4  0.7931762
row5 -0.5950995
> tmp[c("row1","row5"),]
          col1       col2       col3      col4       col5       col6       col7
row1 0.9867351 -0.1572972 -0.7398504 -1.100790 -2.1135116  1.1460549  0.1296722
row5 0.1467389  0.9572088 -0.8338278 -0.333034 -0.8165136 -0.3365341 -1.2780404
            col8       col9      col10       col11      col12     col13
row1 -0.07141885  2.3196603  1.2156593  0.09679109 -0.3571098 0.1121948
row5 -1.08806353 -0.3126668 -0.5950995 -2.52944973 -1.9545277 3.1169844
         col14     col15    col16      col17      col18      col19      col20
row1 0.5226530  0.892627 2.396756 0.00404484 -0.4627571  1.1123941 0.05600396
row5 0.7575808 -1.528467 1.402332 1.14175364 -0.3763123 -0.2551744 0.50750022
> tmp[,c("col6","col20")]
           col6       col20
row1  1.1460549  0.05600396
row2  0.9417362  1.48296563
row3 -0.5061413 -1.78322602
row4 -0.3194401 -1.87481792
row5 -0.3365341  0.50750022
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  1.1460549 0.05600396
row5 -0.3365341 0.50750022
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2    col3     col4     col5     col6     col7     col8
row1 50.13841 51.05548 48.7673 50.21472 50.92561 105.7646 51.52277 51.56282
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.28165 51.24594 49.60593 48.71443 51.37015 49.78729 50.69206 51.71644
        col17   col18   col19    col20
row1 51.11577 49.5563 48.8254 105.3076
> tmp[,"col10"]
        col10
row1 51.24594
row2 29.88859
row3 30.66775
row4 29.43175
row5 50.49646
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.13841 51.05548 48.76730 50.21472 50.92561 105.7646 51.52277 51.56282
row5 49.18655 50.66663 50.77465 50.85008 49.89960 106.4861 49.98441 50.71324
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.28165 51.24594 49.60593 48.71443 51.37015 49.78729 50.69206 51.71644
row5 49.69442 50.49646 49.17750 49.68630 49.89584 50.23816 51.13316 51.09526
        col17    col18    col19    col20
row1 51.11577 49.55630 48.82540 105.3076
row5 49.69624 50.76003 50.03485 105.4020
> tmp[,c("col6","col20")]
          col6     col20
row1 105.76458 105.30756
row2  75.87944  76.61015
row3  75.37313  74.48603
row4  74.27463  74.70059
row5 106.48615 105.40202
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.7646 105.3076
row5 106.4861 105.4020
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.7646 105.3076
row5 106.4861 105.4020
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.1772122
[2,]  1.0298332
[3,] -1.9097120
[4,] -1.1675047
[5,]  1.3271349
> tmp[,c("col17","col7")]
           col17        col7
[1,] -1.09457872  0.25725525
[2,] -0.95807823  0.06738742
[3,] -0.06326238 -0.25738237
[4,] -0.17181268  0.13922126
[5,] -0.45043162  0.86193584
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -1.0553914 -0.2565589
[2,]  1.4379972  0.5131435
[3,] -1.6505131 -1.5709836
[4,]  1.5588675  0.6396438
[5,] -0.2574703 -0.1214035
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -1.055391
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] -1.055391
[2,]  1.437997
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]     [,2]       [,3]      [,4]       [,5]      [,6]       [,7]
row3 0.6310630 1.302381 -0.4253174  2.082030 -0.2227667 1.2249645  0.4631692
row1 0.6288099 1.628057 -0.1845900 -1.268725  0.8730940 0.5278564 -1.5564047
            [,8]      [,9]      [,10]      [,11]      [,12]      [,13]
row3 -0.20199755 -1.885849  0.3782459 -0.5847543 -0.2217648  1.1775233
row1 -0.03661473 -1.916804 -1.0911076 -1.6640710  0.9112650 -0.3285622
         [,14]     [,15]     [,16]     [,17]      [,18]      [,19]       [,20]
row3 -0.695332 1.0511305  1.176790 1.0301034  0.9782270 -1.6876544 -0.50695276
row1 -0.859589 0.9386665 -2.196072 0.2712571 -0.1774191  0.7444282  0.09231892
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]     [,2]       [,3]      [,4]       [,5]       [,6]     [,7]
row2 -0.64505 2.476847 0.06564678 -1.759704 -0.2504844 -0.8876197 1.922485
           [,8]         [,9]     [,10]
row2 -0.8988956 0.0006305222 0.4483738
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]      [,4]       [,5]        [,6]       [,7]
row5 0.0199142 -0.6907483 0.3560494 -1.903161 -0.8726784 0.004969085 -0.2890695
           [,8]      [,9]      [,10]     [,11]    [,12]     [,13]      [,14]
row5 -0.9354055 0.2012445 -0.9067713 -1.121592 2.017135 -1.326204 -0.6540554
          [,15]     [,16]    [,17]    [,18]     [,19]     [,20]
row5 0.04490112 0.5979913 2.014615 -1.14668 -1.026504 0.8843672
> 
> 
> 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: 0x7fb6c8f4e860>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b14f2b885"
 [2] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b4b302e81"
 [3] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b483d3db7"
 [4] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b2c9ede6e"
 [5] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b721d1ea4"
 [6] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b55c6db83"
 [7] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b7275a173"
 [8] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b8babfba" 
 [9] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b1c8150d0"
[10] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b6de0964e"
[11] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b33ac133d"
[12] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b6623244b"
[13] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198bd23ec50" 
[14] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198b316f7eed"
[15] "/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM198bef612f6" 
> 
> 
> ### 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: 0x7fb6c8c2bc40>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7fb6c8c2bc40>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7fb6c8c2bc40>
> rowMedians(tmp)
  [1]  0.0003803568  0.1946579185 -0.1152450352 -0.0695813639  0.1288260568
  [6]  0.1985770010 -0.0451578018 -0.1837573953 -0.2823614541  0.3093502214
 [11] -0.1133678507  0.1897303645  0.3155512828  0.4539182819  0.2293478295
 [16]  0.0360983373  0.2991363435 -0.8717438753  0.1098875367  0.5377958301
 [21]  0.3651682366  0.3395522351  0.3815584168  0.1754240883  0.3350170381
 [26]  0.0312077118  0.0511848362  0.1169769566 -0.0760101043  0.2221201414
 [31]  0.1273623317  0.0355256077 -0.3528208120 -0.0063271627 -0.0787912769
 [36] -0.0015149435 -0.1049277660  0.0386119558 -0.6219857030  0.0315781855
 [41] -0.3072357984  0.6181183723 -0.5233127781 -0.0037794137 -0.0239478747
 [46]  0.3297577745  0.1642953000  0.4794966881  0.2983869691  0.2427912058
 [51] -0.6192085161  0.0107165916  0.0788156903  0.2217816869 -0.1042505314
 [56] -0.1879249605  0.2682903808  0.1479735078  0.0798324041  0.6675346224
 [61]  0.3682561405 -0.5706730774 -0.1011478076  0.0523648657  0.3161473476
 [66] -0.1938076599  0.2586980973  0.1069990302 -0.4588528971 -0.3308704328
 [71]  0.3213076522 -0.1287248536  0.4093443794  0.2225614514  0.1859103361
 [76] -0.1305226179 -0.5242797827  0.3374013195 -0.1646312204 -0.2668855922
 [81]  0.2023854459 -0.0742815199 -0.3722849724 -0.1696385505 -0.2222364355
 [86] -0.1094770032 -0.6189767943  0.4134353708 -0.0505109744  0.4947339388
 [91] -0.4416382573  0.2327863836 -0.3437905604 -0.1105724113 -0.2406977497
 [96]  0.3975304302  0.4525723964 -0.0344787017 -0.3198746501  0.2958267297
[101] -0.6336029294  0.3560727356  0.0913693456  0.3981992804  0.2191697579
[106] -0.0360292899  0.4222488344 -0.1368570539  0.0646210285 -0.2991317477
[111] -0.4978371267  0.5885439419 -1.0096506176  0.2184124259 -0.1856598133
[116] -0.3407981639  0.1475721261 -0.6202145781 -0.2319814509 -0.2505210689
[121] -0.2280261492  0.0192247846 -0.1325360345  0.2230355833  0.1421325010
[126]  0.1030913808 -0.2025212531  0.3002118070 -0.0481001530  0.2973054568
[131]  0.1043302887 -0.1760280236  0.1895445817 -0.1733237907  0.5141677563
[136]  0.0076601490 -0.0947824997 -0.0899103269  0.1299670870 -0.6454313513
[141] -0.2349073260 -0.0480188449 -0.3177620144 -0.2782750316  0.2353832318
[146]  0.2992137336 -0.8535404330  0.1050823849 -0.3764950619  0.2189814224
[151] -0.4226322647  0.0908014217  0.1613750801 -0.0321950967  0.1717881483
[156] -0.1591715277 -0.6326997670 -0.5367306101 -0.1696503325 -0.5965736714
[161] -0.1213619203 -0.2650785387 -0.3835393987 -0.3867993835 -0.1497037174
[166] -0.0670951696 -0.1571383392  0.0531551725 -0.3216648721  0.2020433747
[171]  0.0095477528 -0.1038246921 -0.0735587312  0.3844595837 -0.0098094883
[176]  0.4047988127 -0.2346751610  0.2663610835 -0.0721839951 -0.3958089231
[181]  0.1291414896  0.3676493168  0.1476975673 -0.2135495720  0.1405200889
[186] -0.0110973905  0.4848991579 -0.1620439699  0.4563074267  0.0255171509
[191]  0.2896456012  0.5879663584  0.0903522786  0.0781741327  0.1676185149
[196]  0.4260834555  0.0805125345  0.1658014558  0.1515420925 -0.1828608923
[201]  0.3092377986  0.3894705235 -0.2857174535  0.3136468339 -0.0703851667
[206]  0.1789683143  0.1802302716  0.3304256625  0.0807245929 -0.1907585889
[211] -0.3384780679 -0.1389029787  0.7592582007  0.1386311449  0.4494808245
[216] -0.6526946531 -0.1466737221  0.0551555166  0.2394726217 -0.0905209365
[221]  0.3857512993 -0.2574978208 -0.5894263569 -0.1042696504 -0.6035500040
[226]  0.1674974325  0.5634226395 -0.2534476706 -0.4163831865 -0.7027786311
> 
> proc.time()
   user  system elapsed 
  6.455  15.544  23.911 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2019-03-18 r76245) -- "Unsuffered Consequences"
Copyright (C) 2019 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: 0x7fdfc2d00000>
> .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: 0x7fdfc2d00000>
> .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: 0x7fdfc2d00000>
> .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: 0x7fdfc2d00000>
> 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: 0x7fdfcd000aa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fdfcd000aa0>
> .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: 0x7fdfcd000aa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fdfcd000aa0>
> .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: 0x7fdfcd000aa0>
> 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: 0x7fdfc2e00250>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fdfc2e00250>
> .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: 0x7fdfc2e00250>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fdfc2e00250>
> .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: 0x7fdfc2e00250>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7fdfc2e00250>
> .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: 0x7fdfc2e00250>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7fdfc2e00250>
> .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: 0x7fdfc2e00250>
> 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: 0x7fdfc2e003e0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7fdfc2e003e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fdfc2e003e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fdfc2e003e0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1eab5886bb95" "BufferedMatrixFile1eab7585609a"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1eab5886bb95" "BufferedMatrixFile1eab7585609a"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fdfcd000db0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fdfcd000db0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fdfcd000db0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fdfcd000db0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7fdfcd000db0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7fdfcd000db0>
> .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: 0x7fdfc2f00270>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fdfc2f00270>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fdfc2f00270>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7fdfc2f00270>
> 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: 0x7fdfcd100130>
> .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: 0x7fdfcd100130>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.605   0.244   0.800 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2019-03-18 r76245) -- "Unsuffered Consequences"
Copyright (C) 2019 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.546   0.160   0.650 

Example timings