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

CHECK report for BufferedMatrix on malbec1

This page was generated on 2020-04-15 12:04:53 -0400 (Wed, 15 Apr 2020).

Package 205/1823HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.50.0
Ben Bolstad
Snapshot Date: 2020-04-14 16:46:13 -0400 (Tue, 14 Apr 2020)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_10
Last Commit: c7a0fa5
Last Changed Date: 2019-10-29 13:07:46 -0400 (Tue, 29 Oct 2019)
malbec1 Linux (Ubuntu 18.04.4 LTS) / x86_64  OK  OK [ OK ]UNNEEDED, same version exists in internal repository
tokay1 Windows Server 2012 R2 Standard / x64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository
merida1 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.50.0
Command: /home/biocbuild/bbs-3.10-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.10-bioc/R/library --no-vignettes --timings BufferedMatrix_1.50.0.tar.gz
StartedAt: 2020-04-15 00:22:50 -0400 (Wed, 15 Apr 2020)
EndedAt: 2020-04-15 00:23:14 -0400 (Wed, 15 Apr 2020)
EllapsedTime: 24.0 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck’
* using R version 3.6.3 (2020-02-29)
* 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.50.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.10-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.10-bioc/R/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
gcc -I"/home/biocbuild/bbs-3.10-bioc/R/include" -DNDEBUG   -I/usr/local/include  -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.10-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){
       ^~~~~~~~~~~~~~~~~~~
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.10-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.10-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.10-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.10-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.10-bioc/R/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 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.300   0.036   0.335 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 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.10-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 411706 22.0     856627 45.8   639351 34.2
Vcells 739041  5.7    8388608 64.0  1807347 13.8
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Apr 15 00:23:07 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Apr 15 00:23:07 2020"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x5562d2c80ac0>
> 
> 
> 
> 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] "Wed Apr 15 00:23:08 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Apr 15 00:23:08 2020"
> 
> ColMode(tmp2)
<pointer: 0x5562d2c80ac0>
> 
> 
> 
> ### 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,] 101.632121  0.3431016 -1.9605675  0.240156507
[2,]  -1.158716 -1.0899377 -0.1114053 -0.764659802
[3,]   1.586213  1.3344512  2.3714818 -1.960184442
[4,]  -1.788782  1.3305239  1.8576692  0.008046121
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.10-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,] 101.632121 0.3431016 1.9605675 0.240156507
[2,]   1.158716 1.0899377 0.1114053 0.764659802
[3,]   1.586213 1.3344512 2.3714818 1.960184442
[4,]   1.788782 1.3305239 1.8576692 0.008046121
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]       [,4]
[1,] 10.081276 0.5857488 1.4002027 0.49005766
[2,]  1.076437 1.0440008 0.3337743 0.87444828
[3,]  1.259450 1.1551845 1.5399616 1.40006587
[4,]  1.337453 1.1534834 1.3629634 0.08970017
> 
> 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.10-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,] 227.44488 31.20059 40.96259 30.14073
[2,]  36.92308 36.52995 28.44915 34.50914
[3,]  39.18071 37.88630 42.77110 40.96084
[4,]  40.16332 37.86536 40.48730 25.90505
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5562d49e1800>
> exp(tmp5)
<pointer: 0x5562d49e1800>
> log(tmp5,2)
<pointer: 0x5562d49e1800>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 473.3967
> Min(tmp5)
[1] 52.68489
> mean(tmp5)
[1] 72.69257
> Sum(tmp5)
[1] 14538.51
> Var(tmp5)
[1] 871.1654
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.95564 69.48826 72.16100 70.22835 70.97001 68.71692 69.94454 71.84492
 [9] 70.49456 72.12156
> rowSums(tmp5)
 [1] 1819.113 1389.765 1443.220 1404.567 1419.400 1374.338 1398.891 1436.898
 [9] 1409.891 1442.431
> rowVars(tmp5)
 [1] 8160.67646   54.69575   56.37914   98.19351   51.69571   43.85343
 [7]   40.08248   61.46934   79.82611   74.95172
> rowSd(tmp5)
 [1] 90.336462  7.395657  7.508604  9.909264  7.189973  6.622192  6.331072
 [8]  7.840239  8.934546  8.657466
> rowMax(tmp5)
 [1] 473.39672  79.13177  89.02244  86.92225  86.34224  81.02808  80.38225
 [8]  85.48852  88.53901  86.95150
> rowMin(tmp5)
 [1] 58.76347 57.92208 59.86570 53.91796 61.22414 56.21487 59.48247 53.45653
 [9] 52.68489 55.74924
> 
> colMeans(tmp5)
 [1] 115.38137  76.93906  71.90492  71.52297  69.72212  75.61381  70.46723
 [8]  69.12823  68.42876  70.82250  67.86718  66.88501  66.39313  71.71383
[15]  69.50193  73.73915  70.07828  73.21764  67.31557  67.20880
> colSums(tmp5)
 [1] 1153.8137  769.3906  719.0492  715.2297  697.2212  756.1381  704.6723
 [8]  691.2823  684.2876  708.2250  678.6718  668.8501  663.9313  717.1383
[15]  695.0193  737.3915  700.7828  732.1764  673.1557  672.0880
> colVars(tmp5)
 [1] 15866.16902    42.97969   125.11729    95.11878    28.73091    45.05815
 [7]    36.47386    58.92801    50.82585    43.20747    93.97100    99.99960
[13]    22.94020    47.75679   117.28091    56.97765    36.51795    30.83748
[19]    24.78139    34.24127
> colSd(tmp5)
 [1] 125.960982   6.555890  11.185584   9.752886   5.360122   6.712537
 [7]   6.039359   7.676458   7.129225   6.573239   9.693864   9.999980
[13]   4.789593   6.910629  10.829631   7.548354   6.043008   5.553150
[19]   4.978091   5.851604
> colMax(tmp5)
 [1] 473.39672  82.82552  89.02244  85.48852  77.05847  86.92225  79.13177
 [8]  82.45402  79.67028  79.31760  84.41779  80.38225  71.58601  79.11699
[15]  88.53901  86.95150  76.95525  80.82957  75.96436  76.48613
> colMin(tmp5)
 [1] 66.81459 64.93994 56.21487 53.91796 61.22414 65.52509 61.72825 60.04999
 [9] 56.41918 57.92208 55.74924 52.68489 58.48899 59.48247 54.27684 63.58163
[17] 60.53748 63.73745 57.86950 59.50223
> 
> 
> ### 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] 90.95564 69.48826 72.16100 70.22835 70.97001 68.71692 69.94454 71.84492
 [9]       NA 72.12156
> rowSums(tmp5)
 [1] 1819.113 1389.765 1443.220 1404.567 1419.400 1374.338 1398.891 1436.898
 [9]       NA 1442.431
> rowVars(tmp5)
 [1] 8160.67646   54.69575   56.37914   98.19351   51.69571   43.85343
 [7]   40.08248   61.46934   74.93971   74.95172
> rowSd(tmp5)
 [1] 90.336462  7.395657  7.508604  9.909264  7.189973  6.622192  6.331072
 [8]  7.840239  8.656772  8.657466
> rowMax(tmp5)
 [1] 473.39672  79.13177  89.02244  86.92225  86.34224  81.02808  80.38225
 [8]  85.48852        NA  86.95150
> rowMin(tmp5)
 [1] 58.76347 57.92208 59.86570 53.91796 61.22414 56.21487 59.48247 53.45653
 [9]       NA 55.74924
> 
> colMeans(tmp5)
 [1] 115.38137  76.93906  71.90492  71.52297  69.72212  75.61381  70.46723
 [8]  69.12823  68.42876  70.82250  67.86718  66.88501  66.39313  71.71383
[15]  69.50193  73.73915  70.07828  73.21764        NA  67.20880
> colSums(tmp5)
 [1] 1153.8137  769.3906  719.0492  715.2297  697.2212  756.1381  704.6723
 [8]  691.2823  684.2876  708.2250  678.6718  668.8501  663.9313  717.1383
[15]  695.0193  737.3915  700.7828  732.1764        NA  672.0880
> colVars(tmp5)
 [1] 15866.16902    42.97969   125.11729    95.11878    28.73091    45.05815
 [7]    36.47386    58.92801    50.82585    43.20747    93.97100    99.99960
[13]    22.94020    47.75679   117.28091    56.97765    36.51795    30.83748
[19]          NA    34.24127
> colSd(tmp5)
 [1] 125.960982   6.555890  11.185584   9.752886   5.360122   6.712537
 [7]   6.039359   7.676458   7.129225   6.573239   9.693864   9.999980
[13]   4.789593   6.910629  10.829631   7.548354   6.043008   5.553150
[19]         NA   5.851604
> colMax(tmp5)
 [1] 473.39672  82.82552  89.02244  85.48852  77.05847  86.92225  79.13177
 [8]  82.45402  79.67028  79.31760  84.41779  80.38225  71.58601  79.11699
[15]  88.53901  86.95150  76.95525  80.82957        NA  76.48613
> colMin(tmp5)
 [1] 66.81459 64.93994 56.21487 53.91796 61.22414 65.52509 61.72825 60.04999
 [9] 56.41918 57.92208 55.74924 52.68489 58.48899 59.48247 54.27684 63.58163
[17] 60.53748 63.73745       NA 59.50223
> 
> Max(tmp5,na.rm=TRUE)
[1] 473.3967
> Min(tmp5,na.rm=TRUE)
[1] 52.68489
> mean(tmp5,na.rm=TRUE)
[1] 72.76706
> Sum(tmp5,na.rm=TRUE)
[1] 14480.65
> Var(tmp5,na.rm=TRUE)
[1] 874.4499
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.95564 69.48826 72.16100 70.22835 70.97001 68.71692 69.94454 71.84492
 [9] 71.15904 72.12156
> rowSums(tmp5,na.rm=TRUE)
 [1] 1819.113 1389.765 1443.220 1404.567 1419.400 1374.338 1398.891 1436.898
 [9] 1352.022 1442.431
> rowVars(tmp5,na.rm=TRUE)
 [1] 8160.67646   54.69575   56.37914   98.19351   51.69571   43.85343
 [7]   40.08248   61.46934   74.93971   74.95172
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.336462  7.395657  7.508604  9.909264  7.189973  6.622192  6.331072
 [8]  7.840239  8.656772  8.657466
> rowMax(tmp5,na.rm=TRUE)
 [1] 473.39672  79.13177  89.02244  86.92225  86.34224  81.02808  80.38225
 [8]  85.48852  88.53901  86.95150
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.76347 57.92208 59.86570 53.91796 61.22414 56.21487 59.48247 53.45653
 [9] 52.68489 55.74924
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.38137  76.93906  71.90492  71.52297  69.72212  75.61381  70.46723
 [8]  69.12823  68.42876  70.82250  67.86718  66.88501  66.39313  71.71383
[15]  69.50193  73.73915  70.07828  73.21764  68.36513  67.20880
> colSums(tmp5,na.rm=TRUE)
 [1] 1153.8137  769.3906  719.0492  715.2297  697.2212  756.1381  704.6723
 [8]  691.2823  684.2876  708.2250  678.6718  668.8501  663.9313  717.1383
[15]  695.0193  737.3915  700.7828  732.1764  615.2862  672.0880
> colVars(tmp5,na.rm=TRUE)
 [1] 15866.16902    42.97969   125.11729    95.11878    28.73091    45.05815
 [7]    36.47386    58.92801    50.82585    43.20747    93.97100    99.99960
[13]    22.94020    47.75679   117.28091    56.97765    36.51795    30.83748
[19]    15.48626    34.24127
> colSd(tmp5,na.rm=TRUE)
 [1] 125.960982   6.555890  11.185584   9.752886   5.360122   6.712537
 [7]   6.039359   7.676458   7.129225   6.573239   9.693864   9.999980
[13]   4.789593   6.910629  10.829631   7.548354   6.043008   5.553150
[19]   3.935258   5.851604
> colMax(tmp5,na.rm=TRUE)
 [1] 473.39672  82.82552  89.02244  85.48852  77.05847  86.92225  79.13177
 [8]  82.45402  79.67028  79.31760  84.41779  80.38225  71.58601  79.11699
[15]  88.53901  86.95150  76.95525  80.82957  75.96436  76.48613
> colMin(tmp5,na.rm=TRUE)
 [1] 66.81459 64.93994 56.21487 53.91796 61.22414 65.52509 61.72825 60.04999
 [9] 56.41918 57.92208 55.74924 52.68489 58.48899 59.48247 54.27684 63.58163
[17] 60.53748 63.73745 62.30723 59.50223
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.95564 69.48826 72.16100 70.22835 70.97001 68.71692 69.94454 71.84492
 [9]      NaN 72.12156
> rowSums(tmp5,na.rm=TRUE)
 [1] 1819.113 1389.765 1443.220 1404.567 1419.400 1374.338 1398.891 1436.898
 [9]    0.000 1442.431
> rowVars(tmp5,na.rm=TRUE)
 [1] 8160.67646   54.69575   56.37914   98.19351   51.69571   43.85343
 [7]   40.08248   61.46934         NA   74.95172
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.336462  7.395657  7.508604  9.909264  7.189973  6.622192  6.331072
 [8]  7.840239        NA  8.657466
> rowMax(tmp5,na.rm=TRUE)
 [1] 473.39672  79.13177  89.02244  86.92225  86.34224  81.02808  80.38225
 [8]  85.48852        NA  86.95150
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.76347 57.92208 59.86570 53.91796 61.22414 56.21487 59.48247 53.45653
 [9]       NA 55.74924
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 120.06557  76.43075  72.76821  72.24693  69.19407  76.22301  69.79029
 [8]  69.63095  68.49548  70.51274  66.85236  68.46280  67.11157  70.90444
[15]  67.38670  73.35490  69.66097  73.21401       NaN  68.06508
> colSums(tmp5,na.rm=TRUE)
 [1] 1080.5901  687.8767  654.9139  650.2224  622.7466  686.0071  628.1126
 [8]  626.6786  616.4594  634.6147  601.6713  616.1652  604.0041  638.1400
[15]  606.4803  660.1941  626.9487  658.9261    0.0000  612.5858
> colVars(tmp5,na.rm=TRUE)
 [1] 17602.59633    45.44539   132.37264   101.11236    29.18537    46.51536
 [7]    35.87767    63.45082    57.12900    47.52894    94.13155    84.49351
[13]    20.00097    46.35644    81.60625    62.43882    39.12353    34.69201
[19]          NA    30.27265
> colSd(tmp5,na.rm=TRUE)
 [1] 132.674777   6.741319  11.505331  10.055464   5.402349   6.820217
 [7]   5.989797   7.965602   7.558373   6.894123   9.702141   9.192035
[13]   4.472244   6.808557   9.033618   7.901824   6.254881   5.889993
[19]         NA   5.502058
> colMax(tmp5,na.rm=TRUE)
 [1] 473.39672  82.82552  89.02244  85.48852  77.05847  86.92225  79.13177
 [8]  82.45402  79.67028  79.31760  84.41779  80.38225  71.58601  79.11699
[15]  81.50932  86.95150  76.95525  80.82957      -Inf  76.48613
> colMin(tmp5,na.rm=TRUE)
 [1] 66.81459 64.93994 56.21487 53.91796 61.22414 65.52509 61.72825 60.04999
 [9] 56.41918 57.92208 55.74924 53.45653 58.48899 59.48247 54.27684 63.58163
[17] 60.53748 63.73745      Inf 60.43608
> 
> 
> 
> 
> 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] 178.00863  90.73256 251.30994 293.07361 271.18288 364.04521 337.84367
 [8] 194.94041 131.09277 214.54003
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 178.00863  90.73256 251.30994 293.07361 271.18288 364.04521 337.84367
 [8] 194.94041 131.09277 214.54003
> 
> 
> 
> 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] -2.842171e-14  5.684342e-14  0.000000e+00 -7.105427e-14 -8.526513e-14
 [6]  0.000000e+00  0.000000e+00  2.842171e-14  3.410605e-13 -1.278977e-13
[11]  7.105427e-14 -5.684342e-14  0.000000e+00 -3.126388e-13 -2.842171e-14
[16] -2.842171e-14  0.000000e+00 -1.705303e-13  2.842171e-14  1.136868e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
5   10 
4   2 
6   17 
10   16 
6   14 
6   8 
3   7 
5   17 
3   12 
9   3 
4   8 
1   6 
6   7 
2   4 
4   2 
8   19 
7   16 
2   20 
10   14 
9   2 
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.096319
> Min(tmp)
[1] -2.626519
> mean(tmp)
[1] -0.130021
> Sum(tmp)
[1] -13.0021
> Var(tmp)
[1] 0.9480278
> 
> rowMeans(tmp)
[1] -0.130021
> rowSums(tmp)
[1] -13.0021
> rowVars(tmp)
[1] 0.9480278
> rowSd(tmp)
[1] 0.9736672
> rowMax(tmp)
[1] 2.096319
> rowMin(tmp)
[1] -2.626519
> 
> colMeans(tmp)
  [1]  0.194398084 -1.083823247  0.038975679  0.120305386  0.031533278
  [6]  0.029282859  1.116123060 -0.890433184 -0.342721336 -0.769452792
 [11] -0.465889362  1.200438091 -0.131522615 -0.318310585  1.362028342
 [16] -0.506961455  0.379533953  0.220806532 -0.856815545 -0.724871035
 [21] -1.310862529  0.399885123 -1.356333610  0.660900658 -1.444366166
 [26]  0.996530193  0.023590634  1.769318476 -0.324074044  0.517849646
 [31] -0.239419381 -0.549599704 -0.923808027  0.396392022 -1.747384661
 [36] -0.189432228 -0.175451474 -1.782771880  0.626517069 -1.277460872
 [41] -0.486475966  0.858099065  0.640896435 -0.387413795 -2.626518903
 [46]  2.096318926 -0.470942438 -0.341863336 -0.195331867  1.098741412
 [51] -0.777212481  0.691440846 -0.354697471 -1.836766030 -0.224799065
 [56] -0.395593269 -1.313700866 -0.181549212 -0.437693411 -1.312555270
 [61]  1.007146789  1.154005481 -0.005035255 -0.945392647  0.595790279
 [66]  1.352106448 -0.489812038 -0.153351151 -0.171380846  0.018499007
 [71]  0.090338216 -1.905223333 -1.410771477  1.141791965  0.746322897
 [76] -1.344745043  0.755185797  1.297562020  0.120136612 -0.902310994
 [81]  0.228899134  2.040296807  0.978281091 -0.098480925 -0.220507066
 [86] -0.611438503 -0.405399540  0.303795994 -0.102030232 -0.583112026
 [91] -1.270964405  1.518866629 -0.264782294 -1.625021429  1.429456819
 [96]  0.655552375  1.604777417 -1.197765656 -2.176802679 -0.871615195
> colSums(tmp)
  [1]  0.194398084 -1.083823247  0.038975679  0.120305386  0.031533278
  [6]  0.029282859  1.116123060 -0.890433184 -0.342721336 -0.769452792
 [11] -0.465889362  1.200438091 -0.131522615 -0.318310585  1.362028342
 [16] -0.506961455  0.379533953  0.220806532 -0.856815545 -0.724871035
 [21] -1.310862529  0.399885123 -1.356333610  0.660900658 -1.444366166
 [26]  0.996530193  0.023590634  1.769318476 -0.324074044  0.517849646
 [31] -0.239419381 -0.549599704 -0.923808027  0.396392022 -1.747384661
 [36] -0.189432228 -0.175451474 -1.782771880  0.626517069 -1.277460872
 [41] -0.486475966  0.858099065  0.640896435 -0.387413795 -2.626518903
 [46]  2.096318926 -0.470942438 -0.341863336 -0.195331867  1.098741412
 [51] -0.777212481  0.691440846 -0.354697471 -1.836766030 -0.224799065
 [56] -0.395593269 -1.313700866 -0.181549212 -0.437693411 -1.312555270
 [61]  1.007146789  1.154005481 -0.005035255 -0.945392647  0.595790279
 [66]  1.352106448 -0.489812038 -0.153351151 -0.171380846  0.018499007
 [71]  0.090338216 -1.905223333 -1.410771477  1.141791965  0.746322897
 [76] -1.344745043  0.755185797  1.297562020  0.120136612 -0.902310994
 [81]  0.228899134  2.040296807  0.978281091 -0.098480925 -0.220507066
 [86] -0.611438503 -0.405399540  0.303795994 -0.102030232 -0.583112026
 [91] -1.270964405  1.518866629 -0.264782294 -1.625021429  1.429456819
 [96]  0.655552375  1.604777417 -1.197765656 -2.176802679 -0.871615195
> 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.194398084 -1.083823247  0.038975679  0.120305386  0.031533278
  [6]  0.029282859  1.116123060 -0.890433184 -0.342721336 -0.769452792
 [11] -0.465889362  1.200438091 -0.131522615 -0.318310585  1.362028342
 [16] -0.506961455  0.379533953  0.220806532 -0.856815545 -0.724871035
 [21] -1.310862529  0.399885123 -1.356333610  0.660900658 -1.444366166
 [26]  0.996530193  0.023590634  1.769318476 -0.324074044  0.517849646
 [31] -0.239419381 -0.549599704 -0.923808027  0.396392022 -1.747384661
 [36] -0.189432228 -0.175451474 -1.782771880  0.626517069 -1.277460872
 [41] -0.486475966  0.858099065  0.640896435 -0.387413795 -2.626518903
 [46]  2.096318926 -0.470942438 -0.341863336 -0.195331867  1.098741412
 [51] -0.777212481  0.691440846 -0.354697471 -1.836766030 -0.224799065
 [56] -0.395593269 -1.313700866 -0.181549212 -0.437693411 -1.312555270
 [61]  1.007146789  1.154005481 -0.005035255 -0.945392647  0.595790279
 [66]  1.352106448 -0.489812038 -0.153351151 -0.171380846  0.018499007
 [71]  0.090338216 -1.905223333 -1.410771477  1.141791965  0.746322897
 [76] -1.344745043  0.755185797  1.297562020  0.120136612 -0.902310994
 [81]  0.228899134  2.040296807  0.978281091 -0.098480925 -0.220507066
 [86] -0.611438503 -0.405399540  0.303795994 -0.102030232 -0.583112026
 [91] -1.270964405  1.518866629 -0.264782294 -1.625021429  1.429456819
 [96]  0.655552375  1.604777417 -1.197765656 -2.176802679 -0.871615195
> colMin(tmp)
  [1]  0.194398084 -1.083823247  0.038975679  0.120305386  0.031533278
  [6]  0.029282859  1.116123060 -0.890433184 -0.342721336 -0.769452792
 [11] -0.465889362  1.200438091 -0.131522615 -0.318310585  1.362028342
 [16] -0.506961455  0.379533953  0.220806532 -0.856815545 -0.724871035
 [21] -1.310862529  0.399885123 -1.356333610  0.660900658 -1.444366166
 [26]  0.996530193  0.023590634  1.769318476 -0.324074044  0.517849646
 [31] -0.239419381 -0.549599704 -0.923808027  0.396392022 -1.747384661
 [36] -0.189432228 -0.175451474 -1.782771880  0.626517069 -1.277460872
 [41] -0.486475966  0.858099065  0.640896435 -0.387413795 -2.626518903
 [46]  2.096318926 -0.470942438 -0.341863336 -0.195331867  1.098741412
 [51] -0.777212481  0.691440846 -0.354697471 -1.836766030 -0.224799065
 [56] -0.395593269 -1.313700866 -0.181549212 -0.437693411 -1.312555270
 [61]  1.007146789  1.154005481 -0.005035255 -0.945392647  0.595790279
 [66]  1.352106448 -0.489812038 -0.153351151 -0.171380846  0.018499007
 [71]  0.090338216 -1.905223333 -1.410771477  1.141791965  0.746322897
 [76] -1.344745043  0.755185797  1.297562020  0.120136612 -0.902310994
 [81]  0.228899134  2.040296807  0.978281091 -0.098480925 -0.220507066
 [86] -0.611438503 -0.405399540  0.303795994 -0.102030232 -0.583112026
 [91] -1.270964405  1.518866629 -0.264782294 -1.625021429  1.429456819
 [96]  0.655552375  1.604777417 -1.197765656 -2.176802679 -0.871615195
> colMedians(tmp)
  [1]  0.194398084 -1.083823247  0.038975679  0.120305386  0.031533278
  [6]  0.029282859  1.116123060 -0.890433184 -0.342721336 -0.769452792
 [11] -0.465889362  1.200438091 -0.131522615 -0.318310585  1.362028342
 [16] -0.506961455  0.379533953  0.220806532 -0.856815545 -0.724871035
 [21] -1.310862529  0.399885123 -1.356333610  0.660900658 -1.444366166
 [26]  0.996530193  0.023590634  1.769318476 -0.324074044  0.517849646
 [31] -0.239419381 -0.549599704 -0.923808027  0.396392022 -1.747384661
 [36] -0.189432228 -0.175451474 -1.782771880  0.626517069 -1.277460872
 [41] -0.486475966  0.858099065  0.640896435 -0.387413795 -2.626518903
 [46]  2.096318926 -0.470942438 -0.341863336 -0.195331867  1.098741412
 [51] -0.777212481  0.691440846 -0.354697471 -1.836766030 -0.224799065
 [56] -0.395593269 -1.313700866 -0.181549212 -0.437693411 -1.312555270
 [61]  1.007146789  1.154005481 -0.005035255 -0.945392647  0.595790279
 [66]  1.352106448 -0.489812038 -0.153351151 -0.171380846  0.018499007
 [71]  0.090338216 -1.905223333 -1.410771477  1.141791965  0.746322897
 [76] -1.344745043  0.755185797  1.297562020  0.120136612 -0.902310994
 [81]  0.228899134  2.040296807  0.978281091 -0.098480925 -0.220507066
 [86] -0.611438503 -0.405399540  0.303795994 -0.102030232 -0.583112026
 [91] -1.270964405  1.518866629 -0.264782294 -1.625021429  1.429456819
 [96]  0.655552375  1.604777417 -1.197765656 -2.176802679 -0.871615195
> colRanges(tmp)
          [,1]      [,2]       [,3]      [,4]       [,5]       [,6]     [,7]
[1,] 0.1943981 -1.083823 0.03897568 0.1203054 0.03153328 0.02928286 1.116123
[2,] 0.1943981 -1.083823 0.03897568 0.1203054 0.03153328 0.02928286 1.116123
           [,8]       [,9]      [,10]      [,11]    [,12]      [,13]      [,14]
[1,] -0.8904332 -0.3427213 -0.7694528 -0.4658894 1.200438 -0.1315226 -0.3183106
[2,] -0.8904332 -0.3427213 -0.7694528 -0.4658894 1.200438 -0.1315226 -0.3183106
        [,15]      [,16]    [,17]     [,18]      [,19]     [,20]     [,21]
[1,] 1.362028 -0.5069615 0.379534 0.2208065 -0.8568155 -0.724871 -1.310863
[2,] 1.362028 -0.5069615 0.379534 0.2208065 -0.8568155 -0.724871 -1.310863
         [,22]     [,23]     [,24]     [,25]     [,26]      [,27]    [,28]
[1,] 0.3998851 -1.356334 0.6609007 -1.444366 0.9965302 0.02359063 1.769318
[2,] 0.3998851 -1.356334 0.6609007 -1.444366 0.9965302 0.02359063 1.769318
         [,29]     [,30]      [,31]      [,32]     [,33]    [,34]     [,35]
[1,] -0.324074 0.5178496 -0.2394194 -0.5495997 -0.923808 0.396392 -1.747385
[2,] -0.324074 0.5178496 -0.2394194 -0.5495997 -0.923808 0.396392 -1.747385
          [,36]      [,37]     [,38]     [,39]     [,40]     [,41]     [,42]
[1,] -0.1894322 -0.1754515 -1.782772 0.6265171 -1.277461 -0.486476 0.8580991
[2,] -0.1894322 -0.1754515 -1.782772 0.6265171 -1.277461 -0.486476 0.8580991
         [,43]      [,44]     [,45]    [,46]      [,47]      [,48]      [,49]
[1,] 0.6408964 -0.3874138 -2.626519 2.096319 -0.4709424 -0.3418633 -0.1953319
[2,] 0.6408964 -0.3874138 -2.626519 2.096319 -0.4709424 -0.3418633 -0.1953319
        [,50]      [,51]     [,52]      [,53]     [,54]      [,55]      [,56]
[1,] 1.098741 -0.7772125 0.6914408 -0.3546975 -1.836766 -0.2247991 -0.3955933
[2,] 1.098741 -0.7772125 0.6914408 -0.3546975 -1.836766 -0.2247991 -0.3955933
         [,57]      [,58]      [,59]     [,60]    [,61]    [,62]        [,63]
[1,] -1.313701 -0.1815492 -0.4376934 -1.312555 1.007147 1.154005 -0.005035255
[2,] -1.313701 -0.1815492 -0.4376934 -1.312555 1.007147 1.154005 -0.005035255
          [,64]     [,65]    [,66]     [,67]      [,68]      [,69]      [,70]
[1,] -0.9453926 0.5957903 1.352106 -0.489812 -0.1533512 -0.1713808 0.01849901
[2,] -0.9453926 0.5957903 1.352106 -0.489812 -0.1533512 -0.1713808 0.01849901
          [,71]     [,72]     [,73]    [,74]     [,75]     [,76]     [,77]
[1,] 0.09033822 -1.905223 -1.410771 1.141792 0.7463229 -1.344745 0.7551858
[2,] 0.09033822 -1.905223 -1.410771 1.141792 0.7463229 -1.344745 0.7551858
        [,78]     [,79]     [,80]     [,81]    [,82]     [,83]       [,84]
[1,] 1.297562 0.1201366 -0.902311 0.2288991 2.040297 0.9782811 -0.09848093
[2,] 1.297562 0.1201366 -0.902311 0.2288991 2.040297 0.9782811 -0.09848093
          [,85]      [,86]      [,87]    [,88]      [,89]     [,90]     [,91]
[1,] -0.2205071 -0.6114385 -0.4053995 0.303796 -0.1020302 -0.583112 -1.270964
[2,] -0.2205071 -0.6114385 -0.4053995 0.303796 -0.1020302 -0.583112 -1.270964
        [,92]      [,93]     [,94]    [,95]     [,96]    [,97]     [,98]
[1,] 1.518867 -0.2647823 -1.625021 1.429457 0.6555524 1.604777 -1.197766
[2,] 1.518867 -0.2647823 -1.625021 1.429457 0.6555524 1.604777 -1.197766
         [,99]     [,100]
[1,] -2.176803 -0.8716152
[2,] -2.176803 -0.8716152
> 
> 
> Max(tmp2)
[1] 2.168335
> Min(tmp2)
[1] -2.475522
> mean(tmp2)
[1] -0.004937547
> Sum(tmp2)
[1] -0.4937547
> Var(tmp2)
[1] 0.8675127
> 
> rowMeans(tmp2)
  [1] -0.47179419 -0.57451681  0.05358992  0.87773697 -0.20208300 -0.76438625
  [7]  1.28930190 -0.80205195  0.37682821  0.22227994 -0.29342954  1.74781965
 [13] -0.40951379  2.16833501 -1.14746680  0.45144940 -0.12140826 -0.57888358
 [19]  1.15472364  0.77731346  0.25170261  1.16113749 -0.76011633 -1.52119651
 [25] -1.09826411  0.24863440  0.27460117  0.25874687 -0.40314693  0.86848686
 [31]  0.54236740 -0.46905875 -0.93212363 -0.18349355  0.33573147 -1.75992261
 [37]  0.92933064  0.44342693 -0.80467844  1.67557471  0.66878745 -0.82212285
 [43] -0.37958828 -0.27187838  0.48807960 -0.03551077 -1.68964041  0.71730003
 [49] -1.69056131  0.34007144  0.72808134 -0.62549043  1.79945369 -1.52672321
 [55]  0.71812441  1.79292703  0.65552343  0.49687355 -2.17641104  0.24677170
 [61]  1.17864239  0.60035068 -0.94100761  0.75214900  1.25312406  0.03012458
 [67] -0.58914981 -2.47552150 -0.60998952 -0.26511625 -0.85286376 -1.33114140
 [73]  1.10138486  0.28105766  0.33047492  0.23723755  1.38915979 -0.07498068
 [79]  0.65278072  0.44583607 -0.59539805 -0.21334673 -0.73791186 -0.50742427
 [85]  0.18084663  0.34138748 -0.91701951  0.97607544  0.45608156  1.35325108
 [91]  0.53857744 -1.50682694  0.44067317 -0.06653145 -0.11841170 -0.40076545
 [97]  0.09973517 -0.69407356 -1.64951614 -0.83135940
> rowSums(tmp2)
  [1] -0.47179419 -0.57451681  0.05358992  0.87773697 -0.20208300 -0.76438625
  [7]  1.28930190 -0.80205195  0.37682821  0.22227994 -0.29342954  1.74781965
 [13] -0.40951379  2.16833501 -1.14746680  0.45144940 -0.12140826 -0.57888358
 [19]  1.15472364  0.77731346  0.25170261  1.16113749 -0.76011633 -1.52119651
 [25] -1.09826411  0.24863440  0.27460117  0.25874687 -0.40314693  0.86848686
 [31]  0.54236740 -0.46905875 -0.93212363 -0.18349355  0.33573147 -1.75992261
 [37]  0.92933064  0.44342693 -0.80467844  1.67557471  0.66878745 -0.82212285
 [43] -0.37958828 -0.27187838  0.48807960 -0.03551077 -1.68964041  0.71730003
 [49] -1.69056131  0.34007144  0.72808134 -0.62549043  1.79945369 -1.52672321
 [55]  0.71812441  1.79292703  0.65552343  0.49687355 -2.17641104  0.24677170
 [61]  1.17864239  0.60035068 -0.94100761  0.75214900  1.25312406  0.03012458
 [67] -0.58914981 -2.47552150 -0.60998952 -0.26511625 -0.85286376 -1.33114140
 [73]  1.10138486  0.28105766  0.33047492  0.23723755  1.38915979 -0.07498068
 [79]  0.65278072  0.44583607 -0.59539805 -0.21334673 -0.73791186 -0.50742427
 [85]  0.18084663  0.34138748 -0.91701951  0.97607544  0.45608156  1.35325108
 [91]  0.53857744 -1.50682694  0.44067317 -0.06653145 -0.11841170 -0.40076545
 [97]  0.09973517 -0.69407356 -1.64951614 -0.83135940
> 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] -0.47179419 -0.57451681  0.05358992  0.87773697 -0.20208300 -0.76438625
  [7]  1.28930190 -0.80205195  0.37682821  0.22227994 -0.29342954  1.74781965
 [13] -0.40951379  2.16833501 -1.14746680  0.45144940 -0.12140826 -0.57888358
 [19]  1.15472364  0.77731346  0.25170261  1.16113749 -0.76011633 -1.52119651
 [25] -1.09826411  0.24863440  0.27460117  0.25874687 -0.40314693  0.86848686
 [31]  0.54236740 -0.46905875 -0.93212363 -0.18349355  0.33573147 -1.75992261
 [37]  0.92933064  0.44342693 -0.80467844  1.67557471  0.66878745 -0.82212285
 [43] -0.37958828 -0.27187838  0.48807960 -0.03551077 -1.68964041  0.71730003
 [49] -1.69056131  0.34007144  0.72808134 -0.62549043  1.79945369 -1.52672321
 [55]  0.71812441  1.79292703  0.65552343  0.49687355 -2.17641104  0.24677170
 [61]  1.17864239  0.60035068 -0.94100761  0.75214900  1.25312406  0.03012458
 [67] -0.58914981 -2.47552150 -0.60998952 -0.26511625 -0.85286376 -1.33114140
 [73]  1.10138486  0.28105766  0.33047492  0.23723755  1.38915979 -0.07498068
 [79]  0.65278072  0.44583607 -0.59539805 -0.21334673 -0.73791186 -0.50742427
 [85]  0.18084663  0.34138748 -0.91701951  0.97607544  0.45608156  1.35325108
 [91]  0.53857744 -1.50682694  0.44067317 -0.06653145 -0.11841170 -0.40076545
 [97]  0.09973517 -0.69407356 -1.64951614 -0.83135940
> rowMin(tmp2)
  [1] -0.47179419 -0.57451681  0.05358992  0.87773697 -0.20208300 -0.76438625
  [7]  1.28930190 -0.80205195  0.37682821  0.22227994 -0.29342954  1.74781965
 [13] -0.40951379  2.16833501 -1.14746680  0.45144940 -0.12140826 -0.57888358
 [19]  1.15472364  0.77731346  0.25170261  1.16113749 -0.76011633 -1.52119651
 [25] -1.09826411  0.24863440  0.27460117  0.25874687 -0.40314693  0.86848686
 [31]  0.54236740 -0.46905875 -0.93212363 -0.18349355  0.33573147 -1.75992261
 [37]  0.92933064  0.44342693 -0.80467844  1.67557471  0.66878745 -0.82212285
 [43] -0.37958828 -0.27187838  0.48807960 -0.03551077 -1.68964041  0.71730003
 [49] -1.69056131  0.34007144  0.72808134 -0.62549043  1.79945369 -1.52672321
 [55]  0.71812441  1.79292703  0.65552343  0.49687355 -2.17641104  0.24677170
 [61]  1.17864239  0.60035068 -0.94100761  0.75214900  1.25312406  0.03012458
 [67] -0.58914981 -2.47552150 -0.60998952 -0.26511625 -0.85286376 -1.33114140
 [73]  1.10138486  0.28105766  0.33047492  0.23723755  1.38915979 -0.07498068
 [79]  0.65278072  0.44583607 -0.59539805 -0.21334673 -0.73791186 -0.50742427
 [85]  0.18084663  0.34138748 -0.91701951  0.97607544  0.45608156  1.35325108
 [91]  0.53857744 -1.50682694  0.44067317 -0.06653145 -0.11841170 -0.40076545
 [97]  0.09973517 -0.69407356 -1.64951614 -0.83135940
> 
> colMeans(tmp2)
[1] -0.004937547
> colSums(tmp2)
[1] -0.4937547
> colVars(tmp2)
[1] 0.8675127
> colSd(tmp2)
[1] 0.9314036
> colMax(tmp2)
[1] 2.168335
> colMin(tmp2)
[1] -2.475522
> colMedians(tmp2)
[1] 0.07666254
> colRanges(tmp2)
          [,1]
[1,] -2.475522
[2,]  2.168335
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.6399358 -3.8509556 -0.8828257  1.1575110  0.2329846 -4.7459306
 [7]  1.7425232  0.3993988 -3.5109142  5.3756748
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8140453
[2,] -0.4441963
[3,]  0.3489639
[4,]  0.7315853
[5,]  1.4280518
> 
> rowApply(tmp,sum)
 [1]  0.2594268 -1.6163235  4.9482570 -2.5334757 -0.6938695 -0.3314919
 [7]  3.6372219  2.7843195 -4.4314483 -5.4652142
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    8   10    5    6    8    9    2    6    2     1
 [2,]    1    2    2    2    3    5    6    4    7     7
 [3,]    2    1    7    5    5    6   10    8   10     5
 [4,]    7    7    8    9    9    3    4    5    6     2
 [5,]   10    5    3   10    6    2    8    3    1     9
 [6,]    3    8    6    8    1    1    1   10    3     3
 [7,]    4    6    4    7    7    4    7    7    5     8
 [8,]    9    3    1    3    2    8    9    9    9    10
 [9,]    5    4    9    1    4    7    3    2    4     6
[10,]    6    9   10    4   10   10    5    1    8     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.82696466 -0.02521443 -0.87251768 -1.47928893  3.86829395  0.96279565
 [7]  1.72631410 -1.98357682  7.06296803  0.06852004 -1.08832247 -3.20179858
[13]  2.13499886 -0.15843921  1.02306137 -0.50868880 -1.57882185  3.77841945
[19] -2.11818445  1.55598318
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1946323
[2,] -0.2531757
[3,]  0.2517583
[4,]  0.5260549
[5,]  1.4969594
> 
> rowApply(tmp,sum)
[1] 4.333812 1.539285 1.022903 1.004466 2.093000
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    2   12   19   16    9
[2,]    4   19    6    6    8
[3,]   20    1   16    5    3
[4,]    1   18    4   14    4
[5,]    7   17   12   19   17
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -1.1946323 -0.7651794  1.8280913 -2.1552519 -0.1409004  0.1320922
[2,]  0.2517583  2.2284011 -1.9252055  1.6128310  1.1805470  0.8610251
[3,]  1.4969594 -0.4459251  0.7341850 -0.5015818  0.1473239 -0.5227424
[4,]  0.5260549 -0.6746625 -0.6850284  0.2516224  1.7764280  0.2557301
[5,] -0.2531757 -0.3678485 -0.8245601 -0.6869087  0.9048955  0.2366906
            [,7]       [,8]      [,9]      [,10]      [,11]      [,12]
[1,]  0.05275776  0.9460450 1.1123390  1.0419333 -0.9447012 -0.6662092
[2,] -0.40063287 -0.4745551 3.3837322 -0.5388709 -0.8773698 -0.5862976
[3,]  0.36655315 -2.2814182 1.6294390 -0.2004689  1.4899122 -0.1583012
[4,]  1.69325008 -0.5902191 0.1495942 -0.9031348 -0.2385524 -1.1781441
[5,]  0.01438598  0.4165705 0.7878637  0.6690614 -0.5176113 -0.6128466
          [,13]       [,14]      [,15]      [,16]     [,17]     [,18]
[1,]  0.7509719  1.00575745  0.8224834 -0.4310380  1.524305 0.8525186
[2,]  0.4328544 -1.51990131 -0.2101341 -0.5758258 -1.522170 0.6086045
[3,] -0.1300863 -0.26066159 -0.4881121  0.2108746 -1.436337 1.4522497
[4,]  2.2146695  0.02222024 -0.2580961  1.3233922 -1.473703 0.1940800
[5,] -1.1334106  0.59414600  1.1569203 -1.0360918  1.329084 0.6709666
           [,19]      [,20]
[1,] -0.04686703  0.6092967
[2,] -1.27348625  0.8839811
[3,] -0.43278202  0.3538216
[4,] -1.56325460  0.1622199
[5,]  1.19820545 -0.4533362
> 
> 
> 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.10-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.10-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  644  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  558  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1       col2       col3        col4       col5      col6      col7
row1 0.2096991 -0.7263813 -0.9849504 -0.08906859 -0.2543139 -1.882888 -1.029823
          col8       col9    col10      col11     col12      col13    col14
row1 0.1929735 -0.2565792 1.716073 -0.1695128 0.6099777 -0.2675385 1.824814
         col15   col16       col17     col18     col19    col20
row1 0.4805492 -1.9275 -0.06089231 0.8223889 0.4393883 1.015806
> tmp[,"col10"]
          col10
row1  1.7160727
row2  0.3740431
row3  1.3310814
row4 -0.2321510
row5 -1.7680809
> tmp[c("row1","row5"),]
          col1       col2       col3        col4       col5       col6
row1 0.2096991 -0.7263813 -0.9849504 -0.08906859 -0.2543139 -1.8828876
row5 0.9054441 -2.5774917  1.2159949 -0.53539923  0.4377845  0.2112923
           col7       col8       col9     col10      col11     col12
row1 -1.0298232  0.1929735 -0.2565792  1.716073 -0.1695128 0.6099777
row5  0.3195084 -1.3641771 -1.2811018 -1.768081 -0.2345467 0.3700051
           col13     col14      col15       col16       col17      col18
row1 -0.26753851 1.8248143 0.48054924 -1.92750002 -0.06089231  0.8223889
row5  0.05250521 0.3093173 0.05984216  0.04540908  0.24265090 -0.3328251
         col19     col20
row1 0.4393883 1.0158063
row5 2.1961246 0.1347669
> tmp[,c("col6","col20")]
            col6        col20
row1 -1.88288760  1.015806340
row2  1.40118394  2.025957398
row3  0.01763477 -0.009018803
row4 -0.72855550 -0.441049481
row5  0.21129228  0.134766905
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1 -1.8828876 1.0158063
row5  0.2112923 0.1347669
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2    col3     col4    col5     col6     col7     col8
row1 49.94211 50.98816 50.3373 50.87888 49.6767 105.4669 50.97246 51.21567
         col9    col10    col11    col12    col13    col14    col15   col16
row1 50.47248 51.01014 49.22666 49.82938 48.17986 49.13739 51.76357 49.9051
        col17    col18    col19    col20
row1 49.00961 52.33895 50.43914 105.1437
> tmp[,"col10"]
        col10
row1 51.01014
row2 29.45655
row3 30.86082
row4 31.07726
row5 50.85634
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.94211 50.98816 50.33730 50.87888 49.67670 105.4669 50.97246 51.21567
row5 49.73270 49.47680 47.84874 50.90112 51.50802 105.4173 50.95969 48.36349
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.47248 51.01014 49.22666 49.82938 48.17986 49.13739 51.76357 49.90510
row5 48.92843 50.85634 51.98514 49.62179 49.29878 48.82653 50.65304 50.73049
        col17    col18    col19    col20
row1 49.00961 52.33895 50.43914 105.1437
row5 50.11609 50.12138 49.61719 103.7162
> tmp[,c("col6","col20")]
          col6     col20
row1 105.46693 105.14374
row2  75.69668  73.95148
row3  75.22329  76.63208
row4  74.69178  73.32438
row5 105.41733 103.71625
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.4669 105.1437
row5 105.4173 103.7162
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.4669 105.1437
row5 105.4173 103.7162
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.4161581
[2,] -1.3909885
[3,] -1.3325908
[4,] -1.1226650
[5,] -0.6347098
> tmp[,c("col17","col7")]
           col17         col7
[1,]  0.11985976  0.348044687
[2,]  1.15090618 -0.749764988
[3,] -0.08451391  1.364147626
[4,] -1.24015562  0.969156762
[5,] -1.08852018  0.001861988
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,]  0.5655211  1.88432089
[2,] -1.7177730 -0.05363335
[3,]  0.3752423 -0.38639322
[4,]  1.8292312 -0.23013416
[5,]  1.4682138  1.45474295
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.5655211
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.5655211
[2,] -1.7177730
> 
> 
> 
> 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.05335515 -0.4947151  0.2149932 -0.4721141  0.6461128  1.2039826
row1 -0.15633324 -0.7294812 -1.6759556 -0.8572948 -0.1779855 -0.4541138
          [,7]       [,8]      [,9]     [,10]      [,11]      [,12]      [,13]
row3 -1.966025  0.8763824 0.5798431 0.9040571 -0.1873851  0.1412787 -1.2568448
row1 -0.844302 -0.6305396 0.2497965 0.2338027 -0.6088405 -2.3865743 -0.7329474
          [,14]      [,15]      [,16]      [,17]     [,18]     [,19]      [,20]
row3  0.4874558 -1.3581500  1.7265367 -0.2609082  1.144761 0.7519602  0.3581896
row1 -0.2009655 -0.6674917 -0.1726081 -0.2688245 -1.587781 0.8168424 -0.3819283
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]      [,3]       [,4]     [,5]       [,6]      [,7]
row2 -1.559566 1.254845 -1.571284 -0.2748537 1.028239 -0.2191641 -1.306923
           [,8]     [,9]     [,10]
row2 -0.1432824 1.519941 0.6164319
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]       [,4]     [,5]      [,6]       [,7]
row5 0.7696449 -0.7919905 -1.441117 -0.5690614 2.182935 0.5873326 -0.9416702
          [,8]       [,9]      [,10]       [,11]      [,12]     [,13]
row5 -0.384514 -0.5276518 -0.7953631 -0.04705079 -0.9447596 -1.666137
          [,14]      [,15]      [,16]     [,17]     [,18]     [,19]     [,20]
row5 -0.0149784 -0.9875512 -0.4266155 -1.454346 0.5549801 0.4943919 0.9998664
> 
> 
> 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: 0x5562d459ca50>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM419051f7281a"
 [2] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM41902a508757"
 [3] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM4190488ce8f8"
 [4] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM419019f23977"
 [5] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM4190182e797e"
 [6] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM41905a24cabe"
 [7] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM41906905a71f"
 [8] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM4190513cfd00"
 [9] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM4190606a4a70"
[10] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM41902dd3f700"
[11] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM41902d4c88ea"
[12] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM419023a6f329"
[13] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM419029e7ce36"
[14] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM419079df7fef"
[15] "/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests/BM419068c7ee18"
> 
> 
> ### 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: 0x5562d500abf0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5562d500abf0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.10-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5562d500abf0>
> rowMedians(tmp)
  [1] -0.078764194 -0.109178754 -0.299583560 -0.585514235 -0.075689019
  [6]  0.199753913 -0.097127251 -0.321583699  0.462867810 -0.074656308
 [11] -0.106337213 -0.495920011  0.571552459  0.367817747  0.269983616
 [16] -0.253764936 -0.233241930  0.199213620  0.374052778 -0.092141841
 [21]  0.123023845 -0.554326453 -0.043878317  0.342466186 -0.326809657
 [26]  0.525999040 -0.508278447 -0.305889227 -0.245710495 -0.445664728
 [31]  0.689342109 -0.026961713  0.205993463 -0.554062299  0.444233594
 [36] -0.487619860 -0.031645546 -0.062507531 -0.269097624 -0.250332305
 [41]  0.592408275 -0.509460902  0.146181629 -0.009465656  0.290044974
 [46] -0.214271191 -0.651371871  0.238841967 -0.015414006 -0.136429543
 [51]  0.299298826 -0.408349308 -0.431086836 -0.057043941  0.233354577
 [56] -0.013781675  0.393794778 -0.033478472  0.533919277  0.263109842
 [61]  0.078653050  0.133421775  0.050592252 -0.323315704  0.373874168
 [66] -0.648841833  0.240739709 -0.155700019 -0.501717061 -0.419192377
 [71]  0.014685328  0.696705952  0.394818978 -0.295094652 -0.167141658
 [76] -0.432436820  0.405126491 -0.009161487 -0.113672657 -0.081001849
 [81]  0.006250328  0.106698556 -0.466397208 -0.613484460  0.240028857
 [86]  0.305918754 -0.225023253 -0.198219041 -0.037737112 -0.399497942
 [91] -0.496510047 -0.275077369 -0.221688919  0.317699292 -0.197376951
 [96]  0.504632220  0.422818246 -0.439072038 -0.062218834  0.202703792
[101] -0.314911003  0.236060151  0.164355796  0.118950094  0.129514176
[106] -0.491059531 -0.327025932 -0.482177499 -0.270117501 -0.475869876
[111] -0.120452665  0.168253685 -0.450048287 -0.568566261 -0.094226541
[116]  0.382879169 -0.314618193  0.342700943  0.225329390 -0.210595512
[121]  0.035061992 -0.242552426  0.044614246  0.127788452  0.524785564
[126] -0.223820138  0.112620798  0.272548411 -0.481391270  0.191779773
[131]  0.043118859 -0.155189619  0.036667555 -0.302843064  0.028887980
[136] -0.036895462  0.005444435  0.378402215  0.116867369  1.232505517
[141] -0.462095183 -0.124998935 -0.245022334  0.441293025  0.007758188
[146]  0.410376911  0.108408811  0.256063968  0.374753306  0.049585957
[151]  0.327005797  0.104057948 -0.149069119 -0.176272707 -0.610678013
[156]  0.321380411 -0.116037597  0.257112727  0.196943951  0.103430610
[161] -0.165661432  0.439207732 -0.225563830  0.350612860 -0.501635813
[166]  0.499134498 -0.288516596 -0.188548012 -0.250783922 -0.252443001
[171] -0.071520229  0.482011317  0.222176888 -0.317090708 -0.550475645
[176]  0.165891106 -0.048293406 -0.070171404  0.074400499 -0.384007418
[181]  0.292571362  0.578814008  0.432643742 -0.225333909 -0.253195381
[186] -0.098549680  0.060343630  0.467165640  0.170516353 -0.121541349
[191]  0.323980382 -0.135143047 -0.297500111 -0.496479415 -0.211983322
[196]  0.307110249 -0.193370403 -0.397336989 -0.082499582 -0.241781387
[201] -0.253196044 -0.801035446  0.400701317  0.072493037 -0.323237695
[206] -0.128939511 -0.281978261  0.148631313  0.242295778 -0.138298213
[211]  0.162617836  0.002959864 -0.033883545  0.012021719 -0.553620331
[216] -0.558690709 -0.392052671  0.230990087  0.381786276  0.385458872
[221]  0.493081475 -0.362065016 -0.221380855  0.050097665 -0.176706489
[226]  0.272725584  0.451558473 -0.034564449  0.165113163  0.179743008
> 
> proc.time()
   user  system elapsed 
  2.052   0.936   3.054 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 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: 0x564186425ac0>
> .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: 0x564186425ac0>
> .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: 0x564186425ac0>
> .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: 0x564186425ac0>
> 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: 0x5641868ea9c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5641868ea9c0>
> .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: 0x5641868ea9c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5641868ea9c0>
> .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: 0x5641868ea9c0>
> 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: 0x564186ba1820>
> .Call("R_bm_AddColumn",P)
<pointer: 0x564186ba1820>
> .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: 0x564186ba1820>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x564186ba1820>
> .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: 0x564186ba1820>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x564186ba1820>
> .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: 0x564186ba1820>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x564186ba1820>
> .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: 0x564186ba1820>
> 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: 0x56418623eb00>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x56418623eb00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56418623eb00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56418623eb00>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile444d6b4d5880" "BufferedMatrixFile444d6e2dd9c7"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile444d6b4d5880" "BufferedMatrixFile444d6e2dd9c7"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x56418644b390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56418644b390>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x56418644b390>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x56418644b390>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x56418644b390>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x56418644b390>
> .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: 0x5641868f3ba0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5641868f3ba0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5641868f3ba0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5641868f3ba0>
> 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: 0x5641869628c0>
> .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: 0x5641869628c0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.360   0.028   0.393 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 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.320   0.040   0.365 

Example timings