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

CHECK report for BufferedMatrix on malbec2

This page was generated on 2020-10-17 11:54:30 -0400 (Sat, 17 Oct 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 210/1905HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.52.0
Ben Bolstad
Snapshot Date: 2020-10-16 14:40:19 -0400 (Fri, 16 Oct 2020)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_11
Last Commit: c4ad43d
Last Changed Date: 2020-04-27 14:14:34 -0400 (Mon, 27 Apr 2020)
malbec2 Linux (Ubuntu 18.04.4 LTS) / x86_64  OK  OK [ OK ]UNNEEDED, same version exists in internal repository
tokay2 Windows Server 2012 R2 Standard / x64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository
machv2 macOS 10.14.6 Mojave / x86_64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.52.0
Command: /home/biocbuild/bbs-3.11-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.11-bioc/R/library --no-vignettes --timings BufferedMatrix_1.52.0.tar.gz
StartedAt: 2020-10-16 23:27:30 -0400 (Fri, 16 Oct 2020)
EndedAt: 2020-10-16 23:27:58 -0400 (Fri, 16 Oct 2020)
EllapsedTime: 27.0 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.0.3 (2020-10-10)
* 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.52.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.11-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.11-bioc/R/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
gcc -I"/home/biocbuild/bbs-3.11-bioc/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.11-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.11-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.11-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.11-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.11-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.11-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.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
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.441   0.035   0.461 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
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.11-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 438349 23.5     927477 49.6   649897 34.8
Vcells 788720  6.1    8388608 64.0  2015275 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] "Fri Oct 16 23:27:51 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] "Fri Oct 16 23:27:51 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: 0x5649c1d0e3a0>
> 
> 
> 
> 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] "Fri Oct 16 23:27:52 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] "Fri Oct 16 23:27:52 2020"
> 
> ColMode(tmp2)
<pointer: 0x5649c1d0e3a0>
> 
> 
> 
> ### 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.8344550 -0.567110 -0.61689345  1.1580406
[2,]  0.6112641  0.292966 -0.07277074  1.0717066
[3,] -1.0078733 -1.582453  0.16625801 -0.7780470
[4,]  0.4018716  1.181310  1.33955567 -0.7336322
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]     [,2]       [,3]      [,4]
[1,] 99.8344550 0.567110 0.61689345 1.1580406
[2,]  0.6112641 0.292966 0.07277074 1.0717066
[3,]  1.0078733 1.582453 0.16625801 0.7780470
[4,]  0.4018716 1.181310 1.33955567 0.7336322
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9917193 0.7530671 0.7854256 1.0761230
[2,] 0.7818338 0.5412633 0.2697605 1.0352326
[3,] 1.0039289 1.2579557 0.4077475 0.8820697
[4,] 0.6339334 1.0868810 1.1573918 0.8565233
> 
> 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.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.75165 33.09778 33.47115 36.91927
[2,]  33.42960 30.70560 27.77038 36.42403
[3,]  36.04716 39.16201 29.24373 34.59874
[4,]  31.74121 37.05012 37.91347 34.29887
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5649c3546160>
> exp(tmp5)
<pointer: 0x5649c3546160>
> log(tmp5,2)
<pointer: 0x5649c3546160>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.7911
> Min(tmp5)
[1] 53.44712
> mean(tmp5)
[1] 72.57871
> Sum(tmp5)
[1] 14515.74
> Var(tmp5)
[1] 850.7724
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.65707 67.94173 67.09373 70.97324 72.42713 74.01177 68.94689 72.42315
 [9] 67.19095 73.12145
> rowSums(tmp5)
 [1] 1833.141 1358.835 1341.875 1419.465 1448.543 1480.235 1378.938 1448.463
 [9] 1343.819 1462.429
> rowVars(tmp5)
 [1] 7876.65365   45.57404   50.84067   70.06433   49.32357  107.55332
 [7]   83.75615   48.28978   49.32656   42.22246
> rowSd(tmp5)
 [1] 88.750513  6.750854  7.130264  8.370444  7.023074 10.370792  9.151838
 [8]  6.949085  7.023287  6.497881
> rowMax(tmp5)
 [1] 467.79111  83.14951  81.51059  87.51530  83.53192  94.88394  85.30846
 [8]  83.18192  78.18452  86.12594
> rowMin(tmp5)
 [1] 57.87761 57.80040 57.58035 53.44712 57.62271 58.13101 54.31064 56.93444
 [9] 54.08507 62.00546
> 
> colMeans(tmp5)
 [1] 111.10159  73.49078  68.06895  73.28827  71.37330  67.99297  75.45340
 [8]  68.26563  69.12734  74.05471  75.74848  66.19673  67.92207  70.08489
[15]  67.84580  69.90535  70.78131  67.87671  70.07743  72.91850
> colSums(tmp5)
 [1] 1111.0159  734.9078  680.6895  732.8827  713.7330  679.9297  754.5340
 [8]  682.6563  691.2734  740.5471  757.4848  661.9673  679.2207  700.8489
[15]  678.4580  699.0535  707.8131  678.7671  700.7743  729.1850
> colVars(tmp5)
 [1] 15717.68243    39.22365    43.02004    11.87483    78.25145    73.45608
 [7]    83.06602   102.86957    48.80376    43.05292    45.82717    72.62235
[13]    96.09146    49.79433    96.32611    92.43520   124.95697    29.52995
[19]    51.33363    12.34557
> colSd(tmp5)
 [1] 125.370182   6.262878   6.558967   3.445988   8.845985   8.570652
 [7]   9.114056  10.142463   6.985968   6.561473   6.769577   8.521875
[13]   9.802625   7.056510   9.814586   9.614323  11.178415   5.434147
[19]   7.164749   3.513626
> colMax(tmp5)
 [1] 467.79111  82.13341  78.91193  78.28375  83.65844  83.10716  88.82045
 [8]  81.18627  79.79381  85.16687  85.30846  79.83145  86.12594  84.39253
[15]  83.53192  93.58029  94.88394  76.77642  87.61927  78.60941
> colMin(tmp5)
 [1] 66.06516 63.90968 57.80040 67.55527 54.37473 56.79254 57.62271 53.44712
 [9] 59.46676 65.80628 66.16956 54.08507 58.13101 62.31481 54.32669 59.88606
[17] 56.79428 59.96649 60.55371 68.29543
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 91.65707 67.94173 67.09373 70.97324       NA 74.01177 68.94689 72.42315
 [9] 67.19095 73.12145
> rowSums(tmp5)
 [1] 1833.141 1358.835 1341.875 1419.465       NA 1480.235 1378.938 1448.463
 [9] 1343.819 1462.429
> rowVars(tmp5)
 [1] 7876.65365   45.57404   50.84067   70.06433   44.85229  107.55332
 [7]   83.75615   48.28978   49.32656   42.22246
> rowSd(tmp5)
 [1] 88.750513  6.750854  7.130264  8.370444  6.697185 10.370792  9.151838
 [8]  6.949085  7.023287  6.497881
> rowMax(tmp5)
 [1] 467.79111  83.14951  81.51059  87.51530        NA  94.88394  85.30846
 [8]  83.18192  78.18452  86.12594
> rowMin(tmp5)
 [1] 57.87761 57.80040 57.58035 53.44712       NA 58.13101 54.31064 56.93444
 [9] 54.08507 62.00546
> 
> colMeans(tmp5)
 [1] 111.10159  73.49078  68.06895  73.28827  71.37330  67.99297  75.45340
 [8]  68.26563  69.12734  74.05471  75.74848  66.19673  67.92207  70.08489
[15]        NA  69.90535  70.78131  67.87671  70.07743  72.91850
> colSums(tmp5)
 [1] 1111.0159  734.9078  680.6895  732.8827  713.7330  679.9297  754.5340
 [8]  682.6563  691.2734  740.5471  757.4848  661.9673  679.2207  700.8489
[15]        NA  699.0535  707.8131  678.7671  700.7743  729.1850
> colVars(tmp5)
 [1] 15717.68243    39.22365    43.02004    11.87483    78.25145    73.45608
 [7]    83.06602   102.86957    48.80376    43.05292    45.82717    72.62235
[13]    96.09146    49.79433          NA    92.43520   124.95697    29.52995
[19]    51.33363    12.34557
> colSd(tmp5)
 [1] 125.370182   6.262878   6.558967   3.445988   8.845985   8.570652
 [7]   9.114056  10.142463   6.985968   6.561473   6.769577   8.521875
[13]   9.802625   7.056510         NA   9.614323  11.178415   5.434147
[19]   7.164749   3.513626
> colMax(tmp5)
 [1] 467.79111  82.13341  78.91193  78.28375  83.65844  83.10716  88.82045
 [8]  81.18627  79.79381  85.16687  85.30846  79.83145  86.12594  84.39253
[15]        NA  93.58029  94.88394  76.77642  87.61927  78.60941
> colMin(tmp5)
 [1] 66.06516 63.90968 57.80040 67.55527 54.37473 56.79254 57.62271 53.44712
 [9] 59.46676 65.80628 66.16956 54.08507 58.13101 62.31481       NA 59.88606
[17] 56.79428 59.96649 60.55371 68.29543
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.7911
> Min(tmp5,na.rm=TRUE)
[1] 53.44712
> mean(tmp5,na.rm=TRUE)
[1] 72.52367
> Sum(tmp5,na.rm=TRUE)
[1] 14432.21
> Var(tmp5,na.rm=TRUE)
[1] 854.4603
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.65707 67.94173 67.09373 70.97324 71.84267 74.01177 68.94689 72.42315
 [9] 67.19095 73.12145
> rowSums(tmp5,na.rm=TRUE)
 [1] 1833.141 1358.835 1341.875 1419.465 1365.011 1480.235 1378.938 1448.463
 [9] 1343.819 1462.429
> rowVars(tmp5,na.rm=TRUE)
 [1] 7876.65365   45.57404   50.84067   70.06433   44.85229  107.55332
 [7]   83.75615   48.28978   49.32656   42.22246
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.750513  6.750854  7.130264  8.370444  6.697185 10.370792  9.151838
 [8]  6.949085  7.023287  6.497881
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.79111  83.14951  81.51059  87.51530  82.35494  94.88394  85.30846
 [8]  83.18192  78.18452  86.12594
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.87761 57.80040 57.58035 53.44712 57.62271 58.13101 54.31064 56.93444
 [9] 54.08507 62.00546
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.10159  73.49078  68.06895  73.28827  71.37330  67.99297  75.45340
 [8]  68.26563  69.12734  74.05471  75.74848  66.19673  67.92207  70.08489
[15]  66.10290  69.90535  70.78131  67.87671  70.07743  72.91850
> colSums(tmp5,na.rm=TRUE)
 [1] 1111.0159  734.9078  680.6895  732.8827  713.7330  679.9297  754.5340
 [8]  682.6563  691.2734  740.5471  757.4848  661.9673  679.2207  700.8489
[15]  594.9261  699.0535  707.8131  678.7671  700.7743  729.1850
> colVars(tmp5,na.rm=TRUE)
 [1] 15717.68243    39.22365    43.02004    11.87483    78.25145    73.45608
 [7]    83.06602   102.86957    48.80376    43.05292    45.82717    72.62235
[13]    96.09146    49.79433    74.19266    92.43520   124.95697    29.52995
[19]    51.33363    12.34557
> colSd(tmp5,na.rm=TRUE)
 [1] 125.370182   6.262878   6.558967   3.445988   8.845985   8.570652
 [7]   9.114056  10.142463   6.985968   6.561473   6.769577   8.521875
[13]   9.802625   7.056510   8.613516   9.614323  11.178415   5.434147
[19]   7.164749   3.513626
> colMax(tmp5,na.rm=TRUE)
 [1] 467.79111  82.13341  78.91193  78.28375  83.65844  83.10716  88.82045
 [8]  81.18627  79.79381  85.16687  85.30846  79.83145  86.12594  84.39253
[15]  83.18192  93.58029  94.88394  76.77642  87.61927  78.60941
> colMin(tmp5,na.rm=TRUE)
 [1] 66.06516 63.90968 57.80040 67.55527 54.37473 56.79254 57.62271 53.44712
 [9] 59.46676 65.80628 66.16956 54.08507 58.13101 62.31481 54.32669 59.88606
[17] 56.79428 59.96649 60.55371 68.29543
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.65707 67.94173 67.09373 70.97324      NaN 74.01177 68.94689 72.42315
 [9] 67.19095 73.12145
> rowSums(tmp5,na.rm=TRUE)
 [1] 1833.141 1358.835 1341.875 1419.465    0.000 1480.235 1378.938 1448.463
 [9] 1343.819 1462.429
> rowVars(tmp5,na.rm=TRUE)
 [1] 7876.65365   45.57404   50.84067   70.06433         NA  107.55332
 [7]   83.75615   48.28978   49.32656   42.22246
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.750513  6.750854  7.130264  8.370444        NA 10.370792  9.151838
 [8]  6.949085  7.023287  6.497881
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.79111  83.14951  81.51059  87.51530        NA  94.88394  85.30846
 [8]  83.18192  78.18452  86.12594
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.87761 57.80040 57.58035 53.44712       NA 58.13101 54.31064 56.93444
 [9] 54.08507 62.00546
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.08389  73.44338  68.51276  73.49090  71.36576  68.67426  77.43458
 [8]  67.98673  69.52783  74.05976  75.29634  64.68176  66.31841  69.12725
[15]       NaN  70.01632  69.72143  67.78196  70.18840  73.09644
> colSums(tmp5,na.rm=TRUE)
 [1] 1035.7550  660.9904  616.6149  661.4181  642.2918  618.0683  696.9112
 [8]  611.8805  625.7505  666.5379  677.6671  582.1358  596.8657  622.1452
[15]    0.0000  630.1469  627.4929  610.0377  631.6956  657.8680
> colVars(tmp5,na.rm=TRUE)
 [1] 17503.98262    44.10133    46.18162    12.89729    88.03224    77.41637
 [7]    49.29186   114.85316    53.09984    48.43425    49.25569    55.87992
[13]    79.17125    45.70149          NA   103.85107   127.93891    33.12020
[19]    57.61182    13.53254
> colSd(tmp5,na.rm=TRUE)
 [1] 132.302618   6.640883   6.795706   3.591279   9.382550   8.798657
 [7]   7.020816  10.716957   7.286964   6.959472   7.018240   7.475287
[13]   8.897823   6.760288         NA  10.190735  11.311008   5.755015
[19]   7.590245   3.678661
> colMax(tmp5,na.rm=TRUE)
 [1] 467.79111  82.13341  78.91193  78.28375  83.65844  83.10716  88.82045
 [8]  81.18627  79.79381  85.16687  85.30846  73.40278  86.12594  84.39253
[15]      -Inf  93.58029  94.88394  76.77642  87.61927  78.60941
> colMin(tmp5,na.rm=TRUE)
 [1] 66.06516 63.90968 57.80040 67.55527 54.37473 56.79254 70.91683 53.44712
 [9] 59.46676 65.80628 66.16956 54.08507 58.13101 62.31481      Inf 59.88606
[17] 56.79428 59.96649 60.55371 68.29543
> 
> 
> 
> 
> 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] 185.4869 219.0934 251.2344 257.1749 267.4674 189.8045 425.7196 199.0882
 [9] 268.0161 225.3822
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 185.4869 219.0934 251.2344 257.1749 267.4674 189.8045 425.7196 199.0882
 [9] 268.0161 225.3822
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14 -5.684342e-14  5.684342e-14 -5.684342e-14  5.684342e-14
 [6]  0.000000e+00 -2.842171e-14  5.684342e-14  0.000000e+00  1.421085e-14
[11] -1.421085e-14 -1.705303e-13  5.684342e-14  0.000000e+00 -8.526513e-14
[16]  8.526513e-14  0.000000e+00 -5.684342e-14 -8.526513e-14  2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
10   12 
5   1 
10   20 
5   3 
3   4 
10   11 
3   11 
3   8 
1   1 
6   16 
2   17 
1   14 
6   20 
4   18 
9   6 
4   12 
8   13 
5   17 
3   20 
4   9 
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] 3.231534
> Min(tmp)
[1] -1.924555
> mean(tmp)
[1] 0.149804
> Sum(tmp)
[1] 14.9804
> Var(tmp)
[1] 1.042353
> 
> rowMeans(tmp)
[1] 0.149804
> rowSums(tmp)
[1] 14.9804
> rowVars(tmp)
[1] 1.042353
> rowSd(tmp)
[1] 1.020957
> rowMax(tmp)
[1] 3.231534
> rowMin(tmp)
[1] -1.924555
> 
> colMeans(tmp)
  [1]  0.44112915  3.23153397  1.32475067 -1.12182777  0.72410325  0.15934154
  [7]  1.07757640  0.57428144 -1.09439823  0.48806117  0.46652795  0.18499041
 [13]  0.51497605 -0.69286626 -0.59813067  0.82203847 -0.17816981 -0.61484297
 [19] -1.27427388 -1.11440864 -0.35318701 -0.27979035 -0.08774864  0.92557638
 [25]  0.08116736  0.88890289 -1.31430910 -0.73257694  1.26009350 -0.97999188
 [31]  1.80698012  0.44436327  0.36315533 -0.96172575 -1.56608615  0.83005723
 [37] -1.18729499 -1.22245587  1.09671409  0.12092941 -0.91564759  0.08751060
 [43]  2.14053755  0.14217415 -0.66891567  1.13317495  0.07951925  1.49842511
 [49]  2.11031682 -1.83564589 -0.32774920  0.72728385 -1.21600516 -0.84640748
 [55] -0.02756680  1.35489300 -1.47999747  0.77850352 -1.01363603 -1.68436266
 [61]  0.43004290  0.77393270  0.39079679  0.66641718  0.09470890 -0.74144314
 [67]  1.10294848  1.83524164  0.78679249  1.60599462  0.18030612  0.71498383
 [73]  0.52187867  0.67223533  0.89860955 -1.92455519  2.05918529  0.91047941
 [79]  0.92187734  0.76443956 -1.73885830  0.23298581  0.72277273 -0.90921988
 [85] -0.40453768 -0.97018465 -0.69657081 -0.53129675 -0.39730586  0.15743259
 [91] -0.09227643 -1.33057824  0.79016106  1.41006499  0.11628045  0.34845881
 [97]  0.78219562  1.28036130  0.79145535  0.26462115
> colSums(tmp)
  [1]  0.44112915  3.23153397  1.32475067 -1.12182777  0.72410325  0.15934154
  [7]  1.07757640  0.57428144 -1.09439823  0.48806117  0.46652795  0.18499041
 [13]  0.51497605 -0.69286626 -0.59813067  0.82203847 -0.17816981 -0.61484297
 [19] -1.27427388 -1.11440864 -0.35318701 -0.27979035 -0.08774864  0.92557638
 [25]  0.08116736  0.88890289 -1.31430910 -0.73257694  1.26009350 -0.97999188
 [31]  1.80698012  0.44436327  0.36315533 -0.96172575 -1.56608615  0.83005723
 [37] -1.18729499 -1.22245587  1.09671409  0.12092941 -0.91564759  0.08751060
 [43]  2.14053755  0.14217415 -0.66891567  1.13317495  0.07951925  1.49842511
 [49]  2.11031682 -1.83564589 -0.32774920  0.72728385 -1.21600516 -0.84640748
 [55] -0.02756680  1.35489300 -1.47999747  0.77850352 -1.01363603 -1.68436266
 [61]  0.43004290  0.77393270  0.39079679  0.66641718  0.09470890 -0.74144314
 [67]  1.10294848  1.83524164  0.78679249  1.60599462  0.18030612  0.71498383
 [73]  0.52187867  0.67223533  0.89860955 -1.92455519  2.05918529  0.91047941
 [79]  0.92187734  0.76443956 -1.73885830  0.23298581  0.72277273 -0.90921988
 [85] -0.40453768 -0.97018465 -0.69657081 -0.53129675 -0.39730586  0.15743259
 [91] -0.09227643 -1.33057824  0.79016106  1.41006499  0.11628045  0.34845881
 [97]  0.78219562  1.28036130  0.79145535  0.26462115
> 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.44112915  3.23153397  1.32475067 -1.12182777  0.72410325  0.15934154
  [7]  1.07757640  0.57428144 -1.09439823  0.48806117  0.46652795  0.18499041
 [13]  0.51497605 -0.69286626 -0.59813067  0.82203847 -0.17816981 -0.61484297
 [19] -1.27427388 -1.11440864 -0.35318701 -0.27979035 -0.08774864  0.92557638
 [25]  0.08116736  0.88890289 -1.31430910 -0.73257694  1.26009350 -0.97999188
 [31]  1.80698012  0.44436327  0.36315533 -0.96172575 -1.56608615  0.83005723
 [37] -1.18729499 -1.22245587  1.09671409  0.12092941 -0.91564759  0.08751060
 [43]  2.14053755  0.14217415 -0.66891567  1.13317495  0.07951925  1.49842511
 [49]  2.11031682 -1.83564589 -0.32774920  0.72728385 -1.21600516 -0.84640748
 [55] -0.02756680  1.35489300 -1.47999747  0.77850352 -1.01363603 -1.68436266
 [61]  0.43004290  0.77393270  0.39079679  0.66641718  0.09470890 -0.74144314
 [67]  1.10294848  1.83524164  0.78679249  1.60599462  0.18030612  0.71498383
 [73]  0.52187867  0.67223533  0.89860955 -1.92455519  2.05918529  0.91047941
 [79]  0.92187734  0.76443956 -1.73885830  0.23298581  0.72277273 -0.90921988
 [85] -0.40453768 -0.97018465 -0.69657081 -0.53129675 -0.39730586  0.15743259
 [91] -0.09227643 -1.33057824  0.79016106  1.41006499  0.11628045  0.34845881
 [97]  0.78219562  1.28036130  0.79145535  0.26462115
> colMin(tmp)
  [1]  0.44112915  3.23153397  1.32475067 -1.12182777  0.72410325  0.15934154
  [7]  1.07757640  0.57428144 -1.09439823  0.48806117  0.46652795  0.18499041
 [13]  0.51497605 -0.69286626 -0.59813067  0.82203847 -0.17816981 -0.61484297
 [19] -1.27427388 -1.11440864 -0.35318701 -0.27979035 -0.08774864  0.92557638
 [25]  0.08116736  0.88890289 -1.31430910 -0.73257694  1.26009350 -0.97999188
 [31]  1.80698012  0.44436327  0.36315533 -0.96172575 -1.56608615  0.83005723
 [37] -1.18729499 -1.22245587  1.09671409  0.12092941 -0.91564759  0.08751060
 [43]  2.14053755  0.14217415 -0.66891567  1.13317495  0.07951925  1.49842511
 [49]  2.11031682 -1.83564589 -0.32774920  0.72728385 -1.21600516 -0.84640748
 [55] -0.02756680  1.35489300 -1.47999747  0.77850352 -1.01363603 -1.68436266
 [61]  0.43004290  0.77393270  0.39079679  0.66641718  0.09470890 -0.74144314
 [67]  1.10294848  1.83524164  0.78679249  1.60599462  0.18030612  0.71498383
 [73]  0.52187867  0.67223533  0.89860955 -1.92455519  2.05918529  0.91047941
 [79]  0.92187734  0.76443956 -1.73885830  0.23298581  0.72277273 -0.90921988
 [85] -0.40453768 -0.97018465 -0.69657081 -0.53129675 -0.39730586  0.15743259
 [91] -0.09227643 -1.33057824  0.79016106  1.41006499  0.11628045  0.34845881
 [97]  0.78219562  1.28036130  0.79145535  0.26462115
> colMedians(tmp)
  [1]  0.44112915  3.23153397  1.32475067 -1.12182777  0.72410325  0.15934154
  [7]  1.07757640  0.57428144 -1.09439823  0.48806117  0.46652795  0.18499041
 [13]  0.51497605 -0.69286626 -0.59813067  0.82203847 -0.17816981 -0.61484297
 [19] -1.27427388 -1.11440864 -0.35318701 -0.27979035 -0.08774864  0.92557638
 [25]  0.08116736  0.88890289 -1.31430910 -0.73257694  1.26009350 -0.97999188
 [31]  1.80698012  0.44436327  0.36315533 -0.96172575 -1.56608615  0.83005723
 [37] -1.18729499 -1.22245587  1.09671409  0.12092941 -0.91564759  0.08751060
 [43]  2.14053755  0.14217415 -0.66891567  1.13317495  0.07951925  1.49842511
 [49]  2.11031682 -1.83564589 -0.32774920  0.72728385 -1.21600516 -0.84640748
 [55] -0.02756680  1.35489300 -1.47999747  0.77850352 -1.01363603 -1.68436266
 [61]  0.43004290  0.77393270  0.39079679  0.66641718  0.09470890 -0.74144314
 [67]  1.10294848  1.83524164  0.78679249  1.60599462  0.18030612  0.71498383
 [73]  0.52187867  0.67223533  0.89860955 -1.92455519  2.05918529  0.91047941
 [79]  0.92187734  0.76443956 -1.73885830  0.23298581  0.72277273 -0.90921988
 [85] -0.40453768 -0.97018465 -0.69657081 -0.53129675 -0.39730586  0.15743259
 [91] -0.09227643 -1.33057824  0.79016106  1.41006499  0.11628045  0.34845881
 [97]  0.78219562  1.28036130  0.79145535  0.26462115
> colRanges(tmp)
          [,1]     [,2]     [,3]      [,4]      [,5]      [,6]     [,7]
[1,] 0.4411292 3.231534 1.324751 -1.121828 0.7241032 0.1593415 1.077576
[2,] 0.4411292 3.231534 1.324751 -1.121828 0.7241032 0.1593415 1.077576
          [,8]      [,9]     [,10]    [,11]     [,12]    [,13]      [,14]
[1,] 0.5742814 -1.094398 0.4880612 0.466528 0.1849904 0.514976 -0.6928663
[2,] 0.5742814 -1.094398 0.4880612 0.466528 0.1849904 0.514976 -0.6928663
          [,15]     [,16]      [,17]     [,18]     [,19]     [,20]     [,21]
[1,] -0.5981307 0.8220385 -0.1781698 -0.614843 -1.274274 -1.114409 -0.353187
[2,] -0.5981307 0.8220385 -0.1781698 -0.614843 -1.274274 -1.114409 -0.353187
          [,22]       [,23]     [,24]      [,25]     [,26]     [,27]      [,28]
[1,] -0.2797903 -0.08774864 0.9255764 0.08116736 0.8889029 -1.314309 -0.7325769
[2,] -0.2797903 -0.08774864 0.9255764 0.08116736 0.8889029 -1.314309 -0.7325769
        [,29]      [,30]   [,31]     [,32]     [,33]      [,34]     [,35]
[1,] 1.260094 -0.9799919 1.80698 0.4443633 0.3631553 -0.9617257 -1.566086
[2,] 1.260094 -0.9799919 1.80698 0.4443633 0.3631553 -0.9617257 -1.566086
         [,36]     [,37]     [,38]    [,39]     [,40]      [,41]     [,42]
[1,] 0.8300572 -1.187295 -1.222456 1.096714 0.1209294 -0.9156476 0.0875106
[2,] 0.8300572 -1.187295 -1.222456 1.096714 0.1209294 -0.9156476 0.0875106
        [,43]     [,44]      [,45]    [,46]      [,47]    [,48]    [,49]
[1,] 2.140538 0.1421741 -0.6689157 1.133175 0.07951925 1.498425 2.110317
[2,] 2.140538 0.1421741 -0.6689157 1.133175 0.07951925 1.498425 2.110317
         [,50]      [,51]     [,52]     [,53]      [,54]      [,55]    [,56]
[1,] -1.835646 -0.3277492 0.7272839 -1.216005 -0.8464075 -0.0275668 1.354893
[2,] -1.835646 -0.3277492 0.7272839 -1.216005 -0.8464075 -0.0275668 1.354893
         [,57]     [,58]     [,59]     [,60]     [,61]     [,62]     [,63]
[1,] -1.479997 0.7785035 -1.013636 -1.684363 0.4300429 0.7739327 0.3907968
[2,] -1.479997 0.7785035 -1.013636 -1.684363 0.4300429 0.7739327 0.3907968
         [,64]     [,65]      [,66]    [,67]    [,68]     [,69]    [,70]
[1,] 0.6664172 0.0947089 -0.7414431 1.102948 1.835242 0.7867925 1.605995
[2,] 0.6664172 0.0947089 -0.7414431 1.102948 1.835242 0.7867925 1.605995
         [,71]     [,72]     [,73]     [,74]     [,75]     [,76]    [,77]
[1,] 0.1803061 0.7149838 0.5218787 0.6722353 0.8986096 -1.924555 2.059185
[2,] 0.1803061 0.7149838 0.5218787 0.6722353 0.8986096 -1.924555 2.059185
         [,78]     [,79]     [,80]     [,81]     [,82]     [,83]      [,84]
[1,] 0.9104794 0.9218773 0.7644396 -1.738858 0.2329858 0.7227727 -0.9092199
[2,] 0.9104794 0.9218773 0.7644396 -1.738858 0.2329858 0.7227727 -0.9092199
          [,85]      [,86]      [,87]      [,88]      [,89]     [,90]
[1,] -0.4045377 -0.9701846 -0.6965708 -0.5312968 -0.3973059 0.1574326
[2,] -0.4045377 -0.9701846 -0.6965708 -0.5312968 -0.3973059 0.1574326
           [,91]     [,92]     [,93]    [,94]     [,95]     [,96]     [,97]
[1,] -0.09227643 -1.330578 0.7901611 1.410065 0.1162804 0.3484588 0.7821956
[2,] -0.09227643 -1.330578 0.7901611 1.410065 0.1162804 0.3484588 0.7821956
        [,98]     [,99]    [,100]
[1,] 1.280361 0.7914553 0.2646211
[2,] 1.280361 0.7914553 0.2646211
> 
> 
> Max(tmp2)
[1] 2.506477
> Min(tmp2)
[1] -3.095228
> mean(tmp2)
[1] 0.02273271
> Sum(tmp2)
[1] 2.273271
> Var(tmp2)
[1] 0.935837
> 
> rowMeans(tmp2)
  [1]  1.177766044  0.747776910 -0.369419985  0.183092367 -0.191725646
  [6] -2.184055284  0.748295293 -0.174296891 -3.095228201  0.905395380
 [11]  0.926689011 -0.001984178  1.396305102 -0.553116905 -1.024886402
 [16] -1.139132664 -1.938349567 -0.346126104 -0.645763171 -0.021008880
 [21]  1.738395094 -2.020222900 -0.447070917  0.636224802  2.506477384
 [26]  0.749710281  1.349078473 -0.802514289 -1.016900521 -0.062744645
 [31] -1.299669050  0.995521806  1.942993609  1.042279011 -0.526603120
 [36] -1.614363916  0.890509042  1.052533499 -0.061582439  1.299169749
 [41] -0.014460483 -0.915107340 -0.040543654  0.233530776  0.439937800
 [46]  0.414540388  0.301918685  0.979079669 -0.896440292 -1.125469355
 [51]  0.007593134 -0.843047582  1.423901036 -0.693647422  0.426934504
 [56]  0.192660771  0.550000509 -0.667256021 -0.289651730 -0.184067823
 [61]  0.830037208  0.251096438 -0.486857773 -0.221173316  1.562913969
 [66] -0.080786022  0.574042118  0.072621579  0.278838662  0.828511800
 [71] -0.801928729 -0.808092632 -0.040131829  0.891801527  0.754920477
 [76]  0.739719083  0.070818777  0.457534063  1.298754141  0.025504578
 [81]  0.562959355 -1.078472777 -1.762565090 -0.416172703  0.130249182
 [86]  1.804494383 -0.783888628  0.803471684 -0.426644924 -0.332370686
 [91] -0.939099605 -0.370541288 -0.844399636  0.567979301 -0.686320382
 [96] -0.294258327 -0.973469307 -0.447791118  0.965758692  0.544355813
> rowSums(tmp2)
  [1]  1.177766044  0.747776910 -0.369419985  0.183092367 -0.191725646
  [6] -2.184055284  0.748295293 -0.174296891 -3.095228201  0.905395380
 [11]  0.926689011 -0.001984178  1.396305102 -0.553116905 -1.024886402
 [16] -1.139132664 -1.938349567 -0.346126104 -0.645763171 -0.021008880
 [21]  1.738395094 -2.020222900 -0.447070917  0.636224802  2.506477384
 [26]  0.749710281  1.349078473 -0.802514289 -1.016900521 -0.062744645
 [31] -1.299669050  0.995521806  1.942993609  1.042279011 -0.526603120
 [36] -1.614363916  0.890509042  1.052533499 -0.061582439  1.299169749
 [41] -0.014460483 -0.915107340 -0.040543654  0.233530776  0.439937800
 [46]  0.414540388  0.301918685  0.979079669 -0.896440292 -1.125469355
 [51]  0.007593134 -0.843047582  1.423901036 -0.693647422  0.426934504
 [56]  0.192660771  0.550000509 -0.667256021 -0.289651730 -0.184067823
 [61]  0.830037208  0.251096438 -0.486857773 -0.221173316  1.562913969
 [66] -0.080786022  0.574042118  0.072621579  0.278838662  0.828511800
 [71] -0.801928729 -0.808092632 -0.040131829  0.891801527  0.754920477
 [76]  0.739719083  0.070818777  0.457534063  1.298754141  0.025504578
 [81]  0.562959355 -1.078472777 -1.762565090 -0.416172703  0.130249182
 [86]  1.804494383 -0.783888628  0.803471684 -0.426644924 -0.332370686
 [91] -0.939099605 -0.370541288 -0.844399636  0.567979301 -0.686320382
 [96] -0.294258327 -0.973469307 -0.447791118  0.965758692  0.544355813
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  1.177766044  0.747776910 -0.369419985  0.183092367 -0.191725646
  [6] -2.184055284  0.748295293 -0.174296891 -3.095228201  0.905395380
 [11]  0.926689011 -0.001984178  1.396305102 -0.553116905 -1.024886402
 [16] -1.139132664 -1.938349567 -0.346126104 -0.645763171 -0.021008880
 [21]  1.738395094 -2.020222900 -0.447070917  0.636224802  2.506477384
 [26]  0.749710281  1.349078473 -0.802514289 -1.016900521 -0.062744645
 [31] -1.299669050  0.995521806  1.942993609  1.042279011 -0.526603120
 [36] -1.614363916  0.890509042  1.052533499 -0.061582439  1.299169749
 [41] -0.014460483 -0.915107340 -0.040543654  0.233530776  0.439937800
 [46]  0.414540388  0.301918685  0.979079669 -0.896440292 -1.125469355
 [51]  0.007593134 -0.843047582  1.423901036 -0.693647422  0.426934504
 [56]  0.192660771  0.550000509 -0.667256021 -0.289651730 -0.184067823
 [61]  0.830037208  0.251096438 -0.486857773 -0.221173316  1.562913969
 [66] -0.080786022  0.574042118  0.072621579  0.278838662  0.828511800
 [71] -0.801928729 -0.808092632 -0.040131829  0.891801527  0.754920477
 [76]  0.739719083  0.070818777  0.457534063  1.298754141  0.025504578
 [81]  0.562959355 -1.078472777 -1.762565090 -0.416172703  0.130249182
 [86]  1.804494383 -0.783888628  0.803471684 -0.426644924 -0.332370686
 [91] -0.939099605 -0.370541288 -0.844399636  0.567979301 -0.686320382
 [96] -0.294258327 -0.973469307 -0.447791118  0.965758692  0.544355813
> rowMin(tmp2)
  [1]  1.177766044  0.747776910 -0.369419985  0.183092367 -0.191725646
  [6] -2.184055284  0.748295293 -0.174296891 -3.095228201  0.905395380
 [11]  0.926689011 -0.001984178  1.396305102 -0.553116905 -1.024886402
 [16] -1.139132664 -1.938349567 -0.346126104 -0.645763171 -0.021008880
 [21]  1.738395094 -2.020222900 -0.447070917  0.636224802  2.506477384
 [26]  0.749710281  1.349078473 -0.802514289 -1.016900521 -0.062744645
 [31] -1.299669050  0.995521806  1.942993609  1.042279011 -0.526603120
 [36] -1.614363916  0.890509042  1.052533499 -0.061582439  1.299169749
 [41] -0.014460483 -0.915107340 -0.040543654  0.233530776  0.439937800
 [46]  0.414540388  0.301918685  0.979079669 -0.896440292 -1.125469355
 [51]  0.007593134 -0.843047582  1.423901036 -0.693647422  0.426934504
 [56]  0.192660771  0.550000509 -0.667256021 -0.289651730 -0.184067823
 [61]  0.830037208  0.251096438 -0.486857773 -0.221173316  1.562913969
 [66] -0.080786022  0.574042118  0.072621579  0.278838662  0.828511800
 [71] -0.801928729 -0.808092632 -0.040131829  0.891801527  0.754920477
 [76]  0.739719083  0.070818777  0.457534063  1.298754141  0.025504578
 [81]  0.562959355 -1.078472777 -1.762565090 -0.416172703  0.130249182
 [86]  1.804494383 -0.783888628  0.803471684 -0.426644924 -0.332370686
 [91] -0.939099605 -0.370541288 -0.844399636  0.567979301 -0.686320382
 [96] -0.294258327 -0.973469307 -0.447791118  0.965758692  0.544355813
> 
> colMeans(tmp2)
[1] 0.02273271
> colSums(tmp2)
[1] 2.273271
> colVars(tmp2)
[1] 0.935837
> colSd(tmp2)
[1] 0.9673867
> colMax(tmp2)
[1] 2.506477
> colMin(tmp2)
[1] -3.095228
> colMedians(tmp2)
[1] -0.008222331
> colRanges(tmp2)
          [,1]
[1,] -3.095228
[2,]  2.506477
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.8021654  3.4405225 -2.5249134 -0.2704118 -1.1064977  1.4015597
 [7] -1.3208935  0.8985403 -1.5850456 -1.4834752
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.9882298
[2,] -1.3898745
[3,]  0.3890071
[4,]  0.7571283
[5,]  1.2454630
> 
> rowApply(tmp,sum)
 [1] -4.4053903 -3.4475219  3.6198526 -0.1132018  0.2499027 -4.8722981
 [7]  1.3118049  1.5630438  1.0178130  0.7232149
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    7    1    8    1    3    1    7    9    8     8
 [2,]    9    6    4   10    5   10   10    4    4     5
 [3,]    2    9    2    8    6    7    3    7    5     1
 [4,]   10    3   10    2    9    6    1    3    6     6
 [5,]    5   10    3    7    2    3    2   10   10     2
 [6,]    8    4    5    6    7    8    9    6    1     9
 [7,]    4    2    9    5   10    2    4    2    2     7
 [8,]    1    8    7    4    4    9    8    8    7    10
 [9,]    6    7    6    3    1    5    5    5    9     3
[10,]    3    5    1    9    8    4    6    1    3     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.48140517  0.05899565  0.22877960 -2.02108779  2.76303004  0.80355963
 [7]  1.49007669 -0.70718324 -1.18032010 -3.04633427  2.42865755 -1.75652802
[13]  0.07818365  1.08137857 -0.58504414 -0.69589174  0.21901335  0.90186500
[19] -2.74495432  0.56270008
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.4539004
[2,] -1.3075662
[3,] -0.0485299
[4,]  0.2984846
[5,]  1.0301067
> 
> rowApply(tmp,sum)
[1]  3.719295  4.414030  4.528155 -8.032087 -8.231902
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    9   16   16    3
[2,]   16   20    2    2   17
[3,]    7    7   17   19    6
[4,]    4    6   11    6   11
[5,]   12   15    9   15   20
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -1.4539004  0.7616785 -0.1522576 -0.5205503  0.4019572  1.1858924
[2,] -0.0485299  1.7250558 -0.4310973 -0.5026203  0.7834411 -0.6887193
[3,]  1.0301067 -1.1792437  1.2083753  0.2325370 -0.1398974  0.7113515
[4,]  0.2984846 -1.5396645  0.6388663 -1.0359511  0.1871601 -0.4845346
[5,] -1.3075662  0.2911696 -1.0351071 -0.1945031  1.5303690  0.0795697
            [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,]  0.07185852  0.2191076  0.7736655  0.2033737  0.4696828 -0.1935689
[2,] -0.30218446  0.4896168 -1.2596671 -0.7645396  0.7765185  1.2316894
[3,]  2.32094556 -0.7312505  0.1201760 -0.5149043  1.2272821 -1.3955612
[4,] -0.40691227 -0.5270949 -0.6904650 -1.3498222 -0.6243883  0.4470053
[5,] -0.19363066 -0.1575623 -0.1240295 -0.6204418  0.5795625 -1.8460926
          [,13]       [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -0.3724198  1.59880084 -0.9725137  0.4140740  1.2226070  0.5726961
[2,]  1.2825592  0.19559261  0.4264024  0.5261867  1.0352096  1.6240902
[3,] -0.4229883 -0.67406784  0.9708032  1.4935329 -0.2822982 -0.6843001
[4,] -0.1798475 -0.01499714  0.1091140 -1.8282377 -1.3864802  0.4158761
[5,] -0.2291199 -0.02394991 -1.1188501 -1.3014476 -0.3700248 -1.0264972
           [,19]      [,20]
[1,]  0.03790907 -0.5487971
[2,] -0.51916773 -1.1658067
[3,]  0.41400695  0.8235494
[4,] -1.08962888  1.0294306
[5,] -1.58807373  0.4243240
> 
> 
> 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.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.11-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.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  557  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1       col2       col3      col4       col5      col6      col7
row1 -0.6730831 -0.4629374 0.06160437 0.5481491 -0.2320029 -1.664663 0.2619752
          col8    col9    col10      col11     col12      col13     col14
row1 0.2698693 -1.0034 1.278972 -0.9751605 -1.219454 -0.5945084 0.8775254
         col15     col16     col17     col18     col19     col20
row1 -0.376821 0.4430022 0.4015363 -1.294248 0.5001512 -0.490934
> tmp[,"col10"]
          col10
row1  1.2789721
row2 -0.3962047
row3 -1.0528103
row4  0.9454441
row5 -0.8476476
> tmp[c("row1","row5"),]
           col1       col2       col3       col4        col5       col6
row1 -0.6730831 -0.4629374 0.06160437  0.5481491 -0.23200294 -1.6646629
row5  1.3223330  1.4440013 0.82084805 -1.7327515 -0.05501528 -0.3354555
          col7      col8      col9      col10      col11     col12       col13
row1 0.2619752 0.2698693 -1.003400  1.2789721 -0.9751605 -1.219454 -0.59450840
row5 1.7874396 0.2116565 -1.743663 -0.8476476 -1.7366852 -0.582624 -0.09081492
           col14      col15      col16     col17     col18      col19
row1  0.87752540 -0.3768210  0.4430022 0.4015363 -1.294248  0.5001512
row5 -0.04344186 -0.4527134 -0.6491297 0.4175772 -1.420651 -0.5129810
          col20
row1 -0.4909340
row5 -0.2205629
> tmp[,c("col6","col20")]
           col6       col20
row1 -1.6646629 -0.49093398
row2 -1.1079433  1.35652639
row3 -0.5013239  0.20725062
row4 -0.2787879 -0.07566589
row5 -0.3354555 -0.22056288
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -1.6646629 -0.4909340
row5 -0.3354555 -0.2205629
> 
> 
> 
> 
> 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.0336 49.75909 51.80472 49.37255 49.69049 105.9783 49.0372 51.4894
         col9    col10   col11    col12    col13   col14   col15    col16
row1 49.82638 49.70628 50.7358 49.55958 49.65597 49.6365 50.5454 50.93378
        col17    col18    col19    col20
row1 50.24363 49.68923 52.09609 105.2995
> tmp[,"col10"]
        col10
row1 49.70628
row2 30.30080
row3 30.16090
row4 31.66184
row5 50.65666
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.03360 49.75909 51.80472 49.37255 49.69049 105.9783 49.03720 51.48940
row5 47.98478 50.24792 49.83727 50.37023 50.45565 104.5876 48.88598 48.64971
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.82638 49.70628 50.73580 49.55958 49.65597 49.63650 50.54540 50.93378
row5 51.09221 50.65666 47.93728 50.92784 51.59228 50.44834 49.36613 50.73309
        col17    col18    col19    col20
row1 50.24363 49.68923 52.09609 105.2995
row5 49.10034 52.25505 49.59924 105.0923
> tmp[,c("col6","col20")]
          col6     col20
row1 105.97830 105.29949
row2  76.53363  75.41743
row3  73.73896  76.29435
row4  75.84631  75.68677
row5 104.58760 105.09225
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.9783 105.2995
row5 104.5876 105.0923
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.9783 105.2995
row5 104.5876 105.0923
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.3937532
[2,] -0.1580079
[3,]  1.2036111
[4,] -0.2943479
[5,]  1.5213805
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.8398121  0.2889503
[2,]  0.9648761  0.2029694
[3,]  0.6153492 -1.4014390
[4,]  0.8577111 -0.4275224
[5,]  0.2444218  1.5914235
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,]  0.04260921  0.3397071
[2,]  1.51820143  2.7387367
[3,] -1.29258212 -0.7500748
[4,] -1.05476165  0.5725209
[5,] -1.52504434 -0.5047808
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] 0.04260921
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] 0.04260921
[2,] 1.51820143
> 
> 
> 
> 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.08646136 -0.5577229 1.834628 -0.911920620  0.7926065 -2.0842640
row1 0.74414567 -0.3239105 0.579639  0.003908045 -0.3503487 -0.4361683
          [,7]       [,8]       [,9]      [,10]     [,11]     [,12]     [,13]
row3 0.6425383 -0.6925287 -0.6418295  1.0079205  1.837805 -1.460227  1.030081
row1 2.1698088  0.3627149 -0.8951416 -0.5072308 -0.475207  1.229441 -1.503309
          [,14]      [,15]      [,16]     [,17]      [,18]      [,19]
row3 -0.1078840 -0.3485139 -0.2923564 0.1621441 -2.0774897 -0.2394791
row1 -0.3638757 -2.3711398 -0.2275910 0.6326460  0.5120267  0.0468842
          [,20]
row3 -0.7964063
row1  0.4780098
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]     [,2]       [,3]       [,4]      [,5]       [,6]     [,7]
row2 -0.2902099 1.958107 -0.2341531 -0.2157298 0.6412327 -0.8990138 2.360624
          [,8]      [,9]      [,10]
row2 0.5857483 0.3203744 -0.3847322
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
row5 0.4262989 -2.621956 -1.195482 -0.625789 0.8775803 -1.529167 0.8683747
           [,8]        [,9]      [,10]   [,11]     [,12]     [,13]        [,14]
row5 -0.8927198 -0.07180973 -0.3756913 0.77187 0.2269292 -1.319066 0.0009604008
        [,15]      [,16]     [,17]       [,18]     [,19]      [,20]
row5 0.505336 -0.5650308 0.8618968 -0.03121656 0.5916508 -0.1581823
> 
> 
> 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: 0x5649c2283c80>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM702520fd3bf4"
 [2] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM7025105987a9"
 [3] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM7025413873b1"
 [4] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM702551264258"
 [5] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM702565701268"
 [6] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM70254d69a5b9"
 [7] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM702520ae0f7b"
 [8] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM702574d1bf1c"
 [9] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM70252932d12e"
[10] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM70252ff8b52" 
[11] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM70251d58ae86"
[12] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM7025387e01a4"
[13] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM70256323f816"
[14] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM7025bf3fe1b" 
[15] "/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM7025ef2eafe" 
> 
> 
> ### 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: 0x5649c37b6580>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5649c37b6580>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5649c37b6580>
> rowMedians(tmp)
  [1] -0.260421481  0.243112665 -0.144086744 -0.073254715  0.028155879
  [6]  0.166848225  0.285043343 -0.097769750  0.400936836  0.457278630
 [11]  0.314403999  0.323957043 -0.007838455 -0.176020484  0.500431368
 [16]  0.106376400  0.248659615  0.228529850  0.182514644 -0.213402332
 [21]  0.431637168 -0.093971351  0.183462315 -0.356611093 -0.219769140
 [26] -0.390907165  0.291652802 -0.048680007 -0.249445831 -0.561408203
 [31]  0.330819588 -0.188939769  0.190847400 -0.091785792 -0.015430041
 [36] -0.445966573  0.090646363  0.351111781 -0.256260305 -0.175254759
 [41]  0.415181051  0.307013731 -0.245330014 -0.175662829  0.517234751
 [46]  0.007026112 -0.111866311  0.180689768 -0.265993266 -0.019114854
 [51] -0.024329907  0.205154178 -0.038199229  0.028345862  0.193285601
 [56] -0.542018608 -0.494067907  0.544896071  0.580781264 -0.044558378
 [61]  0.361029461 -0.131039697  0.147917202  0.098485083 -0.189650560
 [66]  0.410873214  0.631736461 -0.240797988 -0.007976078  0.304136461
 [71]  0.063648527  0.009322872  0.206791583 -0.639539482  0.168688705
 [76]  0.026740620 -0.213171393  0.354165575 -0.163634320  0.034749835
 [81]  0.144454377 -0.019466076 -0.300832883 -0.490907460 -0.243754775
 [86] -0.166460517  0.304320186  0.025069232  0.158045165 -0.547536446
 [91]  0.066382371  0.105299383 -0.100419729 -0.074988152  0.420319020
 [96] -0.168293362  0.001194618 -0.037968401 -0.105406288  0.120072706
[101] -0.076057443 -0.229229376  0.226628123  0.576688148  0.436481458
[106]  0.068906536  0.500899129  0.372967244  0.090545498  0.114978754
[111] -0.013991687  0.013311286 -0.025247509 -0.519763270  0.090525796
[116] -0.227803770  0.283129825 -0.491699105 -0.351608596 -0.277785448
[121] -0.893803386  0.211903517  0.396760287 -0.142781167 -0.063292674
[126]  0.064202566  0.080811245  0.070793941  0.067590829  0.739450579
[131] -0.639632251  0.002637569 -0.150551792  0.160541629 -0.118198038
[136]  0.118668606  0.497372895  0.499940780  0.068584679 -1.002073192
[141]  0.667125709 -0.136757996 -0.062377850  0.054569356 -0.165212151
[146] -0.041228006 -0.527045339  0.680889763 -0.136539668 -0.070796573
[151] -0.134563626 -0.092883320  0.043924549  0.244770804 -0.260253319
[156] -0.331109304  0.740361283 -0.022999654 -0.085439375 -0.032796950
[161]  0.605584018  0.395929581  0.322809292  0.204512043  0.655516046
[166] -0.413151656  0.200819578  0.299484939 -0.040985605  0.465588911
[171]  0.092425437  0.220400374 -0.171997726 -0.671391824  0.071374740
[176] -0.325285352  0.051848236  0.213204934 -0.376327889 -0.154265658
[181] -0.116362587 -0.660422702  0.009372986 -0.119828425  0.387856726
[186] -0.628612846  0.135580699 -0.429970579 -0.188317293 -0.038850058
[191]  0.283023093  0.273676531 -0.279026024  0.193717874 -0.279224032
[196] -0.090913112 -0.288317138 -0.459371031 -0.171074273 -0.304367713
[201] -0.482944326 -0.166988418 -0.161562597  0.623223771  0.131738036
[206]  0.113104970  0.403372705  0.016810009  0.361512438 -0.115885915
[211]  0.151279455  0.273609652  0.130060850 -0.227722273  0.453647087
[216] -0.460674890 -0.992296396 -0.048033226 -0.384866002 -0.481763443
[221]  0.434474719 -0.370168264 -0.082388300  0.482803880  0.093014633
[226]  0.145259803 -0.116985431  0.148771294 -0.155087043  0.114587824
> 
> proc.time()
   user  system elapsed 
  2.396   0.935   3.372 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
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: 0x562cfefd23a0>
> .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: 0x562cfefd23a0>
> .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: 0x562cfefd23a0>
> .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: 0x562cfefd23a0>
> 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: 0x562d00fed5e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x562d00fed5e0>
> .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: 0x562d00fed5e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x562d00fed5e0>
> .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: 0x562d00fed5e0>
> 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: 0x562cfeb57880>
> .Call("R_bm_AddColumn",P)
<pointer: 0x562cfeb57880>
> .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: 0x562cfeb57880>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x562cfeb57880>
> .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: 0x562cfeb57880>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x562cfeb57880>
> .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: 0x562cfeb57880>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x562cfeb57880>
> .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: 0x562cfeb57880>
> 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: 0x562d00e8de70>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x562d00e8de70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x562d00e8de70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x562d00e8de70>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile704a428c4458" "BufferedMatrixFile704a7d744c94"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile704a428c4458" "BufferedMatrixFile704a7d744c94"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x562cfeb16820>
> .Call("R_bm_AddColumn",P)
<pointer: 0x562cfeb16820>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x562cfeb16820>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x562cfeb16820>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x562cfeb16820>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x562cfeb16820>
> .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: 0x562d007efd50>
> .Call("R_bm_AddColumn",P)
<pointer: 0x562d007efd50>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x562d007efd50>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x562d007efd50>
> 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: 0x562d010f5e00>
> .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: 0x562d010f5e00>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.453   0.041   0.479 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
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.446   0.066   0.496 

Example timings