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

CHECK report for BufferedMatrix on merida1

This page was generated on 2021-05-06 12:34:28 -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: /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Versions/Current/Resources/library --no-vignettes --timings BufferedMatrix_1.54.0.tar.gz
StartedAt: 2021-05-05 23:51:37 -0400 (Wed, 05 May 2021)
EndedAt: 2021-05-05 23:52:27 -0400 (Wed, 05 May 2021)
EllapsedTime: 50.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Versions/Current/Resources/library --no-vignettes --timings BufferedMatrix_1.54.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.0.5 (2021-03-31)
* using platform: x86_64-apple-darwin17.0 (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 sizes of PDF files under ‘inst/doc’ ... OK
* 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
  ‘/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ~
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c init_package.c -o init_package.o
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/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-apple-darwin17.0 (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.461   0.125   0.604 

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-apple-darwin17.0 (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] "/Users/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) limit (Mb) max used (Mb)
Ncells 442561 23.7     955595 51.1         NA   617728 33.0
Vcells 799010  6.1    8388608 64.0      65536  1931409 14.8
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed May  5 23:52:01 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:52:01 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: 0x7f851d766320>
> 
> 
> 
> 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:52:04 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:52:06 2021"
> 
> ColMode(tmp2)
<pointer: 0x7f851d766320>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]        [,3]       [,4]
[1,] 101.0482172 -1.2014778  0.75775710  0.4623214
[2,]   0.1792142  0.3007322  1.58700108  0.4056275
[3,]   0.5074770  1.2219443 -0.09038108 -1.0278772
[4,]  -0.7560583  0.5131962  1.67824908 -0.3991714
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/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,] 101.0482172 1.2014778 0.75775710 0.4623214
[2,]   0.1792142 0.3007322 1.58700108 0.4056275
[3,]   0.5074770 1.2219443 0.09038108 1.0278772
[4,]   0.7560583 0.5131962 1.67824908 0.3991714
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/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.0522742 1.0961194 0.8704924 0.6799422
[2,]  0.4233369 0.5483906 1.2597623 0.6368889
[3,]  0.7123742 1.1054159 0.3006345 1.0138428
[4,]  0.8695161 0.7163771 1.2954725 0.6318001
> 
> 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:    /Users/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,] 226.57096 37.16267 34.46268 32.26174
[2,]  29.41258 30.78464 39.18462 31.77452
[3,]  32.63122 37.27610 28.09673 36.16631
[4,]  34.45122 32.67697 39.63297 31.71717
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7f852d506360>
> exp(tmp5)
<pointer: 0x7f852d506360>
> log(tmp5,2)
<pointer: 0x7f852d506360>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.5778
> Min(tmp5)
[1] 54.18713
> mean(tmp5)
[1] 72.76107
> Sum(tmp5)
[1] 14552.21
> Var(tmp5)
[1] 871.1045
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.74140 69.41205 67.99455 68.06274 70.13999 72.21601 72.76051 70.96846
 [9] 73.90416 70.41083
> rowSums(tmp5)
 [1] 1834.828 1388.241 1359.891 1361.255 1402.800 1444.320 1455.210 1419.369
 [9] 1478.083 1408.217
> rowVars(tmp5)
 [1] 8043.61811   90.81345   39.88571   73.84360   36.79405  111.67179
 [7]   42.04257   56.34190   84.88451   87.48883
> rowSd(tmp5)
 [1] 89.686220  9.529609  6.315514  8.593230  6.065810 10.567487  6.484025
 [8]  7.506124  9.213279  9.353547
> rowMax(tmp5)
 [1] 471.57777  86.58175  78.09607  86.72315  82.29112  92.69312  85.31610
 [8]  86.40751  93.14704  89.01543
> rowMin(tmp5)
 [1] 57.92562 55.33430 58.47965 54.83227 61.92306 56.68384 63.17767 57.69650
 [9] 54.31973 54.18713
> 
> colMeans(tmp5)
 [1] 108.77722  70.37248  71.60390  73.70620  70.22041  67.58196  62.91411
 [8]  74.79957  69.20169  76.91000  67.23298  71.03824  72.69378  70.94290
[15]  71.51140  70.64164  70.84815  69.95614  73.61977  70.64884
> colSums(tmp5)
 [1] 1087.7722  703.7248  716.0390  737.0620  702.2041  675.8196  629.1411
 [8]  747.9957  692.0169  769.1000  672.3298  710.3824  726.9378  709.4290
[15]  715.1140  706.4164  708.4815  699.5614  736.1977  706.4884
> colVars(tmp5)
 [1] 16271.00656    53.11488    80.18677    41.96189    49.21058    65.70505
 [7]    37.56583    94.69621   117.56688    71.32464    37.16783    40.74710
[13]    29.77380   140.00966    31.41468    71.25409    88.35659   113.64028
[19]    55.77935    71.71813
> colSd(tmp5)
 [1] 127.557856   7.287996   8.954706   6.477800   7.015025   8.105865
 [7]   6.129097   9.731198  10.842826   8.445392   6.096543   6.383346
[13]   5.456537  11.832568   5.604880   8.441214   9.399818  10.660219
[19]   7.468557   8.468656
> colMax(tmp5)
 [1] 471.57777  85.70534  82.49084  83.10490  83.87485  80.85144  72.94647
 [8]  92.69312  86.72315  91.54782  76.41624  81.53959  78.86465  93.14704
[15]  80.76686  84.04992  89.01543  86.40751  85.31610  87.62520
> colMin(tmp5)
 [1] 61.21844 64.07419 56.68384 66.01514 60.73139 57.73677 54.18713 55.84798
 [9] 54.31973 65.34346 59.12656 62.29126 62.33724 55.33430 63.24719 60.54133
[17] 58.52892 54.83227 62.16301 59.83156
> 
> 
> ### 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.74140 69.41205 67.99455       NA 70.13999 72.21601 72.76051 70.96846
 [9] 73.90416 70.41083
> rowSums(tmp5)
 [1] 1834.828 1388.241 1359.891       NA 1402.800 1444.320 1455.210 1419.369
 [9] 1478.083 1408.217
> rowVars(tmp5)
 [1] 8043.61811   90.81345   39.88571   74.91791   36.79405  111.67179
 [7]   42.04257   56.34190   84.88451   87.48883
> rowSd(tmp5)
 [1] 89.686220  9.529609  6.315514  8.655513  6.065810 10.567487  6.484025
 [8]  7.506124  9.213279  9.353547
> rowMax(tmp5)
 [1] 471.57777  86.58175  78.09607        NA  82.29112  92.69312  85.31610
 [8]  86.40751  93.14704  89.01543
> rowMin(tmp5)
 [1] 57.92562 55.33430 58.47965       NA 61.92306 56.68384 63.17767 57.69650
 [9] 54.31973 54.18713
> 
> colMeans(tmp5)
 [1] 108.77722  70.37248  71.60390  73.70620  70.22041  67.58196  62.91411
 [8]  74.79957  69.20169  76.91000  67.23298  71.03824  72.69378  70.94290
[15]  71.51140  70.64164  70.84815  69.95614        NA  70.64884
> colSums(tmp5)
 [1] 1087.7722  703.7248  716.0390  737.0620  702.2041  675.8196  629.1411
 [8]  747.9957  692.0169  769.1000  672.3298  710.3824  726.9378  709.4290
[15]  715.1140  706.4164  708.4815  699.5614        NA  706.4884
> colVars(tmp5)
 [1] 16271.00656    53.11488    80.18677    41.96189    49.21058    65.70505
 [7]    37.56583    94.69621   117.56688    71.32464    37.16783    40.74710
[13]    29.77380   140.00966    31.41468    71.25409    88.35659   113.64028
[19]          NA    71.71813
> colSd(tmp5)
 [1] 127.557856   7.287996   8.954706   6.477800   7.015025   8.105865
 [7]   6.129097   9.731198  10.842826   8.445392   6.096543   6.383346
[13]   5.456537  11.832568   5.604880   8.441214   9.399818  10.660219
[19]         NA   8.468656
> colMax(tmp5)
 [1] 471.57777  85.70534  82.49084  83.10490  83.87485  80.85144  72.94647
 [8]  92.69312  86.72315  91.54782  76.41624  81.53959  78.86465  93.14704
[15]  80.76686  84.04992  89.01543  86.40751        NA  87.62520
> colMin(tmp5)
 [1] 61.21844 64.07419 56.68384 66.01514 60.73139 57.73677 54.18713 55.84798
 [9] 54.31973 65.34346 59.12656 62.29126 62.33724 55.33430 63.24719 60.54133
[17] 58.52892 54.83227       NA 59.83156
> 
> Max(tmp5,na.rm=TRUE)
[1] 471.5778
> Min(tmp5,na.rm=TRUE)
[1] 54.18713
> mean(tmp5,na.rm=TRUE)
[1] 72.74852
> Sum(tmp5,na.rm=TRUE)
[1] 14476.96
> Var(tmp5,na.rm=TRUE)
[1] 875.4723
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.74140 69.41205 67.99455 67.68401 70.13999 72.21601 72.76051 70.96846
 [9] 73.90416 70.41083
> rowSums(tmp5,na.rm=TRUE)
 [1] 1834.828 1388.241 1359.891 1285.996 1402.800 1444.320 1455.210 1419.369
 [9] 1478.083 1408.217
> rowVars(tmp5,na.rm=TRUE)
 [1] 8043.61811   90.81345   39.88571   74.91791   36.79405  111.67179
 [7]   42.04257   56.34190   84.88451   87.48883
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.686220  9.529609  6.315514  8.655513  6.065810 10.567487  6.484025
 [8]  7.506124  9.213279  9.353547
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.57777  86.58175  78.09607  86.72315  82.29112  92.69312  85.31610
 [8]  86.40751  93.14704  89.01543
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.92562 55.33430 58.47965 54.83227 61.92306 56.68384 63.17767 57.69650
 [9] 54.31973 54.18713
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 108.77722  70.37248  71.60390  73.70620  70.22041  67.58196  62.91411
 [8]  74.79957  69.20169  76.91000  67.23298  71.03824  72.69378  70.94290
[15]  71.51140  70.64164  70.84815  69.95614  73.43768  70.64884
> colSums(tmp5,na.rm=TRUE)
 [1] 1087.7722  703.7248  716.0390  737.0620  702.2041  675.8196  629.1411
 [8]  747.9957  692.0169  769.1000  672.3298  710.3824  726.9378  709.4290
[15]  715.1140  706.4164  708.4815  699.5614  660.9391  706.4884
> colVars(tmp5,na.rm=TRUE)
 [1] 16271.00656    53.11488    80.18677    41.96189    49.21058    65.70505
 [7]    37.56583    94.69621   117.56688    71.32464    37.16783    40.74710
[13]    29.77380   140.00966    31.41468    71.25409    88.35659   113.64028
[19]    62.37874    71.71813
> colSd(tmp5,na.rm=TRUE)
 [1] 127.557856   7.287996   8.954706   6.477800   7.015025   8.105865
 [7]   6.129097   9.731198  10.842826   8.445392   6.096543   6.383346
[13]   5.456537  11.832568   5.604880   8.441214   9.399818  10.660219
[19]   7.898021   8.468656
> colMax(tmp5,na.rm=TRUE)
 [1] 471.57777  85.70534  82.49084  83.10490  83.87485  80.85144  72.94647
 [8]  92.69312  86.72315  91.54782  76.41624  81.53959  78.86465  93.14704
[15]  80.76686  84.04992  89.01543  86.40751  85.31610  87.62520
> colMin(tmp5,na.rm=TRUE)
 [1] 61.21844 64.07419 56.68384 66.01514 60.73139 57.73677 54.18713 55.84798
 [9] 54.31973 65.34346 59.12656 62.29126 62.33724 55.33430 63.24719 60.54133
[17] 58.52892 54.83227 62.16301 59.83156
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.74140 69.41205 67.99455      NaN 70.13999 72.21601 72.76051 70.96846
 [9] 73.90416 70.41083
> rowSums(tmp5,na.rm=TRUE)
 [1] 1834.828 1388.241 1359.891    0.000 1402.800 1444.320 1455.210 1419.369
 [9] 1478.083 1408.217
> rowVars(tmp5,na.rm=TRUE)
 [1] 8043.61811   90.81345   39.88571         NA   36.79405  111.67179
 [7]   42.04257   56.34190   84.88451   87.48883
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.686220  9.529609  6.315514        NA  6.065810 10.567487  6.484025
 [8]  7.506124  9.213279  9.353547
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.57777  86.58175  78.09607        NA  82.29112  92.69312  85.31610
 [8]  86.40751  93.14704  89.01543
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.92562 55.33430 58.47965       NA 61.92306 56.68384 63.17767 57.69650
 [9] 54.31973 54.18713
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.89628  70.63466  70.39424  74.56076  70.11912  68.67587  63.33207
 [8]  76.90530  67.25486  78.19517  67.47076  71.37155  72.00813  71.84691
[15]  72.16181  70.05889  71.15470  71.63657       NaN  71.54678
> colSums(tmp5,na.rm=TRUE)
 [1] 1016.0665  635.7119  633.5482  671.0469  631.0721  618.0828  569.9886
 [8]  692.1477  605.2937  703.7565  607.2368  642.3439  648.0732  646.6222
[15]  649.4563  630.5300  640.3923  644.7291    0.0000  643.9211
> colVars(tmp5,na.rm=TRUE)
 [1] 18114.00766    58.98091    73.74825    38.99152    55.24648    60.45599
 [7]    40.29623    56.64951    89.62361    61.65898    41.17778    44.59070
[13]    28.20668   148.31696    30.58235    76.34038    98.34395    96.07707
[19]          NA    71.61196
> colSd(tmp5,na.rm=TRUE)
 [1] 134.588289   7.679903   8.587680   6.244319   7.432797   7.775345
 [7]   6.347931   7.526587   9.466975   7.852323   6.416992   6.677627
[13]   5.310997  12.178545   5.530131   8.737298   9.916852   9.801891
[19]         NA   8.462385
> colMax(tmp5,na.rm=TRUE)
 [1] 471.57777  85.70534  81.55766  83.10490  83.87485  80.85144  72.94647
 [8]  92.69312  81.04797  91.54782  76.41624  81.53959  78.09607  93.14704
[15]  80.76686  84.04992  89.01543  86.40751      -Inf  87.62520
> colMin(tmp5,na.rm=TRUE)
 [1] 61.21844 64.07419 56.68384 66.13449 60.73139 57.92562 54.18713 67.52949
 [9] 54.31973 68.15453 59.12656 62.29126 62.33724 55.33430 63.24719 60.54133
[17] 58.52892 61.41709      Inf 59.83156
> 
> 
> 
> 
> 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] 176.3482 217.5408 218.1118 231.4991 246.5268 104.5713 158.6742 165.0468
 [9] 239.0113 295.6972
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 176.3482 217.5408 218.1118 231.4991 246.5268 104.5713 158.6742 165.0468
 [9] 239.0113 295.6972
> 
> 
> 
> 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  2.273737e-13 -5.684342e-14 -2.842171e-14 -5.684342e-14
 [6]  1.136868e-13 -1.705303e-13 -7.105427e-15  5.684342e-14 -2.842171e-14
[11] -2.842171e-14  5.684342e-14  7.105427e-14  5.684342e-14  2.842171e-14
[16]  2.842171e-14 -1.705303e-13 -5.684342e-14 -1.705303e-13 -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)
+ }
8   12 
3   15 
8   19 
5   20 
9   2 
2   18 
3   8 
4   15 
2   4 
1   6 
2   2 
7   1 
3   18 
3   13 
7   16 
9   16 
4   5 
10   8 
9   4 
6   20 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.598141
> Min(tmp)
[1] -2.431358
> mean(tmp)
[1] -0.1106063
> Sum(tmp)
[1] -11.06063
> Var(tmp)
[1] 0.8683889
> 
> rowMeans(tmp)
[1] -0.1106063
> rowSums(tmp)
[1] -11.06063
> rowVars(tmp)
[1] 0.8683889
> rowSd(tmp)
[1] 0.9318739
> rowMax(tmp)
[1] 2.598141
> rowMin(tmp)
[1] -2.431358
> 
> colMeans(tmp)
  [1]  0.763422302 -0.966070198  1.075760207 -0.120325249 -0.900427065
  [6]  0.627480101 -0.568650320  1.134814825  0.398628405  1.930899211
 [11]  1.619202646  0.456154510  0.708010379 -2.431358460 -0.267283485
 [16] -0.645490278  1.848892748 -0.492894599 -0.328047618  0.330983395
 [21] -1.102554578  0.026717282  0.590667069 -0.818966100  0.895007381
 [26] -1.031686873 -0.268583004 -1.490131712 -0.487339919  2.598141113
 [31]  0.135254358  0.361199236 -1.294772916  0.131586325 -1.515871126
 [36] -0.963002480 -1.379352567 -0.934602469  0.360955953  0.210836907
 [41]  0.702233303 -1.288434016 -0.800469138  0.248504393 -0.722472308
 [46]  0.921298510 -0.904579697 -0.233770614  1.289036774 -0.015344235
 [51] -1.676992904  0.036476856  0.383420008  0.701105670  0.855515435
 [56] -0.128546290 -0.846992108 -1.301485374 -0.588715139 -0.053246995
 [61]  0.252448509 -1.822907345  1.517257365  0.207735793  0.459980189
 [66] -1.364999782  1.030969097 -0.497088219  0.579662236  0.158817602
 [71] -0.098697524 -0.026898050 -0.432093587 -1.212987832 -0.357541283
 [76] -0.739983958  0.338237592 -1.404740220 -0.394515342 -0.880821681
 [81]  1.139606276 -0.007359061 -0.807851311  0.970476268  0.881110618
 [86]  1.454048322 -1.030936531 -0.229794761 -1.087576937 -0.011548380
 [91] -0.284283804 -0.379534780 -0.212338055  1.043148859  0.660121848
 [96] -0.198798355 -0.802203705 -0.363749257  0.002248528 -1.880992457
> colSums(tmp)
  [1]  0.763422302 -0.966070198  1.075760207 -0.120325249 -0.900427065
  [6]  0.627480101 -0.568650320  1.134814825  0.398628405  1.930899211
 [11]  1.619202646  0.456154510  0.708010379 -2.431358460 -0.267283485
 [16] -0.645490278  1.848892748 -0.492894599 -0.328047618  0.330983395
 [21] -1.102554578  0.026717282  0.590667069 -0.818966100  0.895007381
 [26] -1.031686873 -0.268583004 -1.490131712 -0.487339919  2.598141113
 [31]  0.135254358  0.361199236 -1.294772916  0.131586325 -1.515871126
 [36] -0.963002480 -1.379352567 -0.934602469  0.360955953  0.210836907
 [41]  0.702233303 -1.288434016 -0.800469138  0.248504393 -0.722472308
 [46]  0.921298510 -0.904579697 -0.233770614  1.289036774 -0.015344235
 [51] -1.676992904  0.036476856  0.383420008  0.701105670  0.855515435
 [56] -0.128546290 -0.846992108 -1.301485374 -0.588715139 -0.053246995
 [61]  0.252448509 -1.822907345  1.517257365  0.207735793  0.459980189
 [66] -1.364999782  1.030969097 -0.497088219  0.579662236  0.158817602
 [71] -0.098697524 -0.026898050 -0.432093587 -1.212987832 -0.357541283
 [76] -0.739983958  0.338237592 -1.404740220 -0.394515342 -0.880821681
 [81]  1.139606276 -0.007359061 -0.807851311  0.970476268  0.881110618
 [86]  1.454048322 -1.030936531 -0.229794761 -1.087576937 -0.011548380
 [91] -0.284283804 -0.379534780 -0.212338055  1.043148859  0.660121848
 [96] -0.198798355 -0.802203705 -0.363749257  0.002248528 -1.880992457
> 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.763422302 -0.966070198  1.075760207 -0.120325249 -0.900427065
  [6]  0.627480101 -0.568650320  1.134814825  0.398628405  1.930899211
 [11]  1.619202646  0.456154510  0.708010379 -2.431358460 -0.267283485
 [16] -0.645490278  1.848892748 -0.492894599 -0.328047618  0.330983395
 [21] -1.102554578  0.026717282  0.590667069 -0.818966100  0.895007381
 [26] -1.031686873 -0.268583004 -1.490131712 -0.487339919  2.598141113
 [31]  0.135254358  0.361199236 -1.294772916  0.131586325 -1.515871126
 [36] -0.963002480 -1.379352567 -0.934602469  0.360955953  0.210836907
 [41]  0.702233303 -1.288434016 -0.800469138  0.248504393 -0.722472308
 [46]  0.921298510 -0.904579697 -0.233770614  1.289036774 -0.015344235
 [51] -1.676992904  0.036476856  0.383420008  0.701105670  0.855515435
 [56] -0.128546290 -0.846992108 -1.301485374 -0.588715139 -0.053246995
 [61]  0.252448509 -1.822907345  1.517257365  0.207735793  0.459980189
 [66] -1.364999782  1.030969097 -0.497088219  0.579662236  0.158817602
 [71] -0.098697524 -0.026898050 -0.432093587 -1.212987832 -0.357541283
 [76] -0.739983958  0.338237592 -1.404740220 -0.394515342 -0.880821681
 [81]  1.139606276 -0.007359061 -0.807851311  0.970476268  0.881110618
 [86]  1.454048322 -1.030936531 -0.229794761 -1.087576937 -0.011548380
 [91] -0.284283804 -0.379534780 -0.212338055  1.043148859  0.660121848
 [96] -0.198798355 -0.802203705 -0.363749257  0.002248528 -1.880992457
> colMin(tmp)
  [1]  0.763422302 -0.966070198  1.075760207 -0.120325249 -0.900427065
  [6]  0.627480101 -0.568650320  1.134814825  0.398628405  1.930899211
 [11]  1.619202646  0.456154510  0.708010379 -2.431358460 -0.267283485
 [16] -0.645490278  1.848892748 -0.492894599 -0.328047618  0.330983395
 [21] -1.102554578  0.026717282  0.590667069 -0.818966100  0.895007381
 [26] -1.031686873 -0.268583004 -1.490131712 -0.487339919  2.598141113
 [31]  0.135254358  0.361199236 -1.294772916  0.131586325 -1.515871126
 [36] -0.963002480 -1.379352567 -0.934602469  0.360955953  0.210836907
 [41]  0.702233303 -1.288434016 -0.800469138  0.248504393 -0.722472308
 [46]  0.921298510 -0.904579697 -0.233770614  1.289036774 -0.015344235
 [51] -1.676992904  0.036476856  0.383420008  0.701105670  0.855515435
 [56] -0.128546290 -0.846992108 -1.301485374 -0.588715139 -0.053246995
 [61]  0.252448509 -1.822907345  1.517257365  0.207735793  0.459980189
 [66] -1.364999782  1.030969097 -0.497088219  0.579662236  0.158817602
 [71] -0.098697524 -0.026898050 -0.432093587 -1.212987832 -0.357541283
 [76] -0.739983958  0.338237592 -1.404740220 -0.394515342 -0.880821681
 [81]  1.139606276 -0.007359061 -0.807851311  0.970476268  0.881110618
 [86]  1.454048322 -1.030936531 -0.229794761 -1.087576937 -0.011548380
 [91] -0.284283804 -0.379534780 -0.212338055  1.043148859  0.660121848
 [96] -0.198798355 -0.802203705 -0.363749257  0.002248528 -1.880992457
> colMedians(tmp)
  [1]  0.763422302 -0.966070198  1.075760207 -0.120325249 -0.900427065
  [6]  0.627480101 -0.568650320  1.134814825  0.398628405  1.930899211
 [11]  1.619202646  0.456154510  0.708010379 -2.431358460 -0.267283485
 [16] -0.645490278  1.848892748 -0.492894599 -0.328047618  0.330983395
 [21] -1.102554578  0.026717282  0.590667069 -0.818966100  0.895007381
 [26] -1.031686873 -0.268583004 -1.490131712 -0.487339919  2.598141113
 [31]  0.135254358  0.361199236 -1.294772916  0.131586325 -1.515871126
 [36] -0.963002480 -1.379352567 -0.934602469  0.360955953  0.210836907
 [41]  0.702233303 -1.288434016 -0.800469138  0.248504393 -0.722472308
 [46]  0.921298510 -0.904579697 -0.233770614  1.289036774 -0.015344235
 [51] -1.676992904  0.036476856  0.383420008  0.701105670  0.855515435
 [56] -0.128546290 -0.846992108 -1.301485374 -0.588715139 -0.053246995
 [61]  0.252448509 -1.822907345  1.517257365  0.207735793  0.459980189
 [66] -1.364999782  1.030969097 -0.497088219  0.579662236  0.158817602
 [71] -0.098697524 -0.026898050 -0.432093587 -1.212987832 -0.357541283
 [76] -0.739983958  0.338237592 -1.404740220 -0.394515342 -0.880821681
 [81]  1.139606276 -0.007359061 -0.807851311  0.970476268  0.881110618
 [86]  1.454048322 -1.030936531 -0.229794761 -1.087576937 -0.011548380
 [91] -0.284283804 -0.379534780 -0.212338055  1.043148859  0.660121848
 [96] -0.198798355 -0.802203705 -0.363749257  0.002248528 -1.880992457
> colRanges(tmp)
          [,1]       [,2]    [,3]       [,4]       [,5]      [,6]       [,7]
[1,] 0.7634223 -0.9660702 1.07576 -0.1203252 -0.9004271 0.6274801 -0.5686503
[2,] 0.7634223 -0.9660702 1.07576 -0.1203252 -0.9004271 0.6274801 -0.5686503
         [,8]      [,9]    [,10]    [,11]     [,12]     [,13]     [,14]
[1,] 1.134815 0.3986284 1.930899 1.619203 0.4561545 0.7080104 -2.431358
[2,] 1.134815 0.3986284 1.930899 1.619203 0.4561545 0.7080104 -2.431358
          [,15]      [,16]    [,17]      [,18]      [,19]     [,20]     [,21]
[1,] -0.2672835 -0.6454903 1.848893 -0.4928946 -0.3280476 0.3309834 -1.102555
[2,] -0.2672835 -0.6454903 1.848893 -0.4928946 -0.3280476 0.3309834 -1.102555
          [,22]     [,23]      [,24]     [,25]     [,26]     [,27]     [,28]
[1,] 0.02671728 0.5906671 -0.8189661 0.8950074 -1.031687 -0.268583 -1.490132
[2,] 0.02671728 0.5906671 -0.8189661 0.8950074 -1.031687 -0.268583 -1.490132
          [,29]    [,30]     [,31]     [,32]     [,33]     [,34]     [,35]
[1,] -0.4873399 2.598141 0.1352544 0.3611992 -1.294773 0.1315863 -1.515871
[2,] -0.4873399 2.598141 0.1352544 0.3611992 -1.294773 0.1315863 -1.515871
          [,36]     [,37]      [,38]    [,39]     [,40]     [,41]     [,42]
[1,] -0.9630025 -1.379353 -0.9346025 0.360956 0.2108369 0.7022333 -1.288434
[2,] -0.9630025 -1.379353 -0.9346025 0.360956 0.2108369 0.7022333 -1.288434
          [,43]     [,44]      [,45]     [,46]      [,47]      [,48]    [,49]
[1,] -0.8004691 0.2485044 -0.7224723 0.9212985 -0.9045797 -0.2337706 1.289037
[2,] -0.8004691 0.2485044 -0.7224723 0.9212985 -0.9045797 -0.2337706 1.289037
           [,50]     [,51]      [,52]   [,53]     [,54]     [,55]      [,56]
[1,] -0.01534423 -1.676993 0.03647686 0.38342 0.7011057 0.8555154 -0.1285463
[2,] -0.01534423 -1.676993 0.03647686 0.38342 0.7011057 0.8555154 -0.1285463
          [,57]     [,58]      [,59]       [,60]     [,61]     [,62]    [,63]
[1,] -0.8469921 -1.301485 -0.5887151 -0.05324699 0.2524485 -1.822907 1.517257
[2,] -0.8469921 -1.301485 -0.5887151 -0.05324699 0.2524485 -1.822907 1.517257
         [,64]     [,65]  [,66]    [,67]      [,68]     [,69]     [,70]
[1,] 0.2077358 0.4599802 -1.365 1.030969 -0.4970882 0.5796622 0.1588176
[2,] 0.2077358 0.4599802 -1.365 1.030969 -0.4970882 0.5796622 0.1588176
           [,71]       [,72]      [,73]     [,74]      [,75]     [,76]
[1,] -0.09869752 -0.02689805 -0.4320936 -1.212988 -0.3575413 -0.739984
[2,] -0.09869752 -0.02689805 -0.4320936 -1.212988 -0.3575413 -0.739984
         [,77]    [,78]      [,79]      [,80]    [,81]        [,82]      [,83]
[1,] 0.3382376 -1.40474 -0.3945153 -0.8808217 1.139606 -0.007359061 -0.8078513
[2,] 0.3382376 -1.40474 -0.3945153 -0.8808217 1.139606 -0.007359061 -0.8078513
         [,84]     [,85]    [,86]     [,87]      [,88]     [,89]       [,90]
[1,] 0.9704763 0.8811106 1.454048 -1.030937 -0.2297948 -1.087577 -0.01154838
[2,] 0.9704763 0.8811106 1.454048 -1.030937 -0.2297948 -1.087577 -0.01154838
          [,91]      [,92]      [,93]    [,94]     [,95]      [,96]      [,97]
[1,] -0.2842838 -0.3795348 -0.2123381 1.043149 0.6601218 -0.1987984 -0.8022037
[2,] -0.2842838 -0.3795348 -0.2123381 1.043149 0.6601218 -0.1987984 -0.8022037
          [,98]       [,99]    [,100]
[1,] -0.3637493 0.002248528 -1.880992
[2,] -0.3637493 0.002248528 -1.880992
> 
> 
> Max(tmp2)
[1] 2.449373
> Min(tmp2)
[1] -2.611327
> mean(tmp2)
[1] -0.04590038
> Sum(tmp2)
[1] -4.590038
> Var(tmp2)
[1] 1.113507
> 
> rowMeans(tmp2)
  [1]  0.98734212 -0.33556576  0.13997506  1.50345079 -0.60138022 -0.18706744
  [7]  2.44937257 -2.13240723 -1.06583951  0.12587594 -1.37848889  0.68857948
 [13]  0.23477232 -0.23519380  0.23353689  0.39599897 -1.59834507 -0.13844542
 [19]  0.06017419  1.42539823  0.68593863 -1.16059935 -0.40615594 -2.18440559
 [25]  0.50091119  1.45820755 -0.17440224 -0.59457062 -1.15897679  0.49586215
 [31]  1.37664758 -1.55418974 -0.83640319 -0.20847606 -1.19716786 -0.65327338
 [37] -1.78436147  1.68241784 -0.13942552  0.65224517  1.61696117  0.67603924
 [43]  0.34594125 -1.66303947  0.49685619 -0.41660137  2.05012293  0.08801378
 [49] -0.24592838  0.29474860 -2.15165692 -1.46231697  0.48728455  0.46902321
 [55] -0.74333837 -1.20888993 -1.00119210 -0.71567160  0.66973606 -1.19323948
 [61] -0.84952686 -0.60481595 -1.08955715  1.81837107  0.67416107  1.36446285
 [67]  0.53499310  0.20625666 -2.61132719 -0.36723498  2.37656744  0.07973461
 [73]  0.34225696 -0.11267602 -0.04429730  1.80582404  0.08058808  0.23602824
 [79] -0.90003233  0.75798345  1.28792001 -0.01406463 -0.98304109 -0.61822069
 [85] -0.86768700  0.06661726  1.44855480 -0.21539571  0.69306042  1.26634475
 [91]  1.31567518 -0.48832008  0.54865178 -0.78060480 -0.51443296 -0.08800259
 [97]  0.45097254 -1.42164097 -0.84162412 -0.29697738
> rowSums(tmp2)
  [1]  0.98734212 -0.33556576  0.13997506  1.50345079 -0.60138022 -0.18706744
  [7]  2.44937257 -2.13240723 -1.06583951  0.12587594 -1.37848889  0.68857948
 [13]  0.23477232 -0.23519380  0.23353689  0.39599897 -1.59834507 -0.13844542
 [19]  0.06017419  1.42539823  0.68593863 -1.16059935 -0.40615594 -2.18440559
 [25]  0.50091119  1.45820755 -0.17440224 -0.59457062 -1.15897679  0.49586215
 [31]  1.37664758 -1.55418974 -0.83640319 -0.20847606 -1.19716786 -0.65327338
 [37] -1.78436147  1.68241784 -0.13942552  0.65224517  1.61696117  0.67603924
 [43]  0.34594125 -1.66303947  0.49685619 -0.41660137  2.05012293  0.08801378
 [49] -0.24592838  0.29474860 -2.15165692 -1.46231697  0.48728455  0.46902321
 [55] -0.74333837 -1.20888993 -1.00119210 -0.71567160  0.66973606 -1.19323948
 [61] -0.84952686 -0.60481595 -1.08955715  1.81837107  0.67416107  1.36446285
 [67]  0.53499310  0.20625666 -2.61132719 -0.36723498  2.37656744  0.07973461
 [73]  0.34225696 -0.11267602 -0.04429730  1.80582404  0.08058808  0.23602824
 [79] -0.90003233  0.75798345  1.28792001 -0.01406463 -0.98304109 -0.61822069
 [85] -0.86768700  0.06661726  1.44855480 -0.21539571  0.69306042  1.26634475
 [91]  1.31567518 -0.48832008  0.54865178 -0.78060480 -0.51443296 -0.08800259
 [97]  0.45097254 -1.42164097 -0.84162412 -0.29697738
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  0.98734212 -0.33556576  0.13997506  1.50345079 -0.60138022 -0.18706744
  [7]  2.44937257 -2.13240723 -1.06583951  0.12587594 -1.37848889  0.68857948
 [13]  0.23477232 -0.23519380  0.23353689  0.39599897 -1.59834507 -0.13844542
 [19]  0.06017419  1.42539823  0.68593863 -1.16059935 -0.40615594 -2.18440559
 [25]  0.50091119  1.45820755 -0.17440224 -0.59457062 -1.15897679  0.49586215
 [31]  1.37664758 -1.55418974 -0.83640319 -0.20847606 -1.19716786 -0.65327338
 [37] -1.78436147  1.68241784 -0.13942552  0.65224517  1.61696117  0.67603924
 [43]  0.34594125 -1.66303947  0.49685619 -0.41660137  2.05012293  0.08801378
 [49] -0.24592838  0.29474860 -2.15165692 -1.46231697  0.48728455  0.46902321
 [55] -0.74333837 -1.20888993 -1.00119210 -0.71567160  0.66973606 -1.19323948
 [61] -0.84952686 -0.60481595 -1.08955715  1.81837107  0.67416107  1.36446285
 [67]  0.53499310  0.20625666 -2.61132719 -0.36723498  2.37656744  0.07973461
 [73]  0.34225696 -0.11267602 -0.04429730  1.80582404  0.08058808  0.23602824
 [79] -0.90003233  0.75798345  1.28792001 -0.01406463 -0.98304109 -0.61822069
 [85] -0.86768700  0.06661726  1.44855480 -0.21539571  0.69306042  1.26634475
 [91]  1.31567518 -0.48832008  0.54865178 -0.78060480 -0.51443296 -0.08800259
 [97]  0.45097254 -1.42164097 -0.84162412 -0.29697738
> rowMin(tmp2)
  [1]  0.98734212 -0.33556576  0.13997506  1.50345079 -0.60138022 -0.18706744
  [7]  2.44937257 -2.13240723 -1.06583951  0.12587594 -1.37848889  0.68857948
 [13]  0.23477232 -0.23519380  0.23353689  0.39599897 -1.59834507 -0.13844542
 [19]  0.06017419  1.42539823  0.68593863 -1.16059935 -0.40615594 -2.18440559
 [25]  0.50091119  1.45820755 -0.17440224 -0.59457062 -1.15897679  0.49586215
 [31]  1.37664758 -1.55418974 -0.83640319 -0.20847606 -1.19716786 -0.65327338
 [37] -1.78436147  1.68241784 -0.13942552  0.65224517  1.61696117  0.67603924
 [43]  0.34594125 -1.66303947  0.49685619 -0.41660137  2.05012293  0.08801378
 [49] -0.24592838  0.29474860 -2.15165692 -1.46231697  0.48728455  0.46902321
 [55] -0.74333837 -1.20888993 -1.00119210 -0.71567160  0.66973606 -1.19323948
 [61] -0.84952686 -0.60481595 -1.08955715  1.81837107  0.67416107  1.36446285
 [67]  0.53499310  0.20625666 -2.61132719 -0.36723498  2.37656744  0.07973461
 [73]  0.34225696 -0.11267602 -0.04429730  1.80582404  0.08058808  0.23602824
 [79] -0.90003233  0.75798345  1.28792001 -0.01406463 -0.98304109 -0.61822069
 [85] -0.86768700  0.06661726  1.44855480 -0.21539571  0.69306042  1.26634475
 [91]  1.31567518 -0.48832008  0.54865178 -0.78060480 -0.51443296 -0.08800259
 [97]  0.45097254 -1.42164097 -0.84162412 -0.29697738
> 
> colMeans(tmp2)
[1] -0.04590038
> colSums(tmp2)
[1] -4.590038
> colVars(tmp2)
[1] 1.113507
> colSd(tmp2)
[1] 1.055228
> colMax(tmp2)
[1] 2.449373
> colMin(tmp2)
[1] -2.611327
> colMedians(tmp2)
[1] -0.06614995
> colRanges(tmp2)
          [,1]
[1,] -2.611327
[2,]  2.449373
> 
> 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.59568593 -5.71741241  0.09126204 -1.26603524  4.97620483 -1.50555193
 [7]  2.68429383  2.41327946 -1.24065503 -2.98617971
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5728599
[2,] -0.9930266
[3,] -0.1077800
[4,]  0.4315835
[5,]  1.4374564
> 
> rowApply(tmp,sum)
 [1]  3.3057479  5.1718064 -2.7790989 -3.1873518  3.2973323 -5.7003770
 [7]  2.4335007 -2.1862228 -4.8854321  0.3836151
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    2    2    2    7    8    2    2    9   10     1
 [2,]    4    9    3    5    1   10    1    2    1     3
 [3,]    7    6    5    3    9    6    5    4    3     7
 [4,]    5    3   10    9    5    3    4    1    6     4
 [5,]    9    5    8    8   10    9    9    6    7     6
 [6,]    1    1    7    1    6    8    6    5    5     9
 [7,]    6    4    6   10    7    1    8    7    8     8
 [8,]    3   10    4    4    3    7   10    8    9     5
 [9,]    8    7    9    2    2    5    7   10    4     2
[10,]   10    8    1    6    4    4    3    3    2    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.50415432  0.12456281 -2.09543837  1.34605662 -2.69059946  2.16172835
 [7] -0.65513857 -3.14672833  1.94667176  0.04637672 -2.10080485  2.18036788
[13] -1.69423228 -0.17852402 -1.30938278  1.33376351  2.10121610  3.76693367
[19] -0.81527466  1.88750244
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.14570260
[2,]  0.09577296
[3,]  0.60333108
[4,]  0.89071942
[5,]  1.06003346
> 
> rowApply(tmp,sum)
[1]  9.1429139 -3.4736384  1.9365463 -3.2893812  0.3967703
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   10   14   15   14   17
[2,]   17   11   10    6    8
[3,]    9    2    9    4   12
[4,]   16    9   16   15    1
[5,]    5    7    8    3    9
> 
> 
> as.matrix(tmp)
            [,1]       [,2]         [,3]       [,4]        [,5]       [,6]
[1,]  0.09577296  1.6184044  0.039079435  1.5873966 -0.29143006  1.2021351
[2,] -0.14570260 -0.2547559 -0.991418338 -0.3205231 -0.53260578  0.4712019
[3,]  0.60333108  0.2911515  0.176984541  0.6407717  0.07486022 -0.7719195
[4,]  0.89071942 -1.1385252 -1.328409177  0.8962942 -1.83065594 -0.1740195
[5,]  1.06003346 -0.3917121  0.008325166 -1.4578828 -0.11076790  1.4343303
           [,7]        [,8]       [,9]       [,10]      [,11]       [,12]
[1,]  0.8448490 -0.06328849 -0.2244489 -0.37504103 -1.5452638  0.46177536
[2,] -0.9375424 -0.82343996  0.2577951 -0.83829275  0.4154511 -0.21798547
[3,]  0.9336086 -1.49629685 -0.6339572  0.99318875  0.3717463 -0.01143463
[4,] -0.4696122 -1.16269952  1.0962663  0.36590379 -0.3432425  1.26932128
[5,] -1.0264416  0.39899648  1.4510165 -0.09938204 -0.9994960  0.67869134
         [,13]      [,14]       [,15]      [,16]      [,17]         [,18]
[1,]  2.881304  2.0813097 -0.26005249  1.4587842 -2.0574445  2.0340638523
[2,] -0.065546 -0.6667819 -0.50005529  1.0242772 -0.1638570 -0.3112119395
[3,] -1.391582 -0.6903778  0.43762627  0.3965727  2.0351186  0.3748708728
[4,] -1.993250 -1.9827963  0.07658831 -0.9984230  1.5516252  1.6688272775
[5,] -1.125158  1.0801222 -1.06348958 -0.5474476  0.7357738  0.0003836067
          [,19]     [,20]
[1,]  0.6590558 -1.004047
[2,] -1.2467351  2.374090
[3,]  1.3697148 -1.767432
[4,] -0.9555020  1.272208
[5,] -0.6418082  1.012684
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /Users/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:    /Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  650  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  562  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/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 1.599066 -2.186662 -0.06580542 0.1262258 0.6372753 -1.763081 -1.188112
           col8      col9    col10      col11     col12      col13     col14
row1 -0.3353673 0.1262244 1.115746 -0.1597654 0.5562834 -0.9588145 -1.599758
         col15     col16     col17      col18     col19      col20
row1 0.4491821 -1.642785 0.5385808 -0.9021812 0.1895741 0.05826449
> tmp[,"col10"]
          col10
row1  1.1157464
row2 -0.9916652
row3  0.9579188
row4  0.7072856
row5 -1.0918651
> tmp[c("row1","row5"),]
          col1       col2        col3      col4      col5       col6      col7
row1 1.5990661 -2.1866621 -0.06580542 0.1262258 0.6372753 -1.7630810 -1.188112
row5 0.4626485  0.3373631 -1.65701200 0.8196243 0.1502944 -0.6481549 -1.387247
           col8      col9     col10      col11     col12      col13      col14
row1 -0.3353673 0.1262244  1.115746 -0.1597654 0.5562834 -0.9588145 -1.5997579
row5 -0.2589415 1.0988261 -1.091865  0.8673644 0.7057833  0.9565833 -0.0606719
          col15       col16      col17      col18     col19      col20
row1  0.4491821 -1.64278488 0.53858084 -0.9021812 0.1895741 0.05826449
row5 -2.0586121  0.01810964 0.05470109  0.8688801 0.8323151 0.60223896
> tmp[,c("col6","col20")]
            col6       col20
row1 -1.76308096  0.05826449
row2 -0.85352597 -0.22017450
row3  0.35468513  1.34302575
row4 -0.04545769  0.97092391
row5 -0.64815489  0.60223896
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -1.7630810 0.05826449
row5 -0.6481549 0.60223896
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.42062 50.13824 51.17107 50.73534 49.51619 105.7256 49.75013 51.20809
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.52641 50.59449 49.55406 49.58215 51.87564 49.47903 50.06626 50.30449
        col17    col18    col19    col20
row1 48.52188 51.78094 51.02814 104.8558
> tmp[,"col10"]
        col10
row1 50.59449
row2 33.41182
row3 28.26404
row4 30.26634
row5 49.59185
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.42062 50.13824 51.17107 50.73534 49.51619 105.7256 49.75013 51.20809
row5 50.25634 50.19115 51.73770 49.88095 50.19888 104.6794 48.53659 49.54317
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.52641 50.59449 49.55406 49.58215 51.87564 49.47903 50.06626 50.30449
row5 52.07585 49.59185 50.59787 49.70169 48.54808 50.51615 51.44068 50.39143
        col17    col18    col19    col20
row1 48.52188 51.78094 51.02814 104.8558
row5 49.53151 48.03434 52.10039 105.0549
> tmp[,c("col6","col20")]
          col6     col20
row1 105.72558 104.85582
row2  73.14293  76.07347
row3  74.27795  75.55681
row4  74.66803  75.15760
row5 104.67937 105.05493
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.7256 104.8558
row5 104.6794 105.0549
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.7256 104.8558
row5 104.6794 105.0549
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.7945345
[2,] -0.4681871
[3,]  1.0344316
[4,]  0.8853888
[5,] -1.0343411
> tmp[,c("col17","col7")]
          col17        col7
[1,] -0.5755534  0.34035854
[2,] -1.0351828 -0.66642226
[3,] -1.0502862 -0.03782425
[4,] -0.8503370  0.10628977
[5,] -0.3271535 -0.97137858
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
          col6      col20
[1,] 1.6492037 1.29142796
[2,] 0.4018763 0.17418740
[3,] 0.6338376 0.06513857
[4,] 1.2106431 0.36495714
[5,] 0.8792924 0.39736281
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.649204
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 1.6492037
[2,] 0.4018763
> 
> 
> 
> 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  2.2772348 0.3157650  0.1904837 -1.093795 -0.1483441 -0.6699893  0.4085039
row1 -0.1381598 0.9956965 -0.3864694 -1.018921  1.5483773  0.2508285 -1.2102544
           [,8]       [,9]     [,10]     [,11]      [,12]     [,13]     [,14]
row3  0.2941499 -0.3953054  0.822699 1.3358319 -0.9920481 2.4325153 0.0429875
row1 -0.5895359 -0.7389858 -2.779049 0.9223387  1.1305364 0.2502944 0.9805275
          [,15]      [,16]      [,17]      [,18]     [,19]    [,20]
row3 -1.4869591 -0.2547829 -1.7098157 -0.2804821  0.149548 2.358031
row1 -0.2435424 -0.2260440  0.4317297 -2.4187621 -0.850630 0.848983
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]       [,3]      [,4]      [,5]      [,6]      [,7]
row2 -1.911783 0.6387954 0.05934235 0.9887959 0.1559212 0.8966604 0.1698863
           [,8]      [,9]      [,10]
row2 -0.1420401 0.2069138 -0.2799358
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]       [,2]      [,3]      [,4]        [,5]       [,6]
row5 -0.2844297 -0.2801892 -1.977026 0.3986028 -0.04279643 -0.2034184
           [,7]       [,8]        [,9]     [,10]      [,11]      [,12]
row5 -0.3844054 0.06271099 -0.06620314 -0.723593 -0.7613145 0.08162645
         [,13]     [,14]      [,15]     [,16]     [,17]     [,18]     [,19]
row5 0.2970767 0.6096035 -0.6947322 0.5093532 0.5659084 -1.238983 -0.861927
          [,20]
row5 -0.3567945
> 
> 
> 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: 0x7f84fd523430>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d5c699eb4"
 [2] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d1a326ad2"
 [3] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d64030e6d"
 [4] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d4a84967" 
 [5] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d446b0b94"
 [6] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d4fc544a3"
 [7] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d201d523f"
 [8] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d6502b691"
 [9] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d15201d66"
[10] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d6f6a1e5f"
[11] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d1ff0281e"
[12] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d4fd9d9f3"
[13] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d67740979"
[14] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d731a1bfe"
[15] "/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests/BM569d3723fbbb"
> 
> 
> ### 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: 0x7f850d43b6c0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7f850d43b6c0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.12-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7f850d43b6c0>
> rowMedians(tmp)
  [1] -0.0238798649  0.3557580544  0.1583523561 -0.3658277767  0.0109031750
  [6]  0.0083242186  0.4582153821  0.2354704580  0.0808204861  0.0525787838
 [11]  0.3093147764 -0.3352538274 -0.0809316009  0.0270496441  0.2487566537
 [16]  0.0581169820  0.0028073345  0.5926711873  0.0807031671 -0.1358855695
 [21] -0.2522359144 -0.1012213041  0.1654371519 -0.1170846856 -0.1510942943
 [26] -0.2631134068  0.4660517023  0.5749976252  0.1126279468  0.2395877686
 [31] -0.5648680619 -0.2194271833  0.0333097520 -0.2589143315  0.0196480956
 [36]  0.1672126333 -0.8004946163  0.0918395208  0.1671029840  0.0167389901
 [41] -0.1606834023 -0.0502041624 -0.5951638255  0.0846320633  0.1906365511
 [46] -0.3605560336  0.0171469839 -0.4375744024 -0.3812009305  0.0971353533
 [51] -0.1459911135 -0.1243679642  0.0771749965 -0.3966351479 -0.3182946659
 [56] -0.2245240191  0.0204424894 -0.3234630341  0.6651996746 -0.3806815639
 [61] -0.1138858793 -0.1396465603  0.2545800895  0.2734313015  0.4160972576
 [66]  0.4713950428  0.1377574700  0.0386458323  0.2020105719  0.1506416059
 [71] -0.2975328899  0.0271578320  0.1407393554  0.8029664816  0.2907449499
 [76]  0.0913199131  0.4005794441  0.0326193517  0.0609128269  0.0172911732
 [81] -0.3453926031  0.0632495392  0.3903223427 -0.0521256772 -0.2142335949
 [86] -0.3529850251  0.0571383237  0.4527779047 -0.6544397514  0.2493594457
 [91] -0.5539426821  0.1696384665  0.0072958579  0.1133044807  0.1632998624
 [96]  0.1757754751 -0.9000286379  0.1052595894  0.0078387315 -0.0381543428
[101] -0.2385082585  0.0981179348  0.2083469635  0.3552317900 -0.4849738285
[106]  0.3782722673  0.1677488417 -0.1449510331  0.5365349295 -0.8976326187
[111]  0.2051283534 -0.1288893841 -0.0721406345 -0.3119418568 -0.5231068282
[116]  0.3334628687 -0.2786887463  0.0009870922 -0.5739513441 -0.1435314243
[121] -0.1969909670  0.1364790525  0.0634268673 -0.0108452185  0.0434952259
[126] -0.0210535612  0.6788897074  0.4266813581  0.2767434905 -0.1316568286
[131]  0.0513805318 -0.1660994383  0.0298172796  0.1117094907  0.2530230950
[136]  0.8769374256  0.2703121595  0.4911489579 -0.1670792292  0.0605208242
[141] -0.5197441617  0.7017580839  0.2209488168 -0.1424574855  0.2257788494
[146]  0.0495714426  0.3627852438  0.4262670769 -0.2845812751 -0.0271198604
[151]  0.7245910086  0.5737405703  0.6017436949  0.0560566711 -0.3699531284
[156]  0.8416746378 -0.3358331961 -0.6170798790  0.4182078579 -0.0935544078
[161]  0.2604478266 -0.1928550396  0.0814969523  0.4140369396  0.9105399646
[166] -0.3014495208  0.2091407327  0.3828890207 -0.0189445739  0.2235538811
[171] -0.0598905405 -0.5931292884 -0.3949708137 -0.0122130159  0.0407895779
[176]  0.2498295709 -0.0230342411 -0.3785375614  0.1569657839  0.1013162480
[181]  0.0490016662  0.2766310654  0.2359493887 -0.0129198473 -0.1024672826
[186]  0.4375330658  0.2044817923 -0.1759127953  0.1741253382 -0.0626340067
[191] -0.2428129024  0.0410437015  0.2940014318  0.1594445244  0.6034611782
[196]  0.6833949072 -0.1338320090  0.0674120980 -0.0479978904  0.5585723293
[201] -0.4055004187  0.1271911429 -0.3794713626 -0.3652497405 -0.3926093260
[206] -0.0792713681  0.2859771517 -0.5183859525 -0.3028941891  0.9266846682
[211] -0.4781121373  0.3126185372  0.6035568500 -0.0935909256 -0.1818729314
[216]  0.0240108796 -0.5626181675 -0.2277281872  0.3592437705  0.6308869981
[221] -0.3008130710 -0.7411092430 -0.2307422144  0.1138445261  0.0560993553
[226] -0.6758244817  0.3516551468 -0.7570547337  0.1036454912 -0.1724221447
> 
> proc.time()
   user  system elapsed 
  3.265  10.493  14.082 

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-apple-darwin17.0 (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: 0x7ff2a7c03360>
> .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: 0x7ff2a7c03360>
> .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: 0x7ff2a7c03360>
> .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: 0x7ff2a7c03360>
> 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: 0x7ff2a7d00aa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff2a7d00aa0>
> .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: 0x7ff2a7d00aa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff2a7d00aa0>
> .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: 0x7ff2a7d00aa0>
> 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: 0x7ff2a7d00ce0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff2a7d00ce0>
> .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: 0x7ff2a7d00ce0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7ff2a7d00ce0>
> .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: 0x7ff2a7d00ce0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7ff2a7d00ce0>
> .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: 0x7ff2a7d00ce0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7ff2a7d00ce0>
> .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: 0x7ff2a7d00ce0>
> 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: 0x7ff2a7c04070>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7ff2a7c04070>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff2a7c04070>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff2a7c04070>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile58d93fb141a9" "BufferedMatrixFile58d9d56d4de" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile58d93fb141a9" "BufferedMatrixFile58d9d56d4de" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff2a7c04310>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff2a7c04310>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7ff2a7c04310>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7ff2a7c04310>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7ff2a7c04310>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7ff2a7c04310>
> .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: 0x7ff2a7c046c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7ff2a7c046c0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7ff2a7c046c0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7ff2a7c046c0>
> 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: 0x7ff2a7c04aa0>
> .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: 0x7ff2a7c04aa0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.386   0.109   0.478 

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-apple-darwin17.0 (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.420   0.072   0.473 

Example timings