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

CHECK report for BufferedMatrix on celaya2

This page was generated on 2020-01-16 13:30:37 -0500 (Thu, 16 Jan 2020).

Package 204/1818HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.51.0
Ben Bolstad
Snapshot Date: 2020-01-15 16:46:30 -0500 (Wed, 15 Jan 2020)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: master
Last Commit: d49733d
Last Changed Date: 2019-10-29 13:34:45 -0500 (Tue, 29 Oct 2019)
malbec2 Linux (Ubuntu 18.04.3 LTS) / x86_64  OK  OK  OK UNNEEDED, same version exists in internal repository
tokay2 Windows Server 2012 R2 Standard / x64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository
celaya2 OS X 10.11.6 El Capitan / x86_64  OK  OK [ OK ] OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.51.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.51.0.tar.gz
StartedAt: 2020-01-16 02:21:56 -0500 (Thu, 16 Jan 2020)
EndedAt: 2020-01-16 02:23:18 -0500 (Thu, 16 Jan 2020)
EllapsedTime: 81.9 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.51.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2019-12-14 r77572)
* using platform: x86_64-apple-darwin15.6.0 (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.51.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.11-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 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ~
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -Wall -g -O2  -c init_package.c -o init_package.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/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 Under development (unstable) (2019-12-14 r77572) -- "Unsuffered Consequences"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix", "BufferedMatrix", .libPaths());.C("dbm_c_tester",integer(1))

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

Adding Additional Column
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 

Reassigning values
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 3
Buffer Cols: 3
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Activating Row Buffer
In row mode: 1
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Squaring Last Column
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 900.000000 

Square rooting Last Row, then turing off Row Buffer
In row mode: 0
Checking on value that should be not be in column buffer2.236068 
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
2.236068 3.162278 3.872983 4.472136 5.000000 30.000000 

Single Indexing. Assign each value its square
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Resizing Buffers Smaller
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Activating Row Mode.
Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
Activating ReadOnly Mode.
The results of assignment is: 0
Printing matrix reversed.
900.000000 625.000000 400.000000 225.000000 100.000000 25.000000 
841.000000 576.000000 361.000000 196.000000 81.000000 16.000000 
784.000000 529.000000 324.000000 169.000000 64.000000 9.000000 
729.000000 484.000000 289.000000 144.000000 49.000000 -30.000000 
676.000000 441.000000 256.000000 121.000000 -20.000000 -10.000000 

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.655   0.253   0.887 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2019-12-14 r77572) -- "Unsuffered Consequences"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/Users/biocbuild/bbs-3.11-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 436192 23.3     939642 50.2         NA   613240 32.8
Vcells 794252  6.1    8388608 64.0      57344  1925579 14.7
> 
> 
> 
> 
> ##
> ## 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] "Thu Jan 16 02:22:31 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] "Thu Jan 16 02:22:32 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: 0x7fa4aaf00000>
> 
> 
> 
> 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] "Thu Jan 16 02:22:41 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] "Thu Jan 16 02:22:43 2020"
> 
> ColMode(tmp2)
<pointer: 0x7fa4aaf00000>
> 
> 
> 
> ### 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.22365440 -1.4383998  0.3213328  0.7691372
[2,]  -0.00458162 -0.5204305 -0.2289651 -0.1647033
[3,]  -0.90515477  0.3016663 -1.0856307  0.8925107
[4,]   0.13940984 -0.7502074 -1.3922005  1.0762080
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
             [,1]      [,2]      [,3]      [,4]
[1,] 100.22365440 1.4383998 0.3213328 0.7691372
[2,]   0.00458162 0.5204305 0.2289651 0.1647033
[3,]   0.90515477 0.3016663 1.0856307 0.8925107
[4,]   0.13940984 0.7502074 1.3922005 1.0762080
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 10.01117647 1.1993331 0.5668622 0.8770047
[2,]  0.06768767 0.7214087 0.4785030 0.4058365
[3,]  0.95139622 0.5492416 1.0419360 0.9447279
[4,]  0.37337627 0.8661451 1.1799154 1.0374045
> 
> 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.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.33542 38.43173 30.98995 34.53918
[2,]  25.68146 32.73452 30.01399 29.22307
[3,]  35.41912 30.79408 36.50499 35.33979
[4,]  28.87317 34.41166 38.19135 36.45025
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7fa4aab162f0>
> exp(tmp5)
<pointer: 0x7fa4aab162f0>
> log(tmp5,2)
<pointer: 0x7fa4aab162f0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.0062
> Min(tmp5)
[1] 52.4792
> mean(tmp5)
[1] 71.86726
> Sum(tmp5)
[1] 14373.45
> Var(tmp5)
[1] 867.4237
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 87.13614 70.34676 67.05792 69.28744 69.63975 72.68117 68.63148 72.47461
 [9] 72.03395 69.38341
> rowSums(tmp5)
 [1] 1742.723 1406.935 1341.158 1385.749 1392.795 1453.623 1372.630 1449.492
 [9] 1440.679 1387.668
> rowVars(tmp5)
 [1] 8125.17750   91.47771   66.99327  100.87254   39.66845   72.92588
 [7]   59.91060   73.45205   77.80647   73.78861
> rowSd(tmp5)
 [1] 90.139766  9.564398  8.184942 10.043532  6.298289  8.539665  7.740194
 [8]  8.570417  8.820798  8.590030
> rowMax(tmp5)
 [1] 469.00615  87.65759  84.82933  84.12617  77.67691  86.23145  79.96218
 [8]  84.93529  89.46242  89.48251
> rowMin(tmp5)
 [1] 55.81196 53.45259 55.62694 52.58347 59.70446 61.24530 52.47920 53.84640
 [9] 56.53221 57.61547
> 
> colMeans(tmp5)
 [1] 107.93611  71.77963  72.20384  71.21901  67.72173  70.99489  74.51508
 [8]  64.55329  67.54257  65.14764  73.29862  71.95185  66.27076  71.85255
[15]  69.58769  74.54868  70.96064  68.53195  66.30584  70.42290
> colSums(tmp5)
 [1] 1079.3611  717.7963  722.0384  712.1901  677.2173  709.9489  745.1508
 [8]  645.5329  675.4257  651.4764  732.9862  719.5185  662.7076  718.5255
[15]  695.8769  745.4868  709.6064  685.3195  663.0584  704.2290
> colVars(tmp5)
 [1] 16140.73709    55.11389    43.20758    70.96216    42.84601    84.00774
 [7]    71.22670    75.25517    57.88286    38.23778   129.46009    80.18848
[13]    74.45808    74.12902    67.76703    59.13155    45.42505   100.20249
[19]    92.83191    71.59123
> colSd(tmp5)
 [1] 127.046201   7.423873   6.573247   8.423904   6.545686   9.165573
 [7]   8.439591   8.674974   7.608079   6.183670  11.378053   8.954802
[13]   8.628910   8.609821   8.232073   7.689704   6.739811  10.010119
[19]   9.634932   8.461160
> colMax(tmp5)
 [1] 469.00615  80.66825  80.35865  83.53735  76.71229  83.06171  89.46242
 [8]  79.82060  82.51505  74.90713  89.48251  86.23145  83.71774  86.17588
[15]  84.12617  86.04564  80.63816  84.93529  87.65759  84.82933
> colMin(tmp5)
 [1] 53.45259 58.85189 62.47020 58.84459 57.61547 55.38458 58.38632 52.47920
 [9] 58.77969 57.05505 56.53221 59.52333 56.82221 57.68491 55.78634 63.77392
[17] 60.57484 52.58347 53.84640 56.59483
> 
> 
> ### 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] 87.13614 70.34676 67.05792 69.28744 69.63975 72.68117 68.63148       NA
 [9] 72.03395 69.38341
> rowSums(tmp5)
 [1] 1742.723 1406.935 1341.158 1385.749 1392.795 1453.623 1372.630       NA
 [9] 1440.679 1387.668
> rowVars(tmp5)
 [1] 8125.17750   91.47771   66.99327  100.87254   39.66845   72.92588
 [7]   59.91060   70.97794   77.80647   73.78861
> rowSd(tmp5)
 [1] 90.139766  9.564398  8.184942 10.043532  6.298289  8.539665  7.740194
 [8]  8.424841  8.820798  8.590030
> rowMax(tmp5)
 [1] 469.00615  87.65759  84.82933  84.12617  77.67691  86.23145  79.96218
 [8]        NA  89.46242  89.48251
> rowMin(tmp5)
 [1] 55.81196 53.45259 55.62694 52.58347 59.70446 61.24530 52.47920       NA
 [9] 56.53221 57.61547
> 
> colMeans(tmp5)
 [1] 107.93611  71.77963  72.20384  71.21901  67.72173        NA  74.51508
 [8]  64.55329  67.54257  65.14764  73.29862  71.95185  66.27076  71.85255
[15]  69.58769  74.54868  70.96064  68.53195  66.30584  70.42290
> colSums(tmp5)
 [1] 1079.3611  717.7963  722.0384  712.1901  677.2173        NA  745.1508
 [8]  645.5329  675.4257  651.4764  732.9862  719.5185  662.7076  718.5255
[15]  695.8769  745.4868  709.6064  685.3195  663.0584  704.2290
> colVars(tmp5)
 [1] 16140.73709    55.11389    43.20758    70.96216    42.84601          NA
 [7]    71.22670    75.25517    57.88286    38.23778   129.46009    80.18848
[13]    74.45808    74.12902    67.76703    59.13155    45.42505   100.20249
[19]    92.83191    71.59123
> colSd(tmp5)
 [1] 127.046201   7.423873   6.573247   8.423904   6.545686         NA
 [7]   8.439591   8.674974   7.608079   6.183670  11.378053   8.954802
[13]   8.628910   8.609821   8.232073   7.689704   6.739811  10.010119
[19]   9.634932   8.461160
> colMax(tmp5)
 [1] 469.00615  80.66825  80.35865  83.53735  76.71229        NA  89.46242
 [8]  79.82060  82.51505  74.90713  89.48251  86.23145  83.71774  86.17588
[15]  84.12617  86.04564  80.63816  84.93529  87.65759  84.82933
> colMin(tmp5)
 [1] 53.45259 58.85189 62.47020 58.84459 57.61547       NA 58.38632 52.47920
 [9] 58.77969 57.05505 56.53221 59.52333 56.82221 57.68491 55.78634 63.77392
[17] 60.57484 52.58347 53.84640 56.59483
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.0062
> Min(tmp5,na.rm=TRUE)
[1] 52.4792
> mean(tmp5,na.rm=TRUE)
[1] 71.81101
> Sum(tmp5,na.rm=TRUE)
[1] 14290.39
> Var(tmp5,na.rm=TRUE)
[1] 871.1686
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 87.13614 70.34676 67.05792 69.28744 69.63975 72.68117 68.63148 71.91740
 [9] 72.03395 69.38341
> rowSums(tmp5,na.rm=TRUE)
 [1] 1742.723 1406.935 1341.158 1385.749 1392.795 1453.623 1372.630 1366.431
 [9] 1440.679 1387.668
> rowVars(tmp5,na.rm=TRUE)
 [1] 8125.17750   91.47771   66.99327  100.87254   39.66845   72.92588
 [7]   59.91060   70.97794   77.80647   73.78861
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.139766  9.564398  8.184942 10.043532  6.298289  8.539665  7.740194
 [8]  8.424841  8.820798  8.590030
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.00615  87.65759  84.82933  84.12617  77.67691  86.23145  79.96218
 [8]  84.93529  89.46242  89.48251
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.81196 53.45259 55.62694 52.58347 59.70446 61.24530 52.47920 53.84640
 [9] 56.53221 57.61547
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 107.93611  71.77963  72.20384  71.21901  67.72173  69.65414  74.51508
 [8]  64.55329  67.54257  65.14764  73.29862  71.95185  66.27076  71.85255
[15]  69.58769  74.54868  70.96064  68.53195  66.30584  70.42290
> colSums(tmp5,na.rm=TRUE)
 [1] 1079.3611  717.7963  722.0384  712.1901  677.2173  626.8872  745.1508
 [8]  645.5329  675.4257  651.4764  732.9862  719.5185  662.7076  718.5255
[15]  695.8769  745.4868  709.6064  685.3195  663.0584  704.2290
> colVars(tmp5,na.rm=TRUE)
 [1] 16140.73709    55.11389    43.20758    70.96216    42.84601    74.28537
 [7]    71.22670    75.25517    57.88286    38.23778   129.46009    80.18848
[13]    74.45808    74.12902    67.76703    59.13155    45.42505   100.20249
[19]    92.83191    71.59123
> colSd(tmp5,na.rm=TRUE)
 [1] 127.046201   7.423873   6.573247   8.423904   6.545686   8.618896
 [7]   8.439591   8.674974   7.608079   6.183670  11.378053   8.954802
[13]   8.628910   8.609821   8.232073   7.689704   6.739811  10.010119
[19]   9.634932   8.461160
> colMax(tmp5,na.rm=TRUE)
 [1] 469.00615  80.66825  80.35865  83.53735  76.71229  78.86540  89.46242
 [8]  79.82060  82.51505  74.90713  89.48251  86.23145  83.71774  86.17588
[15]  84.12617  86.04564  80.63816  84.93529  87.65759  84.82933
> colMin(tmp5,na.rm=TRUE)
 [1] 53.45259 58.85189 62.47020 58.84459 57.61547 55.38458 58.38632 52.47920
 [9] 58.77969 57.05505 56.53221 59.52333 56.82221 57.68491 55.78634 63.77392
[17] 60.57484 52.58347 53.84640 56.59483
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 87.13614 70.34676 67.05792 69.28744 69.63975 72.68117 68.63148      NaN
 [9] 72.03395 69.38341
> rowSums(tmp5,na.rm=TRUE)
 [1] 1742.723 1406.935 1341.158 1385.749 1392.795 1453.623 1372.630    0.000
 [9] 1440.679 1387.668
> rowVars(tmp5,na.rm=TRUE)
 [1] 8125.17750   91.47771   66.99327  100.87254   39.66845   72.92588
 [7]   59.91060         NA   77.80647   73.78861
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.139766  9.564398  8.184942 10.043532  6.298289  8.539665  7.740194
 [8]        NA  8.820798  8.590030
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.00615  87.65759  84.82933  84.12617  77.67691  86.23145  79.96218
 [8]        NA  89.46242  89.48251
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.81196 53.45259 55.62694 52.58347 59.70446 61.24530 52.47920       NA
 [9] 56.53221 57.61547
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.56986  71.27936  71.29775  71.21372  66.87463       NaN  74.70820
 [8]  64.61889  67.68810  65.99891  72.03349  71.12958  64.85841  71.95255
[15]  69.09711  75.74588  71.21515  66.70935  67.69022  70.66031
> colSums(tmp5,na.rm=TRUE)
 [1] 1004.1287  641.5143  641.6798  640.9235  601.8717    0.0000  672.3738
 [8]  581.5700  609.1929  593.9902  648.3014  640.1662  583.7256  647.5729
[15]  621.8740  681.7129  640.9363  600.3842  609.2120  635.9428
> colVars(tmp5,na.rm=TRUE)
 [1] 18009.78264    59.18757    39.37229    79.83212    40.12901          NA
 [7]    79.71045    84.61365    64.87995    34.86498   127.63641    82.60563
[13]    61.32453    83.28267    73.53038    50.39862    50.37447    75.35703
[19]    82.87511    79.90607
> colSd(tmp5,na.rm=TRUE)
 [1] 134.200531   7.693346   6.274734   8.934882   6.334746         NA
 [7]   8.928071   9.198568   8.054809   5.904657  11.297628   9.088764
[13]   7.830998   9.125934   8.574986   7.099198   7.097497   8.680843
[19]   9.103577   8.939019
> colMax(tmp5,na.rm=TRUE)
 [1] 469.00615  80.66825  79.49030  83.53735  76.71229      -Inf  89.46242
 [8]  79.82060  82.51505  74.90713  89.48251  86.23145  83.71774  86.17588
[15]  84.12617  86.04564  80.63816  82.08136  87.65759  84.82933
> colMin(tmp5,na.rm=TRUE)
 [1] 53.45259 58.85189 62.47020 58.84459 57.61547      Inf 58.38632 52.47920
 [9] 58.77969 57.05505 56.53221 59.52333 56.82221 57.68491 55.78634 64.51218
[17] 60.57484 52.58347 60.55659 56.59483
> 
> 
> 
> 
> 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] 209.1274 217.5243 149.2622 307.6934 163.3477 190.3177 174.1755 311.5681
 [9] 184.7012 268.2842
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 209.1274 217.5243 149.2622 307.6934 163.3477 190.3177 174.1755 311.5681
 [9] 184.7012 268.2842
> 
> 
> 
> 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 -8.526513e-14  5.684342e-14  0.000000e+00 -2.842171e-14
 [6]  0.000000e+00  1.989520e-13  6.394885e-14 -1.136868e-13  1.136868e-13
[11] -5.684342e-14 -5.684342e-14  2.842171e-14  0.000000e+00  1.278977e-13
[16] -1.989520e-13 -8.526513e-14 -5.684342e-14 -1.421085e-13 -5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
4   2 
2   13 
4   1 
7   13 
7   1 
1   12 
9   7 
3   20 
6   17 
2   2 
6   5 
4   8 
7   2 
5   2 
2   11 
4   9 
7   6 
6   19 
6   13 
10   18 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.021676
> Min(tmp)
[1] -2.194107
> mean(tmp)
[1] -0.1116496
> Sum(tmp)
[1] -11.16496
> Var(tmp)
[1] 0.7983616
> 
> rowMeans(tmp)
[1] -0.1116496
> rowSums(tmp)
[1] -11.16496
> rowVars(tmp)
[1] 0.7983616
> rowSd(tmp)
[1] 0.8935108
> rowMax(tmp)
[1] 2.021676
> rowMin(tmp)
[1] -2.194107
> 
> colMeans(tmp)
  [1] -0.55453875 -0.82175565 -0.67508276  1.37678469 -1.30559095 -0.01849659
  [7]  0.51610652  0.27062140 -0.44757098 -0.88197208  0.29138475  1.82763445
 [13]  0.22583715 -0.23984503  1.06178172 -1.10849154  0.92805381  1.79779249
 [19]  0.70124979  0.46727958 -1.18605197 -0.74993128  0.50471143 -2.05733335
 [25] -0.27737599  0.60182852  1.44959770 -0.62807126  0.68684821  0.02475166
 [31]  0.44041621 -0.88263521 -0.77340752 -0.50054568  0.70419077  0.07128037
 [37] -0.15734885  0.86581062  2.02167635  0.51219526  0.05835508 -1.26712922
 [43] -0.19105790  0.22867336 -0.67885555 -0.17282169  0.21108856  0.49652454
 [49] -1.81687306  0.39512251  0.55141154 -2.19410705  0.27554164 -1.76126618
 [55]  0.83669333  0.37873492 -1.26416700 -0.67771525 -1.37092526 -0.11289677
 [61] -0.97265251 -0.46459574 -1.23654431  0.75497972 -0.32847769 -0.36774563
 [67]  0.28828231  1.08164025 -0.39454123 -1.02993713 -1.02803666 -1.28607654
 [73]  0.66004704 -0.12591463 -1.01346301  0.22176613  1.05000588  0.83182927
 [79]  0.27096866  0.62449293  0.34383230 -0.72389793 -1.18721372 -0.42117231
 [85] -0.44882241 -0.99906453  0.27168164  0.13697768  0.74650151  0.55987324
 [91] -2.00750985 -0.05948283 -1.23508678  1.21837233 -0.98688416 -1.03446527
 [97]  0.64828706 -0.35863779  0.58108546  0.24852486
> colSums(tmp)
  [1] -0.55453875 -0.82175565 -0.67508276  1.37678469 -1.30559095 -0.01849659
  [7]  0.51610652  0.27062140 -0.44757098 -0.88197208  0.29138475  1.82763445
 [13]  0.22583715 -0.23984503  1.06178172 -1.10849154  0.92805381  1.79779249
 [19]  0.70124979  0.46727958 -1.18605197 -0.74993128  0.50471143 -2.05733335
 [25] -0.27737599  0.60182852  1.44959770 -0.62807126  0.68684821  0.02475166
 [31]  0.44041621 -0.88263521 -0.77340752 -0.50054568  0.70419077  0.07128037
 [37] -0.15734885  0.86581062  2.02167635  0.51219526  0.05835508 -1.26712922
 [43] -0.19105790  0.22867336 -0.67885555 -0.17282169  0.21108856  0.49652454
 [49] -1.81687306  0.39512251  0.55141154 -2.19410705  0.27554164 -1.76126618
 [55]  0.83669333  0.37873492 -1.26416700 -0.67771525 -1.37092526 -0.11289677
 [61] -0.97265251 -0.46459574 -1.23654431  0.75497972 -0.32847769 -0.36774563
 [67]  0.28828231  1.08164025 -0.39454123 -1.02993713 -1.02803666 -1.28607654
 [73]  0.66004704 -0.12591463 -1.01346301  0.22176613  1.05000588  0.83182927
 [79]  0.27096866  0.62449293  0.34383230 -0.72389793 -1.18721372 -0.42117231
 [85] -0.44882241 -0.99906453  0.27168164  0.13697768  0.74650151  0.55987324
 [91] -2.00750985 -0.05948283 -1.23508678  1.21837233 -0.98688416 -1.03446527
 [97]  0.64828706 -0.35863779  0.58108546  0.24852486
> 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.55453875 -0.82175565 -0.67508276  1.37678469 -1.30559095 -0.01849659
  [7]  0.51610652  0.27062140 -0.44757098 -0.88197208  0.29138475  1.82763445
 [13]  0.22583715 -0.23984503  1.06178172 -1.10849154  0.92805381  1.79779249
 [19]  0.70124979  0.46727958 -1.18605197 -0.74993128  0.50471143 -2.05733335
 [25] -0.27737599  0.60182852  1.44959770 -0.62807126  0.68684821  0.02475166
 [31]  0.44041621 -0.88263521 -0.77340752 -0.50054568  0.70419077  0.07128037
 [37] -0.15734885  0.86581062  2.02167635  0.51219526  0.05835508 -1.26712922
 [43] -0.19105790  0.22867336 -0.67885555 -0.17282169  0.21108856  0.49652454
 [49] -1.81687306  0.39512251  0.55141154 -2.19410705  0.27554164 -1.76126618
 [55]  0.83669333  0.37873492 -1.26416700 -0.67771525 -1.37092526 -0.11289677
 [61] -0.97265251 -0.46459574 -1.23654431  0.75497972 -0.32847769 -0.36774563
 [67]  0.28828231  1.08164025 -0.39454123 -1.02993713 -1.02803666 -1.28607654
 [73]  0.66004704 -0.12591463 -1.01346301  0.22176613  1.05000588  0.83182927
 [79]  0.27096866  0.62449293  0.34383230 -0.72389793 -1.18721372 -0.42117231
 [85] -0.44882241 -0.99906453  0.27168164  0.13697768  0.74650151  0.55987324
 [91] -2.00750985 -0.05948283 -1.23508678  1.21837233 -0.98688416 -1.03446527
 [97]  0.64828706 -0.35863779  0.58108546  0.24852486
> colMin(tmp)
  [1] -0.55453875 -0.82175565 -0.67508276  1.37678469 -1.30559095 -0.01849659
  [7]  0.51610652  0.27062140 -0.44757098 -0.88197208  0.29138475  1.82763445
 [13]  0.22583715 -0.23984503  1.06178172 -1.10849154  0.92805381  1.79779249
 [19]  0.70124979  0.46727958 -1.18605197 -0.74993128  0.50471143 -2.05733335
 [25] -0.27737599  0.60182852  1.44959770 -0.62807126  0.68684821  0.02475166
 [31]  0.44041621 -0.88263521 -0.77340752 -0.50054568  0.70419077  0.07128037
 [37] -0.15734885  0.86581062  2.02167635  0.51219526  0.05835508 -1.26712922
 [43] -0.19105790  0.22867336 -0.67885555 -0.17282169  0.21108856  0.49652454
 [49] -1.81687306  0.39512251  0.55141154 -2.19410705  0.27554164 -1.76126618
 [55]  0.83669333  0.37873492 -1.26416700 -0.67771525 -1.37092526 -0.11289677
 [61] -0.97265251 -0.46459574 -1.23654431  0.75497972 -0.32847769 -0.36774563
 [67]  0.28828231  1.08164025 -0.39454123 -1.02993713 -1.02803666 -1.28607654
 [73]  0.66004704 -0.12591463 -1.01346301  0.22176613  1.05000588  0.83182927
 [79]  0.27096866  0.62449293  0.34383230 -0.72389793 -1.18721372 -0.42117231
 [85] -0.44882241 -0.99906453  0.27168164  0.13697768  0.74650151  0.55987324
 [91] -2.00750985 -0.05948283 -1.23508678  1.21837233 -0.98688416 -1.03446527
 [97]  0.64828706 -0.35863779  0.58108546  0.24852486
> colMedians(tmp)
  [1] -0.55453875 -0.82175565 -0.67508276  1.37678469 -1.30559095 -0.01849659
  [7]  0.51610652  0.27062140 -0.44757098 -0.88197208  0.29138475  1.82763445
 [13]  0.22583715 -0.23984503  1.06178172 -1.10849154  0.92805381  1.79779249
 [19]  0.70124979  0.46727958 -1.18605197 -0.74993128  0.50471143 -2.05733335
 [25] -0.27737599  0.60182852  1.44959770 -0.62807126  0.68684821  0.02475166
 [31]  0.44041621 -0.88263521 -0.77340752 -0.50054568  0.70419077  0.07128037
 [37] -0.15734885  0.86581062  2.02167635  0.51219526  0.05835508 -1.26712922
 [43] -0.19105790  0.22867336 -0.67885555 -0.17282169  0.21108856  0.49652454
 [49] -1.81687306  0.39512251  0.55141154 -2.19410705  0.27554164 -1.76126618
 [55]  0.83669333  0.37873492 -1.26416700 -0.67771525 -1.37092526 -0.11289677
 [61] -0.97265251 -0.46459574 -1.23654431  0.75497972 -0.32847769 -0.36774563
 [67]  0.28828231  1.08164025 -0.39454123 -1.02993713 -1.02803666 -1.28607654
 [73]  0.66004704 -0.12591463 -1.01346301  0.22176613  1.05000588  0.83182927
 [79]  0.27096866  0.62449293  0.34383230 -0.72389793 -1.18721372 -0.42117231
 [85] -0.44882241 -0.99906453  0.27168164  0.13697768  0.74650151  0.55987324
 [91] -2.00750985 -0.05948283 -1.23508678  1.21837233 -0.98688416 -1.03446527
 [97]  0.64828706 -0.35863779  0.58108546  0.24852486
> colRanges(tmp)
           [,1]       [,2]       [,3]     [,4]      [,5]        [,6]      [,7]
[1,] -0.5545387 -0.8217557 -0.6750828 1.376785 -1.305591 -0.01849659 0.5161065
[2,] -0.5545387 -0.8217557 -0.6750828 1.376785 -1.305591 -0.01849659 0.5161065
          [,8]      [,9]      [,10]     [,11]    [,12]     [,13]     [,14]
[1,] 0.2706214 -0.447571 -0.8819721 0.2913847 1.827634 0.2258372 -0.239845
[2,] 0.2706214 -0.447571 -0.8819721 0.2913847 1.827634 0.2258372 -0.239845
        [,15]     [,16]     [,17]    [,18]     [,19]     [,20]     [,21]
[1,] 1.061782 -1.108492 0.9280538 1.797792 0.7012498 0.4672796 -1.186052
[2,] 1.061782 -1.108492 0.9280538 1.797792 0.7012498 0.4672796 -1.186052
          [,22]     [,23]     [,24]     [,25]     [,26]    [,27]      [,28]
[1,] -0.7499313 0.5047114 -2.057333 -0.277376 0.6018285 1.449598 -0.6280713
[2,] -0.7499313 0.5047114 -2.057333 -0.277376 0.6018285 1.449598 -0.6280713
         [,29]      [,30]     [,31]      [,32]      [,33]      [,34]     [,35]
[1,] 0.6868482 0.02475166 0.4404162 -0.8826352 -0.7734075 -0.5005457 0.7041908
[2,] 0.6868482 0.02475166 0.4404162 -0.8826352 -0.7734075 -0.5005457 0.7041908
          [,36]      [,37]     [,38]    [,39]     [,40]      [,41]     [,42]
[1,] 0.07128037 -0.1573489 0.8658106 2.021676 0.5121953 0.05835508 -1.267129
[2,] 0.07128037 -0.1573489 0.8658106 2.021676 0.5121953 0.05835508 -1.267129
          [,43]     [,44]      [,45]      [,46]     [,47]     [,48]     [,49]
[1,] -0.1910579 0.2286734 -0.6788555 -0.1728217 0.2110886 0.4965245 -1.816873
[2,] -0.1910579 0.2286734 -0.6788555 -0.1728217 0.2110886 0.4965245 -1.816873
         [,50]     [,51]     [,52]     [,53]     [,54]     [,55]     [,56]
[1,] 0.3951225 0.5514115 -2.194107 0.2755416 -1.761266 0.8366933 0.3787349
[2,] 0.3951225 0.5514115 -2.194107 0.2755416 -1.761266 0.8366933 0.3787349
         [,57]      [,58]     [,59]      [,60]      [,61]      [,62]     [,63]
[1,] -1.264167 -0.6777152 -1.370925 -0.1128968 -0.9726525 -0.4645957 -1.236544
[2,] -1.264167 -0.6777152 -1.370925 -0.1128968 -0.9726525 -0.4645957 -1.236544
         [,64]      [,65]      [,66]     [,67]   [,68]      [,69]     [,70]
[1,] 0.7549797 -0.3284777 -0.3677456 0.2882823 1.08164 -0.3945412 -1.029937
[2,] 0.7549797 -0.3284777 -0.3677456 0.2882823 1.08164 -0.3945412 -1.029937
         [,71]     [,72]    [,73]      [,74]     [,75]     [,76]    [,77]
[1,] -1.028037 -1.286077 0.660047 -0.1259146 -1.013463 0.2217661 1.050006
[2,] -1.028037 -1.286077 0.660047 -0.1259146 -1.013463 0.2217661 1.050006
         [,78]     [,79]     [,80]     [,81]      [,82]     [,83]      [,84]
[1,] 0.8318293 0.2709687 0.6244929 0.3438323 -0.7238979 -1.187214 -0.4211723
[2,] 0.8318293 0.2709687 0.6244929 0.3438323 -0.7238979 -1.187214 -0.4211723
          [,85]      [,86]     [,87]     [,88]     [,89]     [,90]    [,91]
[1,] -0.4488224 -0.9990645 0.2716816 0.1369777 0.7465015 0.5598732 -2.00751
[2,] -0.4488224 -0.9990645 0.2716816 0.1369777 0.7465015 0.5598732 -2.00751
           [,92]     [,93]    [,94]      [,95]     [,96]     [,97]      [,98]
[1,] -0.05948283 -1.235087 1.218372 -0.9868842 -1.034465 0.6482871 -0.3586378
[2,] -0.05948283 -1.235087 1.218372 -0.9868842 -1.034465 0.6482871 -0.3586378
         [,99]    [,100]
[1,] 0.5810855 0.2485249
[2,] 0.5810855 0.2485249
> 
> 
> Max(tmp2)
[1] 2.285368
> Min(tmp2)
[1] -2.596974
> mean(tmp2)
[1] 0.1105926
> Sum(tmp2)
[1] 11.05926
> Var(tmp2)
[1] 0.9181488
> 
> rowMeans(tmp2)
  [1]  1.28217196  0.60783898  0.20324717 -0.26889064  1.97616952  1.42092053
  [7]  1.62164547 -1.03771172  0.95854696  0.58351574  0.46097829  0.37169285
 [13]  0.52165827  0.09841024 -0.64519302 -2.01285914  0.90946679  0.76655539
 [19] -0.06169205  2.28536777 -2.06017546 -1.07423724  0.41228201 -0.87046661
 [25]  1.11610062  1.05607254 -0.28878889 -0.01276645 -0.40204467  0.66086555
 [31] -0.71412411 -0.76680548 -0.55486712 -0.26953555 -1.32605767  0.48281425
 [37]  1.58188205 -1.18194286  0.56122341  0.42129628  0.34176806  1.42472826
 [43]  0.38004164  0.48477412  0.97793298 -0.03168923 -0.14150573  0.92521529
 [49]  0.37130123  1.38976937  1.28757370 -0.58508739 -2.01680403  0.31501759
 [55]  0.14632906  0.44761473  0.37939493 -0.36762892 -0.63466174  0.88728112
 [61] -1.71664733  0.22751267 -0.88681680  0.26198418  1.49194265 -0.90072658
 [67]  0.33065862  1.09086319  0.23134433 -0.53799914 -0.35218636 -0.75422865
 [73]  1.25732265 -0.43038547  0.53984478  0.30705425 -2.59697412 -1.67822614
 [79] -0.32504792 -0.30165891 -0.91420159 -0.51498611  1.19758675  0.54849016
 [85]  1.09656572 -0.06399832  0.68935063 -1.30273656  0.33635296  0.39077080
 [91] -0.04936789  0.39362647 -0.08192799  1.49492486 -0.28490841 -1.11896082
 [97] -0.05578890  1.76716157 -1.04560677  0.52535623
> rowSums(tmp2)
  [1]  1.28217196  0.60783898  0.20324717 -0.26889064  1.97616952  1.42092053
  [7]  1.62164547 -1.03771172  0.95854696  0.58351574  0.46097829  0.37169285
 [13]  0.52165827  0.09841024 -0.64519302 -2.01285914  0.90946679  0.76655539
 [19] -0.06169205  2.28536777 -2.06017546 -1.07423724  0.41228201 -0.87046661
 [25]  1.11610062  1.05607254 -0.28878889 -0.01276645 -0.40204467  0.66086555
 [31] -0.71412411 -0.76680548 -0.55486712 -0.26953555 -1.32605767  0.48281425
 [37]  1.58188205 -1.18194286  0.56122341  0.42129628  0.34176806  1.42472826
 [43]  0.38004164  0.48477412  0.97793298 -0.03168923 -0.14150573  0.92521529
 [49]  0.37130123  1.38976937  1.28757370 -0.58508739 -2.01680403  0.31501759
 [55]  0.14632906  0.44761473  0.37939493 -0.36762892 -0.63466174  0.88728112
 [61] -1.71664733  0.22751267 -0.88681680  0.26198418  1.49194265 -0.90072658
 [67]  0.33065862  1.09086319  0.23134433 -0.53799914 -0.35218636 -0.75422865
 [73]  1.25732265 -0.43038547  0.53984478  0.30705425 -2.59697412 -1.67822614
 [79] -0.32504792 -0.30165891 -0.91420159 -0.51498611  1.19758675  0.54849016
 [85]  1.09656572 -0.06399832  0.68935063 -1.30273656  0.33635296  0.39077080
 [91] -0.04936789  0.39362647 -0.08192799  1.49492486 -0.28490841 -1.11896082
 [97] -0.05578890  1.76716157 -1.04560677  0.52535623
> 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.28217196  0.60783898  0.20324717 -0.26889064  1.97616952  1.42092053
  [7]  1.62164547 -1.03771172  0.95854696  0.58351574  0.46097829  0.37169285
 [13]  0.52165827  0.09841024 -0.64519302 -2.01285914  0.90946679  0.76655539
 [19] -0.06169205  2.28536777 -2.06017546 -1.07423724  0.41228201 -0.87046661
 [25]  1.11610062  1.05607254 -0.28878889 -0.01276645 -0.40204467  0.66086555
 [31] -0.71412411 -0.76680548 -0.55486712 -0.26953555 -1.32605767  0.48281425
 [37]  1.58188205 -1.18194286  0.56122341  0.42129628  0.34176806  1.42472826
 [43]  0.38004164  0.48477412  0.97793298 -0.03168923 -0.14150573  0.92521529
 [49]  0.37130123  1.38976937  1.28757370 -0.58508739 -2.01680403  0.31501759
 [55]  0.14632906  0.44761473  0.37939493 -0.36762892 -0.63466174  0.88728112
 [61] -1.71664733  0.22751267 -0.88681680  0.26198418  1.49194265 -0.90072658
 [67]  0.33065862  1.09086319  0.23134433 -0.53799914 -0.35218636 -0.75422865
 [73]  1.25732265 -0.43038547  0.53984478  0.30705425 -2.59697412 -1.67822614
 [79] -0.32504792 -0.30165891 -0.91420159 -0.51498611  1.19758675  0.54849016
 [85]  1.09656572 -0.06399832  0.68935063 -1.30273656  0.33635296  0.39077080
 [91] -0.04936789  0.39362647 -0.08192799  1.49492486 -0.28490841 -1.11896082
 [97] -0.05578890  1.76716157 -1.04560677  0.52535623
> rowMin(tmp2)
  [1]  1.28217196  0.60783898  0.20324717 -0.26889064  1.97616952  1.42092053
  [7]  1.62164547 -1.03771172  0.95854696  0.58351574  0.46097829  0.37169285
 [13]  0.52165827  0.09841024 -0.64519302 -2.01285914  0.90946679  0.76655539
 [19] -0.06169205  2.28536777 -2.06017546 -1.07423724  0.41228201 -0.87046661
 [25]  1.11610062  1.05607254 -0.28878889 -0.01276645 -0.40204467  0.66086555
 [31] -0.71412411 -0.76680548 -0.55486712 -0.26953555 -1.32605767  0.48281425
 [37]  1.58188205 -1.18194286  0.56122341  0.42129628  0.34176806  1.42472826
 [43]  0.38004164  0.48477412  0.97793298 -0.03168923 -0.14150573  0.92521529
 [49]  0.37130123  1.38976937  1.28757370 -0.58508739 -2.01680403  0.31501759
 [55]  0.14632906  0.44761473  0.37939493 -0.36762892 -0.63466174  0.88728112
 [61] -1.71664733  0.22751267 -0.88681680  0.26198418  1.49194265 -0.90072658
 [67]  0.33065862  1.09086319  0.23134433 -0.53799914 -0.35218636 -0.75422865
 [73]  1.25732265 -0.43038547  0.53984478  0.30705425 -2.59697412 -1.67822614
 [79] -0.32504792 -0.30165891 -0.91420159 -0.51498611  1.19758675  0.54849016
 [85]  1.09656572 -0.06399832  0.68935063 -1.30273656  0.33635296  0.39077080
 [91] -0.04936789  0.39362647 -0.08192799  1.49492486 -0.28490841 -1.11896082
 [97] -0.05578890  1.76716157 -1.04560677  0.52535623
> 
> colMeans(tmp2)
[1] 0.1105926
> colSums(tmp2)
[1] 11.05926
> colVars(tmp2)
[1] 0.9181488
> colSd(tmp2)
[1] 0.9582008
> colMax(tmp2)
[1] 2.285368
> colMin(tmp2)
[1] -2.596974
> colMedians(tmp2)
[1] 0.2845192
> colRanges(tmp2)
          [,1]
[1,] -2.596974
[2,]  2.285368
> 
> 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.0903097  4.5426447 -5.4207966  2.7399220 -0.5656708  0.1161714
 [7] -5.9373121 -2.9349615 -4.9914760 -3.2667143
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.7525978
[2,] -0.5850257
[3,]  0.2835297
[4,]  0.7893470
[5,]  1.2734040
> 
> rowApply(tmp,sum)
 [1] -4.3413944 -0.9831134 -1.8195924 -2.2295488  3.3059169 -2.1530456
 [7]  1.7676084 -0.4010919 -2.2256947 -5.5479276
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1   10   10    2    5    6    6    2    9     8
 [2,]   10    8    5    5    9    8    8    9    6     7
 [3,]    6    7    3    3    2    4    2    5    5     2
 [4,]    8    6    2    9   10    9   10    8    7     3
 [5,]    3    4    7   10    4    7    3    7    3     5
 [6,]    4    3    4    1    6   10    7    4   10     4
 [7,]    9    1    1    4    3    3    4    3    8     1
 [8,]    7    2    9    6    7    5    1   10    1     9
 [9,]    2    9    8    7    1    2    5    1    2    10
[10,]    5    5    6    8    8    1    9    6    4     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.4458686 -1.2858264  0.1096623 -1.1775532  2.9200642  0.4384519
 [7]  4.1705072 -1.0979166  3.8054063 -2.1375643 -0.4256915 -1.7857009
[13]  3.1416616 -2.4749171 -2.4584470  1.7083624 -1.4437114 -3.7213225
[19]  2.0614414 -1.9490603
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.04460124
[2,] -0.04574828
[3,]  0.64131012
[4,]  0.88780810
[5,]  2.00709991
> 
> rowApply(tmp,sum)
[1]  3.2547238 -3.4839587  1.9643251 -2.2810273  0.3896516
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   17    2   19   11   14
[2,]    8   10    5    3   10
[3,]    5   11   11    4   19
[4,]   15    4   12   16    3
[5,]   14   17   18   13    7
> 
> 
> as.matrix(tmp)
            [,1]       [,2]        [,3]        [,4]       [,5]       [,6]
[1,]  0.88780810  0.1583679 -0.26831370  0.70147377  0.6379231  0.1577180
[2,] -2.04460124 -0.1049048  0.05483266 -1.20077585  0.9730032  0.3034025
[3,]  2.00709991 -0.5142751 -0.07242954  0.07741277  1.6674036  0.6666329
[4,] -0.04574828 -0.9479053 -0.92411694  0.40738617  0.1273363 -1.1214710
[5,]  0.64131012  0.1228909  1.31968985 -1.16305010 -0.4856019  0.4321695
          [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] 1.3033443 -1.1676249  0.2153472  0.3061380 -2.1251871  0.3039881
[2,] 1.2214393  0.2396563  1.3336697 -0.2889242  0.7832830 -0.9907388
[3,] 0.4938759 -1.1848197  2.3012770  0.6599505 -0.9826937 -0.2161993
[4,] 0.4683611 -0.1087277  0.6853808 -0.6229947  1.3469118  0.2025515
[5,] 0.6834866  1.1235994 -0.7302684 -2.1917340  0.5519944 -1.0853025
          [,13]      [,14]      [,15]      [,16]       [,17]      [,18]
[1,]  0.7482696 -0.2011682  0.3531347  0.8878165 -0.71915665 -1.4307247
[2,]  0.5376634 -0.3964482 -0.9069505  1.0961387  0.60566556 -1.5410121
[3,] -0.3593582 -0.3236405 -0.8559661  0.7137225 -1.54824862  0.4055385
[4,]  0.3074000 -0.1718772 -0.6585410 -0.5467783 -0.03744075 -2.1525218
[5,]  1.9076868 -1.3817830 -0.3901240 -0.4425370  0.25546909  0.9973976
          [,19]      [,20]
[1,]  1.9991121  0.5064578
[2,] -0.1805441 -2.9778130
[3,] -0.4810131 -0.4899447
[4,] -0.2861403  1.7979085
[5,]  1.0100269 -0.7856689
> 
> 
> 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.11-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.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  650  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  563  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-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.026654 0.06477164 0.8964987 -0.6105409 0.4035107 0.880951 0.2854664
           col8      col9     col10      col11     col12     col13      col14
row1 0.07900265 0.7988099 0.6073476 -0.2521945 0.9582453 -0.826692 -0.3629321
          col15      col16    col17     col18      col19      col20
row1 -0.9731777 -0.4889981 0.600925 0.4533682 -0.1221586 -0.3863065
> tmp[,"col10"]
          col10
row1  0.6073476
row2 -1.1055748
row3  1.7820926
row4  0.9689878
row5  0.5570443
> tmp[c("row1","row5"),]
           col1        col2      col3       col4      col5       col6      col7
row1  1.0266541  0.06477164 0.8964987 -0.6105409 0.4035107  0.8809510 0.2854664
row5 -0.6415162 -1.21316036 0.6322510  1.8368914 0.5611681 -0.5911259 0.9258033
            col8       col9     col10      col11     col12      col13
row1  0.07900265  0.7988099 0.6073476 -0.2521945 0.9582453 -0.8266920
row5 -0.27608771 -0.9998615 0.5570443  1.6334328 0.9324440 -0.9493347
          col14      col15      col16     col17      col18      col19
row1 -0.3629321 -0.9731777 -0.4889981 0.6009250  0.4533682 -0.1221586
row5 -2.1448605  0.8134957 -0.7873263 0.7047661 -1.0241428  2.3249671
          col20
row1 -0.3863065
row5 -0.1300491
> tmp[,c("col6","col20")]
           col6      col20
row1  0.8809510 -0.3863065
row2  0.4173557 -1.7271159
row3 -0.8137432  1.0215030
row4 -0.7570826  1.1093287
row5 -0.5911259 -0.1300491
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  0.8809510 -0.3863065
row5 -0.5911259 -0.1300491
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.62175 50.35149 50.29659 49.35743 49.50177 105.7663 49.63795 52.18075
         col9   col10    col11    col12    col13    col14    col15    col16
row1 50.02753 49.6179 49.13845 48.88349 49.80738 49.72377 49.65012 50.00474
        col17    col18    col19    col20
row1 49.71716 48.79952 49.13153 106.8948
> tmp[,"col10"]
        col10
row1 49.61790
row2 30.36300
row3 29.37504
row4 29.57043
row5 50.83732
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.62175 50.35149 50.29659 49.35743 49.50177 105.7663 49.63795 52.18075
row5 50.13241 50.89708 48.59257 51.45242 50.51051 106.0149 49.61161 51.28322
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.02753 49.61790 49.13845 48.88349 49.80738 49.72377 49.65012 50.00474
row5 50.78801 50.83732 49.07455 48.31620 52.98431 50.38022 50.22049 51.34030
        col17    col18    col19    col20
row1 49.71716 48.79952 49.13153 106.8948
row5 49.36519 51.83669 49.17778 106.5800
> tmp[,c("col6","col20")]
          col6     col20
row1 105.76633 106.89484
row2  72.44519  74.31515
row3  75.55225  75.75474
row4  75.69084  75.30655
row5 106.01490 106.58000
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.7663 106.8948
row5 106.0149 106.5800
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.7663 106.8948
row5 106.0149 106.5800
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.7041254
[2,]  0.3681079
[3,] -0.7318634
[4,]  0.5760692
[5,] -0.7428848
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.1076261  0.8703943
[2,] -0.8886073 -0.6762046
[3,]  0.5694112 -1.3219641
[4,]  1.4575911 -0.1016930
[5,]  0.3104297  1.1465522
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.2941305 -1.3526332
[2,]  1.3971283 -0.8934013
[3,] -0.5082450  0.8540425
[4,]  0.3196274 -0.7202169
[5,]  1.1267499 -0.6638059
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.2941305
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.2941305
[2,]  1.3971283
> 
> 
> 
> 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.1040498 -0.358878  0.1962538  0.4313482 -1.317605 -1.1145830 -1.221364
row1 1.4009742 -1.152131 -1.0564635 -1.4008966 -1.891056  0.1031354 -1.339541
          [,8]      [,9]      [,10]     [,11]      [,12]      [,13]       [,14]
row3 0.3426568 -1.223301  1.2392203 0.6645817 -0.4465972  0.8348860 -0.29955056
row1 1.5631316 -1.230661 -0.7260815 1.4459581  1.2671928 -0.8732249  0.05441497
          [,15]       [,16]       [,17]     [,18]     [,19]     [,20]
row3 -0.3452941 -1.45000442 -0.47774941 0.4450058 -1.333382 0.8890858
row1  0.4692059 -0.01411176  0.01032208 0.9052110 -1.401390 0.3247548
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]       [,2]      [,3]        [,4]     [,5]       [,6]       [,7]
row2 1.264157 -0.5124703 -0.640724 -0.04974957 1.617231 -0.3777335 -0.1470923
           [,8]       [,9]    [,10]
row2 0.04025568 -0.6748544 0.525667
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]     [,4]       [,5]     [,6]      [,7]
row5 0.4940739 -1.717746 0.09590532 1.194007 -0.2948474 1.531178 -1.216131
         [,8]       [,9]     [,10]      [,11]     [,12]       [,13]      [,14]
row5 1.206278 -0.5735043 0.8118608 -0.4846207 0.1670744 -0.08686942 -0.4368827
        [,15]    [,16]     [,17]     [,18]      [,19]      [,20]
row5 1.743266 2.464394 -1.513125 -0.115528 -0.4221635 -0.6799121
> 
> 
> 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: 0x7fa4a55025d0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b6280acf85"
 [2] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b65dbe394c"
 [3] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b673a3dca8"
 [4] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b6aebd4e8" 
 [5] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b6e6d0f2"  
 [6] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b6319fc054"
 [7] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b66f0be43f"
 [8] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b675b61d0d"
 [9] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b672d7cdb" 
[10] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b63b60118b"
[11] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b6201fdb21"
[12] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b6b6b6401" 
[13] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b637728382"
[14] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b63f17e83e"
[15] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM14b63a905ece"
> 
> 
> ### 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: 0x7fa4a5506060>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7fa4a5506060>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7fa4a5506060>
> rowMedians(tmp)
  [1] -0.0207081788 -0.3469873262  0.3752319082  0.0426092981  0.1548055337
  [6]  0.2105761227 -0.0641376962  0.1523269401 -0.3407598292 -0.0916483411
 [11]  0.1543664863  0.2927161494  0.2930271382  0.0210545049 -0.2747085033
 [16] -0.8042021065  0.7331747462  0.2185799135 -0.3424877069  0.0733410663
 [21]  0.2789003006  0.1381772349 -0.0209325391 -0.0298720869 -0.2668421104
 [26]  0.2570176642  0.0410771239 -0.0177081548 -0.2946625119 -0.6312994236
 [31]  0.1457424039  0.1067504090  0.2041112084  0.1494560585  0.1509501293
 [36]  0.0620655553 -0.0174312026 -0.3183718683 -0.3535061506  0.1525115413
 [41] -0.2697545740  0.0205063107 -0.0697739158 -0.6896096135 -0.0005366124
 [46] -0.0537173567 -0.4290730377  0.0999528510 -0.0801009070  0.6943234330
 [51] -0.1695584602  0.2962597900 -0.2840330395 -0.3557202115  0.1644932373
 [56]  0.0235718166  0.3754583644  0.2973669894 -0.1157105873 -0.2986768199
 [61]  0.3724062888 -0.0585207773 -0.0621011655 -0.0426730092 -0.2607455638
 [66] -0.6171238720  0.1173240806  0.5618972357  0.7384464961 -0.0908065958
 [71]  0.2554273347 -0.1138873066  0.2435501877  0.6954221312  0.3043097538
 [76]  0.1276817254  0.0393137836 -0.6198588468  0.4590105656  0.2817084669
 [81]  0.0111390754  0.5602926059 -0.3165870084  0.0552335919  0.2963919898
 [86] -0.1087640540  0.3548180552  0.3155150737  0.0606290845 -0.2178479911
 [91]  0.0215631248  0.1644817187  0.2745582152  0.0336029992  0.0161468634
 [96]  0.0644438739 -0.3809231206  0.3570957371  0.4825508474  0.3272790911
[101]  0.7622961536 -0.5026065052 -0.3096791982 -0.2184576492  0.0473566926
[106]  0.0745665439  0.1175810900  0.0581272459 -0.2708212058  0.0638963567
[111] -0.6740189393 -0.5047093386  0.4724330932 -0.3620576250  0.3793684964
[116] -0.9345508889  0.2766940832  0.1263490073  0.0887670617 -0.3285285887
[121]  0.3855720625 -0.1546020972 -0.3305790713  0.1456201593 -0.2528033446
[126] -0.1801984971  0.3868872735  0.0286654838 -0.2833538580 -0.2894003417
[131]  0.2498512905 -0.2148405847  0.0473401957 -0.1374211393 -0.9576366782
[136] -0.3181692464 -0.1890187614  0.3536592286  0.1405203117  0.0833588835
[141] -0.3593347675 -0.1162227200  0.1224585761  0.0285868782  0.0533496337
[146] -0.2074131069  0.0173160428  0.1889430274  0.2492092825  0.5903289501
[151]  0.4830570925 -0.2132320176 -0.0536176486 -0.1075157109  0.0552617938
[156]  0.1547696333 -0.2920175989 -0.2003208073 -0.1186900789  0.0559913595
[161]  0.1424772740 -0.2895432356  0.1052710900 -0.0184228412 -0.3395110050
[166]  0.0722541011  0.3710789435 -0.3117070758 -0.1511406131  0.1490565321
[171]  0.9760023568 -0.3264197974 -0.2760773385 -0.3426301929 -0.0161112448
[176]  0.1037859527 -0.2206965495 -0.2614311548  0.0740854775  0.1207947230
[181]  0.0171894869 -0.2525322751 -0.2002126098 -0.1428370158  0.4250086842
[186]  0.1798592792 -0.0454872860  0.4172672265 -0.2076145609 -0.2296501710
[191]  0.0101043675  0.1577783828  0.2112309169 -0.0768838088 -0.5051947077
[196]  0.1919292181 -0.2870628984  0.3026599665 -0.0845148664 -0.2617285992
[201]  0.3155054900  0.3485726333 -0.3905095413  0.0454547250  0.0875869265
[206]  0.0036154238  0.2363248780 -0.4787272262 -0.1286196921  0.5283901314
[211] -0.1419479686  0.3039423963  0.1977180248  0.3164138950  0.4401902119
[216]  0.3485726456 -0.0746211817 -0.4553690093  0.2891963671 -0.0221311524
[221]  0.1021248544  0.0048024867 -0.1549899178 -0.3012299632  0.0310593239
[226]  0.0793740380  0.4148547951 -0.2785020841  0.3022348532 -0.6790546761
> 
> proc.time()
   user  system elapsed 
  6.599  16.413  37.922 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2019-12-14 r77572) -- "Unsuffered Consequences"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> prefix <- "dbmtest"
> directory <- getwd()
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x7fa35b916ac0>
> .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: 0x7fa35b916ac0>
> .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: 0x7fa35b916ac0>
> .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: 0x7fa35b916ac0>
> 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: 0x7fa35bc00aa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa35bc00aa0>
> .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: 0x7fa35bc00aa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa35bc00aa0>
> .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: 0x7fa35bc00aa0>
> 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: 0x7fa35bd00000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa35bd00000>
> .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: 0x7fa35bd00000>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fa35bd00000>
> .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: 0x7fa35bd00000>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7fa35bd00000>
> .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: 0x7fa35bd00000>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7fa35bd00000>
> .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: 0x7fa35bd00000>
> 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: 0x7fa35be00090>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7fa35be00090>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa35be00090>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa35be00090>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1b667808d2bb" "BufferedMatrixFile1b66b43308e" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1b667808d2bb" "BufferedMatrixFile1b66b43308e" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa35be003b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa35be003b0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fa35be003b0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fa35be003b0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7fa35be003b0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7fa35be003b0>
> .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: 0x7fa35be007c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fa35be007c0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fa35be007c0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7fa35be007c0>
> 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: 0x7fa35be00ba0>
> .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: 0x7fa35be00ba0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.666   0.246   0.865 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2019-12-14 r77572) -- "Unsuffered Consequences"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.644   0.191   0.777 

Example timings