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 2021-05-06 12:27:02 -0400 (Thu, 06 May 2021).

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 215/1974HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.54.0  (landing page)
Ben Bolstad
Snapshot Date: 2021-05-05 14:51:38 -0400 (Wed, 05 May 2021)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_12
Last Commit: eae3841
Last Changed Date: 2020-10-27 10:30:14 -0400 (Tue, 27 Oct 2020)
malbec1Linux (Ubuntu 18.04.5 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version exists in internal repository
tokay1Windows Server 2012 R2 Standard / x64  OK    OK    OK    OK  UNNEEDED, same version exists in internal repository
merida1macOS 10.14.6 Mojave / x86_64  OK    OK    OK    OK  UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.54.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.54.0.tar.gz
StartedAt: 2021-05-05 23:38:58 -0400 (Wed, 05 May 2021)
EndedAt: 2021-05-05 23:39:23 -0400 (Wed, 05 May 2021)
EllapsedTime: 25.3 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.54.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.0.5 (2021-03-31)
* 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.54.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.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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.440   0.040   0.477 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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 438446 23.5     927717 49.6   649971 34.8
Vcells 788872  6.1    8388608 64.0  2015373 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] "Wed May  5 23:39:17 2021"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed May  5 23:39:17 2021"
> 
> 
> 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: 0x561a94139f00>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed May  5 23:39:18 2021"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed May  5 23:39:18 2021"
> 
> ColMode(tmp2)
<pointer: 0x561a94139f00>
> 
> 
> 
> ### 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,] 100.3463174 -0.5097277 -0.7591917  0.52807592
[2,]  -0.6333747  0.4449361 -0.2222271 -0.57566884
[3,]   0.6617167  0.5970811 -0.1397774 -1.60483090
[4,]   1.2677289 -1.2049985  0.6007691 -0.08837716
> 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,] 100.3463174 0.5097277 0.7591917 0.52807592
[2,]   0.6333747 0.4449361 0.2222271 0.57566884
[3,]   0.6617167 0.5970811 0.1397774 1.60483090
[4,]   1.2677289 1.2049985 0.6007691 0.08837716
> 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,] 10.0173009 0.7139522 0.8713161 0.7266883
[2,]  0.7958484 0.6670353 0.4714097 0.7587284
[3,]  0.8134597 0.7727103 0.3738682 1.2668192
[4,]  1.1259347 1.0977242 0.7750930 0.2972830
> 
> 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,] 225.51933 32.64925 34.47235 32.79496
[2,]  33.59186 32.11529 29.93632 33.16295
[3,]  33.79631 33.32418 28.87846 39.27302
[4,]  37.52708 37.18224 33.35170 28.06121
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x561a93f66e70>
> exp(tmp5)
<pointer: 0x561a93f66e70>
> log(tmp5,2)
<pointer: 0x561a93f66e70>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.3889
> Min(tmp5)
[1] 52.7603
> mean(tmp5)
[1] 72.23519
> Sum(tmp5)
[1] 14447.04
> Var(tmp5)
[1] 867.0992
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.89044 69.38888 69.96788 71.55318 69.41589 68.77576 73.44891 68.08200
 [9] 67.19968 73.62931
> rowSums(tmp5)
 [1] 1817.809 1387.778 1399.358 1431.064 1388.318 1375.515 1468.978 1361.640
 [9] 1343.994 1472.586
> rowVars(tmp5)
 [1] 8002.22697   61.14877   74.80901   60.17360   86.07922   67.62531
 [7]   61.59448   69.31507   89.17374   59.40463
> rowSd(tmp5)
 [1] 89.455167  7.819768  8.649220  7.757164  9.277889  8.223461  7.848215
 [8]  8.325568  9.443185  7.707440
> rowMax(tmp5)
 [1] 469.38893  85.25760  86.23847  84.48052  89.81589  86.60382  84.79949
 [8]  85.02522  88.48742  88.51181
> rowMin(tmp5)
 [1] 57.66136 57.84884 56.53265 55.35690 52.76030 58.21392 59.49819 55.94062
 [9] 53.92803 60.60860
> 
> colMeans(tmp5)
 [1] 110.61001  67.77073  68.38789  68.65453  67.24951  72.06714  74.58763
 [8]  67.70344  71.62026  68.21568  71.15598  71.08537  67.89337  72.29327
[15]  71.31063  72.94705  68.48561  69.87194  72.04430  70.74952
> colSums(tmp5)
 [1] 1106.1001  677.7073  683.8789  686.5453  672.4951  720.6714  745.8763
 [8]  677.0344  716.2026  682.1568  711.5598  710.8537  678.9337  722.9327
[15]  713.1063  729.4705  684.8561  698.7194  720.4430  707.4952
> colVars(tmp5)
 [1] 15912.05137    83.88086    63.71335    68.20528    61.44620   120.15189
 [7]    69.41486    37.93911    83.01817    38.88286    95.85996    58.64062
[13]    78.07577    91.54339    98.70555    94.93349    68.49764   106.99635
[19]    75.01559    51.92938
> colSd(tmp5)
 [1] 126.142980   9.158650   7.982064   8.258649   7.838763  10.961382
 [7]   8.331558   6.159473   9.111431   6.235613   9.790810   7.657716
[13]   8.836049   9.567831   9.935067   9.743382   8.276330  10.343904
[19]   8.661154   7.206204
> colMax(tmp5)
 [1] 469.38893  82.68801  84.04702  81.74165  77.82030  89.96725  86.23847
 [8]  74.48301  83.36630  77.76764  88.51181  85.58353  82.11095  84.79949
[15]  86.60382  85.02522  85.25760  88.48742  84.42988  81.46743
> colMin(tmp5)
 [1] 64.15450 55.98993 59.54164 58.40573 56.01169 55.94062 62.54449 58.75797
 [9] 56.53265 55.76673 56.78988 63.31762 53.92803 55.35690 60.41616 52.76030
[17] 60.14803 58.16867 60.60860 60.55735
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 90.89044 69.38888 69.96788 71.55318 69.41589 68.77576 73.44891 68.08200
 [9]       NA 73.62931
> rowSums(tmp5)
 [1] 1817.809 1387.778 1399.358 1431.064 1388.318 1375.515 1468.978 1361.640
 [9]       NA 1472.586
> rowVars(tmp5)
 [1] 8002.22697   61.14877   74.80901   60.17360   86.07922   67.62531
 [7]   61.59448   69.31507   90.69827   59.40463
> rowSd(tmp5)
 [1] 89.455167  7.819768  8.649220  7.757164  9.277889  8.223461  7.848215
 [8]  8.325568  9.523564  7.707440
> rowMax(tmp5)
 [1] 469.38893  85.25760  86.23847  84.48052  89.81589  86.60382  84.79949
 [8]  85.02522        NA  88.51181
> rowMin(tmp5)
 [1] 57.66136 57.84884 56.53265 55.35690 52.76030 58.21392 59.49819 55.94062
 [9]       NA 60.60860
> 
> colMeans(tmp5)
 [1] 110.61001  67.77073        NA  68.65453  67.24951  72.06714  74.58763
 [8]  67.70344  71.62026  68.21568  71.15598  71.08537  67.89337  72.29327
[15]  71.31063  72.94705  68.48561  69.87194  72.04430  70.74952
> colSums(tmp5)
 [1] 1106.1001  677.7073        NA  686.5453  672.4951  720.6714  745.8763
 [8]  677.0344  716.2026  682.1568  711.5598  710.8537  678.9337  722.9327
[15]  713.1063  729.4705  684.8561  698.7194  720.4430  707.4952
> colVars(tmp5)
 [1] 15912.05137    83.88086          NA    68.20528    61.44620   120.15189
 [7]    69.41486    37.93911    83.01817    38.88286    95.85996    58.64062
[13]    78.07577    91.54339    98.70555    94.93349    68.49764   106.99635
[19]    75.01559    51.92938
> colSd(tmp5)
 [1] 126.142980   9.158650         NA   8.258649   7.838763  10.961382
 [7]   8.331558   6.159473   9.111431   6.235613   9.790810   7.657716
[13]   8.836049   9.567831   9.935067   9.743382   8.276330  10.343904
[19]   8.661154   7.206204
> colMax(tmp5)
 [1] 469.38893  82.68801        NA  81.74165  77.82030  89.96725  86.23847
 [8]  74.48301  83.36630  77.76764  88.51181  85.58353  82.11095  84.79949
[15]  86.60382  85.02522  85.25760  88.48742  84.42988  81.46743
> colMin(tmp5)
 [1] 64.15450 55.98993       NA 58.40573 56.01169 55.94062 62.54449 58.75797
 [9] 56.53265 55.76673 56.78988 63.31762 53.92803 55.35690 60.41616 52.76030
[17] 60.14803 58.16867 60.60860 60.55735
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.3889
> Min(tmp5,na.rm=TRUE)
[1] 52.7603
> mean(tmp5,na.rm=TRUE)
[1] 72.29898
> Sum(tmp5,na.rm=TRUE)
[1] 14387.5
> Var(tmp5,na.rm=TRUE)
[1] 870.6606
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.89044 69.38888 69.96788 71.55318 69.41589 68.77576 73.44891 68.08200
 [9] 67.60273 73.62931
> rowSums(tmp5,na.rm=TRUE)
 [1] 1817.809 1387.778 1399.358 1431.064 1388.318 1375.515 1468.978 1361.640
 [9] 1284.452 1472.586
> rowVars(tmp5,na.rm=TRUE)
 [1] 8002.22697   61.14877   74.80901   60.17360   86.07922   67.62531
 [7]   61.59448   69.31507   90.69827   59.40463
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.455167  7.819768  8.649220  7.757164  9.277889  8.223461  7.848215
 [8]  8.325568  9.523564  7.707440
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.38893  85.25760  86.23847  84.48052  89.81589  86.60382  84.79949
 [8]  85.02522  88.48742  88.51181
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.66136 57.84884 56.53265 55.35690 52.76030 58.21392 59.49819 55.94062
 [9] 53.92803 60.60860
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.61001  67.77073  69.37081  68.65453  67.24951  72.06714  74.58763
 [8]  67.70344  71.62026  68.21568  71.15598  71.08537  67.89337  72.29327
[15]  71.31063  72.94705  68.48561  69.87194  72.04430  70.74952
> colSums(tmp5,na.rm=TRUE)
 [1] 1106.1001  677.7073  624.3373  686.5453  672.4951  720.6714  745.8763
 [8]  677.0344  716.2026  682.1568  711.5598  710.8537  678.9337  722.9327
[15]  713.1063  729.4705  684.8561  698.7194  720.4430  707.4952
> colVars(tmp5,na.rm=TRUE)
 [1] 15912.05137    83.88086    60.80861    68.20528    61.44620   120.15189
 [7]    69.41486    37.93911    83.01817    38.88286    95.85996    58.64062
[13]    78.07577    91.54339    98.70555    94.93349    68.49764   106.99635
[19]    75.01559    51.92938
> colSd(tmp5,na.rm=TRUE)
 [1] 126.142980   9.158650   7.797988   8.258649   7.838763  10.961382
 [7]   8.331558   6.159473   9.111431   6.235613   9.790810   7.657716
[13]   8.836049   9.567831   9.935067   9.743382   8.276330  10.343904
[19]   8.661154   7.206204
> colMax(tmp5,na.rm=TRUE)
 [1] 469.38893  82.68801  84.04702  81.74165  77.82030  89.96725  86.23847
 [8]  74.48301  83.36630  77.76764  88.51181  85.58353  82.11095  84.79949
[15]  86.60382  85.02522  85.25760  88.48742  84.42988  81.46743
> colMin(tmp5,na.rm=TRUE)
 [1] 64.15450 55.98993 60.10673 58.40573 56.01169 55.94062 62.54449 58.75797
 [9] 56.53265 55.76673 56.78988 63.31762 53.92803 55.35690 60.41616 52.76030
[17] 60.14803 58.16867 60.60860 60.55735
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.89044 69.38888 69.96788 71.55318 69.41589 68.77576 73.44891 68.08200
 [9]      NaN 73.62931
> rowSums(tmp5,na.rm=TRUE)
 [1] 1817.809 1387.778 1399.358 1431.064 1388.318 1375.515 1468.978 1361.640
 [9]    0.000 1472.586
> rowVars(tmp5,na.rm=TRUE)
 [1] 8002.22697   61.14877   74.80901   60.17360   86.07922   67.62531
 [7]   61.59448   69.31507         NA   59.40463
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.455167  7.819768  8.649220  7.757164  9.277889  8.223461  7.848215
 [8]  8.325568        NA  7.707440
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.38893  85.25760  86.23847  84.48052  89.81589  86.60382  84.79949
 [8]  85.02522        NA  88.51181
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.66136 57.84884 56.53265 55.35690 52.76030 58.21392 59.49819 55.94062
 [9]       NA 60.60860
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.39225  69.00169       NaN  69.76765  68.49816  71.98654  75.66591
 [8]  68.11259  71.21008  68.38327  70.39378  71.43725  69.44507  72.14473
[15]  72.44676  74.34697  69.41201  67.80356  72.51618  69.55864
> colSums(tmp5,na.rm=TRUE)
 [1] 1029.5302  621.0152    0.0000  627.9089  616.4834  647.8789  680.9932
 [8]  613.0133  640.8907  615.4494  633.5440  642.9352  625.0057  649.3026
[15]  652.0209  669.1227  624.7081  610.2320  652.6456  626.0277
> colVars(tmp5,na.rm=TRUE)
 [1] 17740.12246    77.31913          NA    62.79162    51.58688   135.09780
 [7]    65.01147    40.79821    91.50266    43.42723   101.30672    64.57772
[13]    60.74764   102.73808    96.52233    84.75285    67.40495    72.24088
[19]    81.88756    42.46587
> colSd(tmp5,na.rm=TRUE)
 [1] 133.192051   8.793129         NA   7.924116   7.182400  11.623158
 [7]   8.062969   6.387348   9.565702   6.589934  10.065124   8.036026
[13]   7.794077  10.135980   9.824578   9.206131   8.210052   8.499463
[19]   9.049175   6.516584
> colMax(tmp5,na.rm=TRUE)
 [1] 469.38893  82.68801      -Inf  81.74165  77.82030  89.96725  86.23847
 [8]  74.48301  83.36630  77.76764  88.51181  85.58353  82.11095  84.79949
[15]  86.60382  85.02522  85.25760  86.77887  84.42988  80.80028
> colMin(tmp5,na.rm=TRUE)
 [1] 64.15450 55.98993      Inf 58.40573 57.66136 55.94062 62.54449 58.75797
 [9] 56.53265 55.76673 56.78988 63.31762 57.84884 55.35690 60.41616 52.76030
[17] 61.28743 58.16867 60.60860 60.55735
> 
> 
> 
> 
> 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] 359.6394 324.8175 250.6337 251.1963 370.9287 144.4447 346.1090 237.1139
 [9] 241.7855 495.8962
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 359.6394 324.8175 250.6337 251.1963 370.9287 144.4447 346.1090 237.1139
 [9] 241.7855 495.8962
> 
> 
> 
> 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]  8.526513e-14 -1.421085e-14  5.684342e-14  0.000000e+00  1.421085e-14
 [6]  2.842171e-14  7.105427e-14 -2.842171e-14 -1.136868e-13  5.684342e-14
[11] -1.705303e-13 -5.684342e-14  3.552714e-14  1.705303e-13  1.705303e-13
[16]  5.684342e-14  0.000000e+00 -5.684342e-14  5.684342e-14 -1.136868e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
9   14 
7   9 
1   9 
9   7 
7   12 
2   7 
3   14 
3   5 
7   2 
9   3 
4   2 
6   19 
4   4 
5   16 
7   8 
10   18 
9   15 
6   15 
6   14 
10   17 
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] 1.956451
> Min(tmp)
[1] -2.462793
> mean(tmp)
[1] 0.03057252
> Sum(tmp)
[1] 3.057252
> Var(tmp)
[1] 0.9554403
> 
> rowMeans(tmp)
[1] 0.03057252
> rowSums(tmp)
[1] 3.057252
> rowVars(tmp)
[1] 0.9554403
> rowSd(tmp)
[1] 0.9774663
> rowMax(tmp)
[1] 1.956451
> rowMin(tmp)
[1] -2.462793
> 
> colMeans(tmp)
  [1]  0.09672077 -1.49281514 -0.80734169 -1.29490980 -1.61334335  0.61671289
  [7] -0.14002501 -0.31444453  0.89136798  1.14310829 -1.65553169  0.55296236
 [13]  1.24075942  1.95645091 -0.02470280 -0.31341325  0.90577701 -1.58761794
 [19] -1.50455827 -0.72026325  0.37661952  0.75732393  0.12057789  1.77896427
 [25]  0.24682917  1.31468930 -0.98451414  0.24256333  0.59719657  0.43623044
 [31]  0.60065192  0.28142414 -1.19107764 -0.67022725 -0.12495858  0.84064362
 [37]  0.78171700 -0.51347015  0.99990983  0.49133323  1.79210204 -1.72054782
 [43] -1.07850348  0.73389000  0.67149764 -0.87377146 -1.55345794  0.14109628
 [49]  1.02334317  0.09995410  1.27613889 -0.12063251 -0.33296962 -1.13669521
 [55] -0.12026325  1.33854279  0.18545645 -1.04583575 -0.11204903  0.13565989
 [61]  0.22130274 -1.65745171  0.14291786  0.96725220 -1.14654752  0.89110115
 [67] -0.58854075  0.62678402  1.38605889  1.07840608  0.37110119  0.20947740
 [73] -1.61229024 -0.76044079  0.47126500 -0.34634587 -1.59880951  1.36628879
 [79] -0.87523018  1.29128655 -1.11861178 -0.37262056  0.67583678 -0.13579712
 [85]  0.07062978  0.02972125  0.86033336 -2.46279312  0.22896512 -1.25687483
 [91]  1.17424756 -0.75435615  0.32293527  0.15833185  0.71171758  1.86823560
 [97]  0.75828444  0.71876707 -1.09062004  0.61306062
> colSums(tmp)
  [1]  0.09672077 -1.49281514 -0.80734169 -1.29490980 -1.61334335  0.61671289
  [7] -0.14002501 -0.31444453  0.89136798  1.14310829 -1.65553169  0.55296236
 [13]  1.24075942  1.95645091 -0.02470280 -0.31341325  0.90577701 -1.58761794
 [19] -1.50455827 -0.72026325  0.37661952  0.75732393  0.12057789  1.77896427
 [25]  0.24682917  1.31468930 -0.98451414  0.24256333  0.59719657  0.43623044
 [31]  0.60065192  0.28142414 -1.19107764 -0.67022725 -0.12495858  0.84064362
 [37]  0.78171700 -0.51347015  0.99990983  0.49133323  1.79210204 -1.72054782
 [43] -1.07850348  0.73389000  0.67149764 -0.87377146 -1.55345794  0.14109628
 [49]  1.02334317  0.09995410  1.27613889 -0.12063251 -0.33296962 -1.13669521
 [55] -0.12026325  1.33854279  0.18545645 -1.04583575 -0.11204903  0.13565989
 [61]  0.22130274 -1.65745171  0.14291786  0.96725220 -1.14654752  0.89110115
 [67] -0.58854075  0.62678402  1.38605889  1.07840608  0.37110119  0.20947740
 [73] -1.61229024 -0.76044079  0.47126500 -0.34634587 -1.59880951  1.36628879
 [79] -0.87523018  1.29128655 -1.11861178 -0.37262056  0.67583678 -0.13579712
 [85]  0.07062978  0.02972125  0.86033336 -2.46279312  0.22896512 -1.25687483
 [91]  1.17424756 -0.75435615  0.32293527  0.15833185  0.71171758  1.86823560
 [97]  0.75828444  0.71876707 -1.09062004  0.61306062
> 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.09672077 -1.49281514 -0.80734169 -1.29490980 -1.61334335  0.61671289
  [7] -0.14002501 -0.31444453  0.89136798  1.14310829 -1.65553169  0.55296236
 [13]  1.24075942  1.95645091 -0.02470280 -0.31341325  0.90577701 -1.58761794
 [19] -1.50455827 -0.72026325  0.37661952  0.75732393  0.12057789  1.77896427
 [25]  0.24682917  1.31468930 -0.98451414  0.24256333  0.59719657  0.43623044
 [31]  0.60065192  0.28142414 -1.19107764 -0.67022725 -0.12495858  0.84064362
 [37]  0.78171700 -0.51347015  0.99990983  0.49133323  1.79210204 -1.72054782
 [43] -1.07850348  0.73389000  0.67149764 -0.87377146 -1.55345794  0.14109628
 [49]  1.02334317  0.09995410  1.27613889 -0.12063251 -0.33296962 -1.13669521
 [55] -0.12026325  1.33854279  0.18545645 -1.04583575 -0.11204903  0.13565989
 [61]  0.22130274 -1.65745171  0.14291786  0.96725220 -1.14654752  0.89110115
 [67] -0.58854075  0.62678402  1.38605889  1.07840608  0.37110119  0.20947740
 [73] -1.61229024 -0.76044079  0.47126500 -0.34634587 -1.59880951  1.36628879
 [79] -0.87523018  1.29128655 -1.11861178 -0.37262056  0.67583678 -0.13579712
 [85]  0.07062978  0.02972125  0.86033336 -2.46279312  0.22896512 -1.25687483
 [91]  1.17424756 -0.75435615  0.32293527  0.15833185  0.71171758  1.86823560
 [97]  0.75828444  0.71876707 -1.09062004  0.61306062
> colMin(tmp)
  [1]  0.09672077 -1.49281514 -0.80734169 -1.29490980 -1.61334335  0.61671289
  [7] -0.14002501 -0.31444453  0.89136798  1.14310829 -1.65553169  0.55296236
 [13]  1.24075942  1.95645091 -0.02470280 -0.31341325  0.90577701 -1.58761794
 [19] -1.50455827 -0.72026325  0.37661952  0.75732393  0.12057789  1.77896427
 [25]  0.24682917  1.31468930 -0.98451414  0.24256333  0.59719657  0.43623044
 [31]  0.60065192  0.28142414 -1.19107764 -0.67022725 -0.12495858  0.84064362
 [37]  0.78171700 -0.51347015  0.99990983  0.49133323  1.79210204 -1.72054782
 [43] -1.07850348  0.73389000  0.67149764 -0.87377146 -1.55345794  0.14109628
 [49]  1.02334317  0.09995410  1.27613889 -0.12063251 -0.33296962 -1.13669521
 [55] -0.12026325  1.33854279  0.18545645 -1.04583575 -0.11204903  0.13565989
 [61]  0.22130274 -1.65745171  0.14291786  0.96725220 -1.14654752  0.89110115
 [67] -0.58854075  0.62678402  1.38605889  1.07840608  0.37110119  0.20947740
 [73] -1.61229024 -0.76044079  0.47126500 -0.34634587 -1.59880951  1.36628879
 [79] -0.87523018  1.29128655 -1.11861178 -0.37262056  0.67583678 -0.13579712
 [85]  0.07062978  0.02972125  0.86033336 -2.46279312  0.22896512 -1.25687483
 [91]  1.17424756 -0.75435615  0.32293527  0.15833185  0.71171758  1.86823560
 [97]  0.75828444  0.71876707 -1.09062004  0.61306062
> colMedians(tmp)
  [1]  0.09672077 -1.49281514 -0.80734169 -1.29490980 -1.61334335  0.61671289
  [7] -0.14002501 -0.31444453  0.89136798  1.14310829 -1.65553169  0.55296236
 [13]  1.24075942  1.95645091 -0.02470280 -0.31341325  0.90577701 -1.58761794
 [19] -1.50455827 -0.72026325  0.37661952  0.75732393  0.12057789  1.77896427
 [25]  0.24682917  1.31468930 -0.98451414  0.24256333  0.59719657  0.43623044
 [31]  0.60065192  0.28142414 -1.19107764 -0.67022725 -0.12495858  0.84064362
 [37]  0.78171700 -0.51347015  0.99990983  0.49133323  1.79210204 -1.72054782
 [43] -1.07850348  0.73389000  0.67149764 -0.87377146 -1.55345794  0.14109628
 [49]  1.02334317  0.09995410  1.27613889 -0.12063251 -0.33296962 -1.13669521
 [55] -0.12026325  1.33854279  0.18545645 -1.04583575 -0.11204903  0.13565989
 [61]  0.22130274 -1.65745171  0.14291786  0.96725220 -1.14654752  0.89110115
 [67] -0.58854075  0.62678402  1.38605889  1.07840608  0.37110119  0.20947740
 [73] -1.61229024 -0.76044079  0.47126500 -0.34634587 -1.59880951  1.36628879
 [79] -0.87523018  1.29128655 -1.11861178 -0.37262056  0.67583678 -0.13579712
 [85]  0.07062978  0.02972125  0.86033336 -2.46279312  0.22896512 -1.25687483
 [91]  1.17424756 -0.75435615  0.32293527  0.15833185  0.71171758  1.86823560
 [97]  0.75828444  0.71876707 -1.09062004  0.61306062
> colRanges(tmp)
           [,1]      [,2]       [,3]     [,4]      [,5]      [,6]      [,7]
[1,] 0.09672077 -1.492815 -0.8073417 -1.29491 -1.613343 0.6167129 -0.140025
[2,] 0.09672077 -1.492815 -0.8073417 -1.29491 -1.613343 0.6167129 -0.140025
           [,8]     [,9]    [,10]     [,11]     [,12]    [,13]    [,14]
[1,] -0.3144445 0.891368 1.143108 -1.655532 0.5529624 1.240759 1.956451
[2,] -0.3144445 0.891368 1.143108 -1.655532 0.5529624 1.240759 1.956451
          [,15]      [,16]    [,17]     [,18]     [,19]      [,20]     [,21]
[1,] -0.0247028 -0.3134133 0.905777 -1.587618 -1.504558 -0.7202632 0.3766195
[2,] -0.0247028 -0.3134133 0.905777 -1.587618 -1.504558 -0.7202632 0.3766195
         [,22]     [,23]    [,24]     [,25]    [,26]      [,27]     [,28]
[1,] 0.7573239 0.1205779 1.778964 0.2468292 1.314689 -0.9845141 0.2425633
[2,] 0.7573239 0.1205779 1.778964 0.2468292 1.314689 -0.9845141 0.2425633
         [,29]     [,30]     [,31]     [,32]     [,33]      [,34]      [,35]
[1,] 0.5971966 0.4362304 0.6006519 0.2814241 -1.191078 -0.6702272 -0.1249586
[2,] 0.5971966 0.4362304 0.6006519 0.2814241 -1.191078 -0.6702272 -0.1249586
         [,36]    [,37]      [,38]     [,39]     [,40]    [,41]     [,42]
[1,] 0.8406436 0.781717 -0.5134702 0.9999098 0.4913332 1.792102 -1.720548
[2,] 0.8406436 0.781717 -0.5134702 0.9999098 0.4913332 1.792102 -1.720548
         [,43]   [,44]     [,45]      [,46]     [,47]     [,48]    [,49]
[1,] -1.078503 0.73389 0.6714976 -0.8737715 -1.553458 0.1410963 1.023343
[2,] -1.078503 0.73389 0.6714976 -0.8737715 -1.553458 0.1410963 1.023343
         [,50]    [,51]      [,52]      [,53]     [,54]      [,55]    [,56]
[1,] 0.0999541 1.276139 -0.1206325 -0.3329696 -1.136695 -0.1202632 1.338543
[2,] 0.0999541 1.276139 -0.1206325 -0.3329696 -1.136695 -0.1202632 1.338543
         [,57]     [,58]     [,59]     [,60]     [,61]     [,62]     [,63]
[1,] 0.1854564 -1.045836 -0.112049 0.1356599 0.2213027 -1.657452 0.1429179
[2,] 0.1854564 -1.045836 -0.112049 0.1356599 0.2213027 -1.657452 0.1429179
         [,64]     [,65]     [,66]      [,67]    [,68]    [,69]    [,70]
[1,] 0.9672522 -1.146548 0.8911012 -0.5885407 0.626784 1.386059 1.078406
[2,] 0.9672522 -1.146548 0.8911012 -0.5885407 0.626784 1.386059 1.078406
         [,71]     [,72]    [,73]      [,74]    [,75]      [,76]    [,77]
[1,] 0.3711012 0.2094774 -1.61229 -0.7604408 0.471265 -0.3463459 -1.59881
[2,] 0.3711012 0.2094774 -1.61229 -0.7604408 0.471265 -0.3463459 -1.59881
        [,78]      [,79]    [,80]     [,81]      [,82]     [,83]      [,84]
[1,] 1.366289 -0.8752302 1.291287 -1.118612 -0.3726206 0.6758368 -0.1357971
[2,] 1.366289 -0.8752302 1.291287 -1.118612 -0.3726206 0.6758368 -0.1357971
          [,85]      [,86]     [,87]     [,88]     [,89]     [,90]    [,91]
[1,] 0.07062978 0.02972125 0.8603334 -2.462793 0.2289651 -1.256875 1.174248
[2,] 0.07062978 0.02972125 0.8603334 -2.462793 0.2289651 -1.256875 1.174248
          [,92]     [,93]     [,94]     [,95]    [,96]     [,97]     [,98]
[1,] -0.7543561 0.3229353 0.1583318 0.7117176 1.868236 0.7582844 0.7187671
[2,] -0.7543561 0.3229353 0.1583318 0.7117176 1.868236 0.7582844 0.7187671
        [,99]    [,100]
[1,] -1.09062 0.6130606
[2,] -1.09062 0.6130606
> 
> 
> Max(tmp2)
[1] 2.685496
> Min(tmp2)
[1] -2.445369
> mean(tmp2)
[1] 0.1074398
> Sum(tmp2)
[1] 10.74398
> Var(tmp2)
[1] 0.8741982
> 
> rowMeans(tmp2)
  [1] -2.29772582  0.21448343  0.26178730 -0.97890409  0.99115584 -0.01899818
  [7]  0.10433935  0.58127870 -0.07137334  1.12666504  0.05091171  0.11577746
 [13]  1.66989756  0.20239807  0.45089004 -0.15345394 -0.14809989  1.15262758
 [19] -1.43226274  0.56123595 -0.28017253  1.03986013 -0.38318574  0.52987787
 [25] -0.97646297  0.55877234 -0.18325258  0.21758616 -1.53160302 -0.19780679
 [31]  2.68549552 -0.98287644 -0.74192790  1.88130272  0.40748813  0.03055673
 [37]  1.57553792  0.45328435  0.69663735  0.32981902  0.85766039 -0.28527238
 [43]  1.44849627 -0.20777807  0.41346850 -0.91993635  0.54098140 -1.49092000
 [49]  0.71207360 -0.10147271  0.55576858 -2.44536937 -0.66891819 -0.10605979
 [55] -1.00343669 -0.03899469 -1.27148547 -0.27899769 -0.74214591 -0.82415088
 [61]  1.86044087  1.80936908  0.17288763  2.09928098  0.64971304  2.01899767
 [67]  0.36977096 -1.22201171 -1.86348999 -0.43637153  1.11473730 -0.95902186
 [73]  1.21352016 -1.20630564 -0.42612982  0.27881905 -0.20491567 -0.07135638
 [79]  0.08479656  0.09313049  0.64081047  0.10541664  0.12032610 -0.82253361
 [85]  0.69455869  1.14063817  0.16463992  0.39539451 -0.61755929  0.58640273
 [91] -0.94296510  0.83303285  0.44956713 -0.27444111 -0.26472757  0.22631573
 [97]  0.75942102  0.45643424 -0.34199988  0.40432096
> rowSums(tmp2)
  [1] -2.29772582  0.21448343  0.26178730 -0.97890409  0.99115584 -0.01899818
  [7]  0.10433935  0.58127870 -0.07137334  1.12666504  0.05091171  0.11577746
 [13]  1.66989756  0.20239807  0.45089004 -0.15345394 -0.14809989  1.15262758
 [19] -1.43226274  0.56123595 -0.28017253  1.03986013 -0.38318574  0.52987787
 [25] -0.97646297  0.55877234 -0.18325258  0.21758616 -1.53160302 -0.19780679
 [31]  2.68549552 -0.98287644 -0.74192790  1.88130272  0.40748813  0.03055673
 [37]  1.57553792  0.45328435  0.69663735  0.32981902  0.85766039 -0.28527238
 [43]  1.44849627 -0.20777807  0.41346850 -0.91993635  0.54098140 -1.49092000
 [49]  0.71207360 -0.10147271  0.55576858 -2.44536937 -0.66891819 -0.10605979
 [55] -1.00343669 -0.03899469 -1.27148547 -0.27899769 -0.74214591 -0.82415088
 [61]  1.86044087  1.80936908  0.17288763  2.09928098  0.64971304  2.01899767
 [67]  0.36977096 -1.22201171 -1.86348999 -0.43637153  1.11473730 -0.95902186
 [73]  1.21352016 -1.20630564 -0.42612982  0.27881905 -0.20491567 -0.07135638
 [79]  0.08479656  0.09313049  0.64081047  0.10541664  0.12032610 -0.82253361
 [85]  0.69455869  1.14063817  0.16463992  0.39539451 -0.61755929  0.58640273
 [91] -0.94296510  0.83303285  0.44956713 -0.27444111 -0.26472757  0.22631573
 [97]  0.75942102  0.45643424 -0.34199988  0.40432096
> 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] -2.29772582  0.21448343  0.26178730 -0.97890409  0.99115584 -0.01899818
  [7]  0.10433935  0.58127870 -0.07137334  1.12666504  0.05091171  0.11577746
 [13]  1.66989756  0.20239807  0.45089004 -0.15345394 -0.14809989  1.15262758
 [19] -1.43226274  0.56123595 -0.28017253  1.03986013 -0.38318574  0.52987787
 [25] -0.97646297  0.55877234 -0.18325258  0.21758616 -1.53160302 -0.19780679
 [31]  2.68549552 -0.98287644 -0.74192790  1.88130272  0.40748813  0.03055673
 [37]  1.57553792  0.45328435  0.69663735  0.32981902  0.85766039 -0.28527238
 [43]  1.44849627 -0.20777807  0.41346850 -0.91993635  0.54098140 -1.49092000
 [49]  0.71207360 -0.10147271  0.55576858 -2.44536937 -0.66891819 -0.10605979
 [55] -1.00343669 -0.03899469 -1.27148547 -0.27899769 -0.74214591 -0.82415088
 [61]  1.86044087  1.80936908  0.17288763  2.09928098  0.64971304  2.01899767
 [67]  0.36977096 -1.22201171 -1.86348999 -0.43637153  1.11473730 -0.95902186
 [73]  1.21352016 -1.20630564 -0.42612982  0.27881905 -0.20491567 -0.07135638
 [79]  0.08479656  0.09313049  0.64081047  0.10541664  0.12032610 -0.82253361
 [85]  0.69455869  1.14063817  0.16463992  0.39539451 -0.61755929  0.58640273
 [91] -0.94296510  0.83303285  0.44956713 -0.27444111 -0.26472757  0.22631573
 [97]  0.75942102  0.45643424 -0.34199988  0.40432096
> rowMin(tmp2)
  [1] -2.29772582  0.21448343  0.26178730 -0.97890409  0.99115584 -0.01899818
  [7]  0.10433935  0.58127870 -0.07137334  1.12666504  0.05091171  0.11577746
 [13]  1.66989756  0.20239807  0.45089004 -0.15345394 -0.14809989  1.15262758
 [19] -1.43226274  0.56123595 -0.28017253  1.03986013 -0.38318574  0.52987787
 [25] -0.97646297  0.55877234 -0.18325258  0.21758616 -1.53160302 -0.19780679
 [31]  2.68549552 -0.98287644 -0.74192790  1.88130272  0.40748813  0.03055673
 [37]  1.57553792  0.45328435  0.69663735  0.32981902  0.85766039 -0.28527238
 [43]  1.44849627 -0.20777807  0.41346850 -0.91993635  0.54098140 -1.49092000
 [49]  0.71207360 -0.10147271  0.55576858 -2.44536937 -0.66891819 -0.10605979
 [55] -1.00343669 -0.03899469 -1.27148547 -0.27899769 -0.74214591 -0.82415088
 [61]  1.86044087  1.80936908  0.17288763  2.09928098  0.64971304  2.01899767
 [67]  0.36977096 -1.22201171 -1.86348999 -0.43637153  1.11473730 -0.95902186
 [73]  1.21352016 -1.20630564 -0.42612982  0.27881905 -0.20491567 -0.07135638
 [79]  0.08479656  0.09313049  0.64081047  0.10541664  0.12032610 -0.82253361
 [85]  0.69455869  1.14063817  0.16463992  0.39539451 -0.61755929  0.58640273
 [91] -0.94296510  0.83303285  0.44956713 -0.27444111 -0.26472757  0.22631573
 [97]  0.75942102  0.45643424 -0.34199988  0.40432096
> 
> colMeans(tmp2)
[1] 0.1074398
> colSums(tmp2)
[1] 10.74398
> colVars(tmp2)
[1] 0.8741982
> colSd(tmp2)
[1] 0.9349857
> colMax(tmp2)
[1] 2.685496
> colMin(tmp2)
[1] -2.445369
> colMedians(tmp2)
[1] 0.1180518
> colRanges(tmp2)
          [,1]
[1,] -2.445369
[2,]  2.685496
> 
> 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]  5.80406113 -4.47532396 -1.25269368  0.80185563  2.28787715  6.11378096
 [7] -5.41523203  3.57107639  0.04966145 -0.58669791
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1815958
[2,]  0.1416066
[3,]  0.7803797
[4,]  1.2564714
[5,]  1.9727666
> 
> rowApply(tmp,sum)
 [1] -0.09179899 -4.01335451  2.16849046  1.96379342  0.83341671 -0.39346223
 [7]  0.34939418  0.26135298  3.98621865  1.83431445
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    8    4    8    9    9   10    5    9    7     3
 [2,]    1    3    4    7    8    1    9    1    4     8
 [3,]    7    5   10    1    3    6    4    4    3     5
 [4,]   10    8    6    3   10    4    2    2    6     7
 [5,]    5    2    3    2    7    5    7    7   10    10
 [6,]    6    9    9    6    5    9    8    5    9     2
 [7,]    9    1    1    5    6    3    3    3    5     1
 [8,]    2    7    5   10    4    8    6    6    2     9
 [9,]    3   10    7    8    1    2    1   10    8     6
[10,]    4    6    2    4    2    7   10    8    1     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.4917600  1.2078619 -0.7003772  1.5723925 -2.7294672 -0.6664013
 [7] -0.1176194  0.3007449  0.5895927 -0.3186406 -1.1325630  1.4499639
[13] -2.6599660  3.3256903 -0.6409072 -0.8786358  0.1550480 -0.8235784
[19]  4.0684465 -4.0021597
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.9488418
[2,]  0.5147402
[3,]  0.5754182
[4,]  1.6173935
[5,]  1.7330499
> 
> rowApply(tmp,sum)
[1]  3.263056 -3.050081 -1.740569 -1.391284  3.410063
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   17   16    1   19   18
[2,]    8    6   18   13    9
[3,]   16   17    3   15    5
[4,]   19    8   10   20    4
[5,]   11   10    2    3   13
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]       [,4]       [,5]        [,6]
[1,]  0.5754182  0.04173444  0.5140198  1.1860247  0.2035666  0.05026832
[2,]  0.5147402 -0.57000544  0.6452678 -0.5276462 -0.3947131 -0.80851361
[3,] -1.9488418  1.44276271 -1.6495918 -0.3723303 -1.7563652 -0.43752238
[4,]  1.6173935  0.30916768  0.7570229  2.5989793 -1.3483997  0.11862813
[5,]  1.7330499 -0.01579749 -0.9670959 -1.3126350  0.5664443  0.41073824
             [,7]        [,8]       [,9]      [,10]       [,11]      [,12]
[1,]  0.156027685  0.31540509  0.2348442 -0.5299266  0.24298639  0.5138782
[2,] -0.259735082  0.01406953 -0.6342091  0.4649095  0.04460606  0.8603763
[3,]  0.005280191 -0.45303171  0.1897122 -0.8955086  0.20480405  1.4936012
[4,]  0.047127848 -1.95245764 -0.4047327  0.9795683  0.05574280  0.8769170
[5,] -0.066320084  2.37675959  1.2039781 -0.3376832 -1.68070234 -2.2948087
          [,13]      [,14]      [,15]      [,16]       [,17]      [,18]
[1,] -0.8996143 -0.3205813 -0.1502649  2.4042271 -0.27082798 -0.0241891
[2,] -1.7685591  2.8719370 -1.4273183 -0.4783492  0.05863833  1.0839120
[3,]  0.6795082  1.1652102  0.9541095 -0.9426020  0.38808007 -0.4855519
[4,] -0.4054003 -1.1512936 -0.5474491 -2.7230743 -0.45870091  0.3874578
[5,] -0.2659004  0.7604180  0.5300155  0.8611626  0.43785849 -1.7852073
          [,19]      [,20]
[1,]  0.9488184 -1.9287593
[2,] -0.5404437 -2.1990446
[3,]  2.2675121 -1.5898038
[4,] -1.0766241  0.9288431
[5,]  2.4691839  0.7866048
> 
> 
> 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 :  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.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.7299579 0.3658242 -0.2789747 -0.3081705 -1.092395 -2.641777 0.2565123
          col8      col9     col10     col11     col12      col13     col14
row1 0.2731016 -2.111201 -1.280045 0.1387341 0.4320504 -0.5535289 0.2822348
          col15     col16      col17       col18      col19     col20
row1 -0.4188562 0.2043726 -0.3768025 -0.05568755 -0.2851608 0.9420863
> tmp[,"col10"]
          col10
row1 -1.2800447
row2  0.2067200
row3  0.0851163
row4  1.4582999
row5 -0.9311985
> tmp[c("row1","row5"),]
           col1      col2       col3       col4       col5      col6       col7
row1 -0.7299579 0.3658242 -0.2789747 -0.3081705 -1.0923946 -2.641777 0.25651232
row5 -0.9547894 0.1493403 -2.4056252 -1.5567063 -0.9115856 -1.027616 0.05815897
          col8        col9      col10      col11     col12      col13     col14
row1 0.2731016 -2.11120067 -1.2800447 0.13873412 0.4320504 -0.5535289 0.2822348
row5 0.1394605 -0.03625719 -0.9311985 0.02956137 1.5255927 -1.1676965 0.1000045
          col15      col16      col17       col18      col19     col20
row1 -0.4188562  0.2043726 -0.3768025 -0.05568755 -0.2851608 0.9420863
row5 -0.2683924 -1.6608424  0.8183182  0.64120063  1.3250697 0.6057415
> tmp[,c("col6","col20")]
           col6      col20
row1 -2.6417771  0.9420863
row2  0.3474087  0.1766540
row3 -0.1101456  0.3617805
row4  1.0799641 -0.3391132
row5 -1.0276156  0.6057415
> tmp[c("row1","row5"),c("col6","col20")]
          col6     col20
row1 -2.641777 0.9420863
row5 -1.027616 0.6057415
> 
> 
> 
> 
> 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 51.94793 50.14296 51.42822 50.74854 49.89538 105.3567 50.49909 48.25689
         col9    col10    col11    col12   col13    col14    col15    col16
row1 51.15875 49.36407 50.63396 50.66658 51.4313 49.35605 50.03443 50.42118
       col17    col18    col19    col20
row1 49.4226 50.13953 49.10519 104.7602
> tmp[,"col10"]
        col10
row1 49.36407
row2 29.86770
row3 29.76534
row4 27.91565
row5 49.61567
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.94793 50.14296 51.42822 50.74854 49.89538 105.3567 50.49909 48.25689
row5 50.55095 49.93036 50.02158 48.33338 51.54638 106.8290 48.71040 50.01576
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.15875 49.36407 50.63396 50.66658 51.43130 49.35605 50.03443 50.42118
row5 50.13950 49.61567 49.16378 50.63294 50.87444 52.64693 49.47214 48.40135
        col17    col18    col19    col20
row1 49.42260 50.13953 49.10519 104.7602
row5 51.01458 49.24124 49.35569 104.1723
> tmp[,c("col6","col20")]
          col6     col20
row1 105.35675 104.76020
row2  76.38227  73.73274
row3  74.03227  74.03559
row4  75.23853  75.94056
row5 106.82905 104.17234
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.3567 104.7602
row5 106.8290 104.1723
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.3567 104.7602
row5 106.8290 104.1723
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.4604951
[2,]  0.6507438
[3,]  0.4879294
[4,]  0.1217501
[5,]  0.5195779
> tmp[,c("col17","col7")]
          col17       col7
[1,]  1.2685673 -0.2451353
[2,]  0.4221587  1.1640291
[3,] -0.8778341  0.7263656
[4,]  0.7156538 -1.3816941
[5,] -0.7394544 -1.1201337
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.5737516  1.0367623
[2,] -0.1706549 -1.2622736
[3,]  0.9154256  0.2738147
[4,] -0.1286708  1.2910616
[5,] -0.1852898 -0.7545009
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.5737516
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.5737516
[2,] -0.1706549
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]      [,3]      [,4]      [,5]       [,6]       [,7]
row3  0.1242422 1.0705522 0.3033832 2.5311850  2.288234  0.4888426 -1.6105692
row1 -0.7033648 0.6678833 0.3013866 0.9139087 -1.517514 -0.3022860 -0.3086583
             [,8]       [,9]      [,10]      [,11]       [,12]      [,13]
row3 -0.658302485  0.6874265 -0.2593528 -0.6937124  0.03992787 -0.1743117
row1 -0.009318539 -0.7923447 -0.3342760  0.1110686 -0.23760058  2.1014220
         [,14]      [,15]     [,16]       [,17]      [,18]      [,19]
row3 0.2703414 -0.1114627 0.2378414 -0.05442239 -3.5246292 -0.8058419
row1 0.8419930  1.4106000 0.7364951 -1.13926403 -0.4093548 -1.6140130
          [,20]
row3  0.2720120
row1 -0.3041405
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]      [,2]      [,3]        [,4]      [,5]      [,6]        [,7]
row2 1.619772 0.1462217 0.6889143 -0.09885961 0.3368772 -1.637844 -0.01678956
          [,8]      [,9]     [,10]
row2 0.4248217 0.3241071 0.6161781
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]       [,2]      [,3]       [,4]      [,5]      [,6]      [,7]
row5 -1.28546 -0.0490565 0.1619281 -0.7597975 0.6077137 0.8461641 -1.596328
           [,8]       [,9]    [,10]       [,11]    [,12]      [,13]     [,14]
row5 -0.7504548 -0.3075077 1.093243 -0.09572805 1.768426 -0.1474676 0.3561583
         [,15]     [,16]      [,17]    [,18]     [,19]      [,20]
row5 0.2552035 0.8435312 -0.9463372 1.517584 0.2406781 0.08592998
> 
> 
> 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: 0x561a95d4c710>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd95db6012c"
 [2] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd956a4d35c"
 [3] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd93c9f5360"
 [4] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd93e11ffda"
 [5] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd9552b2b6a"
 [6] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd96258bcc4"
 [7] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd975a294ef"
 [8] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd96e8c8eff"
 [9] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd924811a72"
[10] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd973e73093"
[11] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd93a30a8df"
[12] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd977f02eaa"
[13] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd96e364e3f"
[14] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd95b20145f"
[15] "/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM1cd92aa54a18"
> 
> 
> ### 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: 0x561a956bbbd0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x561a956bbbd0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x561a956bbbd0>
> rowMedians(tmp)
  [1]  0.628798123  0.226203591 -0.265457382  0.027775047  0.037524465
  [6]  0.257646526  0.190996608  0.075738899 -0.346599802 -0.052313700
 [11] -0.035177512  0.382570537  0.343795457 -0.215118188 -0.348825561
 [16]  0.037460050  0.071084391 -0.282057088 -0.097927867  0.064349665
 [21] -0.113428505  0.274946296 -0.063808733 -0.120501713 -0.052808675
 [26]  0.153608849  0.131179067 -0.324386767  0.081544892 -0.390544333
 [31]  0.363063381  0.429250641 -0.061887042 -0.099039280  0.164716953
 [36]  0.407523720  0.170909071  0.050720468  0.453774360  0.028742398
 [41] -0.449234330  0.142416633 -0.359485138 -0.007491006  0.302422211
 [46] -0.349675151 -0.417923673  0.710831943 -0.163175749 -0.121520627
 [51]  0.464791012  0.041028657 -0.096406472 -0.002806320 -0.019466479
 [56]  0.462591138  0.279613659  0.564009607 -0.122260410 -0.239829585
 [61] -0.316001544  0.156833136 -0.784502180  0.259929963 -0.222743483
 [66]  0.108841535 -0.064524218 -0.278218538 -0.203534599  0.510115852
 [71]  0.134396618 -0.072526879 -0.172326458  0.225908110  0.076121584
 [76] -0.186350569  0.173771215 -0.374228434  0.085403266  0.112348764
 [81]  0.223584635 -0.143026211 -0.231370707  0.343484541 -0.051817553
 [86]  0.685071876  0.190007193  0.187441580 -0.272675458  0.349225449
 [91]  0.296165174  0.199330109  0.491465371  0.086967102  0.147950008
 [96] -0.096855552  0.326166443 -0.059728647  0.210990602 -0.676887238
[101]  0.095128701  0.246418942 -0.202917287 -0.449013988  0.692300708
[106]  0.054341505 -0.023457962  0.001945120  0.163476639 -0.581698548
[111] -0.013980975 -0.124075412  0.354135729 -0.365563319  0.168557813
[116]  0.070143713 -0.279862296 -0.252502740  0.182851909  0.183610642
[121]  0.006727515  0.465883136  0.187348382  0.084194599  0.285384095
[126]  0.125565112 -0.109804218 -0.652267166  0.107392208 -0.483429514
[131] -0.417860000  0.088201432 -0.015761262  0.465088599 -0.013323775
[136] -0.361946734 -0.460585152  0.371507341 -0.090111044 -0.771747616
[141] -0.001079074  0.422379442 -0.591589276  0.123265018  0.160989207
[146] -0.058238359 -0.457339666  0.292516764  0.169939855 -0.205906144
[151] -0.158528165  0.155239481 -0.213627055  0.017037345  0.331416413
[156] -0.208041033 -0.489266500 -0.139891077 -0.095522290 -0.151825578
[161]  0.117108660  0.066848407  0.178375013  0.383305799  0.318755478
[166]  0.085794538 -0.077591767 -0.813061924  0.496670296 -0.172878960
[171] -0.086282325 -0.072057588  0.500172050  0.182774349  0.396609996
[176] -0.097556734 -0.376868686 -0.135618932 -0.323646239  0.088236214
[181]  0.016040923 -0.158060247 -0.182938839  0.376446481 -0.205793442
[186] -0.108751211  0.086531904  0.081967891 -0.189311765 -0.607985858
[191]  0.133757927 -0.154638293 -0.215886688 -0.311272058  0.019896057
[196]  0.279684320 -0.001034853 -0.127671777 -0.844065858  0.218741453
[201] -0.062660808 -0.165904928  0.404753532  0.442397215 -0.248968614
[206]  0.003305806  0.208716678  0.104100318  0.061249642  0.450263882
[211]  0.579346695 -0.123246135 -0.174989176  0.152030853 -0.289988830
[216]  0.134931468  0.357084638  0.509003366 -0.107265547 -0.128387384
[221]  0.527165557  0.469466725  0.528699320  0.385298011  0.487845023
[226]  0.122442192  0.313172642  0.003348258 -0.344864652  0.490919012
> 
> proc.time()
   user  system elapsed 
  1.868   0.808   2.699 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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: 0x560240946f00>
> .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: 0x560240946f00>
> .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: 0x560240946f00>
> .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: 0x560240946f00>
> 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: 0x5602429c2250>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5602429c2250>
> .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: 0x5602429c2250>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5602429c2250>
> .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: 0x5602429c2250>
> 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: 0x560242b78260>
> .Call("R_bm_AddColumn",P)
<pointer: 0x560242b78260>
> .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: 0x560242b78260>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x560242b78260>
> .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: 0x560242b78260>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x560242b78260>
> .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: 0x560242b78260>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x560242b78260>
> .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: 0x560242b78260>
> 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: 0x5602412d3e50>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5602412d3e50>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5602412d3e50>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5602412d3e50>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1e923919ec46" "BufferedMatrixFile1e926760e376"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1e923919ec46" "BufferedMatrixFile1e926760e376"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x560242cbb2a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x560242cbb2a0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x560242cbb2a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x560242cbb2a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x560242cbb2a0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x560242cbb2a0>
> .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: 0x560240a62040>
> .Call("R_bm_AddColumn",P)
<pointer: 0x560240a62040>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x560240a62040>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x560240a62040>
> 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: 0x560240a8d8e0>
> .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: 0x560240a8d8e0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.432   0.032   0.464 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 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.388   0.024   0.411 

Example timings