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

CHECK report for BufferedMatrix on malbec1

This page was generated on 2020-08-10 11:33:02 -0400 (Mon, 10 Aug 2020).

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

Summary

Package: BufferedMatrix
Version: 1.53.0
Command: /home/biocbuild/bbs-3.12-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.12-bioc/R/library --no-vignettes --timings BufferedMatrix_1.53.0.tar.gz
StartedAt: 2020-08-09 22:54:05 -0400 (Sun, 09 Aug 2020)
EndedAt: 2020-08-09 22:54:31 -0400 (Sun, 09 Aug 2020)
EllapsedTime: 25.9 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.0.2 (2020-06-22)
* 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.53.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking 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.12-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.12-bioc/R/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
gcc -I"/home/biocbuild/bbs-3.12-bioc/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.12-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.12-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.12-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.12-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.12-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.12-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 4.0.2 (2020-06-22) -- "Taking Off Again"
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.428   0.032   0.460 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-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.12-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 438294 23.5     927094 49.6   650348 34.8
Vcells 788584  6.1    8388608 64.0  2013990 15.4
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sun Aug  9 22:54:24 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sun Aug  9 22:54:24 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: 0x5642bdbcc3c0>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sun Aug  9 22:54:25 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sun Aug  9 22:54:25 2020"
> 
> ColMode(tmp2)
<pointer: 0x5642bdbcc3c0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
          [,1]        [,2]        [,3]       [,4]
[1,] 99.296830 -1.06823608 -0.02220845 -0.1933204
[2,]  1.197671  0.09148455 -0.18571391  0.5184222
[3,]  2.078148  0.05309350  0.42625967  0.7926554
[4,]  1.151526  1.03070244  0.86593869  1.0059015
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]       [,2]       [,3]      [,4]
[1,] 99.296830 1.06823608 0.02220845 0.1933204
[2,]  1.197671 0.09148455 0.18571391 0.5184222
[3,]  2.078148 0.05309350 0.42625967 0.7926554
[4,]  1.151526 1.03070244 0.86593869 1.0059015
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.12-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.964779 1.0335551 0.1490250 0.4396821
[2,] 1.094381 0.3024641 0.4309454 0.7200154
[3,] 1.441578 0.2304203 0.6528856 0.8903120
[4,] 1.073092 1.0152352 0.9305583 1.0029464
> 
> 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.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 223.94462 36.40379 26.51246 29.59014
[2,]  37.14149 28.11613 29.49517 32.71858
[3,]  41.49393 27.35730 31.95512 34.69578
[4,]  36.88245 36.18305 35.17152 36.03537
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5642bcd26180>
> exp(tmp5)
<pointer: 0x5642bcd26180>
> log(tmp5,2)
<pointer: 0x5642bcd26180>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.1114
> Min(tmp5)
[1] 54.38156
> mean(tmp5)
[1] 73.14705
> Sum(tmp5)
[1] 14629.41
> Var(tmp5)
[1] 851.9032
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 88.84027 67.79151 73.55427 71.22420 68.74696 72.39127 73.68163 72.78097
 [9] 72.99402 69.46539
> rowSums(tmp5)
 [1] 1776.805 1355.830 1471.085 1424.484 1374.939 1447.825 1473.633 1455.619
 [9] 1459.880 1389.308
> rowVars(tmp5)
 [1] 7955.20813   35.49961   82.44559   96.45072   74.19450   67.96592
 [7]   58.15235   84.49970   66.49484   72.44137
> rowSd(tmp5)
 [1] 89.191973  5.958155  9.079955  9.820933  8.613623  8.244145  7.625769
 [8]  9.192372  8.154437  8.511249
> rowMax(tmp5)
 [1] 466.11140  77.30514  87.11157  91.83549  86.98082  90.79467  89.50577
 [8]  90.92020  86.36983  88.13213
> rowMin(tmp5)
 [1] 54.88565 57.44446 54.38156 57.39351 55.46494 59.33640 59.63607 60.64728
 [9] 56.35468 57.69848
> 
> colMeans(tmp5)
 [1] 113.88864  66.08535  68.02716  70.46709  70.92299  71.93429  73.87377
 [8]  70.38148  65.48313  70.16270  71.43403  72.37188  68.96754  74.86673
[15]  69.35130  70.83679  73.71265  71.97810  74.27808  73.91731
> colSums(tmp5)
 [1] 1138.8864  660.8535  680.2716  704.6709  709.2299  719.3429  738.7377
 [8]  703.8148  654.8313  701.6270  714.3403  723.7188  689.6754  748.6673
[15]  693.5130  708.3679  737.1265  719.7810  742.7808  739.1731
> colVars(tmp5)
 [1] 15351.31921    45.79775    52.46042    83.90343    67.62750    91.00836
 [7]   110.68474    83.68376    34.03991   113.35002    50.97143    61.43070
[13]    36.75747    75.55216    65.32147   116.70616    48.09088    59.45514
[19]    98.01709   109.63757
> colSd(tmp5)
 [1] 123.900441   6.767403   7.242957   9.159882   8.223594   9.539830
 [7]  10.520682   9.147883   5.834373  10.646597   7.139428   7.837774
[13]   6.062794   8.692074   8.082170  10.803062   6.934759   7.710716
[19]   9.900358  10.470796
> colMax(tmp5)
 [1] 466.11140  75.76971  78.60546  86.98082  88.13213  82.81264  91.83549
 [8]  82.31625  73.02829  86.36983  81.29623  81.38346  78.12660  90.78098
[15]  86.35816  90.79467  82.49674  90.92020  89.50577  90.17359
> colMin(tmp5)
 [1] 63.54439 56.94063 55.18221 57.69848 60.64021 54.88565 59.63607 54.38156
 [9] 57.39351 56.96815 59.51253 59.58939 58.89107 62.06565 60.40245 59.21247
[17] 60.93553 63.50545 59.12887 55.46494
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 88.84027 67.79151 73.55427       NA 68.74696 72.39127 73.68163 72.78097
 [9] 72.99402 69.46539
> rowSums(tmp5)
 [1] 1776.805 1355.830 1471.085       NA 1374.939 1447.825 1473.633 1455.619
 [9] 1459.880 1389.308
> rowVars(tmp5)
 [1] 7955.20813   35.49961   82.44559  100.97410   74.19450   67.96592
 [7]   58.15235   84.49970   66.49484   72.44137
> rowSd(tmp5)
 [1] 89.191973  5.958155  9.079955 10.048587  8.613623  8.244145  7.625769
 [8]  9.192372  8.154437  8.511249
> rowMax(tmp5)
 [1] 466.11140  77.30514  87.11157        NA  86.98082  90.79467  89.50577
 [8]  90.92020  86.36983  88.13213
> rowMin(tmp5)
 [1] 54.88565 57.44446 54.38156       NA 55.46494 59.33640 59.63607 60.64728
 [9] 56.35468 57.69848
> 
> colMeans(tmp5)
 [1] 113.88864  66.08535  68.02716        NA  70.92299  71.93429  73.87377
 [8]  70.38148  65.48313  70.16270  71.43403  72.37188  68.96754  74.86673
[15]  69.35130  70.83679  73.71265  71.97810  74.27808  73.91731
> colSums(tmp5)
 [1] 1138.8864  660.8535  680.2716        NA  709.2299  719.3429  738.7377
 [8]  703.8148  654.8313  701.6270  714.3403  723.7188  689.6754  748.6673
[15]  693.5130  708.3679  737.1265  719.7810  742.7808  739.1731
> colVars(tmp5)
 [1] 15351.31921    45.79775    52.46042          NA    67.62750    91.00836
 [7]   110.68474    83.68376    34.03991   113.35002    50.97143    61.43070
[13]    36.75747    75.55216    65.32147   116.70616    48.09088    59.45514
[19]    98.01709   109.63757
> colSd(tmp5)
 [1] 123.900441   6.767403   7.242957         NA   8.223594   9.539830
 [7]  10.520682   9.147883   5.834373  10.646597   7.139428   7.837774
[13]   6.062794   8.692074   8.082170  10.803062   6.934759   7.710716
[19]   9.900358  10.470796
> colMax(tmp5)
 [1] 466.11140  75.76971  78.60546        NA  88.13213  82.81264  91.83549
 [8]  82.31625  73.02829  86.36983  81.29623  81.38346  78.12660  90.78098
[15]  86.35816  90.79467  82.49674  90.92020  89.50577  90.17359
> colMin(tmp5)
 [1] 63.54439 56.94063 55.18221       NA 60.64021 54.88565 59.63607 54.38156
 [9] 57.39351 56.96815 59.51253 59.58939 58.89107 62.06565 60.40245 59.21247
[17] 60.93553 63.50545 59.12887 55.46494
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.1114
> Min(tmp5,na.rm=TRUE)
[1] 54.38156
> mean(tmp5,na.rm=TRUE)
[1] 73.13773
> Sum(tmp5,na.rm=TRUE)
[1] 14554.41
> Var(tmp5,na.rm=TRUE)
[1] 856.1883
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.84027 67.79151 73.55427 71.02533 68.74696 72.39127 73.68163 72.78097
 [9] 72.99402 69.46539
> rowSums(tmp5,na.rm=TRUE)
 [1] 1776.805 1355.830 1471.085 1349.481 1374.939 1447.825 1473.633 1455.619
 [9] 1459.880 1389.308
> rowVars(tmp5,na.rm=TRUE)
 [1] 7955.20813   35.49961   82.44559  100.97410   74.19450   67.96592
 [7]   58.15235   84.49970   66.49484   72.44137
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.191973  5.958155  9.079955 10.048587  8.613623  8.244145  7.625769
 [8]  9.192372  8.154437  8.511249
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.11140  77.30514  87.11157  91.83549  86.98082  90.79467  89.50577
 [8]  90.92020  86.36983  88.13213
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.88565 57.44446 54.38156 57.39351 55.46494 59.33640 59.63607 60.64728
 [9] 56.35468 57.69848
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.88864  66.08535  68.02716  69.96311  70.92299  71.93429  73.87377
 [8]  70.38148  65.48313  70.16270  71.43403  72.37188  68.96754  74.86673
[15]  69.35130  70.83679  73.71265  71.97810  74.27808  73.91731
> colSums(tmp5,na.rm=TRUE)
 [1] 1138.8864  660.8535  680.2716  629.6680  709.2299  719.3429  738.7377
 [8]  703.8148  654.8313  701.6270  714.3403  723.7188  689.6754  748.6673
[15]  693.5130  708.3679  737.1265  719.7810  742.7808  739.1731
> colVars(tmp5,na.rm=TRUE)
 [1] 15351.31921    45.79775    52.46042    91.53393    67.62750    91.00836
 [7]   110.68474    83.68376    34.03991   113.35002    50.97143    61.43070
[13]    36.75747    75.55216    65.32147   116.70616    48.09088    59.45514
[19]    98.01709   109.63757
> colSd(tmp5,na.rm=TRUE)
 [1] 123.900441   6.767403   7.242957   9.567337   8.223594   9.539830
 [7]  10.520682   9.147883   5.834373  10.646597   7.139428   7.837774
[13]   6.062794   8.692074   8.082170  10.803062   6.934759   7.710716
[19]   9.900358  10.470796
> colMax(tmp5,na.rm=TRUE)
 [1] 466.11140  75.76971  78.60546  86.98082  88.13213  82.81264  91.83549
 [8]  82.31625  73.02829  86.36983  81.29623  81.38346  78.12660  90.78098
[15]  86.35816  90.79467  82.49674  90.92020  89.50577  90.17359
> colMin(tmp5,na.rm=TRUE)
 [1] 63.54439 56.94063 55.18221 57.69848 60.64021 54.88565 59.63607 54.38156
 [9] 57.39351 56.96815 59.51253 59.58939 58.89107 62.06565 60.40245 59.21247
[17] 60.93553 63.50545 59.12887 55.46494
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.84027 67.79151 73.55427      NaN 68.74696 72.39127 73.68163 72.78097
 [9] 72.99402 69.46539
> rowSums(tmp5,na.rm=TRUE)
 [1] 1776.805 1355.830 1471.085    0.000 1374.939 1447.825 1473.633 1455.619
 [9] 1459.880 1389.308
> rowVars(tmp5,na.rm=TRUE)
 [1] 7955.20813   35.49961   82.44559         NA   74.19450   67.96592
 [7]   58.15235   84.49970   66.49484   72.44137
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.191973  5.958155  9.079955        NA  8.613623  8.244145  7.625769
 [8]  9.192372  8.154437  8.511249
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.11140  77.30514  87.11157        NA  86.98082  90.79467  89.50577
 [8]  90.92020  86.36983  88.13213
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.88565 57.44446 54.38156       NA 55.46494 59.33640 59.63607 60.64728
 [9] 56.35468 57.69848
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 118.01338  65.06035  67.45186       NaN  72.06552  71.82711  71.87802
 [8]  70.94629  66.38198  71.50458  72.30019  72.77524  69.40267  73.09848
[15]  68.54466  72.12838  72.73664  72.50772  74.11519  74.51266
> colSums(tmp5,na.rm=TRUE)
 [1] 1062.1204  585.5432  607.0667    0.0000  648.5896  646.4439  646.9022
 [8]  638.5166  597.4378  643.5413  650.7017  654.9771  624.6240  657.8863
[15]  616.9020  649.1554  654.6298  652.5695  667.0367  670.6139
> colVars(tmp5,na.rm=TRUE)
 [1] 17078.83250    39.70309    55.29448          NA    61.39546   102.25515
 [7]    79.71151    90.55538    29.20574   107.26133    48.90279    67.27920
[13]    39.22215    49.82071    66.16658   112.52711    43.38554    63.73151
[19]   109.97073   119.35488
> colSd(tmp5,na.rm=TRUE)
 [1] 130.686007   6.301039   7.436026         NA   7.835525  10.112129
 [7]   8.928130   9.516059   5.404233  10.356705   6.993053   8.202390
[13]   6.262759   7.058379   8.134284  10.607880   6.586770   7.983202
[19]  10.486693  10.924966
> colMax(tmp5,na.rm=TRUE)
 [1] 466.11140  75.76971  78.60546      -Inf  88.13213  82.81264  88.31661
 [8]  82.31625  73.02829  86.36983  81.29623  81.38346  78.12660  83.60175
[15]  86.35816  90.79467  82.09285  90.92020  89.50577  90.17359
> colMin(tmp5,na.rm=TRUE)
 [1] 63.54439 56.94063 55.18221      Inf 62.63460 54.88565 59.63607 54.38156
 [9] 57.44446 56.96815 59.51253 59.58939 58.89107 62.06565 60.40245 61.51207
[17] 60.93553 63.50545 59.12887 55.46494
> 
> 
> 
> 
> 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] 238.9115 127.3304 190.4392 256.9352 235.3527 333.8818 384.4226 273.5030
 [9] 219.1386 237.6620
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 238.9115 127.3304 190.4392 256.9352 235.3527 333.8818 384.4226 273.5030
 [9] 219.1386 237.6620
> 
> 
> 
> 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]  3.552714e-14  0.000000e+00 -5.684342e-14 -1.421085e-14 -5.684342e-14
 [6]  0.000000e+00  0.000000e+00 -5.684342e-14  1.136868e-13  3.410605e-13
[11] -8.526513e-14  0.000000e+00  0.000000e+00 -2.842171e-14 -8.526513e-14
[16]  0.000000e+00 -2.842171e-14  2.842171e-14  5.684342e-14  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
6   11 
3   10 
1   14 
6   6 
6   10 
2   2 
2   7 
1   19 
2   5 
10   12 
4   2 
3   6 
8   14 
10   17 
1   6 
1   4 
6   4 
6   20 
7   20 
9   19 
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.698779
> Min(tmp)
[1] -3.122184
> mean(tmp)
[1] 0.03151829
> Sum(tmp)
[1] 3.151829
> Var(tmp)
[1] 1.224343
> 
> rowMeans(tmp)
[1] 0.03151829
> rowSums(tmp)
[1] 3.151829
> rowVars(tmp)
[1] 1.224343
> rowSd(tmp)
[1] 1.1065
> rowMax(tmp)
[1] 2.698779
> rowMin(tmp)
[1] -3.122184
> 
> colMeans(tmp)
  [1] -0.53927924  0.60633988  0.64185981  0.92767163 -0.84889752  0.84719130
  [7] -0.05266484  1.52208557 -0.14612124  1.08997146  0.29106567  0.20702746
 [13] -1.01898509 -0.22981657  0.63757984 -0.02439235  0.53851873 -0.86480251
 [19]  0.78066426  1.04227260 -0.45726299 -1.99216511 -0.80261399 -0.62140527
 [25] -0.69582071 -0.57749506  2.51440114  1.38830173 -0.69708255  0.32039426
 [31]  0.31091866  2.69877926 -1.73847563 -0.92861334 -1.83243784  1.34028036
 [37] -0.46771260 -0.48722570  1.55479158 -1.10205504 -1.12023421 -0.99939813
 [43]  0.89161134 -0.04524042 -0.21962047 -0.52788083  0.33056196 -0.96599051
 [49]  0.33965373  1.09657239 -1.08120454 -0.52826795 -1.34096084  2.08158850
 [55] -1.74034519  0.09024491  1.20328560  0.43139996 -0.54651736  2.31534933
 [61]  0.38861541  2.46641650  1.32396761 -0.29891440 -0.01559563 -1.16027277
 [67] -1.31741234 -1.34995636  0.59095083  0.34334944  0.08284862  0.88997618
 [73]  0.91059938 -3.12218358  0.14090921  0.65762044  0.10481962 -0.08490819
 [79] -1.00424620  2.19465573 -0.83674323  1.15028433  1.26266614  0.34879605
 [85]  0.15035333  0.26375312 -1.52620056  1.07954531 -3.06640412 -0.43475059
 [91] -0.03335345  0.30360806  0.81742371 -0.28197516 -0.42342567  0.92188636
 [97] -0.56623148  0.30575798  0.01919751 -0.84299566
> colSums(tmp)
  [1] -0.53927924  0.60633988  0.64185981  0.92767163 -0.84889752  0.84719130
  [7] -0.05266484  1.52208557 -0.14612124  1.08997146  0.29106567  0.20702746
 [13] -1.01898509 -0.22981657  0.63757984 -0.02439235  0.53851873 -0.86480251
 [19]  0.78066426  1.04227260 -0.45726299 -1.99216511 -0.80261399 -0.62140527
 [25] -0.69582071 -0.57749506  2.51440114  1.38830173 -0.69708255  0.32039426
 [31]  0.31091866  2.69877926 -1.73847563 -0.92861334 -1.83243784  1.34028036
 [37] -0.46771260 -0.48722570  1.55479158 -1.10205504 -1.12023421 -0.99939813
 [43]  0.89161134 -0.04524042 -0.21962047 -0.52788083  0.33056196 -0.96599051
 [49]  0.33965373  1.09657239 -1.08120454 -0.52826795 -1.34096084  2.08158850
 [55] -1.74034519  0.09024491  1.20328560  0.43139996 -0.54651736  2.31534933
 [61]  0.38861541  2.46641650  1.32396761 -0.29891440 -0.01559563 -1.16027277
 [67] -1.31741234 -1.34995636  0.59095083  0.34334944  0.08284862  0.88997618
 [73]  0.91059938 -3.12218358  0.14090921  0.65762044  0.10481962 -0.08490819
 [79] -1.00424620  2.19465573 -0.83674323  1.15028433  1.26266614  0.34879605
 [85]  0.15035333  0.26375312 -1.52620056  1.07954531 -3.06640412 -0.43475059
 [91] -0.03335345  0.30360806  0.81742371 -0.28197516 -0.42342567  0.92188636
 [97] -0.56623148  0.30575798  0.01919751 -0.84299566
> 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.53927924  0.60633988  0.64185981  0.92767163 -0.84889752  0.84719130
  [7] -0.05266484  1.52208557 -0.14612124  1.08997146  0.29106567  0.20702746
 [13] -1.01898509 -0.22981657  0.63757984 -0.02439235  0.53851873 -0.86480251
 [19]  0.78066426  1.04227260 -0.45726299 -1.99216511 -0.80261399 -0.62140527
 [25] -0.69582071 -0.57749506  2.51440114  1.38830173 -0.69708255  0.32039426
 [31]  0.31091866  2.69877926 -1.73847563 -0.92861334 -1.83243784  1.34028036
 [37] -0.46771260 -0.48722570  1.55479158 -1.10205504 -1.12023421 -0.99939813
 [43]  0.89161134 -0.04524042 -0.21962047 -0.52788083  0.33056196 -0.96599051
 [49]  0.33965373  1.09657239 -1.08120454 -0.52826795 -1.34096084  2.08158850
 [55] -1.74034519  0.09024491  1.20328560  0.43139996 -0.54651736  2.31534933
 [61]  0.38861541  2.46641650  1.32396761 -0.29891440 -0.01559563 -1.16027277
 [67] -1.31741234 -1.34995636  0.59095083  0.34334944  0.08284862  0.88997618
 [73]  0.91059938 -3.12218358  0.14090921  0.65762044  0.10481962 -0.08490819
 [79] -1.00424620  2.19465573 -0.83674323  1.15028433  1.26266614  0.34879605
 [85]  0.15035333  0.26375312 -1.52620056  1.07954531 -3.06640412 -0.43475059
 [91] -0.03335345  0.30360806  0.81742371 -0.28197516 -0.42342567  0.92188636
 [97] -0.56623148  0.30575798  0.01919751 -0.84299566
> colMin(tmp)
  [1] -0.53927924  0.60633988  0.64185981  0.92767163 -0.84889752  0.84719130
  [7] -0.05266484  1.52208557 -0.14612124  1.08997146  0.29106567  0.20702746
 [13] -1.01898509 -0.22981657  0.63757984 -0.02439235  0.53851873 -0.86480251
 [19]  0.78066426  1.04227260 -0.45726299 -1.99216511 -0.80261399 -0.62140527
 [25] -0.69582071 -0.57749506  2.51440114  1.38830173 -0.69708255  0.32039426
 [31]  0.31091866  2.69877926 -1.73847563 -0.92861334 -1.83243784  1.34028036
 [37] -0.46771260 -0.48722570  1.55479158 -1.10205504 -1.12023421 -0.99939813
 [43]  0.89161134 -0.04524042 -0.21962047 -0.52788083  0.33056196 -0.96599051
 [49]  0.33965373  1.09657239 -1.08120454 -0.52826795 -1.34096084  2.08158850
 [55] -1.74034519  0.09024491  1.20328560  0.43139996 -0.54651736  2.31534933
 [61]  0.38861541  2.46641650  1.32396761 -0.29891440 -0.01559563 -1.16027277
 [67] -1.31741234 -1.34995636  0.59095083  0.34334944  0.08284862  0.88997618
 [73]  0.91059938 -3.12218358  0.14090921  0.65762044  0.10481962 -0.08490819
 [79] -1.00424620  2.19465573 -0.83674323  1.15028433  1.26266614  0.34879605
 [85]  0.15035333  0.26375312 -1.52620056  1.07954531 -3.06640412 -0.43475059
 [91] -0.03335345  0.30360806  0.81742371 -0.28197516 -0.42342567  0.92188636
 [97] -0.56623148  0.30575798  0.01919751 -0.84299566
> colMedians(tmp)
  [1] -0.53927924  0.60633988  0.64185981  0.92767163 -0.84889752  0.84719130
  [7] -0.05266484  1.52208557 -0.14612124  1.08997146  0.29106567  0.20702746
 [13] -1.01898509 -0.22981657  0.63757984 -0.02439235  0.53851873 -0.86480251
 [19]  0.78066426  1.04227260 -0.45726299 -1.99216511 -0.80261399 -0.62140527
 [25] -0.69582071 -0.57749506  2.51440114  1.38830173 -0.69708255  0.32039426
 [31]  0.31091866  2.69877926 -1.73847563 -0.92861334 -1.83243784  1.34028036
 [37] -0.46771260 -0.48722570  1.55479158 -1.10205504 -1.12023421 -0.99939813
 [43]  0.89161134 -0.04524042 -0.21962047 -0.52788083  0.33056196 -0.96599051
 [49]  0.33965373  1.09657239 -1.08120454 -0.52826795 -1.34096084  2.08158850
 [55] -1.74034519  0.09024491  1.20328560  0.43139996 -0.54651736  2.31534933
 [61]  0.38861541  2.46641650  1.32396761 -0.29891440 -0.01559563 -1.16027277
 [67] -1.31741234 -1.34995636  0.59095083  0.34334944  0.08284862  0.88997618
 [73]  0.91059938 -3.12218358  0.14090921  0.65762044  0.10481962 -0.08490819
 [79] -1.00424620  2.19465573 -0.83674323  1.15028433  1.26266614  0.34879605
 [85]  0.15035333  0.26375312 -1.52620056  1.07954531 -3.06640412 -0.43475059
 [91] -0.03335345  0.30360806  0.81742371 -0.28197516 -0.42342567  0.92188636
 [97] -0.56623148  0.30575798  0.01919751 -0.84299566
> colRanges(tmp)
           [,1]      [,2]      [,3]      [,4]       [,5]      [,6]        [,7]
[1,] -0.5392792 0.6063399 0.6418598 0.9276716 -0.8488975 0.8471913 -0.05266484
[2,] -0.5392792 0.6063399 0.6418598 0.9276716 -0.8488975 0.8471913 -0.05266484
         [,8]       [,9]    [,10]     [,11]     [,12]     [,13]      [,14]
[1,] 1.522086 -0.1461212 1.089971 0.2910657 0.2070275 -1.018985 -0.2298166
[2,] 1.522086 -0.1461212 1.089971 0.2910657 0.2070275 -1.018985 -0.2298166
         [,15]       [,16]     [,17]      [,18]     [,19]    [,20]     [,21]
[1,] 0.6375798 -0.02439235 0.5385187 -0.8648025 0.7806643 1.042273 -0.457263
[2,] 0.6375798 -0.02439235 0.5385187 -0.8648025 0.7806643 1.042273 -0.457263
         [,22]     [,23]      [,24]      [,25]      [,26]    [,27]    [,28]
[1,] -1.992165 -0.802614 -0.6214053 -0.6958207 -0.5774951 2.514401 1.388302
[2,] -1.992165 -0.802614 -0.6214053 -0.6958207 -0.5774951 2.514401 1.388302
          [,29]     [,30]     [,31]    [,32]     [,33]      [,34]     [,35]
[1,] -0.6970826 0.3203943 0.3109187 2.698779 -1.738476 -0.9286133 -1.832438
[2,] -0.6970826 0.3203943 0.3109187 2.698779 -1.738476 -0.9286133 -1.832438
       [,36]      [,37]      [,38]    [,39]     [,40]     [,41]      [,42]
[1,] 1.34028 -0.4677126 -0.4872257 1.554792 -1.102055 -1.120234 -0.9993981
[2,] 1.34028 -0.4677126 -0.4872257 1.554792 -1.102055 -1.120234 -0.9993981
         [,43]       [,44]      [,45]      [,46]    [,47]      [,48]     [,49]
[1,] 0.8916113 -0.04524042 -0.2196205 -0.5278808 0.330562 -0.9659905 0.3396537
[2,] 0.8916113 -0.04524042 -0.2196205 -0.5278808 0.330562 -0.9659905 0.3396537
        [,50]     [,51]      [,52]     [,53]    [,54]     [,55]      [,56]
[1,] 1.096572 -1.081205 -0.5282679 -1.340961 2.081588 -1.740345 0.09024491
[2,] 1.096572 -1.081205 -0.5282679 -1.340961 2.081588 -1.740345 0.09024491
        [,57]  [,58]      [,59]    [,60]     [,61]    [,62]    [,63]      [,64]
[1,] 1.203286 0.4314 -0.5465174 2.315349 0.3886154 2.466416 1.323968 -0.2989144
[2,] 1.203286 0.4314 -0.5465174 2.315349 0.3886154 2.466416 1.323968 -0.2989144
           [,65]     [,66]     [,67]     [,68]     [,69]     [,70]      [,71]
[1,] -0.01559563 -1.160273 -1.317412 -1.349956 0.5909508 0.3433494 0.08284862
[2,] -0.01559563 -1.160273 -1.317412 -1.349956 0.5909508 0.3433494 0.08284862
         [,72]     [,73]     [,74]     [,75]     [,76]     [,77]       [,78]
[1,] 0.8899762 0.9105994 -3.122184 0.1409092 0.6576204 0.1048196 -0.08490819
[2,] 0.8899762 0.9105994 -3.122184 0.1409092 0.6576204 0.1048196 -0.08490819
         [,79]    [,80]      [,81]    [,82]    [,83]     [,84]     [,85]
[1,] -1.004246 2.194656 -0.8367432 1.150284 1.262666 0.3487961 0.1503533
[2,] -1.004246 2.194656 -0.8367432 1.150284 1.262666 0.3487961 0.1503533
         [,86]     [,87]    [,88]     [,89]      [,90]       [,91]     [,92]
[1,] 0.2637531 -1.526201 1.079545 -3.066404 -0.4347506 -0.03335345 0.3036081
[2,] 0.2637531 -1.526201 1.079545 -3.066404 -0.4347506 -0.03335345 0.3036081
         [,93]      [,94]      [,95]     [,96]      [,97]    [,98]      [,99]
[1,] 0.8174237 -0.2819752 -0.4234257 0.9218864 -0.5662315 0.305758 0.01919751
[2,] 0.8174237 -0.2819752 -0.4234257 0.9218864 -0.5662315 0.305758 0.01919751
         [,100]
[1,] -0.8429957
[2,] -0.8429957
> 
> 
> Max(tmp2)
[1] 2.787261
> Min(tmp2)
[1] -2.608752
> mean(tmp2)
[1] 0.09354883
> Sum(tmp2)
[1] 9.354883
> Var(tmp2)
[1] 0.9836284
> 
> rowMeans(tmp2)
  [1] -0.007991848  0.297803347 -1.310137788 -0.811568306 -0.443062183
  [6]  1.691521947  1.826021743  0.699364294 -0.185955555  1.296783511
 [11]  1.121107847 -0.134210561 -0.662962667 -1.051361188  1.271837443
 [16]  0.174503235 -0.039762203  1.302737130 -1.638460192 -0.584253825
 [21]  2.787261360 -1.363439073 -0.400340787  0.640115148  0.317345363
 [26] -1.345621806  0.238854325  0.129285738  0.816399814  0.412866093
 [31]  0.037056331 -0.917190151  1.320475572 -0.144325518  0.197568665
 [36] -1.624599270  0.316459911 -0.345918650 -0.052430475 -0.317567788
 [41] -1.265775513 -1.011889323 -0.553969375 -0.342334503 -0.226438294
 [46]  2.327198027  1.749394132  0.681859402  0.088370790 -0.685948190
 [51] -0.240714387  0.134073501  0.153103529  0.060507322  0.744749415
 [56] -0.764428379  1.612508650  0.182878692  0.478243173 -0.150634768
 [61]  0.848548286  1.420618993 -1.199968361  0.557347629 -1.579733900
 [66]  1.607986248 -1.018913932 -0.232175002  0.707880037 -2.608751784
 [71]  0.062605322 -0.276625767  0.034435668  0.823444459 -0.526698444
 [76] -1.144060235 -0.106978700  0.436491415 -1.356174562  0.380509061
 [81] -1.105780373  1.210050856 -0.672560524  1.040823756  1.243958925
 [86] -0.207732178  0.936655586  0.624212560  2.629318331  0.387549559
 [91]  0.700656917 -0.059562151 -0.166519022 -0.053802707  0.945772932
 [96] -0.699652748  1.545505090 -0.724516597 -0.967300541 -0.566943687
> rowSums(tmp2)
  [1] -0.007991848  0.297803347 -1.310137788 -0.811568306 -0.443062183
  [6]  1.691521947  1.826021743  0.699364294 -0.185955555  1.296783511
 [11]  1.121107847 -0.134210561 -0.662962667 -1.051361188  1.271837443
 [16]  0.174503235 -0.039762203  1.302737130 -1.638460192 -0.584253825
 [21]  2.787261360 -1.363439073 -0.400340787  0.640115148  0.317345363
 [26] -1.345621806  0.238854325  0.129285738  0.816399814  0.412866093
 [31]  0.037056331 -0.917190151  1.320475572 -0.144325518  0.197568665
 [36] -1.624599270  0.316459911 -0.345918650 -0.052430475 -0.317567788
 [41] -1.265775513 -1.011889323 -0.553969375 -0.342334503 -0.226438294
 [46]  2.327198027  1.749394132  0.681859402  0.088370790 -0.685948190
 [51] -0.240714387  0.134073501  0.153103529  0.060507322  0.744749415
 [56] -0.764428379  1.612508650  0.182878692  0.478243173 -0.150634768
 [61]  0.848548286  1.420618993 -1.199968361  0.557347629 -1.579733900
 [66]  1.607986248 -1.018913932 -0.232175002  0.707880037 -2.608751784
 [71]  0.062605322 -0.276625767  0.034435668  0.823444459 -0.526698444
 [76] -1.144060235 -0.106978700  0.436491415 -1.356174562  0.380509061
 [81] -1.105780373  1.210050856 -0.672560524  1.040823756  1.243958925
 [86] -0.207732178  0.936655586  0.624212560  2.629318331  0.387549559
 [91]  0.700656917 -0.059562151 -0.166519022 -0.053802707  0.945772932
 [96] -0.699652748  1.545505090 -0.724516597 -0.967300541 -0.566943687
> 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.007991848  0.297803347 -1.310137788 -0.811568306 -0.443062183
  [6]  1.691521947  1.826021743  0.699364294 -0.185955555  1.296783511
 [11]  1.121107847 -0.134210561 -0.662962667 -1.051361188  1.271837443
 [16]  0.174503235 -0.039762203  1.302737130 -1.638460192 -0.584253825
 [21]  2.787261360 -1.363439073 -0.400340787  0.640115148  0.317345363
 [26] -1.345621806  0.238854325  0.129285738  0.816399814  0.412866093
 [31]  0.037056331 -0.917190151  1.320475572 -0.144325518  0.197568665
 [36] -1.624599270  0.316459911 -0.345918650 -0.052430475 -0.317567788
 [41] -1.265775513 -1.011889323 -0.553969375 -0.342334503 -0.226438294
 [46]  2.327198027  1.749394132  0.681859402  0.088370790 -0.685948190
 [51] -0.240714387  0.134073501  0.153103529  0.060507322  0.744749415
 [56] -0.764428379  1.612508650  0.182878692  0.478243173 -0.150634768
 [61]  0.848548286  1.420618993 -1.199968361  0.557347629 -1.579733900
 [66]  1.607986248 -1.018913932 -0.232175002  0.707880037 -2.608751784
 [71]  0.062605322 -0.276625767  0.034435668  0.823444459 -0.526698444
 [76] -1.144060235 -0.106978700  0.436491415 -1.356174562  0.380509061
 [81] -1.105780373  1.210050856 -0.672560524  1.040823756  1.243958925
 [86] -0.207732178  0.936655586  0.624212560  2.629318331  0.387549559
 [91]  0.700656917 -0.059562151 -0.166519022 -0.053802707  0.945772932
 [96] -0.699652748  1.545505090 -0.724516597 -0.967300541 -0.566943687
> rowMin(tmp2)
  [1] -0.007991848  0.297803347 -1.310137788 -0.811568306 -0.443062183
  [6]  1.691521947  1.826021743  0.699364294 -0.185955555  1.296783511
 [11]  1.121107847 -0.134210561 -0.662962667 -1.051361188  1.271837443
 [16]  0.174503235 -0.039762203  1.302737130 -1.638460192 -0.584253825
 [21]  2.787261360 -1.363439073 -0.400340787  0.640115148  0.317345363
 [26] -1.345621806  0.238854325  0.129285738  0.816399814  0.412866093
 [31]  0.037056331 -0.917190151  1.320475572 -0.144325518  0.197568665
 [36] -1.624599270  0.316459911 -0.345918650 -0.052430475 -0.317567788
 [41] -1.265775513 -1.011889323 -0.553969375 -0.342334503 -0.226438294
 [46]  2.327198027  1.749394132  0.681859402  0.088370790 -0.685948190
 [51] -0.240714387  0.134073501  0.153103529  0.060507322  0.744749415
 [56] -0.764428379  1.612508650  0.182878692  0.478243173 -0.150634768
 [61]  0.848548286  1.420618993 -1.199968361  0.557347629 -1.579733900
 [66]  1.607986248 -1.018913932 -0.232175002  0.707880037 -2.608751784
 [71]  0.062605322 -0.276625767  0.034435668  0.823444459 -0.526698444
 [76] -1.144060235 -0.106978700  0.436491415 -1.356174562  0.380509061
 [81] -1.105780373  1.210050856 -0.672560524  1.040823756  1.243958925
 [86] -0.207732178  0.936655586  0.624212560  2.629318331  0.387549559
 [91]  0.700656917 -0.059562151 -0.166519022 -0.053802707  0.945772932
 [96] -0.699652748  1.545505090 -0.724516597 -0.967300541 -0.566943687
> 
> colMeans(tmp2)
[1] 0.09354883
> colSums(tmp2)
[1] 9.354883
> colVars(tmp2)
[1] 0.9836284
> colSd(tmp2)
[1] 0.9917804
> colMax(tmp2)
[1] 2.787261
> colMin(tmp2)
[1] -2.608752
> colMedians(tmp2)
[1] 0.035746
> colRanges(tmp2)
          [,1]
[1,] -2.608752
[2,]  2.787261
> 
> 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.4858877 -0.4928026 -4.6875718  1.1591438  3.2384470 -0.8858517
 [7] -2.2440037 -0.9921682 -1.1825300  1.1516524
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.1159483
[2,] -0.6070092
[3,]  0.3088027
[4,]  1.1263444
[5,]  1.2877489
> 
> rowApply(tmp,sum)
 [1] -0.3463007 -1.9411691  0.6050458 -5.5206365 -2.3502142  3.5256788
 [7] -1.8385272  3.8455528 -1.4581832  1.0289566
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    8   10    1    5    4    9   10    9    1     3
 [2,]    5    1    5   10    5    2    5    4    9     7
 [3,]    4    7   10    1    7    3    9    1    7     1
 [4,]    1    8    8    4    2    8    1    6   10     9
 [5,]    7    6    6    9    6   10    7    2    4    10
 [6,]    2    2    7    3   10    4    8    5    5     6
 [7,]    3    9    3    7    1    6    3    3    2     8
 [8,]    6    5    2    8    3    5    6   10    3     5
 [9,]    9    4    4    2    8    1    4    8    8     4
[10,]   10    3    9    6    9    7    2    7    6     2
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.2715864  0.2989254 -0.6740238  0.5356873 -3.1983048  1.8516773
 [7] -0.9280526  0.2851013 -1.5128937 -3.8723001 -2.9172110 -2.2471409
[13] -1.2448233 -3.0295506  2.7768045  1.2528152 -0.2519909 -3.4957324
[19] -3.5828021  2.2918702
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.9622388
[2,] -0.8563067
[3,] -0.4833696
[4,]  0.7815265
[5,]  1.2488022
> 
> rowApply(tmp,sum)
[1] -2.258010 -4.104059 -2.917883 -5.003227 -3.650351
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    5    7    8   18   18
[2,]   14   15   15    8   10
[3,]    8    8   17   16    3
[4,]   11   11   20    9    5
[5,]    7    5    5   14    7
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]       [,5]      [,6]
[1,] -0.8563067  0.1837659 -0.3825287 -0.07286508 -0.5002737  1.129224
[2,] -0.9622388  0.4252144 -0.4060341 -0.04969586 -1.2595872  1.117679
[3,] -0.4833696  0.5092138  0.7464167  1.88042017 -0.9810733 -1.525070
[4,]  0.7815265 -0.3640510  0.3428451 -0.29727562  0.1002592 -1.024771
[5,]  1.2488022 -0.4552177 -0.9747227 -0.92489628 -0.5576298  2.154615
            [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -0.36926007 -1.0576941 -1.7965917 -1.3733035  0.3333697  0.0859526
[2,]  0.27824588  0.4692651  1.1506610  0.6263723 -1.4057039 -1.3503844
[3,]  0.35780995  0.2356382  0.6973871 -1.0462851 -0.1734722 -0.3401724
[4,] -1.15697813 -0.7623469 -1.0219799 -2.3405284 -0.2769036 -0.2481558
[5,] -0.03787025  1.4002389 -0.5423702  0.2614445 -1.3945009 -0.3943809
           [,13]      [,14]      [,15]      [,16]       [,17]      [,18]
[1,] -1.24242301 -0.1026124  1.2988871 -0.7481904  0.87998755  1.0774116
[2,] -0.05378626 -1.5062856 -0.2483562  0.3378535  0.41783681 -1.5568717
[3,] -0.24964074  0.3902635  1.0231017  1.4426053 -1.67407438 -0.5324493
[4,]  1.27354377 -1.1735005  0.2858086  0.7512593 -0.09452372 -0.6855666
[5,] -0.97251701 -0.6374155  0.4173634 -0.5307124  0.21878283 -1.7982564
           [,19]      [,20]
[1,]  0.07593212  1.1795086
[2,] -1.00349580  0.8752527
[3,] -2.28600511 -0.9091274
[4,]  0.05505594  0.8530555
[5,] -0.42428924  0.2931808
> 
> 
> 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.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  643  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.12-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.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1      col2      col3     col4       col5       col6       col7
row1 0.2492521 -0.527015 0.9756804 1.244997 -0.6227577 -0.8948946 -0.4823559
           col8       col9     col10     col11     col12    col13    col14
row1 -0.5546099 -0.7305258 0.6449018 0.7540673 -1.232199 0.998915 1.189338
         col15      col16      col17   col18      col19      col20
row1 0.8945213 -0.6606515 -0.4756418 1.51387 -0.6147158 0.06233719
> tmp[,"col10"]
          col10
row1  0.6449018
row2  0.4157433
row3 -1.7556371
row4  2.6800205
row5  0.9851296
> tmp[c("row1","row5"),]
          col1       col2      col3      col4       col5       col6       col7
row1 0.2492521 -0.5270150 0.9756804 1.2449973 -0.6227577 -0.8948946 -0.4823559
row5 1.2004935  0.6810343 0.8413771 0.6508481 -0.7211775 -1.0846040 -1.3232063
           col8        col9     col10      col11     col12      col13     col14
row1 -0.5546099 -0.73052577 0.6449018  0.7540673 -1.232199  0.9989150 1.1893376
row5 -1.7322666  0.03661293 0.9851296 -0.6115805 -1.686955 -0.8623789 0.9401307
          col15      col16      col17      col18      col19      col20
row1  0.8945213 -0.6606515 -0.4756418  1.5138702 -0.6147158 0.06233719
row5 -0.4834947  0.3828877 -0.8073032 -0.7157741 -0.4354562 0.41906649
> tmp[,c("col6","col20")]
            col6       col20
row1 -0.89489463  0.06233719
row2 -0.63372021 -1.29387596
row3 -0.06050855  0.43045559
row4 -0.55445585 -0.08499286
row5 -1.08460398  0.41906649
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.8948946 0.06233719
row5 -1.0846040 0.41906649
> 
> 
> 
> 
> 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.20535 48.33993 50.41372 49.94999 50.42561 104.9049 50.27323 49.64164
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.07983 50.30265 50.69029 50.10785 50.59563 51.22074 49.32751 49.11958
        col17    col18    col19    col20
row1 49.40597 49.64333 48.43269 104.0801
> tmp[,"col10"]
        col10
row1 50.30265
row2 30.73877
row3 31.60005
row4 30.23310
row5 50.54669
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.20535 48.33993 50.41372 49.94999 50.42561 104.9049 50.27323 49.64164
row5 51.29816 51.91809 48.61585 50.17434 50.28529 103.0933 49.06834 50.25144
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.07983 50.30265 50.69029 50.10785 50.59563 51.22074 49.32751 49.11958
row5 51.14727 50.54669 51.50915 48.65926 51.04553 50.25545 50.97399 47.61697
        col17    col18    col19    col20
row1 49.40597 49.64333 48.43269 104.0801
row5 49.59576 50.42351 50.98807 104.4880
> tmp[,c("col6","col20")]
          col6     col20
row1 104.90486 104.08009
row2  74.23623  76.02390
row3  76.40477  74.98509
row4  75.88831  74.85335
row5 103.09331 104.48798
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.9049 104.0801
row5 103.0933 104.4880
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.9049 104.0801
row5 103.0933 104.4880
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -0.05043379
[2,] -0.83233099
[3,] -1.27812770
[4,]  0.28429425
[5,]  0.84407085
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.9075483  0.4758285
[2,]  0.4109588 -0.2565776
[3,] -1.2157201  0.6838519
[4,] -1.3349043  0.6385182
[5,]  1.4603182  0.8630437
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6        col20
[1,] -0.3584787 -0.162117355
[2,]  0.4987534 -1.527342597
[3,]  0.5779545 -0.511282729
[4,]  0.1787795 -0.861801099
[5,] -0.5394825  0.009113591
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.3584787
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.3584787
[2,]  0.4987534
> 
> 
> 
> 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.5573977 -0.3714762  0.09992793 -0.9312326  0.4931594 -0.9072188
row1  0.5448062 -0.4112540 -0.03696619  0.2085123 -0.5262795 -0.3246171
          [,7]       [,8]        [,9]     [,10]      [,11]       [,12]
row3 0.4403460 -0.4226197 -0.02374718 0.4403062 -0.4846637  0.88650742
row1 0.8723861  0.6989950 -0.30382050 1.9626875  0.8565636 -0.03343859
         [,13]     [,14]        [,15]      [,16]      [,17]      [,18]
row3  1.613770 0.5475866  0.734597709 -0.8019726  0.9576759  0.0413181
row1 -1.124949 0.3990437 -0.002360289  2.2494994 -0.7389108 -0.7360923
          [,19]     [,20]
row3 -1.9342976  0.806896
row1  0.5021041 -1.256535
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]     [,2]      [,3]      [,4]     [,5]     [,6]       [,7]
row2 -0.3927123 1.540788 -1.052302 0.1512655 1.908793 1.720963 -0.3529144
          [,8]       [,9]      [,10]
row2 0.2851678 -0.4849639 -0.6625722
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]      [,3]      [,4]        [,5]     [,6]       [,7]
row5 -1.127061 1.271211 0.6691664 0.1268515 -0.06735392 1.385595 -0.7904188
          [,8]     [,9]    [,10]     [,11]       [,12]     [,13]     [,14]
row5 0.7003331 0.615437 1.513606 0.3016334 -0.03475901 -3.338417 0.2561815
          [,15]      [,16]     [,17]     [,18]    [,19]     [,20]
row5 -0.3984464 -0.7003329 0.2775986 -1.593252 0.521755 0.8518445
> 
> 
> 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: 0x5642bf4ee9d0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee3fd5da0f"
 [2] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee66a280f8"
 [3] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee4b384f95"
 [4] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee8e2f3b2" 
 [5] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee6a76f3"  
 [6] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee35113624"
 [7] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee3b63c5d9"
 [8] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee6e22fb2c"
 [9] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee286c3479"
[10] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee6c64ef97"
[11] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37eed00a430" 
[12] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee7fdf8fbe"
[13] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee1d0daa6c"
[14] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee40efddf2"
[15] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM37ee24ecc054"
> 
> 
> ### 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: 0x5642be39e850>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5642be39e850>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5642be39e850>
> rowMedians(tmp)
  [1] -0.091449658 -0.317692803  0.154867373 -0.656133789  0.480641092
  [6]  0.361089007  0.682931964 -0.182539315 -0.451845628 -0.092974950
 [11]  0.467465424 -0.290680356  0.483281000 -0.191566641  0.170958898
 [16] -0.292579238 -0.072753643  0.055275852  0.683457887  0.113081127
 [21] -0.091476757 -0.067207316  0.056245085 -0.277357676 -0.201819855
 [26] -0.046967398  0.328063375 -0.397922986  0.190595826  0.208977592
 [31] -0.390716134 -0.065274521 -0.304780244  0.011989128 -0.319524840
 [36]  0.104524091 -0.207234846 -0.068169982 -0.123196685  0.572139862
 [41]  0.094891902 -0.054807856  0.328378507  0.167937580 -0.182034695
 [46]  0.041772332 -0.410015506  0.324715840 -0.076504987  0.509082911
 [51] -0.428596054  0.190178613  0.111783275 -0.317178991 -0.383473407
 [56]  0.807894889  0.245611207 -0.028473899  0.103014404  0.305347664
 [61] -0.344351495  0.145362224  0.273169202  0.044477927  0.416294876
 [66] -0.127097766  0.642276255 -0.098178953  0.172647102 -0.425560823
 [71] -0.343746364  0.102476465  0.368211682  0.549360079 -0.060431428
 [76]  0.348148687  0.263326956 -0.174097015  0.491715759 -0.443923771
 [81] -0.262197662  0.358750615 -0.023710647 -0.572306684 -0.032992897
 [86]  0.258889561  0.177075771  0.198649370  0.158314462 -0.033125605
 [91]  0.024400500  0.617865938  0.188442282 -0.164757058 -0.397194249
 [96]  0.036416814  0.304540491 -0.143636635  0.203093082  0.107259208
[101] -0.291192103  0.263541075  0.027719844  0.103341971 -0.009190945
[106]  0.500275564 -0.399434457  0.216546885  0.320196200  0.053100486
[111] -0.425227650 -0.249146689 -0.022406218  0.347849262 -0.319815345
[116]  0.119815197 -0.431708913  0.343552837 -0.337335854 -0.383779337
[121] -0.224124247 -0.023596483  0.004949671 -0.396317188 -0.322688908
[126] -0.650588585  0.072550724 -0.188486929 -0.430629515  0.500449809
[131]  0.333994902 -0.352245248 -0.281165068  0.181302619 -0.643065142
[136] -0.198230382 -0.017605548  0.290418699  0.170044942  0.539002889
[141] -0.071328646  0.299043575  0.201151394 -0.709840814  0.133370242
[146]  0.195793681 -0.224101180 -0.155975669 -0.162403146  0.135845911
[151] -0.501096812  0.181020620 -0.730586507  0.184784896 -0.044054467
[156]  0.214080950 -0.056381735  0.772275969 -0.285525972 -0.206472010
[161]  0.617207306  0.221038537  0.462785602 -0.269635788  0.908708983
[166] -0.615000841 -0.304848170 -0.304250920  0.094093056 -0.137068156
[171]  0.021601230  0.148829267 -0.273073818 -0.100420263 -0.547031052
[176] -0.240530465  0.171878367  0.020059021 -0.006321422 -0.122980076
[181]  0.091418160 -0.125228334 -0.073041165  0.194912643 -0.077675786
[186]  0.448930302 -0.182675334  0.200168631  0.272156893  0.400866766
[191] -0.041474017  0.318326261  0.521946109  0.219765721 -0.252461434
[196]  0.015759421 -0.044344624  0.144624888  0.058239080  0.054702213
[201] -0.194936605  0.142535696 -0.579005217  0.308323707  1.133115231
[206]  0.491787583  0.459964555 -0.121535798  0.172869936  0.256840363
[211] -0.773153467 -0.414496879 -0.572345415 -0.007124367 -0.258596528
[216]  0.448535296  0.173426022 -0.326218372 -0.011985383 -0.457264724
[221] -0.030806237  0.467448726  0.473199686 -0.403731161  0.157938652
[226]  0.325938904 -0.133913759 -0.053383704  0.292772292 -0.610987815
> 
> proc.time()
   user  system elapsed 
  2.392   1.096   3.520 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-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: 0x55f6c72363c0>
> .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: 0x55f6c72363c0>
> .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: 0x55f6c72363c0>
> .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: 0x55f6c72363c0>
> 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: 0x55f6c65fb780>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f6c65fb780>
> .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: 0x55f6c65fb780>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f6c65fb780>
> .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: 0x55f6c65fb780>
> 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: 0x55f6c7a81770>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f6c7a81770>
> .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: 0x55f6c7a81770>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55f6c7a81770>
> .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: 0x55f6c7a81770>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x55f6c7a81770>
> .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: 0x55f6c7a81770>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x55f6c7a81770>
> .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: 0x55f6c7a81770>
> 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: 0x55f6c63a3e30>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x55f6c63a3e30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f6c63a3e30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f6c63a3e30>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile39bd3101f494" "BufferedMatrixFile39bdcc29d8b" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile39bd3101f494" "BufferedMatrixFile39bdcc29d8b" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f6c830f7a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f6c830f7a0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55f6c830f7a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55f6c830f7a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x55f6c830f7a0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x55f6c830f7a0>
> .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: 0x55f6c6d7a8a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f6c6d7a8a0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55f6c6d7a8a0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x55f6c6d7a8a0>
> 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: 0x55f6c82f9f20>
> .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: 0x55f6c82f9f20>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.436   0.016   0.450 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-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.276   0.048   0.320 

Example timings