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

CHECK report for BufferedMatrix on merida1

This page was generated on 2020-08-10 12:30:39 -0400 (Mon, 10 Aug 2020).

TO THE DEVELOPERS/MAINTAINERS OF THE BufferedMatrix PACKAGE: Please make sure to use the following settings in order to reproduce any error or warning you see on this page.
Package 205/1882HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.53.0
Ben Bolstad
Snapshot Date: 2020-08-09 14:51:29 -0400 (Sun, 09 Aug 2020)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: master
Last Commit: 35d9382
Last Changed Date: 2020-04-27 14:14:34 -0400 (Mon, 27 Apr 2020)
malbec1 Linux (Ubuntu 18.04.4 LTS) / x86_64  OK  OK  OK UNNEEDED, same version exists in internal repository
nebbiolo1 Linux (Ubuntu 20.04.1 LTS) / x86_64  OK  OK  OK 
tokay1 Windows Server 2012 R2 Standard / x64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository
merida1 macOS 10.14.6 Mojave / x86_64  OK  OK [ OK ] OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.53.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.53.0.tar.gz
StartedAt: 2020-08-09 22:49:50 -0400 (Sun, 09 Aug 2020)
EndedAt: 2020-08-09 22:50:40 -0400 (Sun, 09 Aug 2020)
EllapsedTime: 50.6 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.53.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.0.2 (2020-06-22)
* using platform: x86_64-apple-darwin17.0 (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.53.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.12-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/4.0/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -mmacosx-version-min=10.13 -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 -mmacosx-version-min=10.13 -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 -mmacosx-version-min=10.13 -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 -mmacosx-version-min=10.13 -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/4.0/Resources/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.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.451   0.123   0.554 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.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.12-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 442409 23.7     954447   51         NA   619157 33.1
Vcells 798714  6.1    8388608   64      65536  1935182 14.8
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sun Aug  9 22:50:15 2020"
> 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] "Sun Aug  9 22:50:15 2020"
> 
> 
> 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: 0x7ff04bd20360>
> 
> 
> 
> 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] "Sun Aug  9 22:50:19 2020"
> 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] "Sun Aug  9 22:50:20 2020"
> 
> ColMode(tmp2)
<pointer: 0x7ff04bd20360>
> 
> 
> 
> ### 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.7083475  1.4762178 -0.05256453 -0.25481440
[2,]   1.6897667  0.4412554 -2.03249606  0.01987284
[3,]  -0.1942917 -0.4366895  0.22330883  0.23047221
[4,]  -0.8166410 -2.9174948  1.79208139 -1.28153890
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]       [,3]       [,4]
[1,] 100.7083475 1.4762178 0.05256453 0.25481440
[2,]   1.6897667 0.4412554 2.03249606 0.01987284
[3,]   0.1942917 0.4366895 0.22330883 0.23047221
[4,]   0.8166410 2.9174948 1.79208139 1.28153890
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0353549 1.2149970 0.2292695 0.5047914
[2,]  1.2999103 0.6642706 1.4256564 0.1409710
[3,]  0.4407854 0.6608248 0.4725556 0.4800752
[4,]  0.9036819 1.7080676 1.3386864 1.1320508
> 
> 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.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 226.06190 38.62619 27.34526 30.30273
[2,]  39.68887 32.08396 41.28906 26.42958
[3,]  29.60215 32.04494 29.94887 30.03122
[4,]  34.85346 44.99817 40.17895 37.60205
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7ff04bd30a60>
> exp(tmp5)
<pointer: 0x7ff04bd30a60>
> log(tmp5,2)
<pointer: 0x7ff04bd30a60>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.5182
> Min(tmp5)
[1] 54.31654
> mean(tmp5)
[1] 72.42269
> Sum(tmp5)
[1] 14484.54
> Var(tmp5)
[1] 873.8304
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 88.13572 72.32952 69.94144 72.25225 71.60884 69.63917 68.65615 74.10149
 [9] 68.33840 69.22398
> rowSums(tmp5)
 [1] 1762.714 1446.590 1398.829 1445.045 1432.177 1392.783 1373.123 1482.030
 [9] 1366.768 1384.480
> rowVars(tmp5)
 [1] 8149.98333   78.33782   60.88809   88.35150  121.21351   63.31207
 [7]  100.84913   53.41171   56.29919   58.08021
> rowSd(tmp5)
 [1] 90.277258  8.850865  7.803082  9.399548 11.009701  7.956888 10.042367
 [8]  7.308332  7.503279  7.621037
> rowMax(tmp5)
 [1] 470.51822  86.42417  82.76087  93.65780  98.50813  83.64024  87.28562
 [8]  89.30030  81.36479  82.33175
> rowMin(tmp5)
 [1] 56.91558 55.00971 54.64817 58.87079 54.31654 55.23704 54.87637 55.39478
 [9] 55.53070 55.77668
> 
> colMeans(tmp5)
 [1] 109.66686  70.40315  69.48829  68.84095  68.98561  73.37315  71.15578
 [8]  66.31772  71.00329  72.48690  75.12725  69.29039  66.65275  64.76641
[15]  70.73349  73.16267  73.45527  69.09912  71.96641  72.47845
> colSums(tmp5)
 [1] 1096.6686  704.0315  694.8829  688.4095  689.8561  733.7315  711.5578
 [8]  663.1772  710.0329  724.8690  751.2725  692.9039  666.5275  647.6641
[15]  707.3349  731.6267  734.5527  690.9912  719.6641  724.7845
> colVars(tmp5)
 [1] 16124.48899   133.32698   146.82156    63.90949    37.09968   115.36720
 [7]    46.30555    72.09307    77.10542    47.45503    93.01631    87.72069
[13]    51.14463    40.65960    25.42309    75.48796    80.91233    89.35164
[19]    67.85102    78.02256
> colSd(tmp5)
 [1] 126.982239  11.546730  12.116995   7.994341   6.090951  10.740912
 [7]   6.804818   8.490764   8.780969   6.888761   9.644496   9.365932
[13]   7.151548   6.376488   5.042132   8.688381   8.995128   9.452600
[19]   8.237173   8.833038
> colMax(tmp5)
 [1] 470.51822  93.65780  85.93777  82.33175  78.14914  98.50813  80.66946
 [8]  77.49311  82.76087  83.64024  89.30030  82.78931  77.15873  73.10443
[15]  77.30923  85.50918  87.28562  83.29321  81.39948  90.34838
> colMin(tmp5)
 [1] 58.54395 54.31654 55.39478 55.00971 59.42945 61.36020 55.83844 55.53070
 [9] 56.78551 59.92874 58.87079 54.64817 55.35250 54.87637 61.71711 57.93331
[17] 57.71368 55.23704 57.63387 60.59828
> 
> 
> ### 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] 88.13572 72.32952 69.94144 72.25225 71.60884 69.63917 68.65615 74.10149
 [9]       NA 69.22398
> rowSums(tmp5)
 [1] 1762.714 1446.590 1398.829 1445.045 1432.177 1392.783 1373.123 1482.030
 [9]       NA 1384.480
> rowVars(tmp5)
 [1] 8149.98333   78.33782   60.88809   88.35150  121.21351   63.31207
 [7]  100.84913   53.41171   54.87733   58.08021
> rowSd(tmp5)
 [1] 90.277258  8.850865  7.803082  9.399548 11.009701  7.956888 10.042367
 [8]  7.308332  7.407923  7.621037
> rowMax(tmp5)
 [1] 470.51822  86.42417  82.76087  93.65780  98.50813  83.64024  87.28562
 [8]  89.30030        NA  82.33175
> rowMin(tmp5)
 [1] 56.91558 55.00971 54.64817 58.87079 54.31654 55.23704 54.87637 55.39478
 [9]       NA 55.77668
> 
> colMeans(tmp5)
 [1] 109.66686  70.40315  69.48829  68.84095  68.98561  73.37315  71.15578
 [8]  66.31772  71.00329  72.48690  75.12725  69.29039        NA  64.76641
[15]  70.73349  73.16267  73.45527  69.09912  71.96641  72.47845
> colSums(tmp5)
 [1] 1096.6686  704.0315  694.8829  688.4095  689.8561  733.7315  711.5578
 [8]  663.1772  710.0329  724.8690  751.2725  692.9039        NA  647.6641
[15]  707.3349  731.6267  734.5527  690.9912  719.6641  724.7845
> colVars(tmp5)
 [1] 16124.48899   133.32698   146.82156    63.90949    37.09968   115.36720
 [7]    46.30555    72.09307    77.10542    47.45503    93.01631    87.72069
[13]          NA    40.65960    25.42309    75.48796    80.91233    89.35164
[19]    67.85102    78.02256
> colSd(tmp5)
 [1] 126.982239  11.546730  12.116995   7.994341   6.090951  10.740912
 [7]   6.804818   8.490764   8.780969   6.888761   9.644496   9.365932
[13]         NA   6.376488   5.042132   8.688381   8.995128   9.452600
[19]   8.237173   8.833038
> colMax(tmp5)
 [1] 470.51822  93.65780  85.93777  82.33175  78.14914  98.50813  80.66946
 [8]  77.49311  82.76087  83.64024  89.30030  82.78931        NA  73.10443
[15]  77.30923  85.50918  87.28562  83.29321  81.39948  90.34838
> colMin(tmp5)
 [1] 58.54395 54.31654 55.39478 55.00971 59.42945 61.36020 55.83844 55.53070
 [9] 56.78551 59.92874 58.87079 54.64817       NA 54.87637 61.71711 57.93331
[17] 57.71368 55.23704 57.63387 60.59828
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.5182
> Min(tmp5,na.rm=TRUE)
[1] 54.31654
> mean(tmp5,na.rm=TRUE)
[1] 72.3989
> Sum(tmp5,na.rm=TRUE)
[1] 14407.38
> Var(tmp5,na.rm=TRUE)
[1] 878.1299
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.13572 72.32952 69.94144 72.25225 71.60884 69.63917 68.65615 74.10149
 [9] 67.87417 69.22398
> rowSums(tmp5,na.rm=TRUE)
 [1] 1762.714 1446.590 1398.829 1445.045 1432.177 1392.783 1373.123 1482.030
 [9] 1289.609 1384.480
> rowVars(tmp5,na.rm=TRUE)
 [1] 8149.98333   78.33782   60.88809   88.35150  121.21351   63.31207
 [7]  100.84913   53.41171   54.87733   58.08021
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.277258  8.850865  7.803082  9.399548 11.009701  7.956888 10.042367
 [8]  7.308332  7.407923  7.621037
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.51822  86.42417  82.76087  93.65780  98.50813  83.64024  87.28562
 [8]  89.30030  81.36479  82.33175
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.91558 55.00971 54.64817 58.87079 54.31654 55.23704 54.87637 55.39478
 [9] 55.53070 55.77668
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.66686  70.40315  69.48829  68.84095  68.98561  73.37315  71.15578
 [8]  66.31772  71.00329  72.48690  75.12725  69.29039  65.48542  64.76641
[15]  70.73349  73.16267  73.45527  69.09912  71.96641  72.47845
> colSums(tmp5,na.rm=TRUE)
 [1] 1096.6686  704.0315  694.8829  688.4095  689.8561  733.7315  711.5578
 [8]  663.1772  710.0329  724.8690  751.2725  692.9039  589.3687  647.6641
[15]  707.3349  731.6267  734.5527  690.9912  719.6641  724.7845
> colVars(tmp5,na.rm=TRUE)
 [1] 16124.48899   133.32698   146.82156    63.90949    37.09968   115.36720
 [7]    46.30555    72.09307    77.10542    47.45503    93.01631    87.72069
[13]    42.20776    40.65960    25.42309    75.48796    80.91233    89.35164
[19]    67.85102    78.02256
> colSd(tmp5,na.rm=TRUE)
 [1] 126.982239  11.546730  12.116995   7.994341   6.090951  10.740912
 [7]   6.804818   8.490764   8.780969   6.888761   9.644496   9.365932
[13]   6.496750   6.376488   5.042132   8.688381   8.995128   9.452600
[19]   8.237173   8.833038
> colMax(tmp5,na.rm=TRUE)
 [1] 470.51822  93.65780  85.93777  82.33175  78.14914  98.50813  80.66946
 [8]  77.49311  82.76087  83.64024  89.30030  82.78931  74.61733  73.10443
[15]  77.30923  85.50918  87.28562  83.29321  81.39948  90.34838
> colMin(tmp5,na.rm=TRUE)
 [1] 58.54395 54.31654 55.39478 55.00971 59.42945 61.36020 55.83844 55.53070
 [9] 56.78551 59.92874 58.87079 54.64817 55.35250 54.87637 61.71711 57.93331
[17] 57.71368 55.23704 57.63387 60.59828
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.13572 72.32952 69.94144 72.25225 71.60884 69.63917 68.65615 74.10149
 [9]      NaN 69.22398
> rowSums(tmp5,na.rm=TRUE)
 [1] 1762.714 1446.590 1398.829 1445.045 1432.177 1392.783 1373.123 1482.030
 [9]    0.000 1384.480
> rowVars(tmp5,na.rm=TRUE)
 [1] 8149.98333   78.33782   60.88809   88.35150  121.21351   63.31207
 [7]  100.84913   53.41171         NA   58.08021
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.277258  8.850865  7.803082  9.399548 11.009701  7.956888 10.042367
 [8]  7.308332        NA  7.621037
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.51822  86.42417  82.76087  93.65780  98.50813  83.64024  87.28562
 [8]  89.30030        NA  82.33175
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.91558 55.00971 54.64817 58.87079 54.31654 55.23704 54.87637 55.39478
 [9]       NA 55.77668
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.48326  70.12657  68.54421  68.50299  69.41576  74.70792  71.62592
 [8]  67.51628  70.57479  72.68503  75.39687  69.79797       NaN  65.47490
[15]  71.50657  73.85442  75.20433  69.92013  70.92215  71.78461
> colSums(tmp5,na.rm=TRUE)
 [1] 1030.3493  631.1392  616.8979  616.5269  624.7418  672.3713  644.6333
 [8]  607.6465  635.1731  654.1653  678.5719  628.1817    0.0000  589.2741
[15]  643.5591  664.6898  676.8390  629.2812  638.2993  646.0615
> colVars(tmp5,na.rm=TRUE)
 [1] 17879.07590   149.13230   155.14733    70.61325    39.65555   109.74491
 [7]    49.60714    64.94362    84.67804    52.94527   103.82551    95.78732
[13]          NA    40.09506    21.87751    79.54062    56.61003    92.93750
[19]    64.06440    82.35944
> colSd(tmp5,na.rm=TRUE)
 [1] 133.712662  12.211974  12.455815   8.403169   6.297266  10.475920
 [7]   7.043233   8.058761   9.202067   7.276350  10.189480   9.787100
[13]         NA   6.332066   4.677341   8.918555   7.523964   9.640409
[19]   8.004024   9.075210
> colMax(tmp5,na.rm=TRUE)
 [1] 470.51822  93.65780  85.93777  82.33175  78.14914  98.50813  80.66946
 [8]  77.49311  82.76087  83.64024  89.30030  82.78931      -Inf  73.10443
[15]  77.30923  85.50918  87.28562  83.29321  81.39948  90.34838
> colMin(tmp5,na.rm=TRUE)
 [1] 58.54395 54.31654 55.39478 55.00971 59.42945 62.22471 55.83844 56.15615
 [9] 56.78551 59.92874 58.87079 54.64817      Inf 54.87637 61.71711 57.93331
[17] 67.54461 55.23704 57.63387 60.59828
> 
> 
> 
> 
> 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] 313.1432 402.7136 178.5376 144.2883 188.2224 132.8227 297.9817 224.4078
 [9] 187.8287 167.7887
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 313.1432 402.7136 178.5376 144.2883 188.2224 132.8227 297.9817 224.4078
 [9] 187.8287 167.7887
> 
> 
> 
> 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  3.410605e-13  0.000000e+00 -2.842171e-14  0.000000e+00
 [6]  2.842171e-14  0.000000e+00  1.136868e-13 -1.421085e-13 -2.842171e-14
[11]  0.000000e+00 -2.842171e-14 -3.410605e-13  0.000000e+00 -1.705303e-13
[16]  5.684342e-14 -5.684342e-14 -2.842171e-14  5.684342e-14  3.552714e-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)
+ }
7   12 
10   13 
10   3 
9   13 
2   11 
8   13 
3   16 
8   17 
9   4 
9   11 
10   16 
4   17 
5   1 
9   10 
2   5 
4   9 
7   1 
9   17 
9   6 
1   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.204388
> Min(tmp)
[1] -2.604505
> mean(tmp)
[1] -0.1155776
> Sum(tmp)
[1] -11.55776
> Var(tmp)
[1] 0.8648141
> 
> rowMeans(tmp)
[1] -0.1155776
> rowSums(tmp)
[1] -11.55776
> rowVars(tmp)
[1] 0.8648141
> rowSd(tmp)
[1] 0.9299538
> rowMax(tmp)
[1] 2.204388
> rowMin(tmp)
[1] -2.604505
> 
> colMeans(tmp)
  [1] -0.53237042  1.53317642 -2.04790332 -0.67577644  0.71967310 -0.65287573
  [7] -0.67562204  1.14744440 -0.69952139 -0.55017484  0.19314342  0.23630527
 [13] -1.04948745 -1.74270163 -1.01542025 -0.91209168 -2.06470092  0.85118699
 [19]  1.50605773 -0.33116805 -0.36349982 -1.47433867  1.04381475  0.82446492
 [25] -1.09645563  0.70365061  0.17058874 -0.16930269 -0.54803965  0.41900424
 [31]  0.47394204  0.07978419  0.82842052  1.95949505 -0.42703856 -0.18342889
 [37] -0.13934607  0.06901705 -0.29659692 -0.38229963  0.58030433 -0.42067765
 [43]  0.16350934 -0.11733883  0.17057726  0.55511325 -0.56543624 -0.53636250
 [49] -1.01387122  0.22621942  2.05152238  2.20438850  0.35347197  1.64649792
 [55]  0.45421110  0.06855233  0.31277535 -1.45518137 -0.66329621  0.57586554
 [61] -0.83567870 -1.63107971 -0.37437413  0.24721288  0.35758617  0.71520861
 [67]  0.08124478 -1.08053177  1.13890360 -0.80623035 -0.31041771 -0.78868065
 [73] -0.94768650 -1.42770628  0.52469184 -1.84196467 -0.09554239 -0.84533481
 [79]  0.93954963 -0.57187925 -1.58723874  0.55893620 -0.43754518 -0.53811929
 [85]  0.83047964  0.03971541  0.27855497 -0.45545035 -0.46862011 -0.86766127
 [91]  0.94492283  1.60849276 -0.42969723 -0.41493938  0.80555939  0.27996572
 [97] -2.60450550 -0.13949607 -0.29246748 -0.43579401
> colSums(tmp)
  [1] -0.53237042  1.53317642 -2.04790332 -0.67577644  0.71967310 -0.65287573
  [7] -0.67562204  1.14744440 -0.69952139 -0.55017484  0.19314342  0.23630527
 [13] -1.04948745 -1.74270163 -1.01542025 -0.91209168 -2.06470092  0.85118699
 [19]  1.50605773 -0.33116805 -0.36349982 -1.47433867  1.04381475  0.82446492
 [25] -1.09645563  0.70365061  0.17058874 -0.16930269 -0.54803965  0.41900424
 [31]  0.47394204  0.07978419  0.82842052  1.95949505 -0.42703856 -0.18342889
 [37] -0.13934607  0.06901705 -0.29659692 -0.38229963  0.58030433 -0.42067765
 [43]  0.16350934 -0.11733883  0.17057726  0.55511325 -0.56543624 -0.53636250
 [49] -1.01387122  0.22621942  2.05152238  2.20438850  0.35347197  1.64649792
 [55]  0.45421110  0.06855233  0.31277535 -1.45518137 -0.66329621  0.57586554
 [61] -0.83567870 -1.63107971 -0.37437413  0.24721288  0.35758617  0.71520861
 [67]  0.08124478 -1.08053177  1.13890360 -0.80623035 -0.31041771 -0.78868065
 [73] -0.94768650 -1.42770628  0.52469184 -1.84196467 -0.09554239 -0.84533481
 [79]  0.93954963 -0.57187925 -1.58723874  0.55893620 -0.43754518 -0.53811929
 [85]  0.83047964  0.03971541  0.27855497 -0.45545035 -0.46862011 -0.86766127
 [91]  0.94492283  1.60849276 -0.42969723 -0.41493938  0.80555939  0.27996572
 [97] -2.60450550 -0.13949607 -0.29246748 -0.43579401
> 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.53237042  1.53317642 -2.04790332 -0.67577644  0.71967310 -0.65287573
  [7] -0.67562204  1.14744440 -0.69952139 -0.55017484  0.19314342  0.23630527
 [13] -1.04948745 -1.74270163 -1.01542025 -0.91209168 -2.06470092  0.85118699
 [19]  1.50605773 -0.33116805 -0.36349982 -1.47433867  1.04381475  0.82446492
 [25] -1.09645563  0.70365061  0.17058874 -0.16930269 -0.54803965  0.41900424
 [31]  0.47394204  0.07978419  0.82842052  1.95949505 -0.42703856 -0.18342889
 [37] -0.13934607  0.06901705 -0.29659692 -0.38229963  0.58030433 -0.42067765
 [43]  0.16350934 -0.11733883  0.17057726  0.55511325 -0.56543624 -0.53636250
 [49] -1.01387122  0.22621942  2.05152238  2.20438850  0.35347197  1.64649792
 [55]  0.45421110  0.06855233  0.31277535 -1.45518137 -0.66329621  0.57586554
 [61] -0.83567870 -1.63107971 -0.37437413  0.24721288  0.35758617  0.71520861
 [67]  0.08124478 -1.08053177  1.13890360 -0.80623035 -0.31041771 -0.78868065
 [73] -0.94768650 -1.42770628  0.52469184 -1.84196467 -0.09554239 -0.84533481
 [79]  0.93954963 -0.57187925 -1.58723874  0.55893620 -0.43754518 -0.53811929
 [85]  0.83047964  0.03971541  0.27855497 -0.45545035 -0.46862011 -0.86766127
 [91]  0.94492283  1.60849276 -0.42969723 -0.41493938  0.80555939  0.27996572
 [97] -2.60450550 -0.13949607 -0.29246748 -0.43579401
> colMin(tmp)
  [1] -0.53237042  1.53317642 -2.04790332 -0.67577644  0.71967310 -0.65287573
  [7] -0.67562204  1.14744440 -0.69952139 -0.55017484  0.19314342  0.23630527
 [13] -1.04948745 -1.74270163 -1.01542025 -0.91209168 -2.06470092  0.85118699
 [19]  1.50605773 -0.33116805 -0.36349982 -1.47433867  1.04381475  0.82446492
 [25] -1.09645563  0.70365061  0.17058874 -0.16930269 -0.54803965  0.41900424
 [31]  0.47394204  0.07978419  0.82842052  1.95949505 -0.42703856 -0.18342889
 [37] -0.13934607  0.06901705 -0.29659692 -0.38229963  0.58030433 -0.42067765
 [43]  0.16350934 -0.11733883  0.17057726  0.55511325 -0.56543624 -0.53636250
 [49] -1.01387122  0.22621942  2.05152238  2.20438850  0.35347197  1.64649792
 [55]  0.45421110  0.06855233  0.31277535 -1.45518137 -0.66329621  0.57586554
 [61] -0.83567870 -1.63107971 -0.37437413  0.24721288  0.35758617  0.71520861
 [67]  0.08124478 -1.08053177  1.13890360 -0.80623035 -0.31041771 -0.78868065
 [73] -0.94768650 -1.42770628  0.52469184 -1.84196467 -0.09554239 -0.84533481
 [79]  0.93954963 -0.57187925 -1.58723874  0.55893620 -0.43754518 -0.53811929
 [85]  0.83047964  0.03971541  0.27855497 -0.45545035 -0.46862011 -0.86766127
 [91]  0.94492283  1.60849276 -0.42969723 -0.41493938  0.80555939  0.27996572
 [97] -2.60450550 -0.13949607 -0.29246748 -0.43579401
> colMedians(tmp)
  [1] -0.53237042  1.53317642 -2.04790332 -0.67577644  0.71967310 -0.65287573
  [7] -0.67562204  1.14744440 -0.69952139 -0.55017484  0.19314342  0.23630527
 [13] -1.04948745 -1.74270163 -1.01542025 -0.91209168 -2.06470092  0.85118699
 [19]  1.50605773 -0.33116805 -0.36349982 -1.47433867  1.04381475  0.82446492
 [25] -1.09645563  0.70365061  0.17058874 -0.16930269 -0.54803965  0.41900424
 [31]  0.47394204  0.07978419  0.82842052  1.95949505 -0.42703856 -0.18342889
 [37] -0.13934607  0.06901705 -0.29659692 -0.38229963  0.58030433 -0.42067765
 [43]  0.16350934 -0.11733883  0.17057726  0.55511325 -0.56543624 -0.53636250
 [49] -1.01387122  0.22621942  2.05152238  2.20438850  0.35347197  1.64649792
 [55]  0.45421110  0.06855233  0.31277535 -1.45518137 -0.66329621  0.57586554
 [61] -0.83567870 -1.63107971 -0.37437413  0.24721288  0.35758617  0.71520861
 [67]  0.08124478 -1.08053177  1.13890360 -0.80623035 -0.31041771 -0.78868065
 [73] -0.94768650 -1.42770628  0.52469184 -1.84196467 -0.09554239 -0.84533481
 [79]  0.93954963 -0.57187925 -1.58723874  0.55893620 -0.43754518 -0.53811929
 [85]  0.83047964  0.03971541  0.27855497 -0.45545035 -0.46862011 -0.86766127
 [91]  0.94492283  1.60849276 -0.42969723 -0.41493938  0.80555939  0.27996572
 [97] -2.60450550 -0.13949607 -0.29246748 -0.43579401
> colRanges(tmp)
           [,1]     [,2]      [,3]       [,4]      [,5]       [,6]      [,7]
[1,] -0.5323704 1.533176 -2.047903 -0.6757764 0.7196731 -0.6528757 -0.675622
[2,] -0.5323704 1.533176 -2.047903 -0.6757764 0.7196731 -0.6528757 -0.675622
         [,8]       [,9]      [,10]     [,11]     [,12]     [,13]     [,14]
[1,] 1.147444 -0.6995214 -0.5501748 0.1931434 0.2363053 -1.049487 -1.742702
[2,] 1.147444 -0.6995214 -0.5501748 0.1931434 0.2363053 -1.049487 -1.742702
        [,15]      [,16]     [,17]    [,18]    [,19]      [,20]      [,21]
[1,] -1.01542 -0.9120917 -2.064701 0.851187 1.506058 -0.3311681 -0.3634998
[2,] -1.01542 -0.9120917 -2.064701 0.851187 1.506058 -0.3311681 -0.3634998
         [,22]    [,23]     [,24]     [,25]     [,26]     [,27]      [,28]
[1,] -1.474339 1.043815 0.8244649 -1.096456 0.7036506 0.1705887 -0.1693027
[2,] -1.474339 1.043815 0.8244649 -1.096456 0.7036506 0.1705887 -0.1693027
          [,29]     [,30]    [,31]      [,32]     [,33]    [,34]      [,35]
[1,] -0.5480396 0.4190042 0.473942 0.07978419 0.8284205 1.959495 -0.4270386
[2,] -0.5480396 0.4190042 0.473942 0.07978419 0.8284205 1.959495 -0.4270386
          [,36]      [,37]      [,38]      [,39]      [,40]     [,41]
[1,] -0.1834289 -0.1393461 0.06901705 -0.2965969 -0.3822996 0.5803043
[2,] -0.1834289 -0.1393461 0.06901705 -0.2965969 -0.3822996 0.5803043
          [,42]     [,43]      [,44]     [,45]     [,46]      [,47]      [,48]
[1,] -0.4206776 0.1635093 -0.1173388 0.1705773 0.5551133 -0.5654362 -0.5363625
[2,] -0.4206776 0.1635093 -0.1173388 0.1705773 0.5551133 -0.5654362 -0.5363625
         [,49]     [,50]    [,51]    [,52]    [,53]    [,54]     [,55]
[1,] -1.013871 0.2262194 2.051522 2.204388 0.353472 1.646498 0.4542111
[2,] -1.013871 0.2262194 2.051522 2.204388 0.353472 1.646498 0.4542111
          [,56]     [,57]     [,58]      [,59]     [,60]      [,61]    [,62]
[1,] 0.06855233 0.3127753 -1.455181 -0.6632962 0.5758655 -0.8356787 -1.63108
[2,] 0.06855233 0.3127753 -1.455181 -0.6632962 0.5758655 -0.8356787 -1.63108
          [,63]     [,64]     [,65]     [,66]      [,67]     [,68]    [,69]
[1,] -0.3743741 0.2472129 0.3575862 0.7152086 0.08124478 -1.080532 1.138904
[2,] -0.3743741 0.2472129 0.3575862 0.7152086 0.08124478 -1.080532 1.138904
          [,70]      [,71]      [,72]      [,73]     [,74]     [,75]     [,76]
[1,] -0.8062304 -0.3104177 -0.7886806 -0.9476865 -1.427706 0.5246918 -1.841965
[2,] -0.8062304 -0.3104177 -0.7886806 -0.9476865 -1.427706 0.5246918 -1.841965
           [,77]      [,78]     [,79]      [,80]     [,81]     [,82]      [,83]
[1,] -0.09554239 -0.8453348 0.9395496 -0.5718792 -1.587239 0.5589362 -0.4375452
[2,] -0.09554239 -0.8453348 0.9395496 -0.5718792 -1.587239 0.5589362 -0.4375452
          [,84]     [,85]      [,86]    [,87]      [,88]      [,89]      [,90]
[1,] -0.5381193 0.8304796 0.03971541 0.278555 -0.4554503 -0.4686201 -0.8676613
[2,] -0.5381193 0.8304796 0.03971541 0.278555 -0.4554503 -0.4686201 -0.8676613
         [,91]    [,92]      [,93]      [,94]     [,95]     [,96]     [,97]
[1,] 0.9449228 1.608493 -0.4296972 -0.4149394 0.8055594 0.2799657 -2.604505
[2,] 0.9449228 1.608493 -0.4296972 -0.4149394 0.8055594 0.2799657 -2.604505
          [,98]      [,99]    [,100]
[1,] -0.1394961 -0.2924675 -0.435794
[2,] -0.1394961 -0.2924675 -0.435794
> 
> 
> Max(tmp2)
[1] 2.039078
> Min(tmp2)
[1] -2.471936
> mean(tmp2)
[1] -0.2287827
> Sum(tmp2)
[1] -22.87827
> Var(tmp2)
[1] 1.201987
> 
> rowMeans(tmp2)
  [1] -1.98821747  0.16621678  1.25231651 -0.60568918 -0.92242986  0.65951876
  [7]  1.09384725 -0.38609612  0.65398798 -0.15169896  1.03410883 -0.01026969
 [13] -1.37221318 -2.30988400  0.17574119 -2.47193635 -1.09347990  1.03218859
 [19] -1.35918908  0.51857471  1.59998049  0.63189092 -0.39203227 -1.33459746
 [25]  0.36536222  1.26159909  0.26110609  0.39696722 -1.10114137  0.62454525
 [31]  0.04318901 -0.98153754 -1.20470432 -0.95051576 -1.79258075 -0.25891470
 [37] -2.40782162 -0.81327594  0.38515663 -0.30241540  0.56926236 -2.03332694
 [43]  0.06126335 -0.41599586 -1.22481850  2.03206010  0.34276718 -1.31321465
 [49]  1.59427924 -0.69104775 -0.01394984 -1.74372130  2.03907782 -2.26815767
 [55]  0.79417378 -0.07398022  1.19293199  0.47891312 -0.15687420 -1.78036889
 [61] -2.32101159 -1.05032775 -0.96312801 -1.00316002 -0.59390424 -1.91559946
 [67] -0.65148064  1.34009977  1.01366635  0.07160535 -0.68103196  0.97121302
 [73] -0.71239174 -1.15820831 -0.64256535 -0.75334428  0.56484979 -1.45033294
 [79] -1.21234505 -0.29498673  0.63017967  1.59084436  1.90140276  0.26418054
 [85] -0.48323860  1.90147978 -0.38443808 -0.15500092 -0.15295101 -1.39594971
 [91] -0.80293339  1.10519238 -0.40647014 -0.62741543 -1.04491863  0.06163140
 [97]  0.83978627 -0.39434538  0.90035923 -0.11821147
> rowSums(tmp2)
  [1] -1.98821747  0.16621678  1.25231651 -0.60568918 -0.92242986  0.65951876
  [7]  1.09384725 -0.38609612  0.65398798 -0.15169896  1.03410883 -0.01026969
 [13] -1.37221318 -2.30988400  0.17574119 -2.47193635 -1.09347990  1.03218859
 [19] -1.35918908  0.51857471  1.59998049  0.63189092 -0.39203227 -1.33459746
 [25]  0.36536222  1.26159909  0.26110609  0.39696722 -1.10114137  0.62454525
 [31]  0.04318901 -0.98153754 -1.20470432 -0.95051576 -1.79258075 -0.25891470
 [37] -2.40782162 -0.81327594  0.38515663 -0.30241540  0.56926236 -2.03332694
 [43]  0.06126335 -0.41599586 -1.22481850  2.03206010  0.34276718 -1.31321465
 [49]  1.59427924 -0.69104775 -0.01394984 -1.74372130  2.03907782 -2.26815767
 [55]  0.79417378 -0.07398022  1.19293199  0.47891312 -0.15687420 -1.78036889
 [61] -2.32101159 -1.05032775 -0.96312801 -1.00316002 -0.59390424 -1.91559946
 [67] -0.65148064  1.34009977  1.01366635  0.07160535 -0.68103196  0.97121302
 [73] -0.71239174 -1.15820831 -0.64256535 -0.75334428  0.56484979 -1.45033294
 [79] -1.21234505 -0.29498673  0.63017967  1.59084436  1.90140276  0.26418054
 [85] -0.48323860  1.90147978 -0.38443808 -0.15500092 -0.15295101 -1.39594971
 [91] -0.80293339  1.10519238 -0.40647014 -0.62741543 -1.04491863  0.06163140
 [97]  0.83978627 -0.39434538  0.90035923 -0.11821147
> 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.98821747  0.16621678  1.25231651 -0.60568918 -0.92242986  0.65951876
  [7]  1.09384725 -0.38609612  0.65398798 -0.15169896  1.03410883 -0.01026969
 [13] -1.37221318 -2.30988400  0.17574119 -2.47193635 -1.09347990  1.03218859
 [19] -1.35918908  0.51857471  1.59998049  0.63189092 -0.39203227 -1.33459746
 [25]  0.36536222  1.26159909  0.26110609  0.39696722 -1.10114137  0.62454525
 [31]  0.04318901 -0.98153754 -1.20470432 -0.95051576 -1.79258075 -0.25891470
 [37] -2.40782162 -0.81327594  0.38515663 -0.30241540  0.56926236 -2.03332694
 [43]  0.06126335 -0.41599586 -1.22481850  2.03206010  0.34276718 -1.31321465
 [49]  1.59427924 -0.69104775 -0.01394984 -1.74372130  2.03907782 -2.26815767
 [55]  0.79417378 -0.07398022  1.19293199  0.47891312 -0.15687420 -1.78036889
 [61] -2.32101159 -1.05032775 -0.96312801 -1.00316002 -0.59390424 -1.91559946
 [67] -0.65148064  1.34009977  1.01366635  0.07160535 -0.68103196  0.97121302
 [73] -0.71239174 -1.15820831 -0.64256535 -0.75334428  0.56484979 -1.45033294
 [79] -1.21234505 -0.29498673  0.63017967  1.59084436  1.90140276  0.26418054
 [85] -0.48323860  1.90147978 -0.38443808 -0.15500092 -0.15295101 -1.39594971
 [91] -0.80293339  1.10519238 -0.40647014 -0.62741543 -1.04491863  0.06163140
 [97]  0.83978627 -0.39434538  0.90035923 -0.11821147
> rowMin(tmp2)
  [1] -1.98821747  0.16621678  1.25231651 -0.60568918 -0.92242986  0.65951876
  [7]  1.09384725 -0.38609612  0.65398798 -0.15169896  1.03410883 -0.01026969
 [13] -1.37221318 -2.30988400  0.17574119 -2.47193635 -1.09347990  1.03218859
 [19] -1.35918908  0.51857471  1.59998049  0.63189092 -0.39203227 -1.33459746
 [25]  0.36536222  1.26159909  0.26110609  0.39696722 -1.10114137  0.62454525
 [31]  0.04318901 -0.98153754 -1.20470432 -0.95051576 -1.79258075 -0.25891470
 [37] -2.40782162 -0.81327594  0.38515663 -0.30241540  0.56926236 -2.03332694
 [43]  0.06126335 -0.41599586 -1.22481850  2.03206010  0.34276718 -1.31321465
 [49]  1.59427924 -0.69104775 -0.01394984 -1.74372130  2.03907782 -2.26815767
 [55]  0.79417378 -0.07398022  1.19293199  0.47891312 -0.15687420 -1.78036889
 [61] -2.32101159 -1.05032775 -0.96312801 -1.00316002 -0.59390424 -1.91559946
 [67] -0.65148064  1.34009977  1.01366635  0.07160535 -0.68103196  0.97121302
 [73] -0.71239174 -1.15820831 -0.64256535 -0.75334428  0.56484979 -1.45033294
 [79] -1.21234505 -0.29498673  0.63017967  1.59084436  1.90140276  0.26418054
 [85] -0.48323860  1.90147978 -0.38443808 -0.15500092 -0.15295101 -1.39594971
 [91] -0.80293339  1.10519238 -0.40647014 -0.62741543 -1.04491863  0.06163140
 [97]  0.83978627 -0.39434538  0.90035923 -0.11821147
> 
> colMeans(tmp2)
[1] -0.2287827
> colSums(tmp2)
[1] -22.87827
> colVars(tmp2)
[1] 1.201987
> colSd(tmp2)
[1] 1.096352
> colMax(tmp2)
[1] 2.039078
> colMin(tmp2)
[1] -2.471936
> colMedians(tmp2)
[1] -0.2769507
> colRanges(tmp2)
          [,1]
[1,] -2.471936
[2,]  2.039078
> 
> 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] -1.552229 -2.728260  4.888824  1.608654  2.156770  3.974526 -8.391531
 [8] -4.556312  2.748175  1.238384
> colApply(tmp,quantile)[,1]
             [,1]
[1,] -1.946460869
[2,] -0.552098619
[3,]  0.008906363
[4,]  0.498157685
[5,]  0.950996982
> 
> rowApply(tmp,sum)
 [1]  1.087501  1.587336  2.113874  4.012317  1.191257 -3.292192 -3.229692
 [8] -3.485563  3.664963 -4.262800
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9   10    6    1    3    6    6    3    7     7
 [2,]    5    8    8    4    8    3    5    1    3     8
 [3,]    1    4    7    6   10    5    9    9   10     9
 [4,]    4    5    4    9    4    4    8    7    5     3
 [5,]    3    3    1   10    2    7    7   10    1    10
 [6,]    6    6    5    7    6   10   10    5    8     2
 [7,]    7    1    3    3    1    1    3    2    4     4
 [8,]    2    9    2    2    5    8    2    6    2     1
 [9,]   10    7   10    5    9    2    4    8    6     6
[10,]    8    2    9    8    7    9    1    4    9     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.2251450 -2.8367117  0.5801519 -1.8541372  1.4526946 -0.8780132
 [7]  0.3256030 -2.4849597  1.0810739 -1.6178004  0.3859108  0.3088448
[13] -4.1052229  4.4003404 -1.9286738 -1.1994012 -1.8429118  0.3976580
[19] -3.3343841  5.9893639
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.0736016
[2,]  0.1555916
[3,]  0.9192982
[4,]  1.0057340
[5,]  1.2181228
> 
> rowApply(tmp,sum)
[1] -7.097846 -8.565839  1.665237  5.926231  3.136788
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    4   17   14   14   16
[2,]   10    8    1   12    6
[3,]   18    9   16   15    2
[4,]   12   10   10   11    4
[5,]   14   14   12   10   17
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]        [,5]        [,6]
[1,] -1.0736016 -0.4819757  0.4055396 -0.3089988  0.06187325  0.19754252
[2,]  0.1555916 -0.7278559 -0.7128541 -0.6049401 -0.02324248 -0.06423777
[3,]  0.9192982 -1.4854730  0.9420713 -0.1280504  0.28210565  0.07763909
[4,]  1.2181228  0.4136390  1.2358954  0.1423310  0.12599295 -0.78474397
[5,]  1.0057340 -0.5550461 -1.2905002 -0.9544788  1.00596521 -0.30421304
            [,7]       [,8]      [,9]       [,10]      [,11]      [,12]
[1,] -0.60890048 -0.5691171  0.637622 -0.71722248 -0.8165283  0.1313871
[2,] -1.26293500 -0.5316668 -1.328272  0.07953857 -0.9784785 -0.9563888
[3,]  0.92267017 -1.0596514  1.390975 -0.51727943  3.0083686 -1.0155044
[4,]  0.04004401 -0.9447439  1.465765 -1.42225117 -0.2914882  2.9649841
[5,]  1.23472431  0.6202195 -1.085016  0.95941407 -0.5359627 -0.8156331
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -0.3677716 -1.2557454 -0.1682793  1.2786203 -0.6478239 -1.9725369
[2,]  0.5226269  1.2616327 -0.3042357 -1.1676853 -1.9274615  0.8445714
[3,] -0.4053748  0.5817401 -0.4723701 -1.3100557 -1.4765690  1.2764217
[4,] -2.3888591  2.5568473 -1.5334050  0.4767130  1.8408682 -0.4248913
[5,] -1.4658442  1.2558658  0.5496163 -0.4769935  0.3680743  0.6740931
          [,19]      [,20]
[1,] -1.1013715 0.27944250
[2,] -0.8535994 0.01405252
[3,] -1.1893234 1.32359811
[4,] -0.8941624 2.12957411
[5,]  0.7040726 2.24269666
> 
> 
> 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.12-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.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.12-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.514709 -0.03461057 -1.866285 -0.6058925 0.3307569 0.0443483 -1.227572
          col8       col9      col10     col11    col12      col13     col14
row1 0.3049637 -0.7975452 -0.7241307 0.4517633 1.054104 0.02533745 -2.554792
         col15     col16      col17     col18     col19     col20
row1 0.6723518 0.2958514 -0.5455678 0.9581388 -1.221072 -1.456321
> tmp[,"col10"]
          col10
row1 -0.7241307
row2  0.6268290
row3 -0.5780852
row4 -0.9220065
row5 -0.1905269
> tmp[c("row1","row5"),]
           col1        col2       col3       col4       col5       col6
row1 -1.5147092 -0.03461057 -1.8662848 -0.6058925  0.3307569  0.0443483
row5 -0.3295767  0.79539475 -0.4482731  0.3989629 -0.3270080 -0.8401979
           col7       col8       col9      col10      col11      col12
row1 -1.2275722  0.3049637 -0.7975452 -0.7241307  0.4517633  1.0541038
row5 -0.8356424 -0.7229682  0.4040929 -0.1905269 -0.1957687 -0.1539832
          col13     col14      col15     col16      col17     col18       col19
row1 0.02533745 -2.554792  0.6723518 0.2958514 -0.5455678 0.9581388 -1.22107154
row5 0.69503078 -1.116795 -0.4116917 0.7648036  0.4946570 0.8151683  0.06637917
         col20
row1 -1.456321
row5 -1.964678
> tmp[,c("col6","col20")]
           col6      col20
row1  0.0443483 -1.4563214
row2 -1.0186843  0.6994637
row3  1.6452327 -0.5206033
row4  2.1228751  0.2528577
row5 -0.8401979 -1.9646784
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1  0.0443483 -1.456321
row5 -0.8401979 -1.964678
> 
> 
> 
> 
> 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.85813 49.61488 50.57943 48.85758 49.78228 103.4216 49.4702 49.9827
      col9    col10    col11    col12    col13    col14    col15    col16
row1 50.14 48.01187 49.78983 50.37291 52.09071 49.91877 50.12464 50.71643
        col17    col18    col19    col20
row1 48.78672 49.72591 49.20507 104.6954
> tmp[,"col10"]
        col10
row1 48.01187
row2 29.51992
row3 29.79060
row4 30.24990
row5 49.62253
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.85813 49.61488 50.57943 48.85758 49.78228 103.4216 49.47020 49.98270
row5 49.65404 48.88930 49.18364 50.43900 51.03279 104.3809 49.39501 50.30765
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.14000 48.01187 49.78983 50.37291 52.09071 49.91877 50.12464 50.71643
row5 50.91239 49.62253 51.21469 50.73736 49.36662 49.38234 47.84479 50.31939
        col17    col18    col19    col20
row1 48.78672 49.72591 49.20507 104.6954
row5 50.50635 50.51991 49.73512 104.4613
> tmp[,c("col6","col20")]
          col6     col20
row1 103.42156 104.69541
row2  74.39642  76.37658
row3  75.59707  75.27675
row4  76.79129  75.76554
row5 104.38086 104.46128
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.4216 104.6954
row5 104.3809 104.4613
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.4216 104.6954
row5 104.3809 104.4613
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.2097997
[2,] -2.1522842
[3,]  0.4832141
[4,]  0.7018518
[5,]  0.3287695
> tmp[,c("col17","col7")]
           col17        col7
[1,] 0.826725245 -1.32483440
[2,] 1.289759287  1.33863261
[3,] 2.770685612 -0.83001622
[4,] 0.230657757  0.49897300
[5,] 0.001466269 -0.01189797
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.2402919  0.6431116
[2,]  1.2696379  0.1468949
[3,]  2.0569966  0.5256459
[4,] -0.8016669 -2.2214120
[5,]  0.4794535  1.6305119
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.2402919
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.2402919
[2,]  1.2696379
> 
> 
> 
> 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.9369965 0.7966426 1.5806061 0.6751381 -0.9971776  0.07448151 -0.2961963
row1 -0.1982144 0.6531240 0.6152889 0.5959835  1.5376684 -0.07363219  1.2640149
          [,8]        [,9]     [,10]      [,11]       [,12]     [,13]     [,14]
row3 0.5895635 -0.03759709 -1.530480 -0.5373237  0.06055322 0.4390867 0.6536772
row1 1.9005865 -0.46543865  0.979317 -0.3079540 -0.33583297 0.6044311 1.4474804
          [,15]      [,16]      [,17]       [,18]     [,19]      [,20]
row3 -0.9687926 -0.9663627 -1.2362432 -0.05066783 0.5615239  0.0556308
row1  0.7050013 -0.3339876  0.3084652  0.97433331 1.9581273 -0.6143647
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]       [,2]    [,3]       [,4]       [,5]       [,6]      [,7]
row2 1.087187 -0.1291359 1.04229 -0.9791763 -0.9782488 -0.1498792 0.3825572
         [,8]      [,9]     [,10]
row2 0.162973 -1.274119 0.9569869
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
        [,1]      [,2]      [,3]     [,4]       [,5]     [,6]      [,7]
row5 0.25827 -1.101315 0.1824437 1.021811 -0.3800347 1.140096 0.4654224
         [,8]      [,9]     [,10]     [,11]     [,12]     [,13]     [,14]
row5 1.404417 0.5887318 0.2688957 0.3959475 0.6293665 0.3211981 0.9272858
         [,15]    [,16]     [,17]      [,18]      [,19]  [,20]
row5 -1.484419 2.226356 0.2136387 -0.5708123 -0.2690088 1.9675
> 
> 
> 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: 0x7ff08e91c240>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b45966148"
 [2] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b13cce1a9"
 [3] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b6ff32866"
 [4] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b44e179f5"
 [5] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b2f0de727"
 [6] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b39c2c993"
 [7] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b233fef85"
 [8] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b3a8616d7"
 [9] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b39459b45"
[10] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b8d4ec63" 
[11] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b52eb5c1c"
[12] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b59ec5ccb"
[13] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b2cc0418c"
[14] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b20f6548" 
[15] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1592b40c25b06"
> 
> 
> ### 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: 0x7ff02bc3b2e0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7ff02bc3b2e0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7ff02bc3b2e0>
> rowMedians(tmp)
  [1]  0.0606792450  0.2379704663 -0.2026971107 -0.4370859406  0.0464144849
  [6] -0.0546061957  0.1443653938  0.2467113265  0.2056297323 -0.2757898972
 [11]  0.3701984736 -0.2700282328  0.4696784459 -0.2687136515  0.1541022132
 [16] -0.6953695248 -0.1058077846  0.6387682424  0.0399627035 -0.0843748043
 [21]  0.1819174406  0.3938773382  0.4093272418 -0.0049454009  0.3217817639
 [26]  0.0069999269  0.2068830435 -0.1757208561 -0.5785634965 -0.1638984962
 [31]  0.2100023167  0.2260388926 -0.3588052588  0.0161140357  0.3193908766
 [36]  0.2717336339  0.0938630755 -0.1757031690 -0.0653358434  0.0489657648
 [41] -0.5394491555 -0.1693392945  0.4353204117  0.1191705055  0.4242265696
 [46] -0.2373960876  0.2370757480 -0.2777761516 -0.0304073040 -0.3140391270
 [51] -0.1816541921  0.1107501079  0.0216494516  0.1698302419  0.2851317114
 [56]  0.0373011585  0.3297724012  0.1647593677  0.2887034317 -0.4571187571
 [61] -0.0113879701 -0.2495173156 -0.0810862562 -0.3802034474  0.6048212419
 [66] -0.2471170277 -0.2328286374  0.2099393928 -0.2356931750  0.4654764059
 [71]  0.0004484859  0.6207096779 -0.4225206414 -0.2404775555  0.2910355528
 [76]  0.4438897136  0.4384357937 -0.1528504184 -0.0058216874 -0.0969040538
 [81] -0.1078536292 -0.3751767425  0.0351741313  0.0530366284  0.1533448335
 [86]  0.3255900863 -0.2120639838 -0.1643509805 -0.4785841614 -0.5017017034
 [91] -0.1900002720 -0.3531014577  0.2455015776  0.4016343282 -0.2294209088
 [96]  0.0662833837  0.2450868294 -0.3418276381  0.4719129932 -0.1303690271
[101] -0.1373902881  0.4331129297  0.0831397968  0.2490051860  0.0976864891
[106] -0.0422261283 -0.0762196168 -0.1003253432  0.0245204908 -0.2711258322
[111]  0.0544033100 -0.3850719845  0.5798455575 -0.2947351352 -0.4623194704
[116] -0.0248483918  0.0674587042  0.2423276596  0.1993337460  0.1280851345
[121]  0.1281911747  0.7416182767  0.2857033664 -0.0693852387 -0.0175746769
[126] -0.2567980466 -0.2670860574 -0.1417139085 -0.3259660999  0.5551493078
[131] -0.2210185536  0.1441365303 -0.2027461322 -0.4822549256  0.2150273990
[136] -0.1643689423 -0.0280030851 -0.5923582818 -0.0524817994 -0.1595059388
[141] -0.1464563063 -0.0684649015 -0.4006280072 -0.1713834739 -0.4966397545
[146]  0.1310521789 -0.1237458081 -0.4391293461 -0.4970157854 -0.5088780780
[151] -0.2286369015 -0.0363642847 -0.3093140382 -0.5550865079  0.1421163764
[156] -0.0212572979  0.2754732017 -0.0623156904  0.5517780563  0.2080249606
[161] -0.1761376622  0.3076073337 -0.3867734554 -0.3039697834  0.2005135829
[166] -0.3026475013 -0.2602294907  0.2140439719 -0.3917640502 -0.3578550204
[171] -0.4494516290  0.2917918597  0.1037564406 -0.3015797336  0.2966788183
[176] -0.1373854478  0.0014189288 -0.0224167205  0.0979586040  0.3296003740
[181] -0.1109115507  0.1491541787  0.0965504796  0.0184366697  0.2005585978
[186]  0.4448818256 -0.4246192983 -0.3305468369  0.1618852145 -0.0535877213
[191] -0.4670574181 -0.6398950835  0.0561515700 -0.3887408891 -0.2194983358
[196] -0.0117179774  0.0686686062  0.4458839794  0.1277472349  0.2530265004
[201]  0.3944291443 -0.2817791823 -0.1033353580  0.5722470266  0.0545353187
[206] -0.3579046863  0.0816049415  0.0616204461  0.5182303448 -0.0470578144
[211] -0.0778554445  0.1752321193 -0.2758957869  0.1464393106  0.1773510881
[216]  0.2157994413  0.3403449286  0.1684778240 -0.2441959259  0.0149618977
[221] -0.6382798131 -0.2840256997 -0.3448850059 -0.0142480951 -0.1909479623
[226]  0.2607055903 -0.1206667614 -0.1541487989 -0.5607012071  0.0565859002
> 
> proc.time()
   user  system elapsed 
  3.695  12.155  16.350 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.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: 0x7f7efa8714a0>
> .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: 0x7f7efa8714a0>
> .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: 0x7f7efa8714a0>
> .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: 0x7f7efa8714a0>
> 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: 0x7f7f4ec2df80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f7f4ec2df80>
> .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: 0x7f7f4ec2df80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f7f4ec2df80>
> .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: 0x7f7f4ec2df80>
> 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: 0x7f7eeef00990>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f7eeef00990>
> .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: 0x7f7eeef00990>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7f7eeef00990>
> .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: 0x7f7eeef00990>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7f7eeef00990>
> .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: 0x7f7eeef00990>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7f7eeef00990>
> .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: 0x7f7eeef00990>
> 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: 0x7f7eeef01f90>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7f7eeef01f90>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f7eeef01f90>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f7eeef01f90>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile160331d4de635" "BufferedMatrixFile160336544b09a"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile160331d4de635" "BufferedMatrixFile160336544b09a"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f7eeed08340>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f7eeed08340>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7f7eeed08340>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7f7eeed08340>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7f7eeed08340>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7f7eeed08340>
> .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: 0x7f7eeed08610>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f7eeed08610>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7f7eeed08610>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7f7eeed08610>
> 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: 0x7f7eeed089f0>
> .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: 0x7f7eeed089f0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.448   0.124   0.549 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.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.452   0.080   0.510 

Example timings