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

CHECK report for BufferedMatrix on machv2

This page was generated on 2020-10-17 11:58:09 -0400 (Sat, 17 Oct 2020).

TO THE DEVELOPERS/MAINTAINERS OF THE BufferedMatrix PACKAGE: Please make sure to use the following settings in order to reproduce any error or warning you see on this page.
Package 210/1905HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.52.0
Ben Bolstad
Snapshot Date: 2020-10-16 14:40:19 -0400 (Fri, 16 Oct 2020)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_11
Last Commit: c4ad43d
Last Changed Date: 2020-04-27 14:14:34 -0400 (Mon, 27 Apr 2020)
malbec2 Linux (Ubuntu 18.04.4 LTS) / x86_64  OK  OK  OK UNNEEDED, same version exists in internal repository
tokay2 Windows Server 2012 R2 Standard / x64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository
machv2 macOS 10.14.6 Mojave / x86_64  OK  OK [ OK ] OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.52.0
Command: /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.52.0.tar.gz
StartedAt: 2020-10-16 23:16:41 -0400 (Fri, 16 Oct 2020)
EndedAt: 2020-10-16 23:17:32 -0400 (Fri, 16 Oct 2020)
EllapsedTime: 51.3 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.52.0.tar.gz
###
##############################################################################
##############################################################################


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

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-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.11-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
Ncells 442464 23.7     955235 51.1         NA   617894 33.0
Vcells 798850  6.1    8388608 64.0      65536  1932312 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] "Fri Oct 16 23:17:07 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Fri Oct 16 23:17:07 2020"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x7fd7e5691540>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Fri Oct 16 23:17:10 2020"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Fri Oct 16 23:17:12 2020"
> 
> ColMode(tmp2)
<pointer: 0x7fd7e5691540>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
             [,1]        [,2]       [,3]       [,4]
[1,] 99.361547041  0.05938395 -0.2969439 -0.2703964
[2,]  0.003165862  0.83713917  0.5799696  1.9087366
[3,]  0.510973392 -0.75992794  0.5834485 -0.9852039
[4,]  0.267952116  1.74475431  0.5803223 -0.8245759
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
             [,1]       [,2]      [,3]      [,4]
[1,] 99.361547041 0.05938395 0.2969439 0.2703964
[2,]  0.003165862 0.83713917 0.5799696 1.9087366
[3,]  0.510973392 0.75992794 0.5834485 0.9852039
[4,]  0.267952116 1.74475431 0.5803223 0.8245759
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 9.96802624 0.2436882 0.5449256 0.5199965
[2,] 0.05626599 0.9149531 0.7615573 1.3815703
[3,] 0.71482403 0.8717385 0.7638380 0.9925744
[4,] 0.51764091 1.3208915 0.7617889 0.9080616
> 
> 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.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.04181 27.49627 30.74620 30.47036
[2,]  25.56583 34.98667 33.19554 40.72444
[3,]  32.65921 34.47731 33.22183 35.91095
[4,]  30.44436 39.95367 33.19821 34.90519
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7fd80540efe0>
> exp(tmp5)
<pointer: 0x7fd80540efe0>
> log(tmp5,2)
<pointer: 0x7fd80540efe0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.3137
> Min(tmp5)
[1] 53.21192
> mean(tmp5)
[1] 72.65547
> Sum(tmp5)
[1] 14531.09
> Var(tmp5)
[1] 870.2119
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 86.60820 71.78914 72.02966 73.58550 67.67421 71.43616 72.44330 70.57849
 [9] 69.34805 71.06202
> rowSums(tmp5)
 [1] 1732.164 1435.783 1440.593 1471.710 1353.484 1428.723 1448.866 1411.570
 [9] 1386.961 1421.240
> rowVars(tmp5)
 [1] 8063.84540   70.13152   44.09427   93.36080   63.26250  117.74847
 [7]  149.17445   92.10295   62.59741  104.50958
> rowSd(tmp5)
 [1] 89.798916  8.374457  6.640352  9.662339  7.953773 10.851197 12.213699
 [8]  9.597028  7.911853 10.222993
> rowMax(tmp5)
 [1] 466.31367  87.32080  81.46000  95.56617  85.08276  91.98516  93.90634
 [8]  89.53594  83.28249  91.66329
> rowMin(tmp5)
 [1] 56.16307 53.21192 58.72573 59.21205 56.76712 56.17240 54.19644 54.41264
 [9] 55.36808 55.68758
> 
> colMeans(tmp5)
 [1] 106.89763  69.96467  71.43949  70.52543  70.09221  74.81283  67.01753
 [8]  68.80122  73.48092  71.17047  69.75730  71.64748  67.05580  66.76839
[15]  73.65418  73.29966  72.20038  71.81403  72.02714  70.68269
> colSums(tmp5)
 [1] 1068.9763  699.6467  714.3949  705.2543  700.9221  748.1283  670.1753
 [8]  688.0122  734.8092  711.7047  697.5730  716.4748  670.5580  667.6839
[15]  736.5418  732.9966  722.0038  718.1403  720.2714  706.8269
> colVars(tmp5)
 [1] 16024.72497    52.43743    53.73081   107.72593    67.43434   127.02597
 [7]    84.88255   141.40734    97.58504   104.39935    66.91338    95.58349
[13]    44.29945    70.87631   119.56429   113.74379    34.45127   135.58365
[19]   127.81533    94.97006
> colSd(tmp5)
 [1] 126.588803   7.241369   7.330130  10.379110   8.211841  11.270580
 [7]   9.213173  11.891482   9.878514  10.217600   8.180060   9.776681
[13]   6.655783   8.418807  10.934546  10.665074   5.869521  11.644039
[19]  11.305544   9.745259
> colMax(tmp5)
 [1] 466.31367  83.15833  79.49018  90.66291  82.69284  91.66329  85.53502
 [8]  95.56617  89.45584  89.53594  83.20591  91.31119  77.96135  80.04744
[15]  93.90634  91.56892  80.14503  89.51778  91.98516  83.28249
> colMin(tmp5)
 [1] 53.21192 57.22988 56.43605 59.93903 58.72573 59.61165 55.36808 55.68758
 [9] 56.88135 54.19644 57.79257 60.55080 58.97236 54.57398 59.68411 58.16331
[17] 62.73119 54.41264 56.16307 57.18248
> 
> 
> ### 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] 86.60820 71.78914 72.02966 73.58550 67.67421 71.43616       NA 70.57849
 [9] 69.34805 71.06202
> rowSums(tmp5)
 [1] 1732.164 1435.783 1440.593 1471.710 1353.484 1428.723       NA 1411.570
 [9] 1386.961 1421.240
> rowVars(tmp5)
 [1] 8063.84540   70.13152   44.09427   93.36080   63.26250  117.74847
 [7]  156.10489   92.10295   62.59741  104.50958
> rowSd(tmp5)
 [1] 89.798916  8.374457  6.640352  9.662339  7.953773 10.851197 12.494194
 [8]  9.597028  7.911853 10.222993
> rowMax(tmp5)
 [1] 466.31367  87.32080  81.46000  95.56617  85.08276  91.98516        NA
 [8]  89.53594  83.28249  91.66329
> rowMin(tmp5)
 [1] 56.16307 53.21192 58.72573 59.21205 56.76712 56.17240       NA 54.41264
 [9] 55.36808 55.68758
> 
> colMeans(tmp5)
 [1] 106.89763  69.96467  71.43949  70.52543  70.09221  74.81283  67.01753
 [8]  68.80122  73.48092  71.17047  69.75730  71.64748        NA  66.76839
[15]  73.65418  73.29966  72.20038  71.81403  72.02714  70.68269
> colSums(tmp5)
 [1] 1068.9763  699.6467  714.3949  705.2543  700.9221  748.1283  670.1753
 [8]  688.0122  734.8092  711.7047  697.5730  716.4748        NA  667.6839
[15]  736.5418  732.9966  722.0038  718.1403  720.2714  706.8269
> colVars(tmp5)
 [1] 16024.72497    52.43743    53.73081   107.72593    67.43434   127.02597
 [7]    84.88255   141.40734    97.58504   104.39935    66.91338    95.58349
[13]          NA    70.87631   119.56429   113.74379    34.45127   135.58365
[19]   127.81533    94.97006
> colSd(tmp5)
 [1] 126.588803   7.241369   7.330130  10.379110   8.211841  11.270580
 [7]   9.213173  11.891482   9.878514  10.217600   8.180060   9.776681
[13]         NA   8.418807  10.934546  10.665074   5.869521  11.644039
[19]  11.305544   9.745259
> colMax(tmp5)
 [1] 466.31367  83.15833  79.49018  90.66291  82.69284  91.66329  85.53502
 [8]  95.56617  89.45584  89.53594  83.20591  91.31119        NA  80.04744
[15]  93.90634  91.56892  80.14503  89.51778  91.98516  83.28249
> colMin(tmp5)
 [1] 53.21192 57.22988 56.43605 59.93903 58.72573 59.61165 55.36808 55.68758
 [9] 56.88135 54.19644 57.79257 60.55080       NA 54.57398 59.68411 58.16331
[17] 62.73119 54.41264 56.16307 57.18248
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.3137
> Min(tmp5,na.rm=TRUE)
[1] 53.21192
> mean(tmp5,na.rm=TRUE)
[1] 72.68075
> Sum(tmp5,na.rm=TRUE)
[1] 14463.47
> Var(tmp5,na.rm=TRUE)
[1] 874.4785
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 86.60820 71.78914 72.02966 73.58550 67.67421 71.43616 72.69684 70.57849
 [9] 69.34805 71.06202
> rowSums(tmp5,na.rm=TRUE)
 [1] 1732.164 1435.783 1440.593 1471.710 1353.484 1428.723 1381.240 1411.570
 [9] 1386.961 1421.240
> rowVars(tmp5,na.rm=TRUE)
 [1] 8063.84540   70.13152   44.09427   93.36080   63.26250  117.74847
 [7]  156.10489   92.10295   62.59741  104.50958
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.798916  8.374457  6.640352  9.662339  7.953773 10.851197 12.494194
 [8]  9.597028  7.911853 10.222993
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.31367  87.32080  81.46000  95.56617  85.08276  91.98516  93.90634
 [8]  89.53594  83.28249  91.66329
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.16307 53.21192 58.72573 59.21205 56.76712 56.17240 54.19644 54.41264
 [9] 55.36808 55.68758
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 106.89763  69.96467  71.43949  70.52543  70.09221  74.81283  67.01753
 [8]  68.80122  73.48092  71.17047  69.75730  71.64748  66.99243  66.76839
[15]  73.65418  73.29966  72.20038  71.81403  72.02714  70.68269
> colSums(tmp5,na.rm=TRUE)
 [1] 1068.9763  699.6467  714.3949  705.2543  700.9221  748.1283  670.1753
 [8]  688.0122  734.8092  711.7047  697.5730  716.4748  602.9319  667.6839
[15]  736.5418  732.9966  722.0038  718.1403  720.2714  706.8269
> colVars(tmp5,na.rm=TRUE)
 [1] 16024.72497    52.43743    53.73081   107.72593    67.43434   127.02597
 [7]    84.88255   141.40734    97.58504   104.39935    66.91338    95.58349
[13]    49.79171    70.87631   119.56429   113.74379    34.45127   135.58365
[19]   127.81533    94.97006
> colSd(tmp5,na.rm=TRUE)
 [1] 126.588803   7.241369   7.330130  10.379110   8.211841  11.270580
 [7]   9.213173  11.891482   9.878514  10.217600   8.180060   9.776681
[13]   7.056324   8.418807  10.934546  10.665074   5.869521  11.644039
[19]  11.305544   9.745259
> colMax(tmp5,na.rm=TRUE)
 [1] 466.31367  83.15833  79.49018  90.66291  82.69284  91.66329  85.53502
 [8]  95.56617  89.45584  89.53594  83.20591  91.31119  77.96135  80.04744
[15]  93.90634  91.56892  80.14503  89.51778  91.98516  83.28249
> colMin(tmp5,na.rm=TRUE)
 [1] 53.21192 57.22988 56.43605 59.93903 58.72573 59.61165 55.36808 55.68758
 [9] 56.88135 54.19644 57.79257 60.55080 58.97236 54.57398 59.68411 58.16331
[17] 62.73119 54.41264 56.16307 57.18248
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 86.60820 71.78914 72.02966 73.58550 67.67421 71.43616      NaN 70.57849
 [9] 69.34805 71.06202
> rowSums(tmp5,na.rm=TRUE)
 [1] 1732.164 1435.783 1440.593 1471.710 1353.484 1428.723    0.000 1411.570
 [9] 1386.961 1421.240
> rowVars(tmp5,na.rm=TRUE)
 [1] 8063.84540   70.13152   44.09427   93.36080   63.26250  117.74847
 [7]         NA   92.10295   62.59741  104.50958
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.798916  8.374457  6.640352  9.662339  7.953773 10.851197        NA
 [8]  9.597028  7.911853 10.222993
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.31367  87.32080  81.46000  95.56617  85.08276  91.98516        NA
 [8]  89.53594  83.28249  91.66329
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.16307 53.21192 58.72573 59.21205 56.76712 56.17240       NA 54.41264
 [9] 55.36808 55.68758
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.35977  71.04270  71.01799  68.28793  70.99465  76.50185  64.96003
 [8]  68.35247  72.36985  73.05648  69.41211  70.16804       NaN  68.12333
[15]  71.40394  73.54745  72.36641  70.75524  70.68557  72.18272
> colSums(tmp5,na.rm=TRUE)
 [1] 1002.2379  639.3843  639.1619  614.5914  638.9519  688.5167  584.6403
 [8]  615.1722  651.3286  657.5083  624.7090  631.5123    0.0000  613.1100
[15]  642.6354  661.9271  651.2977  636.7972  636.1701  649.6445
> colVars(tmp5,na.rm=TRUE)
 [1] 17803.82059    45.91798    58.44837    64.86973    66.70153   110.81033
 [7]    47.86825   156.81771    95.89521    77.43291    73.93709    82.90787
[13]          NA    59.08256    77.54453   127.27099    38.44755   139.92002
[19]   123.54435    81.52802
> colSd(tmp5,na.rm=TRUE)
 [1] 133.430958   6.776281   7.645153   8.054175   8.167100  10.526649
 [7]   6.918688  12.522688   9.792610   8.799597   8.598668   9.105376
[13]         NA   7.686518   8.805937  11.281445   6.200609  11.828779
[19]  11.115050   9.029287
> colMax(tmp5,na.rm=TRUE)
 [1] 466.31367  83.15833  79.49018  84.76259  82.69284  91.66329  73.89881
 [8]  95.56617  89.45584  89.53594  83.20591  91.31119      -Inf  80.04744
[15]  85.08276  91.56892  80.14503  89.51778  91.98516  83.28249
> colMin(tmp5,na.rm=TRUE)
 [1] 53.21192 57.22988 56.43605 59.93903 58.72573 60.22153 55.36808 55.68758
 [9] 56.88135 59.34343 57.79257 60.55080      Inf 59.55385 59.68411 58.16331
[17] 62.73119 54.41264 56.16307 58.09132
> 
> 
> 
> 
> 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] 233.0617 236.0685 252.2545 249.4471 181.5094 254.7410 140.5276 404.4860
 [9] 182.6223 162.5313
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 233.0617 236.0685 252.2545 249.4471 181.5094 254.7410 140.5276 404.4860
 [9] 182.6223 162.5313
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  8.526513e-14  5.684342e-14 -1.136868e-13 -1.989520e-13 -5.684342e-14
 [6] -2.273737e-13  1.278977e-13  1.136868e-13  1.136868e-13 -8.526513e-14
[11]  8.526513e-14  1.705303e-13  0.000000e+00 -5.684342e-14  5.684342e-14
[16] -8.526513e-14 -2.842171e-14  6.394885e-14  3.410605e-13  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
10   14 
9   12 
6   9 
9   1 
2   17 
7   13 
5   16 
4   20 
1   2 
3   3 
8   18 
5   14 
5   13 
9   4 
1   6 
7   20 
2   7 
3   18 
1   2 
7   14 
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.70173
> Min(tmp)
[1] -2.205203
> mean(tmp)
[1] -0.1127626
> Sum(tmp)
[1] -11.27626
> Var(tmp)
[1] 0.9900849
> 
> rowMeans(tmp)
[1] -0.1127626
> rowSums(tmp)
[1] -11.27626
> rowVars(tmp)
[1] 0.9900849
> rowSd(tmp)
[1] 0.9950301
> rowMax(tmp)
[1] 2.70173
> rowMin(tmp)
[1] -2.205203
> 
> colMeans(tmp)
  [1] -0.58265286  0.27606328 -1.31698155 -0.98720110 -0.59779554  0.49183738
  [7]  1.25425111 -0.22356593 -0.63332996  0.12135572  1.53918620 -1.63199980
 [13]  0.02142753  0.51532145  1.38610565  0.46234866  1.05804430 -0.23189084
 [19] -0.66014012  0.59614666 -0.26872600 -0.46156748  0.15107411  1.10809848
 [25] -1.66217388 -0.50031927 -0.45931484 -1.19591594  0.66239891  0.11925447
 [31]  0.02476782  0.58775949  0.47202025  0.40294861 -0.53514491  0.49038225
 [37] -0.25259703 -1.39224829  0.18020945 -0.57393329 -1.23852683  0.19580959
 [43] -0.21185895  1.29606527 -1.77681984 -0.63575888 -0.01131185 -0.10660018
 [49]  0.75198407 -1.02461933  0.40512363 -0.50610911 -0.37715307 -1.21349080
 [55]  0.08288428 -1.85724576  0.80739001  2.61842410 -0.08400666  1.28816593
 [61] -0.67310793 -2.20520282  1.60092875 -0.10337570 -0.03601235 -0.56785166
 [67]  0.45869619 -2.03368997  2.30651782 -1.23149099  0.43442112 -1.49185153
 [73]  0.10000711  0.49374030 -0.57280903 -0.77586565 -0.86537214  2.70172972
 [79] -1.94291505 -0.43173922  1.22271888  0.39906592  0.58617015 -1.09495280
 [85] -1.07726337 -1.79398375 -1.01180757  0.67290321  0.95277920  0.43162071
 [91]  0.73862421 -0.01405273  0.02348461 -1.24667680  0.58978240  0.80519421
 [97] -0.59656332 -0.29019435 -0.60586345 -1.28785371
> colSums(tmp)
  [1] -0.58265286  0.27606328 -1.31698155 -0.98720110 -0.59779554  0.49183738
  [7]  1.25425111 -0.22356593 -0.63332996  0.12135572  1.53918620 -1.63199980
 [13]  0.02142753  0.51532145  1.38610565  0.46234866  1.05804430 -0.23189084
 [19] -0.66014012  0.59614666 -0.26872600 -0.46156748  0.15107411  1.10809848
 [25] -1.66217388 -0.50031927 -0.45931484 -1.19591594  0.66239891  0.11925447
 [31]  0.02476782  0.58775949  0.47202025  0.40294861 -0.53514491  0.49038225
 [37] -0.25259703 -1.39224829  0.18020945 -0.57393329 -1.23852683  0.19580959
 [43] -0.21185895  1.29606527 -1.77681984 -0.63575888 -0.01131185 -0.10660018
 [49]  0.75198407 -1.02461933  0.40512363 -0.50610911 -0.37715307 -1.21349080
 [55]  0.08288428 -1.85724576  0.80739001  2.61842410 -0.08400666  1.28816593
 [61] -0.67310793 -2.20520282  1.60092875 -0.10337570 -0.03601235 -0.56785166
 [67]  0.45869619 -2.03368997  2.30651782 -1.23149099  0.43442112 -1.49185153
 [73]  0.10000711  0.49374030 -0.57280903 -0.77586565 -0.86537214  2.70172972
 [79] -1.94291505 -0.43173922  1.22271888  0.39906592  0.58617015 -1.09495280
 [85] -1.07726337 -1.79398375 -1.01180757  0.67290321  0.95277920  0.43162071
 [91]  0.73862421 -0.01405273  0.02348461 -1.24667680  0.58978240  0.80519421
 [97] -0.59656332 -0.29019435 -0.60586345 -1.28785371
> 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.58265286  0.27606328 -1.31698155 -0.98720110 -0.59779554  0.49183738
  [7]  1.25425111 -0.22356593 -0.63332996  0.12135572  1.53918620 -1.63199980
 [13]  0.02142753  0.51532145  1.38610565  0.46234866  1.05804430 -0.23189084
 [19] -0.66014012  0.59614666 -0.26872600 -0.46156748  0.15107411  1.10809848
 [25] -1.66217388 -0.50031927 -0.45931484 -1.19591594  0.66239891  0.11925447
 [31]  0.02476782  0.58775949  0.47202025  0.40294861 -0.53514491  0.49038225
 [37] -0.25259703 -1.39224829  0.18020945 -0.57393329 -1.23852683  0.19580959
 [43] -0.21185895  1.29606527 -1.77681984 -0.63575888 -0.01131185 -0.10660018
 [49]  0.75198407 -1.02461933  0.40512363 -0.50610911 -0.37715307 -1.21349080
 [55]  0.08288428 -1.85724576  0.80739001  2.61842410 -0.08400666  1.28816593
 [61] -0.67310793 -2.20520282  1.60092875 -0.10337570 -0.03601235 -0.56785166
 [67]  0.45869619 -2.03368997  2.30651782 -1.23149099  0.43442112 -1.49185153
 [73]  0.10000711  0.49374030 -0.57280903 -0.77586565 -0.86537214  2.70172972
 [79] -1.94291505 -0.43173922  1.22271888  0.39906592  0.58617015 -1.09495280
 [85] -1.07726337 -1.79398375 -1.01180757  0.67290321  0.95277920  0.43162071
 [91]  0.73862421 -0.01405273  0.02348461 -1.24667680  0.58978240  0.80519421
 [97] -0.59656332 -0.29019435 -0.60586345 -1.28785371
> colMin(tmp)
  [1] -0.58265286  0.27606328 -1.31698155 -0.98720110 -0.59779554  0.49183738
  [7]  1.25425111 -0.22356593 -0.63332996  0.12135572  1.53918620 -1.63199980
 [13]  0.02142753  0.51532145  1.38610565  0.46234866  1.05804430 -0.23189084
 [19] -0.66014012  0.59614666 -0.26872600 -0.46156748  0.15107411  1.10809848
 [25] -1.66217388 -0.50031927 -0.45931484 -1.19591594  0.66239891  0.11925447
 [31]  0.02476782  0.58775949  0.47202025  0.40294861 -0.53514491  0.49038225
 [37] -0.25259703 -1.39224829  0.18020945 -0.57393329 -1.23852683  0.19580959
 [43] -0.21185895  1.29606527 -1.77681984 -0.63575888 -0.01131185 -0.10660018
 [49]  0.75198407 -1.02461933  0.40512363 -0.50610911 -0.37715307 -1.21349080
 [55]  0.08288428 -1.85724576  0.80739001  2.61842410 -0.08400666  1.28816593
 [61] -0.67310793 -2.20520282  1.60092875 -0.10337570 -0.03601235 -0.56785166
 [67]  0.45869619 -2.03368997  2.30651782 -1.23149099  0.43442112 -1.49185153
 [73]  0.10000711  0.49374030 -0.57280903 -0.77586565 -0.86537214  2.70172972
 [79] -1.94291505 -0.43173922  1.22271888  0.39906592  0.58617015 -1.09495280
 [85] -1.07726337 -1.79398375 -1.01180757  0.67290321  0.95277920  0.43162071
 [91]  0.73862421 -0.01405273  0.02348461 -1.24667680  0.58978240  0.80519421
 [97] -0.59656332 -0.29019435 -0.60586345 -1.28785371
> colMedians(tmp)
  [1] -0.58265286  0.27606328 -1.31698155 -0.98720110 -0.59779554  0.49183738
  [7]  1.25425111 -0.22356593 -0.63332996  0.12135572  1.53918620 -1.63199980
 [13]  0.02142753  0.51532145  1.38610565  0.46234866  1.05804430 -0.23189084
 [19] -0.66014012  0.59614666 -0.26872600 -0.46156748  0.15107411  1.10809848
 [25] -1.66217388 -0.50031927 -0.45931484 -1.19591594  0.66239891  0.11925447
 [31]  0.02476782  0.58775949  0.47202025  0.40294861 -0.53514491  0.49038225
 [37] -0.25259703 -1.39224829  0.18020945 -0.57393329 -1.23852683  0.19580959
 [43] -0.21185895  1.29606527 -1.77681984 -0.63575888 -0.01131185 -0.10660018
 [49]  0.75198407 -1.02461933  0.40512363 -0.50610911 -0.37715307 -1.21349080
 [55]  0.08288428 -1.85724576  0.80739001  2.61842410 -0.08400666  1.28816593
 [61] -0.67310793 -2.20520282  1.60092875 -0.10337570 -0.03601235 -0.56785166
 [67]  0.45869619 -2.03368997  2.30651782 -1.23149099  0.43442112 -1.49185153
 [73]  0.10000711  0.49374030 -0.57280903 -0.77586565 -0.86537214  2.70172972
 [79] -1.94291505 -0.43173922  1.22271888  0.39906592  0.58617015 -1.09495280
 [85] -1.07726337 -1.79398375 -1.01180757  0.67290321  0.95277920  0.43162071
 [91]  0.73862421 -0.01405273  0.02348461 -1.24667680  0.58978240  0.80519421
 [97] -0.59656332 -0.29019435 -0.60586345 -1.28785371
> colRanges(tmp)
           [,1]      [,2]      [,3]       [,4]       [,5]      [,6]     [,7]
[1,] -0.5826529 0.2760633 -1.316982 -0.9872011 -0.5977955 0.4918374 1.254251
[2,] -0.5826529 0.2760633 -1.316982 -0.9872011 -0.5977955 0.4918374 1.254251
           [,8]     [,9]     [,10]    [,11]  [,12]      [,13]     [,14]
[1,] -0.2235659 -0.63333 0.1213557 1.539186 -1.632 0.02142753 0.5153215
[2,] -0.2235659 -0.63333 0.1213557 1.539186 -1.632 0.02142753 0.5153215
        [,15]     [,16]    [,17]      [,18]      [,19]     [,20]     [,21]
[1,] 1.386106 0.4623487 1.058044 -0.2318908 -0.6601401 0.5961467 -0.268726
[2,] 1.386106 0.4623487 1.058044 -0.2318908 -0.6601401 0.5961467 -0.268726
          [,22]     [,23]    [,24]     [,25]      [,26]      [,27]     [,28]
[1,] -0.4615675 0.1510741 1.108098 -1.662174 -0.5003193 -0.4593148 -1.195916
[2,] -0.4615675 0.1510741 1.108098 -1.662174 -0.5003193 -0.4593148 -1.195916
         [,29]     [,30]      [,31]     [,32]     [,33]     [,34]      [,35]
[1,] 0.6623989 0.1192545 0.02476782 0.5877595 0.4720202 0.4029486 -0.5351449
[2,] 0.6623989 0.1192545 0.02476782 0.5877595 0.4720202 0.4029486 -0.5351449
         [,36]     [,37]     [,38]     [,39]      [,40]     [,41]     [,42]
[1,] 0.4903823 -0.252597 -1.392248 0.1802095 -0.5739333 -1.238527 0.1958096
[2,] 0.4903823 -0.252597 -1.392248 0.1802095 -0.5739333 -1.238527 0.1958096
         [,43]    [,44]    [,45]      [,46]       [,47]      [,48]     [,49]
[1,] -0.211859 1.296065 -1.77682 -0.6357589 -0.01131185 -0.1066002 0.7519841
[2,] -0.211859 1.296065 -1.77682 -0.6357589 -0.01131185 -0.1066002 0.7519841
         [,50]     [,51]      [,52]      [,53]     [,54]      [,55]     [,56]
[1,] -1.024619 0.4051236 -0.5061091 -0.3771531 -1.213491 0.08288428 -1.857246
[2,] -1.024619 0.4051236 -0.5061091 -0.3771531 -1.213491 0.08288428 -1.857246
       [,57]    [,58]       [,59]    [,60]      [,61]     [,62]    [,63]
[1,] 0.80739 2.618424 -0.08400666 1.288166 -0.6731079 -2.205203 1.600929
[2,] 0.80739 2.618424 -0.08400666 1.288166 -0.6731079 -2.205203 1.600929
          [,64]       [,65]      [,66]     [,67]    [,68]    [,69]     [,70]
[1,] -0.1033757 -0.03601235 -0.5678517 0.4586962 -2.03369 2.306518 -1.231491
[2,] -0.1033757 -0.03601235 -0.5678517 0.4586962 -2.03369 2.306518 -1.231491
         [,71]     [,72]     [,73]     [,74]     [,75]      [,76]      [,77]
[1,] 0.4344211 -1.491852 0.1000071 0.4937403 -0.572809 -0.7758656 -0.8653721
[2,] 0.4344211 -1.491852 0.1000071 0.4937403 -0.572809 -0.7758656 -0.8653721
       [,78]     [,79]      [,80]    [,81]     [,82]     [,83]     [,84]
[1,] 2.70173 -1.942915 -0.4317392 1.222719 0.3990659 0.5861701 -1.094953
[2,] 2.70173 -1.942915 -0.4317392 1.222719 0.3990659 0.5861701 -1.094953
         [,85]     [,86]     [,87]     [,88]     [,89]     [,90]     [,91]
[1,] -1.077263 -1.793984 -1.011808 0.6729032 0.9527792 0.4316207 0.7386242
[2,] -1.077263 -1.793984 -1.011808 0.6729032 0.9527792 0.4316207 0.7386242
           [,92]      [,93]     [,94]     [,95]     [,96]      [,97]      [,98]
[1,] -0.01405273 0.02348461 -1.246677 0.5897824 0.8051942 -0.5965633 -0.2901943
[2,] -0.01405273 0.02348461 -1.246677 0.5897824 0.8051942 -0.5965633 -0.2901943
          [,99]    [,100]
[1,] -0.6058635 -1.287854
[2,] -0.6058635 -1.287854
> 
> 
> Max(tmp2)
[1] 2.72721
> Min(tmp2)
[1] -2.10906
> mean(tmp2)
[1] 0.0661155
> Sum(tmp2)
[1] 6.61155
> Var(tmp2)
[1] 0.8973857
> 
> rowMeans(tmp2)
  [1]  0.41073282  0.46591864 -0.58176862 -0.65557187 -0.54307845  1.15743673
  [7] -0.15776957 -0.21202107  0.64406042 -1.55379795  0.40020163  0.15217739
 [13]  0.20941487  0.40323247 -0.24433241  1.73186977 -0.79921419 -2.10906010
 [19] -1.64690395  1.02174123  0.35408506 -1.15249178 -0.36977448 -0.49065833
 [25] -0.46585371  2.07892958 -0.54311304  0.67013642 -0.75509121  0.60747991
 [31] -0.71465345 -1.16026617  0.33312632 -0.14366580 -0.53518806  1.38064152
 [37] -0.46160556  1.26311688 -0.90127386 -1.18694893  2.72721041  0.07201115
 [43]  0.57174867  0.42067596  1.86376687  0.99342550  0.92001247  0.91501582
 [49] -0.08036167  0.10014270 -1.08121312  0.04069048 -1.28063611 -0.47546894
 [55] -0.80822405  2.35621494  0.31374700 -0.72428611  0.53444088 -2.06812410
 [61]  1.15541065  0.05497862 -1.87640654 -0.91298377  1.48235427  0.26404991
 [67]  1.35649990  0.25302940 -1.00856321 -0.70681830  0.17993657  0.48707526
 [73] -0.26809129  0.23870423 -1.45606293  0.24574972 -1.00114132  0.17779511
 [79]  0.73973100 -0.50865804  0.39335892 -0.56740408  0.56925795 -0.25369538
 [85] -0.04870170  0.68869739  0.97134282  1.44490385  0.21614265  1.13746294
 [91] -0.06363180  1.38562181 -0.71391336  0.84804415 -0.03073236 -0.71039876
 [97] -0.44194643  0.91762424  0.40072549  0.36121506
> rowSums(tmp2)
  [1]  0.41073282  0.46591864 -0.58176862 -0.65557187 -0.54307845  1.15743673
  [7] -0.15776957 -0.21202107  0.64406042 -1.55379795  0.40020163  0.15217739
 [13]  0.20941487  0.40323247 -0.24433241  1.73186977 -0.79921419 -2.10906010
 [19] -1.64690395  1.02174123  0.35408506 -1.15249178 -0.36977448 -0.49065833
 [25] -0.46585371  2.07892958 -0.54311304  0.67013642 -0.75509121  0.60747991
 [31] -0.71465345 -1.16026617  0.33312632 -0.14366580 -0.53518806  1.38064152
 [37] -0.46160556  1.26311688 -0.90127386 -1.18694893  2.72721041  0.07201115
 [43]  0.57174867  0.42067596  1.86376687  0.99342550  0.92001247  0.91501582
 [49] -0.08036167  0.10014270 -1.08121312  0.04069048 -1.28063611 -0.47546894
 [55] -0.80822405  2.35621494  0.31374700 -0.72428611  0.53444088 -2.06812410
 [61]  1.15541065  0.05497862 -1.87640654 -0.91298377  1.48235427  0.26404991
 [67]  1.35649990  0.25302940 -1.00856321 -0.70681830  0.17993657  0.48707526
 [73] -0.26809129  0.23870423 -1.45606293  0.24574972 -1.00114132  0.17779511
 [79]  0.73973100 -0.50865804  0.39335892 -0.56740408  0.56925795 -0.25369538
 [85] -0.04870170  0.68869739  0.97134282  1.44490385  0.21614265  1.13746294
 [91] -0.06363180  1.38562181 -0.71391336  0.84804415 -0.03073236 -0.71039876
 [97] -0.44194643  0.91762424  0.40072549  0.36121506
> 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.41073282  0.46591864 -0.58176862 -0.65557187 -0.54307845  1.15743673
  [7] -0.15776957 -0.21202107  0.64406042 -1.55379795  0.40020163  0.15217739
 [13]  0.20941487  0.40323247 -0.24433241  1.73186977 -0.79921419 -2.10906010
 [19] -1.64690395  1.02174123  0.35408506 -1.15249178 -0.36977448 -0.49065833
 [25] -0.46585371  2.07892958 -0.54311304  0.67013642 -0.75509121  0.60747991
 [31] -0.71465345 -1.16026617  0.33312632 -0.14366580 -0.53518806  1.38064152
 [37] -0.46160556  1.26311688 -0.90127386 -1.18694893  2.72721041  0.07201115
 [43]  0.57174867  0.42067596  1.86376687  0.99342550  0.92001247  0.91501582
 [49] -0.08036167  0.10014270 -1.08121312  0.04069048 -1.28063611 -0.47546894
 [55] -0.80822405  2.35621494  0.31374700 -0.72428611  0.53444088 -2.06812410
 [61]  1.15541065  0.05497862 -1.87640654 -0.91298377  1.48235427  0.26404991
 [67]  1.35649990  0.25302940 -1.00856321 -0.70681830  0.17993657  0.48707526
 [73] -0.26809129  0.23870423 -1.45606293  0.24574972 -1.00114132  0.17779511
 [79]  0.73973100 -0.50865804  0.39335892 -0.56740408  0.56925795 -0.25369538
 [85] -0.04870170  0.68869739  0.97134282  1.44490385  0.21614265  1.13746294
 [91] -0.06363180  1.38562181 -0.71391336  0.84804415 -0.03073236 -0.71039876
 [97] -0.44194643  0.91762424  0.40072549  0.36121506
> rowMin(tmp2)
  [1]  0.41073282  0.46591864 -0.58176862 -0.65557187 -0.54307845  1.15743673
  [7] -0.15776957 -0.21202107  0.64406042 -1.55379795  0.40020163  0.15217739
 [13]  0.20941487  0.40323247 -0.24433241  1.73186977 -0.79921419 -2.10906010
 [19] -1.64690395  1.02174123  0.35408506 -1.15249178 -0.36977448 -0.49065833
 [25] -0.46585371  2.07892958 -0.54311304  0.67013642 -0.75509121  0.60747991
 [31] -0.71465345 -1.16026617  0.33312632 -0.14366580 -0.53518806  1.38064152
 [37] -0.46160556  1.26311688 -0.90127386 -1.18694893  2.72721041  0.07201115
 [43]  0.57174867  0.42067596  1.86376687  0.99342550  0.92001247  0.91501582
 [49] -0.08036167  0.10014270 -1.08121312  0.04069048 -1.28063611 -0.47546894
 [55] -0.80822405  2.35621494  0.31374700 -0.72428611  0.53444088 -2.06812410
 [61]  1.15541065  0.05497862 -1.87640654 -0.91298377  1.48235427  0.26404991
 [67]  1.35649990  0.25302940 -1.00856321 -0.70681830  0.17993657  0.48707526
 [73] -0.26809129  0.23870423 -1.45606293  0.24574972 -1.00114132  0.17779511
 [79]  0.73973100 -0.50865804  0.39335892 -0.56740408  0.56925795 -0.25369538
 [85] -0.04870170  0.68869739  0.97134282  1.44490385  0.21614265  1.13746294
 [91] -0.06363180  1.38562181 -0.71391336  0.84804415 -0.03073236 -0.71039876
 [97] -0.44194643  0.91762424  0.40072549  0.36121506
> 
> colMeans(tmp2)
[1] 0.0661155
> colSums(tmp2)
[1] 6.61155
> colVars(tmp2)
[1] 0.8973857
> colSd(tmp2)
[1] 0.9473045
> colMax(tmp2)
[1] 2.72721
> colMin(tmp2)
[1] -2.10906
> colMedians(tmp2)
[1] 0.12616
> colRanges(tmp2)
         [,1]
[1,] -2.10906
[2,]  2.72721
> 
> 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]  2.30298227 -2.32255133  2.04259704 -0.42917651 -2.23181620  0.05914892
 [7]  9.13228239 -3.31694610 -3.44832701  0.32634409
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5616713
[2,] -0.2748417
[3,]  0.3357521
[4,]  0.8862927
[5,]  1.8881277
> 
> rowApply(tmp,sum)
 [1] -7.4587600 -5.2057579  1.9382713  2.4369232  4.9837225  0.6864639
 [7]  2.6049573  1.9864424  2.5047075 -2.3624326
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    6    2   10    8    8    7    5    7    3     6
 [2,]    2    8    5    6    4    6    2    6    5     5
 [3,]    4    6    9    7    9   10    9    2    1     2
 [4,]    7    5    7    3    5    2    4    5    9     4
 [5,]    1   10    1    2    3    4    3    8    8     8
 [6,]    9    7    2    5    6    8    7    9    2     1
 [7,]   10    3    3    9   10    9   10   10   10     7
 [8,]    8    9    8    4    2    3    1    1    4     9
 [9,]    3    4    4    1    1    1    6    4    7    10
[10,]    5    1    6   10    7    5    8    3    6     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.676531325  0.045175188  0.407541467 -1.146567537 -1.923897183
 [6] -1.435282279  1.469091084 -0.473285815 -1.873902330  1.325330833
[11] -3.431959159 -2.949842960 -0.004635444  1.251303776 -0.560417854
[16]  0.556734074  4.205882012  3.024972758  0.367881495 -2.533546792
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.1256471
[2,]  0.4360352
[3,]  0.6073696
[4,]  0.6881576
[5,]  1.0706161
> 
> rowApply(tmp,sum)
[1] -5.06630077  7.23022454 -0.60961717  0.07901234 -4.63621227
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   17   13   15   16    1
[2,]    7    2   17   15   12
[3,]   18   10    6   14    7
[4,]    6    9    1   19    3
[5,]    4    4    5   12   17
> 
> 
> as.matrix(tmp)
           [,1]       [,2]        [,3]        [,4]       [,5]       [,6]
[1,]  0.4360352 -0.6435463  0.64521961 -0.70468973 -1.2877346 -0.3338983
[2,]  0.6073696 -1.1147511  0.09932336  0.07429173 -0.5839744  0.5426725
[3,]  0.6881576  0.9368961 -0.67632844 -1.18150577 -0.6944156 -0.6132313
[4,]  1.0706161  1.0623305  0.74588455  1.52451653  0.3999667 -0.7360648
[5,] -2.1256471 -0.1957540 -0.40655761 -0.85918030  0.2422606 -0.2947603
           [,7]       [,8]       [,9]        [,10]      [,11]      [,12]
[1,] -1.7632005 -1.7052048 -0.5774653  0.140367711 -1.9095293 -0.8545448
[2,]  1.2118621  1.2033072  0.1461906 -0.048448315 -0.2853321 -0.6516550
[3,]  0.9430908 -0.9080477  0.5598619 -0.176613825 -0.1214394 -0.3418001
[4,]  1.3928035  0.7376181 -1.8874752  1.415829985 -0.7244650 -0.5529524
[5,] -0.3154649  0.1990413 -0.1150144 -0.005804723 -0.3911934 -0.5488907
           [,13]      [,14]      [,15]      [,16]       [,17]       [,18]
[1,] -0.04397081 -0.1717306  1.2084165  0.1210985  3.12265234 -0.39943053
[2,] -0.28997582  2.1306536  1.2298248  1.6599457  2.19957214  0.02614038
[3,] -1.00755068  0.7065614 -0.8938701 -0.1928035 -0.60682712  1.58495898
[4,] -0.15007736 -1.6921767 -1.1878722 -0.5912736 -0.09736089  1.85733149
[5,]  1.48693923  0.2779961 -0.9169168 -0.4402330 -0.41215445 -0.04402756
          [,19]      [,20]
[1,] -0.5258749  0.1807296
[2,]  0.7929695 -1.7197618
[3,]  1.0889671  0.2963224
[4,] -1.4250533 -1.0831137
[5,]  0.4368730 -0.2077233
> 
> 
> 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.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  655  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  567  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1      col2       col3      col4      col5       col6       col7
row1 -0.5105777 0.7961543 -0.3996326 -0.948839 0.5107592 -0.4482881 -0.8130532
           col8     col9      col10      col11    col12      col13     col14
row1 -0.2802163 -1.48536 -0.6712194 -0.9287783 1.592394 -0.5686617 0.5823517
          col15      col16    col17      col18      col19     col20
row1 0.04922557 0.08201621 0.401793 -0.7896495 -0.7182934 0.2344872
> tmp[,"col10"]
          col10
row1 -0.6712194
row2 -0.5739390
row3  1.5634758
row4  0.4597251
row5  0.2187906
> tmp[c("row1","row5"),]
            col1       col2       col3       col4       col5       col6
row1 -0.51057766  0.7961543 -0.3996326 -0.9488390  0.5107592 -0.4482881
row5  0.04908677 -0.5024026  1.1060470 -0.7715036 -1.4429180 -0.9112614
            col7       col8       col9      col10      col11       col12
row1 -0.81305316 -0.2802163 -1.4853600 -0.6712194 -0.9287783  1.59239436
row5  0.06726633 -0.4631948 -0.1895633  0.2187906  0.3155165 -0.02956141
          col13      col14      col15      col16      col17      col18
row1 -0.5686617  0.5823517 0.04922557 0.08201621 0.40179305 -0.7896495
row5 -0.3827639 -0.3386835 0.44247121 1.67303214 0.04404729 -0.6954171
          col19     col20
row1 -0.7182934 0.2344872
row5 -1.4711855 1.0495013
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.4482881  0.2344872
row2 -1.0869117 -1.2242900
row3 -2.0978527  1.2720771
row4 -1.3402057  0.6012609
row5 -0.9112614  1.0495013
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1 -0.4482881 0.2344872
row5 -0.9112614 1.0495013
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5    col6     col7     col8
row1 51.50951 50.01057 48.29518 51.20824 51.68849 103.347 49.36598 51.71106
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.21197 49.54806 51.27122 50.28071 49.25322 49.64479 49.18001 49.22566
        col17    col18    col19   col20
row1 49.47417 50.54339 51.63792 105.035
> tmp[,"col10"]
        col10
row1 49.54806
row2 31.17168
row3 30.24374
row4 27.87730
row5 48.92838
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5    col6     col7     col8
row1 51.50951 50.01057 48.29518 51.20824 51.68849 103.347 49.36598 51.71106
row5 49.70260 52.82798 49.07868 49.55542 51.44302 104.413 49.57029 50.04938
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.21197 49.54806 51.27122 50.28071 49.25322 49.64479 49.18001 49.22566
row5 50.20571 48.92838 51.29548 49.61918 50.99012 49.06531 50.24702 50.23847
        col17    col18    col19    col20
row1 49.47417 50.54339 51.63792 105.0350
row5 51.01066 49.48594 50.50662 105.7445
> tmp[,c("col6","col20")]
          col6     col20
row1 103.34697 105.03496
row2  75.11781  77.14161
row3  75.23518  74.94851
row4  73.83147  74.43747
row5 104.41296 105.74455
> tmp[c("row1","row5"),c("col6","col20")]
        col6    col20
row1 103.347 105.0350
row5 104.413 105.7445
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
        col6    col20
row1 103.347 105.0350
row5 104.413 105.7445
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.4989149
[2,] -0.1413962
[3,] -1.2516922
[4,] -2.1848874
[5,]  0.4457931
> tmp[,c("col17","col7")]
           col17       col7
[1,] -0.10922781 -0.9753678
[2,]  1.17449841 -0.3003024
[3,]  0.02304149  0.1901590
[4,]  0.18251943  1.6315893
[5,]  1.48080934  0.3462511
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.7284608  1.1747543
[2,]  0.6017673 -0.1385683
[3,]  1.1802357 -0.9944322
[4,]  0.7527670 -0.1239602
[5,] -0.0302202 -0.6264092
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.7284608
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.7284608
[2,] 0.6017673
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]        [,4]      [,5]       [,6]
row3 -0.4471186 -1.2319188 -1.9008669 -0.42172483 0.3601296 -2.1563551
row1 -0.2547765  0.4390428  0.5610562  0.07695402 0.5299082  0.7792331
          [,7]       [,8]       [,9]      [,10]     [,11]      [,12]
row3 0.8903179 0.05019628 -1.1370471  1.4132642 -1.425282 -0.7496151
row1 1.4761349 1.18549418  0.1036129 -0.5307056  1.130766 -0.9609536
           [,13]      [,14]     [,15]     [,16]      [,17]      [,18]     [,19]
row3  0.06291846  1.2591524 0.1338004  1.676181  0.1740052 -1.0450600  1.905759
row1 -2.51027206 -0.3602875 0.3782410 -0.319367 -0.7251661 -0.7612034 -1.317936
         [,20]
row3 0.6026891
row1 1.1481636
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]      [,3]     [,4]       [,5]     [,6]       [,7]
row2 0.1199246 -0.3919976 -1.553573 0.068769 -0.2757302 -1.30895 -0.4554413
          [,8]      [,9]    [,10]
row2 0.4519168 0.9575353 1.067414
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]      [,2]      [,3]      [,4]       [,5]      [,6]     [,7]
row5 1.661612 0.6596418 0.1340303 0.6594741 -0.2183257 -2.046232 2.464833
            [,8]      [,9]     [,10]      [,11]      [,12]      [,13]     [,14]
row5 -0.01216409 -1.430123 -1.087246 -0.5972269 -0.3798602 -0.3778846 0.4111773
         [,15]    [,16]     [,17]     [,18]      [,19]    [,20]
row5 0.3394683 1.521659 0.2907343 -1.118556 -0.3791421 2.707059
> 
> 
> 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: 0x7fd7d5401d80>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef29fa67c8" 
 [2] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef216b38096"
 [3] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef262bf037e"
 [4] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef26a7e77d7"
 [5] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef214edfae0"
 [6] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef213f192dc"
 [7] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef258e0b3be"
 [8] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef2838ac88" 
 [9] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef240c718ef"
[10] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef24f361422"
[11] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef26763ecce"
[12] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef2514ffd69"
[13] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef25a862233"
[14] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef21c2f70b3"
[15] "/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests/BM12ef26e900639"
> 
> 
> ### 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: 0x7fd7e03100e0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7fd7e03100e0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.11-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7fd7e03100e0>
> rowMedians(tmp)
  [1] -0.068043606  0.327058972  0.036334060  0.354742136  0.687384437
  [6] -0.369001028 -0.079886885  0.140266579  0.421357722  0.743310114
 [11]  0.326464976 -0.313854947 -0.188946021 -0.059853506  0.068299966
 [16] -0.070439558 -0.214874992  0.333199875  0.398330437  0.049226968
 [21] -0.260099299 -0.121541766 -0.605079423  0.012920131 -0.512487747
 [26]  0.547090101 -0.178189536  0.146632650 -0.231532457 -0.371180003
 [31]  0.596492861  0.273679261  0.584548519 -0.045660149 -0.017520105
 [36]  0.013136871 -0.067975305 -0.497337402  0.097970817 -0.315022010
 [41]  0.377375876 -0.250525919  0.342550434  0.230581243 -0.132476308
 [46] -0.079932526  0.202135953 -0.242194453  0.104536655 -0.296044771
 [51]  0.314639380 -0.067276207 -0.007758307  0.201948013 -0.294665769
 [56] -0.399105609 -0.250515912 -0.005839530 -0.303682349  0.210793813
 [61]  0.008451439 -0.515753121 -0.155373303  0.027417527  0.088043908
 [66] -0.231445989 -0.296052986 -0.327552434 -0.104819620  0.352021386
 [71] -0.588577614 -0.076395452 -0.113929730  0.002664981 -0.852593436
 [76]  0.650915258  0.020782469 -0.187161617  0.345338375 -0.093240048
 [81] -0.788239393  0.250942824 -0.178133153 -0.266298829  0.151098716
 [86] -0.291716965 -0.221175259  0.139306790  0.445878249  0.043059528
 [91]  0.401725935  0.300475480 -0.675621222  0.023173145 -0.001677925
 [96]  0.013185041  0.270536154 -0.086013149  0.481156405 -0.301526701
[101] -0.108109155  0.322705137  0.017728190 -0.185033146  0.110004527
[106]  0.205267942  0.046092577 -0.439736378  0.022161327 -0.049068994
[111]  0.087892743 -0.543756861  0.272084649 -0.675454070 -0.084668936
[116] -0.162387391  0.265429453  0.127474900 -0.189233360 -0.074286403
[121]  0.196904805  0.004984437  0.261959481 -0.435138353  0.551237053
[126] -0.784331137 -0.747504302 -0.052748578  0.264384861 -0.271572571
[131]  0.285370255  0.041008989  0.167765033  0.330926712 -0.609754237
[136] -0.189812401  0.030048406 -0.493848606 -0.157565895 -0.318270065
[141]  0.066779022  0.514851308  0.281873902 -0.420241195 -0.712973368
[146] -0.059035441 -0.359769503 -0.234405748 -0.086224484 -0.785580269
[151]  0.083875630 -0.208373027 -0.290518665  0.225248357 -0.254749787
[156]  0.689764216 -0.092731828  0.084605785  0.111135925 -0.052542727
[161] -0.282800968 -1.095025180 -0.568334087 -0.306694704  0.158453983
[166] -0.395702109  0.415022124  0.113216742  0.781800253  0.140631830
[171]  0.791342270 -0.434362622  0.117287570  0.155124968 -0.268941602
[176] -0.048418983  0.149176103 -0.705145723  0.404491470  0.489461699
[181]  0.333988323  0.035143084  0.037573575 -0.279952321 -0.195652389
[186] -0.305918341 -0.212892726  0.118455073  0.049814574 -0.569023403
[191] -0.185846264 -0.139322098  0.232886779  0.475937264 -0.097336060
[196] -0.310024823 -0.505990050 -0.193463747  0.116164880 -0.510062583
[201]  0.298442420  0.141219055  0.372359965  0.040991482 -0.106856335
[206]  0.202195676  0.076486096  0.015644970  0.259912144 -0.174365629
[211] -0.519822006  0.036579846 -0.131782838  0.103580065  0.400008612
[216]  0.339684262  0.062441191 -0.265440222 -0.152272056  0.004101997
[221]  0.350877361  0.300973907  0.016147829  0.071578745  0.555524387
[226] -0.214351071  0.028284338  0.260615392 -0.101824684 -0.155600245
> 
> proc.time()
   user  system elapsed 
  3.905  12.105  16.278 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-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: 0x7f9f615282e0>
> .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: 0x7f9f615282e0>
> .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: 0x7f9f615282e0>
> .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: 0x7f9f615282e0>
> 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: 0x7f9f1171c8d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f9f1171c8d0>
> .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: 0x7f9f1171c8d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f9f1171c8d0>
> .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: 0x7f9f1171c8d0>
> 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: 0x7f9f115068d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f9f115068d0>
> .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: 0x7f9f115068d0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7f9f115068d0>
> .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: 0x7f9f115068d0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7f9f115068d0>
> .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: 0x7f9f115068d0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7f9f115068d0>
> .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: 0x7f9f115068d0>
> 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: 0x7f9f13100000>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7f9f13100000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f9f13100000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f9f13100000>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile130a7649f1d0c" "BufferedMatrixFile130a7a2c3270" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile130a7649f1d0c" "BufferedMatrixFile130a7a2c3270" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f9f13100350>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f9f13100350>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7f9f13100350>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7f9f13100350>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7f9f13100350>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7f9f13100350>
> .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: 0x7f9f51414f30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7f9f51414f30>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7f9f51414f30>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7f9f51414f30>
> 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: 0x7f9f13200090>
> .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: 0x7f9f13200090>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.523   0.142   0.641 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-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.487   0.086   0.548 

Example timings