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

CHECK report for BufferedMatrix on merida2

This page was generated on 2018-10-17 08:47:12 -0400 (Wed, 17 Oct 2018).

Package 172/1561HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.44.0
Ben Bolstad
Snapshot Date: 2018-10-15 16:45:08 -0400 (Mon, 15 Oct 2018)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_7
Last Commit: 6087ec6
Last Changed Date: 2018-04-30 10:35:06 -0400 (Mon, 30 Apr 2018)
malbec2 Linux (Ubuntu 16.04.1 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
merida2 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.44.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.44.0.tar.gz
StartedAt: 2018-10-16 20:12:38 -0400 (Tue, 16 Oct 2018)
EndedAt: 2018-10-16 20:13:18 -0400 (Tue, 16 Oct 2018)
EllapsedTime: 39.6 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck’
* using R version 3.5.1 Patched (2018-07-12 r74967)
* 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.44.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.7-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 3.5.1 Patched (2018-07-12 r74967) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.404   0.098   0.472 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 3.5.1 Patched (2018-07-12 r74967) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/Users/biocbuild/bbs-3.7-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 410030 21.9     866105 46.3         NA   610817 32.7
Vcells 752727  5.8    8388608 64.0      65536  1825159 14.0
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Oct 16 20:13:01 2018"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Oct 16 20:13:01 2018"
> 
> 
> 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: 0x7fcbadb18800>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Oct 16 20:13:03 2018"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Tue Oct 16 20:13:04 2018"
> 
> ColMode(tmp2)
<pointer: 0x7fcbadb18800>
> 
> 
> 
> ### 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,] 99.26874181 -0.2863810 -2.4838393 -0.7876443
[2,] -1.14474206 -0.7917481 -0.5624982 -0.4900416
[3,] -0.09742616  0.7499582 -0.8574317  0.4702997
[4,]  0.61325377  1.5233969  0.8253792 -1.0541815
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.7-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,] 99.26874181 0.2863810 2.4838393 0.7876443
[2,]  1.14474206 0.7917481 0.5624982 0.4900416
[3,]  0.09742616 0.7499582 0.8574317 0.4702997
[4,]  0.61325377 1.5233969 0.8253792 1.0541815
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9633700 0.5351457 1.5760201 0.8874933
[2,] 1.0699262 0.8898023 0.7499988 0.7000297
[3,] 0.3121316 0.8660013 0.9259761 0.6857840
[4,] 0.7831052 1.2342597 0.9085038 1.0267334
> 
> 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.7-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,] 223.90244 30.63784 43.24404 34.66258
[2,]  36.84400 34.68977 33.06249 32.49034
[3,]  28.21874 34.40997 35.11719 32.32814
[4,]  33.44431 38.86599 34.91042 36.32152
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7fcbad816cb0>
> exp(tmp5)
<pointer: 0x7fcbad816cb0>
> log(tmp5,2)
<pointer: 0x7fcbad816cb0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.0236
> Min(tmp5)
[1] 52.62371
> mean(tmp5)
[1] 73.43521
> Sum(tmp5)
[1] 14687.04
> Var(tmp5)
[1] 864.8239
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.62159 68.53974 72.06033 72.64064 72.78626 73.97841 69.45028 69.58865
 [9] 71.61573 71.07049
> rowSums(tmp5)
 [1] 1852.432 1370.795 1441.207 1452.813 1455.725 1479.568 1389.006 1391.773
 [9] 1432.315 1421.410
> rowVars(tmp5)
 [1] 7817.97147  106.65684   76.00552   97.18807   54.64733  128.81612
 [7]  112.44463   85.63983   43.59607   77.13842
> rowSd(tmp5)
 [1] 88.419294 10.327480  8.718114  9.858401  7.392384 11.349719 10.603991
 [8]  9.254179  6.602732  8.782848
> rowMax(tmp5)
 [1] 466.02360  97.04910  83.86329  90.48399  85.82406  98.79388  95.58142
 [8]  88.42911  86.34637  96.74033
> rowMin(tmp5)
 [1] 56.88962 52.89196 56.92801 53.32677 63.35608 57.74204 54.44614 52.62371
 [9] 60.40903 58.41551
> 
> colMeans(tmp5)
 [1] 110.22410  69.69909  74.48280  71.27041  75.24345  73.37556  71.23381
 [8]  68.91551  71.90124  73.07094  67.11776  69.40228  76.90690  70.60368
[15]  68.17847  71.88322  66.45310  71.74179  72.88841  74.11168
> colSums(tmp5)
 [1] 1102.2410  696.9909  744.8280  712.7041  752.4345  733.7556  712.3381
 [8]  689.1551  719.0124  730.7094  671.1776  694.0228  769.0690  706.0368
[15]  681.7847  718.8322  664.5310  717.4179  728.8841  741.1168
> colVars(tmp5)
 [1] 15675.31834    86.68768    96.56056    46.09459   112.88395   111.60407
 [7]    92.37380    76.07771   130.39759    73.43912    72.71386    30.32626
[13]   159.26768    63.86237    78.66414    92.58112    60.56888    40.11097
[19]   134.30213   151.87312
> colSd(tmp5)
 [1] 125.201112   9.310622   9.826524   6.789299  10.624686  10.564283
 [7]   9.611129   8.722254  11.419176   8.569663   8.527242   5.506929
[13]  12.620130   7.991394   8.869281   9.621908   7.782601   6.333322
[19]  11.588879  12.323681
> colMax(tmp5)
 [1] 466.02360  82.29072  90.00680  85.82406  95.58142  96.74033  93.19210
 [8]  82.73884  86.87516  83.86329  81.03058  77.55284  93.69086  82.53463
[15]  82.01205  88.42911  84.66172  83.94352  97.04910  98.79388
> colMin(tmp5)
 [1] 58.73362 52.62371 54.44614 63.07050 57.74204 62.29479 59.26115 56.88962
 [9] 56.45735 56.69741 57.30919 60.75793 52.89196 59.37463 57.46080 60.64640
[17] 57.62282 59.52292 56.92801 53.32677
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 92.62159 68.53974 72.06033 72.64064 72.78626 73.97841 69.45028       NA
 [9] 71.61573 71.07049
> rowSums(tmp5)
 [1] 1852.432 1370.795 1441.207 1452.813 1455.725 1479.568 1389.006       NA
 [9] 1432.315 1421.410
> rowVars(tmp5)
 [1] 7817.97147  106.65684   76.00552   97.18807   54.64733  128.81612
 [7]  112.44463   88.76869   43.59607   77.13842
> rowSd(tmp5)
 [1] 88.419294 10.327480  8.718114  9.858401  7.392384 11.349719 10.603991
 [8]  9.421714  6.602732  8.782848
> rowMax(tmp5)
 [1] 466.02360  97.04910  83.86329  90.48399  85.82406  98.79388  95.58142
 [8]        NA  86.34637  96.74033
> rowMin(tmp5)
 [1] 56.88962 52.89196 56.92801 53.32677 63.35608 57.74204 54.44614       NA
 [9] 60.40903 58.41551
> 
> colMeans(tmp5)
 [1] 110.22410  69.69909  74.48280  71.27041  75.24345  73.37556  71.23381
 [8]  68.91551  71.90124  73.07094  67.11776        NA  76.90690  70.60368
[15]  68.17847  71.88322  66.45310  71.74179  72.88841  74.11168
> colSums(tmp5)
 [1] 1102.2410  696.9909  744.8280  712.7041  752.4345  733.7556  712.3381
 [8]  689.1551  719.0124  730.7094  671.1776        NA  769.0690  706.0368
[15]  681.7847  718.8322  664.5310  717.4179  728.8841  741.1168
> colVars(tmp5)
 [1] 15675.31834    86.68768    96.56056    46.09459   112.88395   111.60407
 [7]    92.37380    76.07771   130.39759    73.43912    72.71386          NA
[13]   159.26768    63.86237    78.66414    92.58112    60.56888    40.11097
[19]   134.30213   151.87312
> colSd(tmp5)
 [1] 125.201112   9.310622   9.826524   6.789299  10.624686  10.564283
 [7]   9.611129   8.722254  11.419176   8.569663   8.527242         NA
[13]  12.620130   7.991394   8.869281   9.621908   7.782601   6.333322
[19]  11.588879  12.323681
> colMax(tmp5)
 [1] 466.02360  82.29072  90.00680  85.82406  95.58142  96.74033  93.19210
 [8]  82.73884  86.87516  83.86329  81.03058        NA  93.69086  82.53463
[15]  82.01205  88.42911  84.66172  83.94352  97.04910  98.79388
> colMin(tmp5)
 [1] 58.73362 52.62371 54.44614 63.07050 57.74204 62.29479 59.26115 56.88962
 [9] 56.45735 56.69741 57.30919       NA 52.89196 59.37463 57.46080 60.64640
[17] 57.62282 59.52292 56.92801 53.32677
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.0236
> Min(tmp5,na.rm=TRUE)
[1] 52.62371
> mean(tmp5,na.rm=TRUE)
[1] 73.42802
> Sum(tmp5,na.rm=TRUE)
[1] 14612.18
> Var(tmp5,na.rm=TRUE)
[1] 869.1813
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.62159 68.53974 72.06033 72.64064 72.78626 73.97841 69.45028 69.31087
 [9] 71.61573 71.07049
> rowSums(tmp5,na.rm=TRUE)
 [1] 1852.432 1370.795 1441.207 1452.813 1455.725 1479.568 1389.006 1316.907
 [9] 1432.315 1421.410
> rowVars(tmp5,na.rm=TRUE)
 [1] 7817.97147  106.65684   76.00552   97.18807   54.64733  128.81612
 [7]  112.44463   88.76869   43.59607   77.13842
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.419294 10.327480  8.718114  9.858401  7.392384 11.349719 10.603991
 [8]  9.421714  6.602732  8.782848
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.02360  97.04910  83.86329  90.48399  85.82406  98.79388  95.58142
 [8]  88.42911  86.34637  96.74033
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.88962 52.89196 56.92801 53.32677 63.35608 57.74204 54.44614 52.62371
 [9] 60.40903 58.41551
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.22410  69.69909  74.48280  71.27041  75.24345  73.37556  71.23381
 [8]  68.91551  71.90124  73.07094  67.11776  68.79516  76.90690  70.60368
[15]  68.17847  71.88322  66.45310  71.74179  72.88841  74.11168
> colSums(tmp5,na.rm=TRUE)
 [1] 1102.2410  696.9909  744.8280  712.7041  752.4345  733.7556  712.3381
 [8]  689.1551  719.0124  730.7094  671.1776  619.1564  769.0690  706.0368
[15]  681.7847  718.8322  664.5310  717.4179  728.8841  741.1168
> colVars(tmp5,na.rm=TRUE)
 [1] 15675.31834    86.68768    96.56056    46.09459   112.88395   111.60407
 [7]    92.37380    76.07771   130.39759    73.43912    72.71386    29.97036
[13]   159.26768    63.86237    78.66414    92.58112    60.56888    40.11097
[19]   134.30213   151.87312
> colSd(tmp5,na.rm=TRUE)
 [1] 125.201112   9.310622   9.826524   6.789299  10.624686  10.564283
 [7]   9.611129   8.722254  11.419176   8.569663   8.527242   5.474519
[13]  12.620130   7.991394   8.869281   9.621908   7.782601   6.333322
[19]  11.588879  12.323681
> colMax(tmp5,na.rm=TRUE)
 [1] 466.02360  82.29072  90.00680  85.82406  95.58142  96.74033  93.19210
 [8]  82.73884  86.87516  83.86329  81.03058  77.55284  93.69086  82.53463
[15]  82.01205  88.42911  84.66172  83.94352  97.04910  98.79388
> colMin(tmp5,na.rm=TRUE)
 [1] 58.73362 52.62371 54.44614 63.07050 57.74204 62.29479 59.26115 56.88962
 [9] 56.45735 56.69741 57.30919 60.75793 52.89196 59.37463 57.46080 60.64640
[17] 57.62282 59.52292 56.92801 53.32677
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.62159 68.53974 72.06033 72.64064 72.78626 73.97841 69.45028      NaN
 [9] 71.61573 71.07049
> rowSums(tmp5,na.rm=TRUE)
 [1] 1852.432 1370.795 1441.207 1452.813 1455.725 1479.568 1389.006    0.000
 [9] 1432.315 1421.410
> rowVars(tmp5,na.rm=TRUE)
 [1] 7817.97147  106.65684   76.00552   97.18807   54.64733  128.81612
 [7]  112.44463         NA   43.59607   77.13842
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.419294 10.327480  8.718114  9.858401  7.392384 11.349719 10.603991
 [8]        NA  6.602732  8.782848
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.02360  97.04910  83.86329  90.48399  85.82406  98.79388  95.58142
 [8]        NA  86.34637  96.74033
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.88962 52.89196 56.92801 53.32677 63.35608 57.74204 54.44614       NA
 [9] 60.40903 58.41551
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.88854  71.59635  74.11315  71.47103  76.61079  74.23854  70.85110
 [8]  68.74220  73.07586  74.89022  67.95049       NaN  76.16198  70.43265
[15]  68.38218  70.04478  66.47064  73.09944  72.61457  73.82244
> colSums(tmp5,na.rm=TRUE)
 [1] 1024.9969  644.3672  667.0184  643.2392  689.4971  668.1469  637.6599
 [8]  618.6798  657.6828  674.0120  611.5544    0.0000  685.4578  633.8938
[15]  615.4396  630.4030  598.2357  657.8950  653.5311  664.4020
> colVars(tmp5,na.rm=TRUE)
 [1] 17483.66637    57.02800   107.09349    51.40364   105.96137   117.17624
 [7]   102.27276    85.24951   131.17533    45.38395    74.00198          NA
[13]   172.93343    71.51610    88.03032    66.13062    68.13653    24.38863
[19]   150.24624   169.91609
> colSd(tmp5,na.rm=TRUE)
 [1] 132.225816   7.551688  10.348599   7.169633  10.293754  10.824798
 [7]  10.112999   9.233066  11.453180   6.736761   8.602440         NA
[13]  13.150416   8.456719   9.382447   8.132074   8.254485   4.938485
[19]  12.257497  13.035187
> colMax(tmp5,na.rm=TRUE)
 [1] 466.02360  82.29072  90.00680  85.82406  95.58142  96.74033  93.19210
 [8]  82.73884  86.87516  83.86329  81.03058      -Inf  93.69086  82.53463
[15]  82.01205  83.28821  84.66172  83.94352  97.04910  98.79388
> colMin(tmp5,na.rm=TRUE)
 [1] 58.73362 61.32575 54.44614 63.07050 57.74204 62.29479 59.26115 56.88962
 [9] 56.45735 61.85982 57.30919      Inf 52.89196 59.37463 57.46080 60.64640
[17] 57.62282 66.96856 56.92801 53.32677
> 
> 
> 
> 
> 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] 192.1751 231.6540 254.2661 243.6946 272.3785 151.9134 320.4623 167.6751
 [9] 190.1883 151.0069
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 192.1751 231.6540 254.2661 243.6946 272.3785 151.9134 320.4623 167.6751
 [9] 190.1883 151.0069
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -1.136868e-13  5.684342e-14 -1.136868e-13 -5.684342e-14 -1.705303e-13
 [6]  0.000000e+00  5.684342e-14 -4.547474e-13  8.526513e-14 -1.421085e-13
[11] -2.842171e-14 -2.273737e-13  2.842171e-14  8.526513e-14  0.000000e+00
[16]  5.684342e-14  1.136868e-13  2.842171e-14  5.684342e-14 -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)
+ }
10   13 
6   16 
1   5 
4   17 
3   12 
4   5 
3   14 
1   9 
6   2 
4   12 
10   20 
3   17 
10   2 
8   4 
5   15 
6   2 
2   6 
10   10 
6   16 
7   8 
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.862801
> Min(tmp)
[1] -2.920059
> mean(tmp)
[1] -0.09948617
> Sum(tmp)
[1] -9.948617
> Var(tmp)
[1] 1.149308
> 
> rowMeans(tmp)
[1] -0.09948617
> rowSums(tmp)
[1] -9.948617
> rowVars(tmp)
[1] 1.149308
> rowSd(tmp)
[1] 1.072058
> rowMax(tmp)
[1] 2.862801
> rowMin(tmp)
[1] -2.920059
> 
> colMeans(tmp)
  [1] -0.338657126 -0.585929326 -0.848547316  1.074198328 -0.200152222
  [6]  0.817265052 -0.466475094  0.970746339  1.546601584 -0.083820335
 [11]  1.095083577 -0.314943503 -0.883859826 -1.560527214  0.036790704
 [16]  0.314313106 -0.199741207  1.023900584 -0.471729893 -1.058230181
 [21]  1.265909532  1.214256876  0.200203633 -0.029509293  0.223949305
 [26] -0.379288510 -1.213825677  0.618256124 -0.747820861  0.678707696
 [31] -1.089509261 -0.381181047 -0.669434868  2.013210215 -0.007425178
 [36] -1.355434147  0.002719001 -1.696059946 -0.845062842  1.912360664
 [41]  0.421289141 -0.988532457  1.791025763 -0.470717691 -0.542400759
 [46]  1.785047483 -0.088706990  1.200099187 -2.178984747 -1.275005557
 [51] -0.294128318  0.076286113  0.268320521  0.657953424  1.392797690
 [56] -1.517636263  1.513923637  0.060460998 -1.692935161 -0.791744670
 [61]  0.142606259 -1.842484074  1.231237718 -0.215152093 -1.105471852
 [66]  0.816763874 -1.250989144 -0.265150513 -0.388244469 -0.076449262
 [71]  1.266693495 -0.984252378  0.638706542 -0.227797101  0.364684702
 [76] -1.084273576 -1.202259183  0.620903737  0.923360939 -0.128727921
 [81]  2.862801408 -1.704418934  0.744695109 -0.455808885  0.325608664
 [86] -0.492132302  1.285380561  0.294775353 -1.206517908  0.258810244
 [91]  0.701499631 -1.738497287 -2.920058887 -1.387198608 -0.327581758
 [96] -2.591953587  0.330677362 -0.965829683  0.226607450  0.669100953
> colSums(tmp)
  [1] -0.338657126 -0.585929326 -0.848547316  1.074198328 -0.200152222
  [6]  0.817265052 -0.466475094  0.970746339  1.546601584 -0.083820335
 [11]  1.095083577 -0.314943503 -0.883859826 -1.560527214  0.036790704
 [16]  0.314313106 -0.199741207  1.023900584 -0.471729893 -1.058230181
 [21]  1.265909532  1.214256876  0.200203633 -0.029509293  0.223949305
 [26] -0.379288510 -1.213825677  0.618256124 -0.747820861  0.678707696
 [31] -1.089509261 -0.381181047 -0.669434868  2.013210215 -0.007425178
 [36] -1.355434147  0.002719001 -1.696059946 -0.845062842  1.912360664
 [41]  0.421289141 -0.988532457  1.791025763 -0.470717691 -0.542400759
 [46]  1.785047483 -0.088706990  1.200099187 -2.178984747 -1.275005557
 [51] -0.294128318  0.076286113  0.268320521  0.657953424  1.392797690
 [56] -1.517636263  1.513923637  0.060460998 -1.692935161 -0.791744670
 [61]  0.142606259 -1.842484074  1.231237718 -0.215152093 -1.105471852
 [66]  0.816763874 -1.250989144 -0.265150513 -0.388244469 -0.076449262
 [71]  1.266693495 -0.984252378  0.638706542 -0.227797101  0.364684702
 [76] -1.084273576 -1.202259183  0.620903737  0.923360939 -0.128727921
 [81]  2.862801408 -1.704418934  0.744695109 -0.455808885  0.325608664
 [86] -0.492132302  1.285380561  0.294775353 -1.206517908  0.258810244
 [91]  0.701499631 -1.738497287 -2.920058887 -1.387198608 -0.327581758
 [96] -2.591953587  0.330677362 -0.965829683  0.226607450  0.669100953
> 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.338657126 -0.585929326 -0.848547316  1.074198328 -0.200152222
  [6]  0.817265052 -0.466475094  0.970746339  1.546601584 -0.083820335
 [11]  1.095083577 -0.314943503 -0.883859826 -1.560527214  0.036790704
 [16]  0.314313106 -0.199741207  1.023900584 -0.471729893 -1.058230181
 [21]  1.265909532  1.214256876  0.200203633 -0.029509293  0.223949305
 [26] -0.379288510 -1.213825677  0.618256124 -0.747820861  0.678707696
 [31] -1.089509261 -0.381181047 -0.669434868  2.013210215 -0.007425178
 [36] -1.355434147  0.002719001 -1.696059946 -0.845062842  1.912360664
 [41]  0.421289141 -0.988532457  1.791025763 -0.470717691 -0.542400759
 [46]  1.785047483 -0.088706990  1.200099187 -2.178984747 -1.275005557
 [51] -0.294128318  0.076286113  0.268320521  0.657953424  1.392797690
 [56] -1.517636263  1.513923637  0.060460998 -1.692935161 -0.791744670
 [61]  0.142606259 -1.842484074  1.231237718 -0.215152093 -1.105471852
 [66]  0.816763874 -1.250989144 -0.265150513 -0.388244469 -0.076449262
 [71]  1.266693495 -0.984252378  0.638706542 -0.227797101  0.364684702
 [76] -1.084273576 -1.202259183  0.620903737  0.923360939 -0.128727921
 [81]  2.862801408 -1.704418934  0.744695109 -0.455808885  0.325608664
 [86] -0.492132302  1.285380561  0.294775353 -1.206517908  0.258810244
 [91]  0.701499631 -1.738497287 -2.920058887 -1.387198608 -0.327581758
 [96] -2.591953587  0.330677362 -0.965829683  0.226607450  0.669100953
> colMin(tmp)
  [1] -0.338657126 -0.585929326 -0.848547316  1.074198328 -0.200152222
  [6]  0.817265052 -0.466475094  0.970746339  1.546601584 -0.083820335
 [11]  1.095083577 -0.314943503 -0.883859826 -1.560527214  0.036790704
 [16]  0.314313106 -0.199741207  1.023900584 -0.471729893 -1.058230181
 [21]  1.265909532  1.214256876  0.200203633 -0.029509293  0.223949305
 [26] -0.379288510 -1.213825677  0.618256124 -0.747820861  0.678707696
 [31] -1.089509261 -0.381181047 -0.669434868  2.013210215 -0.007425178
 [36] -1.355434147  0.002719001 -1.696059946 -0.845062842  1.912360664
 [41]  0.421289141 -0.988532457  1.791025763 -0.470717691 -0.542400759
 [46]  1.785047483 -0.088706990  1.200099187 -2.178984747 -1.275005557
 [51] -0.294128318  0.076286113  0.268320521  0.657953424  1.392797690
 [56] -1.517636263  1.513923637  0.060460998 -1.692935161 -0.791744670
 [61]  0.142606259 -1.842484074  1.231237718 -0.215152093 -1.105471852
 [66]  0.816763874 -1.250989144 -0.265150513 -0.388244469 -0.076449262
 [71]  1.266693495 -0.984252378  0.638706542 -0.227797101  0.364684702
 [76] -1.084273576 -1.202259183  0.620903737  0.923360939 -0.128727921
 [81]  2.862801408 -1.704418934  0.744695109 -0.455808885  0.325608664
 [86] -0.492132302  1.285380561  0.294775353 -1.206517908  0.258810244
 [91]  0.701499631 -1.738497287 -2.920058887 -1.387198608 -0.327581758
 [96] -2.591953587  0.330677362 -0.965829683  0.226607450  0.669100953
> colMedians(tmp)
  [1] -0.338657126 -0.585929326 -0.848547316  1.074198328 -0.200152222
  [6]  0.817265052 -0.466475094  0.970746339  1.546601584 -0.083820335
 [11]  1.095083577 -0.314943503 -0.883859826 -1.560527214  0.036790704
 [16]  0.314313106 -0.199741207  1.023900584 -0.471729893 -1.058230181
 [21]  1.265909532  1.214256876  0.200203633 -0.029509293  0.223949305
 [26] -0.379288510 -1.213825677  0.618256124 -0.747820861  0.678707696
 [31] -1.089509261 -0.381181047 -0.669434868  2.013210215 -0.007425178
 [36] -1.355434147  0.002719001 -1.696059946 -0.845062842  1.912360664
 [41]  0.421289141 -0.988532457  1.791025763 -0.470717691 -0.542400759
 [46]  1.785047483 -0.088706990  1.200099187 -2.178984747 -1.275005557
 [51] -0.294128318  0.076286113  0.268320521  0.657953424  1.392797690
 [56] -1.517636263  1.513923637  0.060460998 -1.692935161 -0.791744670
 [61]  0.142606259 -1.842484074  1.231237718 -0.215152093 -1.105471852
 [66]  0.816763874 -1.250989144 -0.265150513 -0.388244469 -0.076449262
 [71]  1.266693495 -0.984252378  0.638706542 -0.227797101  0.364684702
 [76] -1.084273576 -1.202259183  0.620903737  0.923360939 -0.128727921
 [81]  2.862801408 -1.704418934  0.744695109 -0.455808885  0.325608664
 [86] -0.492132302  1.285380561  0.294775353 -1.206517908  0.258810244
 [91]  0.701499631 -1.738497287 -2.920058887 -1.387198608 -0.327581758
 [96] -2.591953587  0.330677362 -0.965829683  0.226607450  0.669100953
> colRanges(tmp)
           [,1]       [,2]       [,3]     [,4]       [,5]      [,6]       [,7]
[1,] -0.3386571 -0.5859293 -0.8485473 1.074198 -0.2001522 0.8172651 -0.4664751
[2,] -0.3386571 -0.5859293 -0.8485473 1.074198 -0.2001522 0.8172651 -0.4664751
          [,8]     [,9]       [,10]    [,11]      [,12]      [,13]     [,14]
[1,] 0.9707463 1.546602 -0.08382034 1.095084 -0.3149435 -0.8838598 -1.560527
[2,] 0.9707463 1.546602 -0.08382034 1.095084 -0.3149435 -0.8838598 -1.560527
         [,15]     [,16]      [,17]    [,18]      [,19]    [,20]   [,21]
[1,] 0.0367907 0.3143131 -0.1997412 1.023901 -0.4717299 -1.05823 1.26591
[2,] 0.0367907 0.3143131 -0.1997412 1.023901 -0.4717299 -1.05823 1.26591
        [,22]     [,23]       [,24]     [,25]      [,26]     [,27]     [,28]
[1,] 1.214257 0.2002036 -0.02950929 0.2239493 -0.3792885 -1.213826 0.6182561
[2,] 1.214257 0.2002036 -0.02950929 0.2239493 -0.3792885 -1.213826 0.6182561
          [,29]     [,30]     [,31]     [,32]      [,33]   [,34]        [,35]
[1,] -0.7478209 0.6787077 -1.089509 -0.381181 -0.6694349 2.01321 -0.007425178
[2,] -0.7478209 0.6787077 -1.089509 -0.381181 -0.6694349 2.01321 -0.007425178
         [,36]       [,37]    [,38]      [,39]    [,40]     [,41]      [,42]
[1,] -1.355434 0.002719001 -1.69606 -0.8450628 1.912361 0.4212891 -0.9885325
[2,] -1.355434 0.002719001 -1.69606 -0.8450628 1.912361 0.4212891 -0.9885325
        [,43]      [,44]      [,45]    [,46]       [,47]    [,48]     [,49]
[1,] 1.791026 -0.4707177 -0.5424008 1.785047 -0.08870699 1.200099 -2.178985
[2,] 1.791026 -0.4707177 -0.5424008 1.785047 -0.08870699 1.200099 -2.178985
         [,50]      [,51]      [,52]     [,53]     [,54]    [,55]     [,56]
[1,] -1.275006 -0.2941283 0.07628611 0.2683205 0.6579534 1.392798 -1.517636
[2,] -1.275006 -0.2941283 0.07628611 0.2683205 0.6579534 1.392798 -1.517636
        [,57]    [,58]     [,59]      [,60]     [,61]     [,62]    [,63]
[1,] 1.513924 0.060461 -1.692935 -0.7917447 0.1426063 -1.842484 1.231238
[2,] 1.513924 0.060461 -1.692935 -0.7917447 0.1426063 -1.842484 1.231238
          [,64]     [,65]     [,66]     [,67]      [,68]      [,69]       [,70]
[1,] -0.2151521 -1.105472 0.8167639 -1.250989 -0.2651505 -0.3882445 -0.07644926
[2,] -0.2151521 -1.105472 0.8167639 -1.250989 -0.2651505 -0.3882445 -0.07644926
        [,71]      [,72]     [,73]      [,74]     [,75]     [,76]     [,77]
[1,] 1.266693 -0.9842524 0.6387065 -0.2277971 0.3646847 -1.084274 -1.202259
[2,] 1.266693 -0.9842524 0.6387065 -0.2277971 0.3646847 -1.084274 -1.202259
         [,78]     [,79]      [,80]    [,81]     [,82]     [,83]      [,84]
[1,] 0.6209037 0.9233609 -0.1287279 2.862801 -1.704419 0.7446951 -0.4558089
[2,] 0.6209037 0.9233609 -0.1287279 2.862801 -1.704419 0.7446951 -0.4558089
         [,85]      [,86]    [,87]     [,88]     [,89]     [,90]     [,91]
[1,] 0.3256087 -0.4921323 1.285381 0.2947754 -1.206518 0.2588102 0.7014996
[2,] 0.3256087 -0.4921323 1.285381 0.2947754 -1.206518 0.2588102 0.7014996
         [,92]     [,93]     [,94]      [,95]     [,96]     [,97]      [,98]
[1,] -1.738497 -2.920059 -1.387199 -0.3275818 -2.591954 0.3306774 -0.9658297
[2,] -1.738497 -2.920059 -1.387199 -0.3275818 -2.591954 0.3306774 -0.9658297
         [,99]   [,100]
[1,] 0.2266074 0.669101
[2,] 0.2266074 0.669101
> 
> 
> Max(tmp2)
[1] 3.158198
> Min(tmp2)
[1] -2.551728
> mean(tmp2)
[1] 0.04831837
> Sum(tmp2)
[1] 4.831837
> Var(tmp2)
[1] 1.077863
> 
> rowMeans(tmp2)
  [1]  1.322655852 -0.459177730 -0.864552866 -0.813915230 -0.127447936
  [6] -0.577186510  0.554132228 -2.117823499 -0.165336930  0.813731897
 [11]  1.263262194  1.290984244 -1.397773896 -0.042295151  0.178142999
 [16]  0.096038457 -0.261570352  2.191015240  0.990309567  0.157062473
 [21]  0.251791205 -0.878663165  0.330019101  0.268745992 -0.433224055
 [26]  0.256385867  0.591783147 -1.601105247 -1.189873327  0.375723436
 [31] -0.237494957  0.111645337 -0.388698660  0.040681582  0.973057356
 [36] -0.135251009 -1.541762152  1.189034156  1.229992159 -0.572982593
 [41] -0.823608434 -0.565942109  0.975939718  0.677277599  0.909302675
 [46] -1.147306959  1.150801887 -1.670438292 -0.867825706  0.202763451
 [51] -0.789167226 -0.103484376 -1.254974147  1.421264942 -0.518466092
 [56]  3.158197871  0.241331898  0.931328107  0.665474939  0.542874551
 [61] -2.042276057 -1.705797301  1.081348993  1.923398295 -0.400548230
 [66]  0.422981310 -0.188844003 -0.093993400  1.361537582 -1.794147659
 [71] -0.014612750  0.017209296  1.032830141  1.518768223  1.833702149
 [76]  1.477455972  0.464592232 -1.485537180 -0.309571691  1.418159691
 [81]  1.282481175 -1.328894355 -0.704371109 -2.551727793  0.004169493
 [86] -0.127045828  0.404626687 -0.567632040  1.005681231  0.151178152
 [91]  0.815284396 -0.461694186 -0.212345204  0.707699082  0.535760561
 [96] -1.656978756  0.681090596 -0.535091990 -0.450470765 -0.481941901
> rowSums(tmp2)
  [1]  1.322655852 -0.459177730 -0.864552866 -0.813915230 -0.127447936
  [6] -0.577186510  0.554132228 -2.117823499 -0.165336930  0.813731897
 [11]  1.263262194  1.290984244 -1.397773896 -0.042295151  0.178142999
 [16]  0.096038457 -0.261570352  2.191015240  0.990309567  0.157062473
 [21]  0.251791205 -0.878663165  0.330019101  0.268745992 -0.433224055
 [26]  0.256385867  0.591783147 -1.601105247 -1.189873327  0.375723436
 [31] -0.237494957  0.111645337 -0.388698660  0.040681582  0.973057356
 [36] -0.135251009 -1.541762152  1.189034156  1.229992159 -0.572982593
 [41] -0.823608434 -0.565942109  0.975939718  0.677277599  0.909302675
 [46] -1.147306959  1.150801887 -1.670438292 -0.867825706  0.202763451
 [51] -0.789167226 -0.103484376 -1.254974147  1.421264942 -0.518466092
 [56]  3.158197871  0.241331898  0.931328107  0.665474939  0.542874551
 [61] -2.042276057 -1.705797301  1.081348993  1.923398295 -0.400548230
 [66]  0.422981310 -0.188844003 -0.093993400  1.361537582 -1.794147659
 [71] -0.014612750  0.017209296  1.032830141  1.518768223  1.833702149
 [76]  1.477455972  0.464592232 -1.485537180 -0.309571691  1.418159691
 [81]  1.282481175 -1.328894355 -0.704371109 -2.551727793  0.004169493
 [86] -0.127045828  0.404626687 -0.567632040  1.005681231  0.151178152
 [91]  0.815284396 -0.461694186 -0.212345204  0.707699082  0.535760561
 [96] -1.656978756  0.681090596 -0.535091990 -0.450470765 -0.481941901
> 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.322655852 -0.459177730 -0.864552866 -0.813915230 -0.127447936
  [6] -0.577186510  0.554132228 -2.117823499 -0.165336930  0.813731897
 [11]  1.263262194  1.290984244 -1.397773896 -0.042295151  0.178142999
 [16]  0.096038457 -0.261570352  2.191015240  0.990309567  0.157062473
 [21]  0.251791205 -0.878663165  0.330019101  0.268745992 -0.433224055
 [26]  0.256385867  0.591783147 -1.601105247 -1.189873327  0.375723436
 [31] -0.237494957  0.111645337 -0.388698660  0.040681582  0.973057356
 [36] -0.135251009 -1.541762152  1.189034156  1.229992159 -0.572982593
 [41] -0.823608434 -0.565942109  0.975939718  0.677277599  0.909302675
 [46] -1.147306959  1.150801887 -1.670438292 -0.867825706  0.202763451
 [51] -0.789167226 -0.103484376 -1.254974147  1.421264942 -0.518466092
 [56]  3.158197871  0.241331898  0.931328107  0.665474939  0.542874551
 [61] -2.042276057 -1.705797301  1.081348993  1.923398295 -0.400548230
 [66]  0.422981310 -0.188844003 -0.093993400  1.361537582 -1.794147659
 [71] -0.014612750  0.017209296  1.032830141  1.518768223  1.833702149
 [76]  1.477455972  0.464592232 -1.485537180 -0.309571691  1.418159691
 [81]  1.282481175 -1.328894355 -0.704371109 -2.551727793  0.004169493
 [86] -0.127045828  0.404626687 -0.567632040  1.005681231  0.151178152
 [91]  0.815284396 -0.461694186 -0.212345204  0.707699082  0.535760561
 [96] -1.656978756  0.681090596 -0.535091990 -0.450470765 -0.481941901
> rowMin(tmp2)
  [1]  1.322655852 -0.459177730 -0.864552866 -0.813915230 -0.127447936
  [6] -0.577186510  0.554132228 -2.117823499 -0.165336930  0.813731897
 [11]  1.263262194  1.290984244 -1.397773896 -0.042295151  0.178142999
 [16]  0.096038457 -0.261570352  2.191015240  0.990309567  0.157062473
 [21]  0.251791205 -0.878663165  0.330019101  0.268745992 -0.433224055
 [26]  0.256385867  0.591783147 -1.601105247 -1.189873327  0.375723436
 [31] -0.237494957  0.111645337 -0.388698660  0.040681582  0.973057356
 [36] -0.135251009 -1.541762152  1.189034156  1.229992159 -0.572982593
 [41] -0.823608434 -0.565942109  0.975939718  0.677277599  0.909302675
 [46] -1.147306959  1.150801887 -1.670438292 -0.867825706  0.202763451
 [51] -0.789167226 -0.103484376 -1.254974147  1.421264942 -0.518466092
 [56]  3.158197871  0.241331898  0.931328107  0.665474939  0.542874551
 [61] -2.042276057 -1.705797301  1.081348993  1.923398295 -0.400548230
 [66]  0.422981310 -0.188844003 -0.093993400  1.361537582 -1.794147659
 [71] -0.014612750  0.017209296  1.032830141  1.518768223  1.833702149
 [76]  1.477455972  0.464592232 -1.485537180 -0.309571691  1.418159691
 [81]  1.282481175 -1.328894355 -0.704371109 -2.551727793  0.004169493
 [86] -0.127045828  0.404626687 -0.567632040  1.005681231  0.151178152
 [91]  0.815284396 -0.461694186 -0.212345204  0.707699082  0.535760561
 [96] -1.656978756  0.681090596 -0.535091990 -0.450470765 -0.481941901
> 
> colMeans(tmp2)
[1] 0.04831837
> colSums(tmp2)
[1] 4.831837
> colVars(tmp2)
[1] 1.077863
> colSd(tmp2)
[1] 1.038202
> colMax(tmp2)
[1] 3.158198
> colMin(tmp2)
[1] -2.551728
> colMedians(tmp2)
[1] 0.02894544
> colRanges(tmp2)
          [,1]
[1,] -2.551728
[2,]  3.158198
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.0441374 -0.2394571  0.6382617 -1.6866814 -0.8492223 -7.5749083
 [7]  2.6700655 -2.7331756  4.1402832  3.1573215
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.92198751
[2,] -0.06960052
[3,]  0.29641362
[4,]  0.79920680
[5,]  1.17170993
> 
> rowApply(tmp,sum)
 [1]  1.1302683 -0.4714280  0.3635275  2.5877285 -3.7637735  0.6346763
 [7] -1.5164590  4.0738552 -0.5238911 -1.9478797
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    8   10    2    8    4    5    8    6     6
 [2,]    5    3    8    4    6   10    1    5    4     7
 [3,]    3    7    1    6    5    7    6    7    2     8
 [4,]    6    6    4    8    1    5    3    6    3    10
 [5,]    2    2    5    3   10    1   10    3   10     4
 [6,]    1    4    2    7    3    3    8    1    1     1
 [7,]    4    9    6    5    7    2    4   10    8     2
 [8,]    7    5    7    1    9    6    2    4    5     5
 [9,]   10   10    9   10    2    9    7    9    7     3
[10,]    8    1    3    9    4    8    9    2    9     9
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -3.08992124  0.02057588  3.59471283  2.54313247  1.02264894  3.02787455
 [7] -3.11097725 -0.40628581  0.47007198 -1.31067472 -0.60151353 -2.51572757
[13]  0.87728691  3.60300305 -1.22428031  0.78439393 -3.95802347  0.79848304
[19]  3.67000583 -5.84260561
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.66413523
[2,] -1.20950511
[3,] -0.59882469
[4,] -0.01448195
[5,]  0.39702574
> 
> rowApply(tmp,sum)
[1]  4.6707743 -1.1625421 -0.1721491 -7.7422004  2.7582971
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    9    4    5    3   12
[2,]   19    7   13    7    2
[3,]   16   18   15   20    4
[4,]   18   10   12   12   16
[5,]    2   11   17   16   13
> 
> 
> as.matrix(tmp)
            [,1]       [,2]       [,3]        [,4]       [,5]        [,6]
[1,] -0.01448195  1.9455148  0.8579178  1.25986346 -0.8715879  0.94426851
[2,] -1.20950511 -0.1582854  1.6889133  0.02320837  0.1777948  1.69869430
[3,] -0.59882469  0.4753630  0.6955276  0.44558997  0.7354220  0.04548085
[4,] -1.66413523 -0.7242242  1.2583696 -0.16690547  0.5486401  1.14433135
[5,]  0.39702574 -1.5177924 -0.9060154  0.98137614  0.4323800 -0.80490046
           [,7]       [,8]        [,9]      [,10]       [,11]      [,12]
[1,] -0.4684414 -0.3879288 -0.58096020 -0.7120932 -0.04464985  0.1439728
[2,] -2.9542788  0.1999298  0.69867805 -0.4826352  0.31900411 -2.0191118
[3,]  0.5870511 -0.5799025  0.72138725 -1.3921322  0.87803345 -2.5206465
[4,]  0.6456869 -0.6843345 -0.32424946 -0.1258350 -1.62621154  0.4094272
[5,] -0.9209950  1.0459502 -0.04478367  1.4020208 -0.12768971  1.4706307
          [,13]       [,14]      [,15]      [,16]       [,17]      [,18]
[1,]  0.2451851  2.76018683 -1.5672952  0.2519419  0.45325442  0.1712820
[2,] -0.1335996 -0.07087887  0.6423957  0.2886187 -1.68482927 -0.2901052
[3,] -0.8045554 -0.14100935  0.2217993  1.7339116  0.14959836  0.0364109
[4,]  0.6902063 -0.97693758 -0.2193557 -1.2790737 -2.89819185  0.1982982
[5,]  0.8800504  2.03164203 -0.3018245 -0.2110046  0.02214486  0.6825971
          [,19]       [,20]
[1,]  0.3347073 -0.04988223
[2,]  1.8564436  0.24700644
[3,]  1.3622230 -2.22287677
[4,] -0.2143454 -1.73336058
[5,]  0.3309773 -2.08349247
> 
> 
> 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.7-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.7-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  639  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  554  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.8  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.290864 -0.1510287 -0.04975126 1.147651 0.9863728 1.680495 0.08719715
            col8     col9      col10      col11      col12     col13      col14
row1 -0.04914625 -1.48388 -0.5508953 0.03279938 -0.2483935 -1.184987 0.09867963
          col15    col16    col17      col18      col19     col20
row1 -0.7750183 1.027831 -0.27274 -0.5919857 -0.5054031 -0.191915
> tmp[,"col10"]
          col10
row1 -0.5508953
row2 -2.2585549
row3 -0.2468932
row4  0.4648486
row5  0.7234608
> tmp[c("row1","row5"),]
          col1       col2        col3       col4       col5       col6
row1 1.2908639 -0.1510287 -0.04975126 1.14765058  0.9863728  1.6804945
row5 0.2938652 -0.1416761 -1.11167510 0.09414282 -1.0943074 -0.3235116
           col7        col8       col9      col10       col11      col12
row1 0.08719715 -0.04914625 -1.4838801 -0.5508953  0.03279938 -0.2483935
row5 2.59338167  0.90592984 -0.3175125  0.7234608 -1.23440896  0.3149628
         col13      col14      col15    col16      col17      col18      col19
row1 -1.184987 0.09867963 -0.7750183 1.027831 -0.2727400 -0.5919857 -0.5054031
row5 -1.256738 0.88185997 -1.5752584 1.966252  0.4206613  0.8413154 -1.5713886
         col20
row1 -0.191915
row5  1.053695
> tmp[,c("col6","col20")]
           col6      col20
row1  1.6804945 -0.1919150
row2 -0.2264414 -0.2565162
row3 -0.2175358  0.8411783
row4 -0.5833450 -1.3134983
row5 -0.3235116  1.0536951
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1  1.6804945 -0.191915
row5 -0.3235116  1.053695
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 52.58262 49.28534 49.52899 48.86928 49.42192 104.8833 48.91125 50.65688
         col9    col10    col11    col12    col13    col14    col15   col16
row1 50.76723 49.47797 51.14205 50.92296 49.47821 48.61301 49.44805 49.3569
        col17    col18    col19    col20
row1 49.91218 49.61886 51.20523 104.8105
> tmp[,"col10"]
        col10
row1 49.47797
row2 28.85038
row3 30.01080
row4 28.70904
row5 50.36125
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 52.58262 49.28534 49.52899 48.86928 49.42192 104.8833 48.91125 50.65688
row5 49.72224 50.59457 49.13686 51.16057 49.34395 105.1884 49.03248 50.05134
         col9    col10    col11    col12    col13    col14    col15   col16
row1 50.76723 49.47797 51.14205 50.92296 49.47821 48.61301 49.44805 49.3569
row5 51.48325 50.36125 51.11233 51.71286 50.34015 50.46777 50.74691 49.2745
        col17    col18    col19    col20
row1 49.91218 49.61886 51.20523 104.8105
row5 50.76843 50.74695 49.97607 104.3769
> tmp[,c("col6","col20")]
          col6     col20
row1 104.88333 104.81049
row2  73.26795  75.34247
row3  76.61517  75.14581
row4  74.07985  75.22141
row5 105.18841 104.37686
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.8833 104.8105
row5 105.1884 104.3769
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.8833 104.8105
row5 105.1884 104.3769
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -1.2880304
[2,] -1.0757489
[3,] -1.7007176
[4,] -1.6891421
[5,] -0.2371273
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.4761384  0.7538197
[2,]  1.1471380 -1.7269589
[3,]  0.5405262 -0.5496592
[4,]  1.5607505 -1.8332464
[5,] -1.0184708 -0.4211095
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.7423256  2.9488081
[2,] -1.1793920 -0.2036292
[3,]  1.7810733 -1.9704682
[4,] -0.5669900  0.2673406
[5,]  1.0844116  1.5869898
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.7423256
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.7423256
[2,] -1.1793920
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
            [,1]       [,2]       [,3]       [,4]      [,5]       [,6]
row3 -0.81412123 -1.0553070 0.29396943  1.7913752 0.3096088  0.4356529
row1 -0.02436281 -0.2191899 0.06109885 -0.6201808 0.9707726 -0.3829250
          [,7]       [,8]       [,9]    [,10]      [,11]      [,12]     [,13]
row3 -0.252075 -0.7632401 -0.5618810 1.288265 -0.1891233  0.3084438 0.5173244
row1 -2.327132 -1.0290638  0.6212426 1.166215  0.5681244 -0.4834974 1.3740933
          [,14]     [,15]      [,16]      [,17]     [,18]       [,19]     [,20]
row3 -0.3409266 0.5828332 -1.9900721 -0.9796561 1.1987110 -0.08651321 1.5359752
row1  0.9218703 0.5976345  0.4276389 -0.3435166 0.9995272  0.57321611 0.7069964
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]        [,3]       [,4]     [,5]     [,6]     [,7]
row2 -2.929855 -0.3985388 -0.03426779 0.09810844 1.466827 1.568316 1.626472
         [,8]      [,9]     [,10]
row2 1.496931 0.1817653 0.9064871
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]       [,4]      [,5]       [,6]       [,7]
row5 0.3539867 -0.1153164 -2.680171 -0.9644139 -1.166805 0.04053956 -0.2332241
         [,8]       [,9]     [,10]     [,11]    [,12]    [,13]     [,14]
row5 1.291262 -0.7826923 0.6371744 0.3766733 0.198999 1.365396 0.3487061
         [,15]     [,16]     [,17]   [,18]     [,19]   [,20]
row5 0.4529266 0.3885036 0.8070899 1.42547 0.7953009 0.54169
> 
> 
> 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: 0x7fcbadc0c0a0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc2949c235"
 [2] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc296d3ac0"
 [3] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc422c287f"
 [4] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc6116cbc9"
 [5] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc1f9d2aeb"
 [6] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc76cba84" 
 [7] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc734933ea"
 [8] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc4aef82c7"
 [9] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc3272fd40"
[10] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc1b508ea0"
[11] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc45c3b862"
[12] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc347e4db6"
[13] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc502002a6"
[14] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc658e0962"
[15] "/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM2dc500a3504"
> 
> 
> ### 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: 0x7fcbaac19c20>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7fcbaac19c20>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7fcbaac19c20>
> rowMedians(tmp)
  [1]  0.501586275  0.033966549 -0.584040399  0.544445025  0.556611398
  [6]  0.334328542  0.128396754  0.368938092  0.351678117 -0.244746079
 [11]  0.079248289  0.099934979  0.026138984  0.250737978 -0.137949144
 [16] -0.176068291  0.030739386  0.332727936  0.170773941  0.446443137
 [21]  0.025646543  0.474999099 -0.467688993  0.319711588  0.051220634
 [26]  0.534292257  0.294228828 -0.649523071 -0.302578785  0.127988909
 [31] -0.161684046  0.511827514 -0.065645192  0.082298652 -0.428455030
 [36]  0.244572121  0.060136410  0.019069692 -0.162787884  0.162855852
 [41] -0.269371407  0.169295274 -0.269211867  0.156294389 -0.359357794
 [46]  0.084479988 -0.327546479 -0.493838657 -0.014026814  0.464407293
 [51] -0.060802178 -0.331233928  0.532093326  0.042897225 -0.470428172
 [56]  0.349935345 -0.114466247 -0.209616670 -0.194624279  0.084932568
 [61]  0.588740237 -0.084025056 -0.044005985  0.503620497  0.083180980
 [66] -0.592764289 -0.313560068  0.186319729  0.194286480  0.457202158
 [71] -0.018005474 -0.052543118 -0.494014262 -0.230496959  0.093787796
 [76] -0.146002378 -0.446185285  0.311927965  0.378634128  0.653949425
 [81]  0.561964475  0.548719743  0.027010884 -0.052610074  0.238689858
 [86]  0.429889146 -0.015366031 -0.361666923 -0.136518881  0.181983553
 [91] -0.067107964  0.192666166  0.375362045 -0.553025702  0.339287578
 [96]  0.118532149  0.324008860 -0.039796232  0.441792755  0.013301525
[101]  0.050023329  0.275221125  0.352281109 -0.090892936 -0.310650751
[106]  0.175915098 -0.271024787 -0.060668884 -0.187083174  0.282687353
[111]  0.264993922 -0.321067893 -0.036906597 -0.110065665  0.630819496
[116] -0.283210171  0.299716360 -0.301852718 -0.050639719 -0.053621687
[121]  0.044591222  0.031676532  0.803416652 -0.057314398 -0.313507275
[126]  0.175083808  0.032563467 -0.218021673 -0.151421525 -0.102215952
[131] -0.160979184 -0.239334564  0.087319282  0.140289804 -0.398277851
[136] -0.655177334  0.057303233 -0.128024385 -0.022949389  0.184864807
[141]  0.594106637 -0.351873345  0.268299614  0.094327794  0.052778003
[146]  0.289218853  0.130548173  0.109094440  0.022859619 -0.114743998
[151]  0.257427852  0.461158609 -0.186704735  0.407572786 -0.200425401
[156] -0.168854129 -0.031994938  0.160554677  0.503691284 -0.681824987
[161] -0.282379932  0.200935511 -0.274183562  0.608135224  0.040435220
[166] -0.412746681 -0.199902178 -0.553236485 -0.232354386 -0.428829762
[171]  0.062411831 -0.637885640 -0.276346204  0.006289865 -0.200165617
[176]  1.095540858  0.138668663  0.251446026  0.368880968 -0.039247954
[181] -0.294574585 -0.124908635 -0.269989983 -0.142097160 -0.323566244
[186]  0.050481370  0.366906926  0.091162362 -0.134566800  0.261205271
[191] -0.090621824  0.440777415 -0.013587761  0.014475757  0.340935242
[196]  0.144449149 -0.271118164  0.050260486 -0.005471406  0.069765827
[201] -0.183357981 -0.107488530 -0.039223518 -0.017429598 -0.450453479
[206]  0.069728900 -0.190109954  0.095804318 -0.149688571 -0.166068356
[211]  0.445812254  0.083681352 -0.348775947 -0.100593254  0.464131077
[216]  0.181475785  0.113735447  0.188820751  0.282217326 -0.658315527
[221] -0.312043867 -0.043159985  0.145606785  0.015928871 -0.160980490
[226] -0.650212628 -0.350908178  0.552947860  0.396707870  0.078250209
> 
> proc.time()
   user  system elapsed 
  4.239   6.764  11.344 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 3.5.1 Patched (2018-07-12 r74967) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x7ff90f073040>
> .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: 0x7ff90f073040>
> .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: 0x7ff90f073040>
> .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: 0x7ff90f073040>
> 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: 0x7ff90b6017a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff90b6017a0>
> .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: 0x7ff90b6017a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff90b6017a0>
> .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: 0x7ff90b6017a0>
> 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: 0x7ff90b603e10>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff90b603e10>
> .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: 0x7ff90b603e10>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7ff90b603e10>
> .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: 0x7ff90b603e10>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7ff90b603e10>
> .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: 0x7ff90b603e10>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7ff90b603e10>
> .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: 0x7ff90b603e10>
> 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: 0x7ff90b6040a0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7ff90b6040a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff90b6040a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff90b6040a0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile73816303a11" "BufferedMatrixFile7382e4e4b47"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile73816303a11" "BufferedMatrixFile7382e4e4b47"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff9149000e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff9149000e0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7ff9149000e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7ff9149000e0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7ff9149000e0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7ff9149000e0>
> .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: 0x7ff9087049e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff9087049e0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7ff9087049e0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7ff9087049e0>
> 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: 0x7ff9084072c0>
> .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: 0x7ff9084072c0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.419   0.102   0.488 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 3.5.1 Patched (2018-07-12 r74967) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.382   0.068   0.424 

Example timings