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

CHECK report for BufferedMatrix on malbec2

This page was generated on 2018-10-17 08:21:55 -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: /home/biocbuild/bbs-3.7-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.7-bioc/R/library --no-vignettes --timings BufferedMatrix_1.44.0.tar.gz
StartedAt: 2018-10-15 22:54:46 -0400 (Mon, 15 Oct 2018)
EndedAt: 2018-10-15 22:55:07 -0400 (Mon, 15 Oct 2018)
EllapsedTime: 21.0 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.7-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.7-bioc/R/library --no-vignettes --timings BufferedMatrix_1.44.0.tar.gz
###
##############################################################################
##############################################################################


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



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.7-bioc/R/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/home/biocbuild/bbs-3.7-bioc/R/library’
* installing *source* package ‘BufferedMatrix’ ...
** libs
gcc -I"/home/biocbuild/bbs-3.7-bioc/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.7-bioc/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘˜’ [-Wparentheses]
   if (!(Matrix->readonly) & setting){
       ^
doubleBufferedMatrix.c: At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 static int sort_double(const double *a1,const double *a2){
            ^
gcc -I"/home/biocbuild/bbs-3.7-bioc/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/bbs-3.7-bioc/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/bbs-3.7-bioc/R/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/bbs-3.7-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.7-bioc/R/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-pc-linux-gnu (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.224   0.044   0.263 

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-pc-linux-gnu (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] "/home/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) max used (Mb)
Ncells 406484 21.8     844295 45.1   634174 33.9
Vcells 743969  5.7    8388608 64.0  1812828 13.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Oct 15 22:55:02 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] "Mon Oct 15 22:55:02 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: 0x3394190>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Oct 15 22:55: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] "Mon Oct 15 22:55:03 2018"
> 
> ColMode(tmp2)
<pointer: 0x3394190>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]       [,3]        [,4]
[1,] 98.2797393 -1.3739251  0.2139432 -0.39417747
[2,] -0.3108225  0.6071871  1.0307623  1.70983227
[3,] -2.1512637  0.4350449  0.3652376 -2.85462518
[4,]  0.1209955 -0.2441085 -0.2833995  0.07056359
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/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,] 98.2797393 1.3739251 0.2139432 0.39417747
[2,]  0.3108225 0.6071871 1.0307623 1.70983227
[3,]  2.1512637 0.4350449 0.3652376 2.85462518
[4,]  0.1209955 0.2441085 0.2833995 0.07056359
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/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.9136138 1.1721455 0.4625399 0.6278355
[2,] 0.5575146 0.7792221 1.0152646 1.3076055
[3,] 1.4667187 0.6595794 0.6043489 1.6895636
[4,] 0.3478441 0.4940734 0.5323528 0.2656381
> 
> 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:    /home/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,] 222.41588 38.09538 29.83934 31.67253
[2,]  30.88597 33.39941 36.18341 39.78589
[3,]  41.81845 32.03084 31.40873 44.75026
[4,]  28.59944 30.18484 30.60693 27.72694
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x2eb8a80>
> exp(tmp5)
<pointer: 0x2eb8a80>
> log(tmp5,2)
<pointer: 0x2eb8a80>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 462.9295
> Min(tmp5)
[1] 52.94641
> mean(tmp5)
[1] 73.9478
> Sum(tmp5)
[1] 14789.56
> Var(tmp5)
[1] 846.7066
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.93608 70.10306 73.31914 68.29358 73.30417 73.99432 71.82750 71.81699
 [9] 70.83563 74.04747
> rowSums(tmp5)
 [1] 1838.722 1402.061 1466.383 1365.872 1466.083 1479.886 1436.550 1436.340
 [9] 1416.713 1480.949
> rowVars(tmp5)
 [1] 7689.49017   70.75865  115.30417   58.89659   63.41654  138.07568
 [7]  129.73050   42.80642   48.03298  101.23271
> rowSd(tmp5)
 [1] 87.689738  8.411816 10.737978  7.674411  7.963451 11.750561 11.389930
 [8]  6.542662  6.930583 10.061447
> rowMax(tmp5)
 [1] 462.92951  82.80911  93.14181  85.14333  90.29510  92.66693  92.75610
 [8]  82.79271  84.20323  90.64727
> rowMin(tmp5)
 [1] 59.52083 56.19008 57.35403 57.71000 61.06579 55.91303 52.94641 60.19946
 [9] 56.01120 54.79724
> 
> colMeans(tmp5)
 [1] 107.27288  74.10171  72.42177  72.93114  74.03275  72.06553  73.13928
 [8]  78.61797  66.34849  72.08887  71.92701  71.13552  69.00636  70.18697
[15]  71.61596  72.80767  75.18247  68.18958  73.26140  72.62258
> colSums(tmp5)
 [1] 1072.7288  741.0171  724.2177  729.3114  740.3275  720.6553  731.3928
 [8]  786.1797  663.4849  720.8887  719.2701  711.3552  690.0636  701.8697
[15]  716.1596  728.0767  751.8247  681.8958  732.6140  726.2258
> colVars(tmp5)
 [1] 15686.99181   101.29733    69.51307   160.61699   161.11240   129.89242
 [7]    56.33497    22.18348    54.23978    97.26639    81.06825    93.11661
[13]    89.82942    49.75887    82.92353   123.61135    86.07615    40.64829
[19]    51.65321    44.19295
> colSd(tmp5)
 [1] 125.247722  10.064658   8.337450  12.673476  12.693006  11.397036
 [7]   7.505663   4.709934   7.364766   9.862372   9.003791   9.649695
[13]   9.477838   7.053997   9.106236  11.118064   9.277723   6.375601
[19]   7.187016   6.647778
> colMax(tmp5)
 [1] 462.92951  88.79965  86.44158  93.14181  90.64727  92.75610  82.79271
 [8]  85.14333  78.92923  84.70590  80.81674  88.91689  81.40566  81.65445
[15]  84.20323  88.77634  90.29510  79.48324  86.37049  83.01425
> colMin(tmp5)
 [1] 59.05675 61.89171 62.10668 57.71000 52.94641 55.91303 60.79973 70.18008
 [9] 53.37196 57.35403 56.01120 61.98428 55.61238 60.73846 58.77627 54.79724
[17] 56.19008 60.77895 63.65973 63.80672
> 
> 
> ### 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] 91.93608 70.10306 73.31914 68.29358 73.30417 73.99432 71.82750 71.81699
 [9] 70.83563       NA
> rowSums(tmp5)
 [1] 1838.722 1402.061 1466.383 1365.872 1466.083 1479.886 1436.550 1436.340
 [9] 1416.713       NA
> rowVars(tmp5)
 [1] 7689.49017   70.75865  115.30417   58.89659   63.41654  138.07568
 [7]  129.73050   42.80642   48.03298   99.41324
> rowSd(tmp5)
 [1] 87.689738  8.411816 10.737978  7.674411  7.963451 11.750561 11.389930
 [8]  6.542662  6.930583  9.970619
> rowMax(tmp5)
 [1] 462.92951  82.80911  93.14181  85.14333  90.29510  92.66693  92.75610
 [8]  82.79271  84.20323        NA
> rowMin(tmp5)
 [1] 59.52083 56.19008 57.35403 57.71000 61.06579 55.91303 52.94641 60.19946
 [9] 56.01120       NA
> 
> colMeans(tmp5)
 [1] 107.27288        NA  72.42177  72.93114  74.03275  72.06553  73.13928
 [8]  78.61797  66.34849  72.08887  71.92701  71.13552  69.00636  70.18697
[15]  71.61596  72.80767  75.18247  68.18958  73.26140  72.62258
> colSums(tmp5)
 [1] 1072.7288        NA  724.2177  729.3114  740.3275  720.6553  731.3928
 [8]  786.1797  663.4849  720.8887  719.2701  711.3552  690.0636  701.8697
[15]  716.1596  728.0767  751.8247  681.8958  732.6140  726.2258
> colVars(tmp5)
 [1] 15686.99181          NA    69.51307   160.61699   161.11240   129.89242
 [7]    56.33497    22.18348    54.23978    97.26639    81.06825    93.11661
[13]    89.82942    49.75887    82.92353   123.61135    86.07615    40.64829
[19]    51.65321    44.19295
> colSd(tmp5)
 [1] 125.247722         NA   8.337450  12.673476  12.693006  11.397036
 [7]   7.505663   4.709934   7.364766   9.862372   9.003791   9.649695
[13]   9.477838   7.053997   9.106236  11.118064   9.277723   6.375601
[19]   7.187016   6.647778
> colMax(tmp5)
 [1] 462.92951        NA  86.44158  93.14181  90.64727  92.75610  82.79271
 [8]  85.14333  78.92923  84.70590  80.81674  88.91689  81.40566  81.65445
[15]  84.20323  88.77634  90.29510  79.48324  86.37049  83.01425
> colMin(tmp5)
 [1] 59.05675       NA 62.10668 57.71000 52.94641 55.91303 60.79973 70.18008
 [9] 53.37196 57.35403 56.01120 61.98428 55.61238 60.73846 58.77627 54.79724
[17] 56.19008 60.77895 63.65973 63.80672
> 
> Max(tmp5,na.rm=TRUE)
[1] 462.9295
> Min(tmp5,na.rm=TRUE)
[1] 52.94641
> mean(tmp5,na.rm=TRUE)
[1] 73.8906
> Sum(tmp5,na.rm=TRUE)
[1] 14704.23
> Var(tmp5,na.rm=TRUE)
[1] 850.3254
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.93608 70.10306 73.31914 68.29358 73.30417 73.99432 71.82750 71.81699
 [9] 70.83563 73.45368
> rowSums(tmp5,na.rm=TRUE)
 [1] 1838.722 1402.061 1466.383 1365.872 1466.083 1479.886 1436.550 1436.340
 [9] 1416.713 1395.620
> rowVars(tmp5,na.rm=TRUE)
 [1] 7689.49017   70.75865  115.30417   58.89659   63.41654  138.07568
 [7]  129.73050   42.80642   48.03298   99.41324
> rowSd(tmp5,na.rm=TRUE)
 [1] 87.689738  8.411816 10.737978  7.674411  7.963451 11.750561 11.389930
 [8]  6.542662  6.930583  9.970619
> rowMax(tmp5,na.rm=TRUE)
 [1] 462.92951  82.80911  93.14181  85.14333  90.29510  92.66693  92.75610
 [8]  82.79271  84.20323  90.64727
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.52083 56.19008 57.35403 57.71000 61.06579 55.91303 52.94641 60.19946
 [9] 56.01120 54.79724
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 107.27288  72.85418  72.42177  72.93114  74.03275  72.06553  73.13928
 [8]  78.61797  66.34849  72.08887  71.92701  71.13552  69.00636  70.18697
[15]  71.61596  72.80767  75.18247  68.18958  73.26140  72.62258
> colSums(tmp5,na.rm=TRUE)
 [1] 1072.7288  655.6876  724.2177  729.3114  740.3275  720.6553  731.3928
 [8]  786.1797  663.4849  720.8887  719.2701  711.3552  690.0636  701.8697
[15]  716.1596  728.0767  751.8247  681.8958  732.6140  726.2258
> colVars(tmp5,na.rm=TRUE)
 [1] 15686.99181    96.45074    69.51307   160.61699   161.11240   129.89242
 [7]    56.33497    22.18348    54.23978    97.26639    81.06825    93.11661
[13]    89.82942    49.75887    82.92353   123.61135    86.07615    40.64829
[19]    51.65321    44.19295
> colSd(tmp5,na.rm=TRUE)
 [1] 125.247722   9.820934   8.337450  12.673476  12.693006  11.397036
 [7]   7.505663   4.709934   7.364766   9.862372   9.003791   9.649695
[13]   9.477838   7.053997   9.106236  11.118064   9.277723   6.375601
[19]   7.187016   6.647778
> colMax(tmp5,na.rm=TRUE)
 [1] 462.92951  88.79965  86.44158  93.14181  90.64727  92.75610  82.79271
 [8]  85.14333  78.92923  84.70590  80.81674  88.91689  81.40566  81.65445
[15]  84.20323  88.77634  90.29510  79.48324  86.37049  83.01425
> colMin(tmp5,na.rm=TRUE)
 [1] 59.05675 61.89171 62.10668 57.71000 52.94641 55.91303 60.79973 70.18008
 [9] 53.37196 57.35403 56.01120 61.98428 55.61238 60.73846 58.77627 54.79724
[17] 56.19008 60.77895 63.65973 63.80672
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.93608 70.10306 73.31914 68.29358 73.30417 73.99432 71.82750 71.81699
 [9] 70.83563      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1838.722 1402.061 1466.383 1365.872 1466.083 1479.886 1436.550 1436.340
 [9] 1416.713    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 7689.49017   70.75865  115.30417   58.89659   63.41654  138.07568
 [7]  129.73050   42.80642   48.03298         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 87.689738  8.411816 10.737978  7.674411  7.963451 11.750561 11.389930
 [8]  6.542662  6.930583        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 462.92951  82.80911  93.14181  85.14333  90.29510  92.66693  92.75610
 [8]  82.79271  84.20323        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.52083 56.19008 57.35403 57.71000 61.06579 55.91303 52.94641 60.19946
 [9] 56.01120       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.16807       NaN  71.78003  73.84438  72.18669  72.15240  72.95095
 [8]  78.70511  65.79264  71.55208  71.40555  71.51364  70.49458  71.13617
[15]  70.35983  74.80883  74.63662  66.93472  71.80484  71.65309
> colSums(tmp5,na.rm=TRUE)
 [1] 1009.5126    0.0000  646.0203  664.5994  649.6802  649.3716  656.5585
 [8]  708.3460  592.1338  643.9688  642.6499  643.6227  634.4512  640.2256
[15]  633.2385  673.2795  671.7296  602.4125  646.2435  644.8778
> colVars(tmp5,na.rm=TRUE)
 [1] 17378.28404          NA    73.56918   171.31141   142.91226   146.04409
 [7]    62.97781    24.87100    57.54383   106.18311    88.14260   103.14776
[13]    76.14162    45.84266    75.53824    94.01059    93.48379    28.01448
[19]    34.24206    39.14309
> colSd(tmp5,na.rm=TRUE)
 [1] 131.826720         NA   8.577248  13.088599  11.954592  12.084870
 [7]   7.935856   4.987083   7.585765  10.304519   9.388429  10.156168
[13]   8.725916   6.770721   8.691274   9.695906   9.668701   5.292870
[19]   5.851671   6.256444
> colMax(tmp5,na.rm=TRUE)
 [1] 462.92951      -Inf  86.44158  93.14181  87.17566  92.75610  82.79271
 [8]  85.14333  78.92923  84.70590  80.81674  88.91689  81.40566  81.65445
[15]  84.20323  88.77634  90.29510  72.81485  78.65932  83.01425
> colMin(tmp5,na.rm=TRUE)
 [1] 59.05675      Inf 62.10668 57.71000 52.94641 55.91303 60.79973 70.18008
 [9] 53.37196 57.35403 56.01120 61.98428 58.94555 60.73846 58.77627 61.69728
[17] 56.19008 60.77895 63.65973 63.80672
> 
> 
> 
> 
> 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] 281.7632 154.2022 232.0202 139.7498 177.8487 237.7420 287.4364 193.8477
 [9] 206.5938 330.9984
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 281.7632 154.2022 232.0202 139.7498 177.8487 237.7420 287.4364 193.8477
 [9] 206.5938 330.9984
> 
> 
> 
> 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  1.705303e-13  0.000000e+00 -5.684342e-14 -3.410605e-13
 [6]  1.705303e-13 -1.421085e-13  1.421085e-13  5.684342e-14  1.136868e-13
[11] -2.842171e-14  2.842171e-14 -4.263256e-14  2.273737e-13 -8.526513e-14
[16] -2.842171e-14 -1.705303e-13 -2.131628e-14  4.973799e-14  8.526513e-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)
+ }
6   19 
4   12 
7   14 
4   14 
4   19 
7   12 
1   2 
8   6 
3   8 
7   18 
4   4 
8   14 
10   9 
1   2 
1   8 
9   6 
7   20 
4   11 
2   1 
1   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.580156
> Min(tmp)
[1] -2.448139
> mean(tmp)
[1] -0.118724
> Sum(tmp)
[1] -11.8724
> Var(tmp)
[1] 0.8236697
> 
> rowMeans(tmp)
[1] -0.118724
> rowSums(tmp)
[1] -11.8724
> rowVars(tmp)
[1] 0.8236697
> rowSd(tmp)
[1] 0.9075625
> rowMax(tmp)
[1] 2.580156
> rowMin(tmp)
[1] -2.448139
> 
> colMeans(tmp)
  [1] -0.339427907  0.800280901 -1.138260793  0.396465753 -0.996415946
  [6] -0.308440878 -0.332984553 -0.094374805 -0.342368592 -0.995484732
 [11] -0.904700694 -1.251529089  0.504767394 -0.880639040  0.249671816
 [16] -0.704648145 -0.397059743 -0.408852103  0.452793102  0.442357908
 [21] -0.239497089 -0.392043369 -1.186767088 -0.176191732 -0.698699894
 [26]  0.495297103 -1.510695738 -0.945051541  1.659241386  0.739697032
 [31]  0.886045712  1.179374292 -2.448138583  0.081067297  0.137985222
 [36]  1.564160035  0.069451637  0.697292594 -0.911071677  0.934766570
 [41]  0.657848765 -0.911909737 -0.745313061 -1.047196200  1.183750952
 [46]  0.857879415 -0.838923923  0.148299876  0.095061255 -0.560241254
 [51] -1.220940849 -0.512384364 -0.099068752  1.314617409  0.288834462
 [56] -0.560117419 -0.321381053  0.535743926 -0.571842723 -0.069292528
 [61]  1.355272431  0.001725702 -1.750563670 -1.916781849  0.690157632
 [66] -1.025910176 -1.317185572 -0.081183741  0.558042726 -0.894019023
 [71] -0.994317341  0.356085505 -0.609739904  0.030456151 -0.766357142
 [76] -0.849988575 -0.107859627 -0.570562170 -1.455623509  1.065796051
 [81] -0.328687426  0.049814050  0.110846459 -1.056061748  0.176696748
 [86]  0.476900027 -1.300385915 -1.360082475 -1.293075264  0.598242555
 [91]  0.992282246  0.223790719 -0.315212678  2.580156058  0.901116534
 [96]  0.926643048  0.409449497  1.602241442  0.059740058  1.644944413
> colSums(tmp)
  [1] -0.339427907  0.800280901 -1.138260793  0.396465753 -0.996415946
  [6] -0.308440878 -0.332984553 -0.094374805 -0.342368592 -0.995484732
 [11] -0.904700694 -1.251529089  0.504767394 -0.880639040  0.249671816
 [16] -0.704648145 -0.397059743 -0.408852103  0.452793102  0.442357908
 [21] -0.239497089 -0.392043369 -1.186767088 -0.176191732 -0.698699894
 [26]  0.495297103 -1.510695738 -0.945051541  1.659241386  0.739697032
 [31]  0.886045712  1.179374292 -2.448138583  0.081067297  0.137985222
 [36]  1.564160035  0.069451637  0.697292594 -0.911071677  0.934766570
 [41]  0.657848765 -0.911909737 -0.745313061 -1.047196200  1.183750952
 [46]  0.857879415 -0.838923923  0.148299876  0.095061255 -0.560241254
 [51] -1.220940849 -0.512384364 -0.099068752  1.314617409  0.288834462
 [56] -0.560117419 -0.321381053  0.535743926 -0.571842723 -0.069292528
 [61]  1.355272431  0.001725702 -1.750563670 -1.916781849  0.690157632
 [66] -1.025910176 -1.317185572 -0.081183741  0.558042726 -0.894019023
 [71] -0.994317341  0.356085505 -0.609739904  0.030456151 -0.766357142
 [76] -0.849988575 -0.107859627 -0.570562170 -1.455623509  1.065796051
 [81] -0.328687426  0.049814050  0.110846459 -1.056061748  0.176696748
 [86]  0.476900027 -1.300385915 -1.360082475 -1.293075264  0.598242555
 [91]  0.992282246  0.223790719 -0.315212678  2.580156058  0.901116534
 [96]  0.926643048  0.409449497  1.602241442  0.059740058  1.644944413
> 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.339427907  0.800280901 -1.138260793  0.396465753 -0.996415946
  [6] -0.308440878 -0.332984553 -0.094374805 -0.342368592 -0.995484732
 [11] -0.904700694 -1.251529089  0.504767394 -0.880639040  0.249671816
 [16] -0.704648145 -0.397059743 -0.408852103  0.452793102  0.442357908
 [21] -0.239497089 -0.392043369 -1.186767088 -0.176191732 -0.698699894
 [26]  0.495297103 -1.510695738 -0.945051541  1.659241386  0.739697032
 [31]  0.886045712  1.179374292 -2.448138583  0.081067297  0.137985222
 [36]  1.564160035  0.069451637  0.697292594 -0.911071677  0.934766570
 [41]  0.657848765 -0.911909737 -0.745313061 -1.047196200  1.183750952
 [46]  0.857879415 -0.838923923  0.148299876  0.095061255 -0.560241254
 [51] -1.220940849 -0.512384364 -0.099068752  1.314617409  0.288834462
 [56] -0.560117419 -0.321381053  0.535743926 -0.571842723 -0.069292528
 [61]  1.355272431  0.001725702 -1.750563670 -1.916781849  0.690157632
 [66] -1.025910176 -1.317185572 -0.081183741  0.558042726 -0.894019023
 [71] -0.994317341  0.356085505 -0.609739904  0.030456151 -0.766357142
 [76] -0.849988575 -0.107859627 -0.570562170 -1.455623509  1.065796051
 [81] -0.328687426  0.049814050  0.110846459 -1.056061748  0.176696748
 [86]  0.476900027 -1.300385915 -1.360082475 -1.293075264  0.598242555
 [91]  0.992282246  0.223790719 -0.315212678  2.580156058  0.901116534
 [96]  0.926643048  0.409449497  1.602241442  0.059740058  1.644944413
> colMin(tmp)
  [1] -0.339427907  0.800280901 -1.138260793  0.396465753 -0.996415946
  [6] -0.308440878 -0.332984553 -0.094374805 -0.342368592 -0.995484732
 [11] -0.904700694 -1.251529089  0.504767394 -0.880639040  0.249671816
 [16] -0.704648145 -0.397059743 -0.408852103  0.452793102  0.442357908
 [21] -0.239497089 -0.392043369 -1.186767088 -0.176191732 -0.698699894
 [26]  0.495297103 -1.510695738 -0.945051541  1.659241386  0.739697032
 [31]  0.886045712  1.179374292 -2.448138583  0.081067297  0.137985222
 [36]  1.564160035  0.069451637  0.697292594 -0.911071677  0.934766570
 [41]  0.657848765 -0.911909737 -0.745313061 -1.047196200  1.183750952
 [46]  0.857879415 -0.838923923  0.148299876  0.095061255 -0.560241254
 [51] -1.220940849 -0.512384364 -0.099068752  1.314617409  0.288834462
 [56] -0.560117419 -0.321381053  0.535743926 -0.571842723 -0.069292528
 [61]  1.355272431  0.001725702 -1.750563670 -1.916781849  0.690157632
 [66] -1.025910176 -1.317185572 -0.081183741  0.558042726 -0.894019023
 [71] -0.994317341  0.356085505 -0.609739904  0.030456151 -0.766357142
 [76] -0.849988575 -0.107859627 -0.570562170 -1.455623509  1.065796051
 [81] -0.328687426  0.049814050  0.110846459 -1.056061748  0.176696748
 [86]  0.476900027 -1.300385915 -1.360082475 -1.293075264  0.598242555
 [91]  0.992282246  0.223790719 -0.315212678  2.580156058  0.901116534
 [96]  0.926643048  0.409449497  1.602241442  0.059740058  1.644944413
> colMedians(tmp)
  [1] -0.339427907  0.800280901 -1.138260793  0.396465753 -0.996415946
  [6] -0.308440878 -0.332984553 -0.094374805 -0.342368592 -0.995484732
 [11] -0.904700694 -1.251529089  0.504767394 -0.880639040  0.249671816
 [16] -0.704648145 -0.397059743 -0.408852103  0.452793102  0.442357908
 [21] -0.239497089 -0.392043369 -1.186767088 -0.176191732 -0.698699894
 [26]  0.495297103 -1.510695738 -0.945051541  1.659241386  0.739697032
 [31]  0.886045712  1.179374292 -2.448138583  0.081067297  0.137985222
 [36]  1.564160035  0.069451637  0.697292594 -0.911071677  0.934766570
 [41]  0.657848765 -0.911909737 -0.745313061 -1.047196200  1.183750952
 [46]  0.857879415 -0.838923923  0.148299876  0.095061255 -0.560241254
 [51] -1.220940849 -0.512384364 -0.099068752  1.314617409  0.288834462
 [56] -0.560117419 -0.321381053  0.535743926 -0.571842723 -0.069292528
 [61]  1.355272431  0.001725702 -1.750563670 -1.916781849  0.690157632
 [66] -1.025910176 -1.317185572 -0.081183741  0.558042726 -0.894019023
 [71] -0.994317341  0.356085505 -0.609739904  0.030456151 -0.766357142
 [76] -0.849988575 -0.107859627 -0.570562170 -1.455623509  1.065796051
 [81] -0.328687426  0.049814050  0.110846459 -1.056061748  0.176696748
 [86]  0.476900027 -1.300385915 -1.360082475 -1.293075264  0.598242555
 [91]  0.992282246  0.223790719 -0.315212678  2.580156058  0.901116534
 [96]  0.926643048  0.409449497  1.602241442  0.059740058  1.644944413
> colRanges(tmp)
           [,1]      [,2]      [,3]      [,4]       [,5]       [,6]       [,7]
[1,] -0.3394279 0.8002809 -1.138261 0.3964658 -0.9964159 -0.3084409 -0.3329846
[2,] -0.3394279 0.8002809 -1.138261 0.3964658 -0.9964159 -0.3084409 -0.3329846
           [,8]       [,9]      [,10]      [,11]     [,12]     [,13]     [,14]
[1,] -0.0943748 -0.3423686 -0.9954847 -0.9047007 -1.251529 0.5047674 -0.880639
[2,] -0.0943748 -0.3423686 -0.9954847 -0.9047007 -1.251529 0.5047674 -0.880639
         [,15]      [,16]      [,17]      [,18]     [,19]     [,20]      [,21]
[1,] 0.2496718 -0.7046481 -0.3970597 -0.4088521 0.4527931 0.4423579 -0.2394971
[2,] 0.2496718 -0.7046481 -0.3970597 -0.4088521 0.4527931 0.4423579 -0.2394971
          [,22]     [,23]      [,24]      [,25]     [,26]     [,27]      [,28]
[1,] -0.3920434 -1.186767 -0.1761917 -0.6986999 0.4952971 -1.510696 -0.9450515
[2,] -0.3920434 -1.186767 -0.1761917 -0.6986999 0.4952971 -1.510696 -0.9450515
        [,29]    [,30]     [,31]    [,32]     [,33]     [,34]     [,35]   [,36]
[1,] 1.659241 0.739697 0.8860457 1.179374 -2.448139 0.0810673 0.1379852 1.56416
[2,] 1.659241 0.739697 0.8860457 1.179374 -2.448139 0.0810673 0.1379852 1.56416
          [,37]     [,38]      [,39]     [,40]     [,41]      [,42]      [,43]
[1,] 0.06945164 0.6972926 -0.9110717 0.9347666 0.6578488 -0.9119097 -0.7453131
[2,] 0.06945164 0.6972926 -0.9110717 0.9347666 0.6578488 -0.9119097 -0.7453131
         [,44]    [,45]     [,46]      [,47]     [,48]      [,49]      [,50]
[1,] -1.047196 1.183751 0.8578794 -0.8389239 0.1482999 0.09506126 -0.5602413
[2,] -1.047196 1.183751 0.8578794 -0.8389239 0.1482999 0.09506126 -0.5602413
         [,51]      [,52]       [,53]    [,54]     [,55]      [,56]      [,57]
[1,] -1.220941 -0.5123844 -0.09906875 1.314617 0.2888345 -0.5601174 -0.3213811
[2,] -1.220941 -0.5123844 -0.09906875 1.314617 0.2888345 -0.5601174 -0.3213811
         [,58]      [,59]       [,60]    [,61]       [,62]     [,63]     [,64]
[1,] 0.5357439 -0.5718427 -0.06929253 1.355272 0.001725702 -1.750564 -1.916782
[2,] 0.5357439 -0.5718427 -0.06929253 1.355272 0.001725702 -1.750564 -1.916782
         [,65]    [,66]     [,67]       [,68]     [,69]     [,70]      [,71]
[1,] 0.6901576 -1.02591 -1.317186 -0.08118374 0.5580427 -0.894019 -0.9943173
[2,] 0.6901576 -1.02591 -1.317186 -0.08118374 0.5580427 -0.894019 -0.9943173
         [,72]      [,73]      [,74]      [,75]      [,76]      [,77]
[1,] 0.3560855 -0.6097399 0.03045615 -0.7663571 -0.8499886 -0.1078596
[2,] 0.3560855 -0.6097399 0.03045615 -0.7663571 -0.8499886 -0.1078596
          [,78]     [,79]    [,80]      [,81]      [,82]     [,83]     [,84]
[1,] -0.5705622 -1.455624 1.065796 -0.3286874 0.04981405 0.1108465 -1.056062
[2,] -0.5705622 -1.455624 1.065796 -0.3286874 0.04981405 0.1108465 -1.056062
         [,85]  [,86]     [,87]     [,88]     [,89]     [,90]     [,91]
[1,] 0.1766967 0.4769 -1.300386 -1.360082 -1.293075 0.5982426 0.9922822
[2,] 0.1766967 0.4769 -1.300386 -1.360082 -1.293075 0.5982426 0.9922822
         [,92]      [,93]    [,94]     [,95]    [,96]     [,97]    [,98]
[1,] 0.2237907 -0.3152127 2.580156 0.9011165 0.926643 0.4094495 1.602241
[2,] 0.2237907 -0.3152127 2.580156 0.9011165 0.926643 0.4094495 1.602241
          [,99]   [,100]
[1,] 0.05974006 1.644944
[2,] 0.05974006 1.644944
> 
> 
> Max(tmp2)
[1] 2.666392
> Min(tmp2)
[1] -2.565714
> mean(tmp2)
[1] -0.130105
> Sum(tmp2)
[1] -13.0105
> Var(tmp2)
[1] 0.9932579
> 
> rowMeans(tmp2)
  [1] -1.1085216415 -1.2123550331  1.1353542976 -0.3818006389 -2.5657140764
  [6] -0.1190137363  0.1800306976 -1.7894259754 -0.2896249144  0.5499100244
 [11] -1.5699460824 -1.5633996857  0.8765362356  0.6729186943 -0.4785643697
 [16]  0.8906843500 -0.6880772619 -0.5114947062 -0.1147816433  2.6663924506
 [21] -0.5251835815  0.7413546304 -0.3043932080 -0.0646302372  0.2822762848
 [26] -0.9505923700  0.1600902827 -0.7735436944 -0.7101871072 -0.5244231881
 [31]  0.2526346669 -0.6278710607 -1.4803124622  2.0353851858 -0.9287336829
 [36] -1.2629525005  0.3429918722 -0.6498118635  0.1800635831 -1.5564134634
 [41]  0.4142366514  0.9058631905  0.2778494549 -0.4604359765 -0.6960090984
 [46]  1.6297897963 -1.3301801605  0.1072883101 -0.3367321341  2.1640692844
 [51] -0.7466939814  1.0263301696 -1.1162928433 -0.4574273847  0.4135362255
 [56]  0.9099366540 -0.0002006004  1.1947148636  1.3420296706  0.7508919896
 [61] -0.3545831346 -0.0589414730 -1.6591739332  0.5974202163 -0.2179318721
 [66] -1.1885423659 -0.3145728051 -0.6031363351 -0.9746983106  0.1160772726
 [71] -0.8570913886 -1.4661913789  0.0091922364  1.7505713979  0.4550486318
 [76]  0.7204181303  1.5758313181  1.1369734644 -1.4476123678 -1.9223254039
 [81] -0.9172294614 -1.7150343420 -0.1401811266  1.1028296691  0.0203062101
 [86]  0.6258108722  0.7931016849  0.6453310133 -0.2700749585 -1.1335145259
 [91]  0.0464961819 -0.7844490797 -1.2422107309 -0.1787810325 -1.0932835768
 [96] -0.1321414980  0.5099828566 -0.2982235403  0.1296744847  1.5169419894
> rowSums(tmp2)
  [1] -1.1085216415 -1.2123550331  1.1353542976 -0.3818006389 -2.5657140764
  [6] -0.1190137363  0.1800306976 -1.7894259754 -0.2896249144  0.5499100244
 [11] -1.5699460824 -1.5633996857  0.8765362356  0.6729186943 -0.4785643697
 [16]  0.8906843500 -0.6880772619 -0.5114947062 -0.1147816433  2.6663924506
 [21] -0.5251835815  0.7413546304 -0.3043932080 -0.0646302372  0.2822762848
 [26] -0.9505923700  0.1600902827 -0.7735436944 -0.7101871072 -0.5244231881
 [31]  0.2526346669 -0.6278710607 -1.4803124622  2.0353851858 -0.9287336829
 [36] -1.2629525005  0.3429918722 -0.6498118635  0.1800635831 -1.5564134634
 [41]  0.4142366514  0.9058631905  0.2778494549 -0.4604359765 -0.6960090984
 [46]  1.6297897963 -1.3301801605  0.1072883101 -0.3367321341  2.1640692844
 [51] -0.7466939814  1.0263301696 -1.1162928433 -0.4574273847  0.4135362255
 [56]  0.9099366540 -0.0002006004  1.1947148636  1.3420296706  0.7508919896
 [61] -0.3545831346 -0.0589414730 -1.6591739332  0.5974202163 -0.2179318721
 [66] -1.1885423659 -0.3145728051 -0.6031363351 -0.9746983106  0.1160772726
 [71] -0.8570913886 -1.4661913789  0.0091922364  1.7505713979  0.4550486318
 [76]  0.7204181303  1.5758313181  1.1369734644 -1.4476123678 -1.9223254039
 [81] -0.9172294614 -1.7150343420 -0.1401811266  1.1028296691  0.0203062101
 [86]  0.6258108722  0.7931016849  0.6453310133 -0.2700749585 -1.1335145259
 [91]  0.0464961819 -0.7844490797 -1.2422107309 -0.1787810325 -1.0932835768
 [96] -0.1321414980  0.5099828566 -0.2982235403  0.1296744847  1.5169419894
> 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.1085216415 -1.2123550331  1.1353542976 -0.3818006389 -2.5657140764
  [6] -0.1190137363  0.1800306976 -1.7894259754 -0.2896249144  0.5499100244
 [11] -1.5699460824 -1.5633996857  0.8765362356  0.6729186943 -0.4785643697
 [16]  0.8906843500 -0.6880772619 -0.5114947062 -0.1147816433  2.6663924506
 [21] -0.5251835815  0.7413546304 -0.3043932080 -0.0646302372  0.2822762848
 [26] -0.9505923700  0.1600902827 -0.7735436944 -0.7101871072 -0.5244231881
 [31]  0.2526346669 -0.6278710607 -1.4803124622  2.0353851858 -0.9287336829
 [36] -1.2629525005  0.3429918722 -0.6498118635  0.1800635831 -1.5564134634
 [41]  0.4142366514  0.9058631905  0.2778494549 -0.4604359765 -0.6960090984
 [46]  1.6297897963 -1.3301801605  0.1072883101 -0.3367321341  2.1640692844
 [51] -0.7466939814  1.0263301696 -1.1162928433 -0.4574273847  0.4135362255
 [56]  0.9099366540 -0.0002006004  1.1947148636  1.3420296706  0.7508919896
 [61] -0.3545831346 -0.0589414730 -1.6591739332  0.5974202163 -0.2179318721
 [66] -1.1885423659 -0.3145728051 -0.6031363351 -0.9746983106  0.1160772726
 [71] -0.8570913886 -1.4661913789  0.0091922364  1.7505713979  0.4550486318
 [76]  0.7204181303  1.5758313181  1.1369734644 -1.4476123678 -1.9223254039
 [81] -0.9172294614 -1.7150343420 -0.1401811266  1.1028296691  0.0203062101
 [86]  0.6258108722  0.7931016849  0.6453310133 -0.2700749585 -1.1335145259
 [91]  0.0464961819 -0.7844490797 -1.2422107309 -0.1787810325 -1.0932835768
 [96] -0.1321414980  0.5099828566 -0.2982235403  0.1296744847  1.5169419894
> rowMin(tmp2)
  [1] -1.1085216415 -1.2123550331  1.1353542976 -0.3818006389 -2.5657140764
  [6] -0.1190137363  0.1800306976 -1.7894259754 -0.2896249144  0.5499100244
 [11] -1.5699460824 -1.5633996857  0.8765362356  0.6729186943 -0.4785643697
 [16]  0.8906843500 -0.6880772619 -0.5114947062 -0.1147816433  2.6663924506
 [21] -0.5251835815  0.7413546304 -0.3043932080 -0.0646302372  0.2822762848
 [26] -0.9505923700  0.1600902827 -0.7735436944 -0.7101871072 -0.5244231881
 [31]  0.2526346669 -0.6278710607 -1.4803124622  2.0353851858 -0.9287336829
 [36] -1.2629525005  0.3429918722 -0.6498118635  0.1800635831 -1.5564134634
 [41]  0.4142366514  0.9058631905  0.2778494549 -0.4604359765 -0.6960090984
 [46]  1.6297897963 -1.3301801605  0.1072883101 -0.3367321341  2.1640692844
 [51] -0.7466939814  1.0263301696 -1.1162928433 -0.4574273847  0.4135362255
 [56]  0.9099366540 -0.0002006004  1.1947148636  1.3420296706  0.7508919896
 [61] -0.3545831346 -0.0589414730 -1.6591739332  0.5974202163 -0.2179318721
 [66] -1.1885423659 -0.3145728051 -0.6031363351 -0.9746983106  0.1160772726
 [71] -0.8570913886 -1.4661913789  0.0091922364  1.7505713979  0.4550486318
 [76]  0.7204181303  1.5758313181  1.1369734644 -1.4476123678 -1.9223254039
 [81] -0.9172294614 -1.7150343420 -0.1401811266  1.1028296691  0.0203062101
 [86]  0.6258108722  0.7931016849  0.6453310133 -0.2700749585 -1.1335145259
 [91]  0.0464961819 -0.7844490797 -1.2422107309 -0.1787810325 -1.0932835768
 [96] -0.1321414980  0.5099828566 -0.2982235403  0.1296744847  1.5169419894
> 
> colMeans(tmp2)
[1] -0.130105
> colSums(tmp2)
[1] -13.0105
> colVars(tmp2)
[1] 0.9932579
> colSd(tmp2)
[1] 0.9966232
> colMax(tmp2)
[1] 2.666392
> colMin(tmp2)
[1] -2.565714
> colMedians(tmp2)
[1] -0.1594811
> colRanges(tmp2)
          [,1]
[1,] -2.565714
[2,]  2.666392
> 
> 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.116817 -2.117329  4.436937 -2.380856  5.280603 -4.116216  1.262359
 [8] -6.268848  4.675304 -3.237694
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.9099228
[2,] -0.7048814
[3,] -0.1920653
[4,]  0.4262119
[5,]  0.8139965
> 
> rowApply(tmp,sum)
 [1] -0.2322224  0.9338134  0.7057551  2.2682545 -3.9169822 -1.4800773
 [7] -5.6928345  5.0602390 -1.9736960 -1.2548059
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    3    1    9    2    3    8    8    7    4     8
 [2,]    7    9   10    7    2    3    5    4    2     2
 [3,]    1    4    6    3   10    2    9    9    9     9
 [4,]    8    5    4    8    6    6    6    3    6     1
 [5,]   10   10    2    5    9    9    1   10    3     4
 [6,]    5    8    8    1    8    1    2    1    8     3
 [7,]    6    7    3   10    7    7    4    6    7     6
 [8,]    4    3    7    4    1    5    7    2    1     7
 [9,]    9    2    5    6    5   10   10    8   10    10
[10,]    2    6    1    9    4    4    3    5    5     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.1582728  1.6003254  3.3776144  3.2116692  1.7114696 -1.2361701
 [7] -1.0053944  0.3259104  2.4945858 -1.4917044  1.4380102 -3.4026078
[13] -1.0927706  2.7548165 -3.1017846  0.6172657 -2.7917858  0.8810117
[19] -1.1558110 -0.6075769
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.2878039
[2,] -1.0063378
[3,] -0.4028877
[4,]  0.8071271
[5,]  1.7316295
> 
> rowApply(tmp,sum)
[1] -1.5956379  5.3937823  3.6750900 -4.1811231 -0.9233109
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    5   20    5   19    2
[2,]   10   18   13   11   11
[3,]   19   17   14   13   12
[4,]    7   16   20    4   20
[5,]    2   15   17    2   19
> 
> 
> as.matrix(tmp)
           [,1]        [,2]        [,3]       [,4]      [,5]       [,6]
[1,] -1.0063378 -0.18006702  1.38479497 -0.7207419 -1.291772  0.9675127
[2,]  1.7316295  1.60502553  1.20285216  1.1710217  1.036333 -0.7733304
[3,] -0.4028877  0.37174001  0.58309316  1.6244481  1.332134  0.1966075
[4,]  0.8071271 -0.21017970 -0.09112707 -0.9132992 -1.308820 -0.5765491
[5,] -1.2878039  0.01380659  0.29800121  2.0502405  1.943595 -1.0504106
           [,7]        [,8]        [,9]       [,10]      [,11]      [,12]
[1,]  0.2628027  1.04658929  1.18106715 -0.08120714 -0.1814461 -0.8901842
[2,] -1.2170409  0.16352697  0.84376823 -1.49455850  0.8669357  0.7366050
[3,] -0.3416430  0.14967554 -0.08853686  0.19723149  0.6418447 -1.0020381
[4,] -0.2108495  0.07188936 -0.91973226 -0.68598806  0.5092741 -0.4996173
[5,]  0.5013363 -1.10577075  1.47801955  0.57281777 -0.3985981 -1.7473732
           [,13]     [,14]        [,15]      [,16]      [,17]      [,18]
[1,] -0.09485846 0.2589761 -0.008657028 -0.3682624 -1.8739975  2.1893302
[2,]  1.61591455 0.5209681 -1.574278652  0.6929776 -1.7260091  0.2391949
[3,] -0.52784173 0.1395977 -1.436093062  1.3018014  1.5796095 -1.8466948
[4,] -1.63306898 1.4769557 -0.503782480 -0.1777137  0.4682563  0.7462825
[5,] -0.45291598 0.3583190  0.421026599 -0.8315373 -1.2396451 -0.4471011
          [,19]      [,20]
[1,] -1.1110827 -1.0780966
[2,]  0.4868711 -0.7346239
[3,] -0.3968307  1.5998732
[4,] -0.4725979 -0.0575831
[5,]  0.3378293 -0.3371466
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/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:    /home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  638  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  550  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/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 -0.3870909 -0.56379 -0.7557998 -0.5131578 1.804665 -0.1215587 -1.366059
          col8      col9     col10    col11      col12     col13       col14
row1 0.9682797 0.8004317 -1.020097 1.845719 0.04002196 -1.363009 -0.07060162
          col15     col16     col17      col18   col19      col20
row1 -0.7065232 -0.379137 0.9851575 -0.8268981 0.51595 0.06835488
> tmp[,"col10"]
          col10
row1 -1.0200972
row2  0.9466209
row3 -1.4429549
row4 -0.5037770
row5 -0.3461159
> tmp[c("row1","row5"),]
           col1       col2       col3        col4       col5       col6
row1 -0.3870909 -0.5637900 -0.7557998 -0.51315776  1.8046648 -0.1215587
row5 -0.2288039  0.0893262 -0.4945288  0.01019662 -0.1344917  0.3787128
          col7      col8       col9      col10    col11      col12     col13
row1 -1.366059 0.9682797  0.8004317 -1.0200972 1.845719 0.04002196 -1.363009
row5  2.406622 0.3897649 -1.5566480 -0.3461159 1.020282 0.50675793 -1.226495
           col14      col15     col16      col17      col18     col19
row1 -0.07060162 -0.7065232 -0.379137  0.9851575 -0.8268981  0.515950
row5  0.46904907  0.0743171 -2.286862 -0.5745289 -0.2112435 -1.238098
          col20
row1 0.06835488
row5 0.52857588
> tmp[,c("col6","col20")]
           col6       col20
row1 -0.1215587  0.06835488
row2 -0.3215764 -0.95621473
row3 -0.2292673 -0.27916830
row4  0.7694323  1.32839376
row5  0.3787128  0.52857588
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.1215587 0.06835488
row5  0.3787128 0.52857588
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.02115 47.95393 49.28036 51.89902 51.00455 105.0991 51.58408 51.41136
        col9    col10    col11    col12    col13    col14    col15    col16
row1 51.9685 52.32677 50.74439 51.47307 50.67258 48.36532 50.57705 49.09002
        col17    col18    col19   col20
row1 50.01096 49.98777 49.42036 105.845
> tmp[,"col10"]
        col10
row1 52.32677
row2 29.98163
row3 29.70985
row4 30.55759
row5 50.00365
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.02115 47.95393 49.28036 51.89902 51.00455 105.0991 51.58408 51.41136
row5 50.64131 49.53303 51.04982 50.40541 51.30498 104.2924 48.56275 49.97449
        col9    col10    col11    col12    col13    col14    col15    col16
row1 51.9685 52.32677 50.74439 51.47307 50.67258 48.36532 50.57705 49.09002
row5 49.5024 50.00365 48.25281 49.65828 51.40064 49.01911 49.63007 52.19523
        col17    col18    col19    col20
row1 50.01096 49.98777 49.42036 105.8450
row5 49.97598 49.31436 51.46240 103.6611
> tmp[,c("col6","col20")]
          col6     col20
row1 105.09910 105.84502
row2  74.63210  73.33096
row3  73.08255  72.28712
row4  74.75678  73.34092
row5 104.29241 103.66113
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.0991 105.8450
row5 104.2924 103.6611
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.0991 105.8450
row5 104.2924 103.6611
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  1.11194260
[2,]  0.08200302
[3,]  0.50337419
[4,]  0.15317154
[5,] -0.19158562
> tmp[,c("col17","col7")]
          col17        col7
[1,]  0.1072395 -0.18830154
[2,] -1.2493089  0.68530440
[3,] -0.4783996  0.09485507
[4,] -0.1871930  0.47121627
[5,]  0.2301238  1.51022141
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,]  1.1534989  0.43626409
[2,] -0.6617807  0.02987399
[3,] -1.6688571  0.35052402
[4,]  1.2345802  1.06667704
[5,]  0.3556872 -0.21174143
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.153499
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  1.1534989
[2,] -0.6617807
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]       [,4]      [,5]       [,6]       [,7]
row3 -0.3430693  0.6351022 0.9377363 1.02637441 1.1548149 -0.1697443 -0.8638620
row1 -1.9258295 -0.9581523 1.2090299 0.03114765 0.3592054 -0.3388700 -0.7139818
           [,8]       [,9]      [,10]      [,11]      [,12]     [,13]
row3 0.29693007 -0.5901790  0.7273832 1.25045545 -0.4825102 0.1998837
row1 0.08715114 -0.6069969 -0.3727047 0.06673731  1.0262060 0.5677896
          [,14]      [,15]     [,16]     [,17]     [,18]        [,19]
row3 -1.5543262 -1.4969985 1.5673735 -1.180450 -1.296596 -1.097654047
row1  0.1843801 -0.8890525 0.4784413  1.423371  0.652866 -0.002540171
          [,20]
row3 -0.8166615
row1 -1.7566564
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]      [,3]      [,4]    [,5]      [,6]       [,7]
row2 0.1703665 0.3060998 0.3845834 0.2918454 1.35381 0.1732276 -0.4555602
          [,8]      [,9]    [,10]
row2 -1.475556 0.8202504 1.205387
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]        [,3]     [,4]       [,5]       [,6]       [,7]
row5 0.8108938 -1.068058 -0.08297125 1.535038 0.04851997 -0.4238441 -0.4088601
           [,8]      [,9]      [,10]     [,11]     [,12]    [,13]      [,14]
row5 0.08575037 -1.044371 0.04250211 0.9825112 0.5060864 1.288372 -0.1705826
         [,15]     [,16]    [,17]    [,18]     [,19]     [,20]
row5 -1.583054 0.5061283 1.059671 2.500045 0.4601893 0.3318025
> 
> 
> 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: 0x211d5a0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM181449702f28"
 [2] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM18144b0fd478"
 [3] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM1814782f4bf2"
 [4] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM18146706fef5"
 [5] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM181460588237"
 [6] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM18141bb9cac7"
 [7] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM18142121955d"
 [8] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM181446a2105a"
 [9] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM181436a44ce4"
[10] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM1814777118f" 
[11] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM181446ad4992"
[12] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM181461a239"  
[13] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM181436a03384"
[14] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM1814170651b" 
[15] "/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests/BM181429519c80"
> 
> 
> ### 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: 0x20a4a10>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x20a4a10>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.7-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x20a4a10>
> rowMedians(tmp)
  [1]  0.275337303  0.021057815  0.148981403  0.346613896 -0.058081293
  [6] -0.109560673 -0.219131455  0.275522045 -0.088017386  0.339188449
 [11]  0.614715000  0.236915817  0.338035912 -0.247958463  0.057951269
 [16] -0.024411723 -0.381289557 -0.413637194 -0.441504731 -0.543220602
 [21]  0.126457134 -0.111823591  0.170076146 -0.090135121 -0.140953331
 [26]  0.507782591 -0.418375507  0.248985316 -0.321610499  0.321115701
 [31]  0.164415527  0.545203599 -0.315315129  0.464672697 -0.484345079
 [36] -0.148846993  0.011948115  0.116702819  0.258125039  0.143258814
 [41]  0.185038984 -0.180214149 -0.052761501 -0.464165909 -0.040360382
 [46] -0.146865701  0.388372041  0.133175468 -0.302130747  0.049308717
 [51] -0.165003073 -0.574829010  0.573338775 -0.121575230 -0.554333918
 [56] -0.218979663 -0.086263639  0.265040873  0.203096565 -0.064315795
 [61] -0.030218203  0.408080424 -0.282518123 -0.427347052  0.100178565
 [66]  0.033122038 -0.334329947 -0.420435855 -0.062673778  0.461487414
 [71]  0.116631792 -0.020681395 -0.459634486 -0.104927080  0.012312164
 [76] -0.469930005 -0.099298418  0.333410173 -0.355302577  0.134043909
 [81] -0.025073787 -0.147244158  0.136855517 -0.097261955  0.113229590
 [86]  0.250098576  0.502630294 -0.020676088  0.014821230  0.340457675
 [91]  0.201345283  0.193734603  0.590421363 -0.481960434  0.472008741
 [96]  0.181267995 -0.118332655  0.046255142  0.266151067  0.189616149
[101] -0.411248568  0.240794154 -0.510651973 -0.134092481  0.465005555
[106] -0.207858650  0.180047773  0.134790547 -0.066233439 -0.157336383
[111] -0.297989998 -0.335770689  0.255159717 -0.245881768 -0.530080726
[116] -0.174069478  0.693939280 -0.216374412  0.121650164 -0.440196487
[121]  0.126986882  0.221511755 -0.021119582 -0.238203864 -0.293810300
[126] -0.215318459  0.034210627  0.413887372 -0.081255376 -0.194828164
[131]  0.409288215  0.426036092  0.075466591  0.017820197  0.115715029
[136]  0.025093382  0.093734173  0.084100490 -0.456254235  0.375153802
[141]  0.271413994  0.169221249 -0.356753069 -0.116923693  0.230780814
[146]  0.177108292 -0.010905593  0.058108090 -0.078478970  0.184994491
[151] -0.037273226 -0.412917660 -0.082638205 -0.163417898 -0.171127745
[156] -0.199595041 -0.360448045  0.016128949 -0.495148398  0.221439712
[161] -0.282857543 -0.249536682 -0.123647599  0.339386390  0.098704473
[166]  0.187941190 -0.050045086  0.190977228 -0.489421123  0.341442615
[171]  0.447734107  0.118509254  0.250306507  0.049316363  0.092399489
[176]  0.840469038  0.062839906 -0.476056415 -0.124809682  0.058828527
[181] -0.430987363  0.202840711 -0.134682502  0.008069723  0.245232209
[186] -0.196879411 -0.010491821 -0.044221586  0.084719070  0.190341445
[191]  0.269966759  0.205040429  0.231789931 -0.130471328  0.858444753
[196] -0.335553855 -0.262338096  0.271051708  0.509726597  0.099002645
[201]  0.003055461  0.222445950  0.074900487 -0.053646979  0.267701966
[206]  0.077192636  0.106467468  0.920299428  0.614772650  0.524313841
[211] -0.382163549  0.756025446  0.465915912  0.306144068 -0.085435942
[216] -0.223228256 -0.085803137  0.151114250 -0.187645431  0.079862312
[221]  0.122723765  0.271689713  0.195509097  0.254010038  0.066461887
[226]  0.045876336  0.526455424 -0.431178663 -0.085738935 -0.042777287
> 
> proc.time()
   user  system elapsed 
  1.648   0.788   2.479 

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-pc-linux-gnu (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: 0x30f8190>
> .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: 0x30f8190>
> .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: 0x30f8190>
> .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: 0x30f8190>
> 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: 0x2173c60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x2173c60>
> .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: 0x2173c60>
> .Call("R_bm_AddColumn",P)
<pointer: 0x2173c60>
> .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: 0x2173c60>
> 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: 0x1d53040>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1d53040>
> .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: 0x1d53040>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x1d53040>
> .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: 0x1d53040>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x1d53040>
> .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: 0x1d53040>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x1d53040>
> .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: 0x1d53040>
> 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: 0x1762eb0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x1762eb0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1762eb0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1762eb0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile18d23082ee51" "BufferedMatrixFile18d27af71dc7"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile18d23082ee51" "BufferedMatrixFile18d27af71dc7"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x330eee0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x330eee0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x330eee0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x330eee0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x330eee0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x330eee0>
> .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: 0x1bf62e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1bf62e0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x1bf62e0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x1bf62e0>
> 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: 0x23b08d0>
> .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: 0x23b08d0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.240   0.024   0.261 

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-pc-linux-gnu (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.236   0.008   0.240 

Example timings