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

CHECK report for BufferedMatrix on merida1

This page was generated on 2019-04-16 11:54:35 -0400 (Tue, 16 Apr 2019).

Package 183/1649HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.46.0
Ben Bolstad
Snapshot Date: 2019-04-15 17:01:12 -0400 (Mon, 15 Apr 2019)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_8
Last Commit: 9fb17da
Last Changed Date: 2018-10-30 11:41:43 -0400 (Tue, 30 Oct 2018)
malbec1 Linux (Ubuntu 16.04.6 LTS) / x86_64  OK  OK  OK UNNEEDED, same version exists in internal repository
merida1 OS X 10.11.6 El Capitan / x86_64  OK  OK [ OK ] OK UNNEEDED, same version exists in internal repository

Summary

Package: BufferedMatrix
Version: 1.46.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.46.0.tar.gz
StartedAt: 2019-04-15 22:42:32 -0400 (Mon, 15 Apr 2019)
EndedAt: 2019-04-15 22:43:10 -0400 (Mon, 15 Apr 2019)
EllapsedTime: 38.4 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.46.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck’
* using R version 3.5.3 (2019-03-11)
* using platform: x86_64-apple-darwin15.6.0 (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.46.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.8-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/3.5/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -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 -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 -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 -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/3.5/Resources/library/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
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.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.353   0.089   0.416 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.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.8-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 410406 22.0     867110 46.4         NA   610957 32.7
Vcells 745501  5.7    8388608 64.0      65536  1801998 13.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] "Mon Apr 15 22:42:53 2019"
> 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] "Mon Apr 15 22:42:53 2019"
> 
> 
> 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: 0x7fee0bf03c00>
> 
> 
> 
> 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] "Mon Apr 15 22:42:56 2019"
> 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] "Mon Apr 15 22:42:57 2019"
> 
> ColMode(tmp2)
<pointer: 0x7fee0bf03c00>
> 
> 
> 
> ### 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.54681885 -0.8339565  0.2122096 -1.1112079
[2,] -0.09987717 -0.4209788 -1.6927968 -1.1113734
[3,] -0.74150068 -0.8423694  2.1452775  0.4947072
[4,] -0.17421624  1.1918463 -0.1103544  0.6215638
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 99.54681885 0.8339565 0.2122096 1.1112079
[2,]  0.09987717 0.4209788 1.6927968 1.1113734
[3,]  0.74150068 0.8423694 2.1452775 0.4947072
[4,]  0.17421624 1.1918463 0.1103544 0.6215638
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9773152 0.9132122 0.4606622 1.0541385
[2,] 0.3160335 0.6488288 1.3010752 1.0542170
[3,] 0.8611043 0.9178068 1.4646766 0.7033542
[4,] 0.4173922 1.0917171 0.3321964 0.7883932
> 
> 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.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.31997 34.96608 29.81883 36.65259
[2,]  28.26021 31.90927 39.70355 36.65354
[3,]  34.35254 35.02044 41.79204 32.52825
[4,]  29.34814 37.10902 28.43232 33.50550
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7fee10b21790>
> exp(tmp5)
<pointer: 0x7fee10b21790>
> log(tmp5,2)
<pointer: 0x7fee10b21790>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.8926
> Min(tmp5)
[1] 53.33362
> mean(tmp5)
[1] 72.98872
> Sum(tmp5)
[1] 14597.74
> Var(tmp5)
[1] 858.8607
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.76479 72.07028 68.36356 70.30411 72.93697 70.36780 70.57415 69.31334
 [9] 70.78742 73.40483
> rowSums(tmp5)
 [1] 1835.296 1441.406 1367.271 1406.082 1458.739 1407.356 1411.483 1386.267
 [9] 1415.748 1468.097
> rowVars(tmp5)
 [1] 7844.80912   73.91243   90.38614   47.26330   57.93177   58.00896
 [7]   85.57708  127.62536   69.27712  105.68348
> rowSd(tmp5)
 [1] 88.570927  8.597234  9.507162  6.874831  7.611293  7.616361  9.250788
 [8] 11.297139  8.323288 10.280247
> rowMax(tmp5)
 [1] 466.89263  86.18911  86.98466  80.60651  84.23498  82.60388  87.20390
 [8]  99.28508  84.25129  93.59974
> rowMin(tmp5)
 [1] 60.83028 58.81993 53.33362 59.17815 57.91282 53.85977 56.65068 55.25621
 [9] 56.71099 59.41010
> 
> colMeans(tmp5)
 [1] 106.65966  70.37301  73.38126  71.80939  69.18285  69.34583  69.35767
 [8]  72.71877  67.45077  69.05615  73.32779  75.75351  69.19725  73.47386
[15]  65.16500  69.25889  71.81766  77.12166  73.57879  71.74475
> colSums(tmp5)
 [1] 1066.5966  703.7301  733.8126  718.0939  691.8285  693.4583  693.5767
 [8]  727.1877  674.5077  690.5615  733.2779  757.5351  691.9725  734.7386
[15]  651.6500  692.5889  718.1766  771.2166  735.7879  717.4475
> colVars(tmp5)
 [1] 16047.28737    84.57727   113.99808    59.74168    61.60804    49.02796
 [7]    76.79489    78.70528    76.04674    54.15744    88.86333    37.19813
[13]    54.02772    72.74943    33.84290   104.88531    68.71138   125.22632
[19]   116.45488    89.67571
> colSd(tmp5)
 [1] 126.677888   9.196590  10.676989   7.729274   7.849079   7.001997
 [7]   8.763269   8.871600   8.720478   7.359174   9.426735   6.099027
[13]   7.350355   8.529328   5.817465  10.241353   8.289233  11.190457
[19]  10.791426   9.469726
> colMax(tmp5)
 [1] 466.89263  86.19313  86.98466  83.85041  81.69279  78.45082  80.90506
 [8]  85.10278  80.67383  77.51546  93.59974  83.15671  79.41399  87.20390
[15]  73.36752  87.26345  83.68776  99.28508  87.09852  84.25129
> colMin(tmp5)
 [1] 58.81993 55.25621 59.17815 58.01569 59.36300 56.36203 57.91282 55.25699
 [9] 53.33362 55.88554 58.87426 63.54825 56.78020 60.97557 56.65068 56.59448
[17] 60.83401 59.41010 53.85977 61.38577
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 91.76479 72.07028 68.36356 70.30411 72.93697 70.36780 70.57415 69.31334
 [9] 70.78742       NA
> rowSums(tmp5)
 [1] 1835.296 1441.406 1367.271 1406.082 1458.739 1407.356 1411.483 1386.267
 [9] 1415.748       NA
> rowVars(tmp5)
 [1] 7844.80912   73.91243   90.38614   47.26330   57.93177   58.00896
 [7]   85.57708  127.62536   69.27712  104.72493
> rowSd(tmp5)
 [1] 88.570927  8.597234  9.507162  6.874831  7.611293  7.616361  9.250788
 [8] 11.297139  8.323288 10.233520
> rowMax(tmp5)
 [1] 466.89263  86.18911  86.98466  80.60651  84.23498  82.60388  87.20390
 [8]  99.28508  84.25129        NA
> rowMin(tmp5)
 [1] 60.83028 58.81993 53.33362 59.17815 57.91282 53.85977 56.65068 55.25621
 [9] 56.71099       NA
> 
> colMeans(tmp5)
 [1] 106.65966  70.37301  73.38126  71.80939  69.18285  69.34583  69.35767
 [8]  72.71877  67.45077  69.05615  73.32779  75.75351  69.19725  73.47386
[15]  65.16500  69.25889  71.81766  77.12166  73.57879        NA
> colSums(tmp5)
 [1] 1066.5966  703.7301  733.8126  718.0939  691.8285  693.4583  693.5767
 [8]  727.1877  674.5077  690.5615  733.2779  757.5351  691.9725  734.7386
[15]  651.6500  692.5889  718.1766  771.2166  735.7879        NA
> colVars(tmp5)
 [1] 16047.28737    84.57727   113.99808    59.74168    61.60804    49.02796
 [7]    76.79489    78.70528    76.04674    54.15744    88.86333    37.19813
[13]    54.02772    72.74943    33.84290   104.88531    68.71138   125.22632
[19]   116.45488          NA
> colSd(tmp5)
 [1] 126.677888   9.196590  10.676989   7.729274   7.849079   7.001997
 [7]   8.763269   8.871600   8.720478   7.359174   9.426735   6.099027
[13]   7.350355   8.529328   5.817465  10.241353   8.289233  11.190457
[19]  10.791426         NA
> colMax(tmp5)
 [1] 466.89263  86.19313  86.98466  83.85041  81.69279  78.45082  80.90506
 [8]  85.10278  80.67383  77.51546  93.59974  83.15671  79.41399  87.20390
[15]  73.36752  87.26345  83.68776  99.28508  87.09852        NA
> colMin(tmp5)
 [1] 58.81993 55.25621 59.17815 58.01569 59.36300 56.36203 57.91282 55.25699
 [9] 53.33362 55.88554 58.87426 63.54825 56.78020 60.97557 56.65068 56.59448
[17] 60.83401 59.41010 53.85977       NA
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.8926
> Min(tmp5,na.rm=TRUE)
[1] 53.33362
> mean(tmp5,na.rm=TRUE)
[1] 73.04094
> Sum(tmp5,na.rm=TRUE)
[1] 14535.15
> Var(tmp5,na.rm=TRUE)
[1] 862.6503
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.76479 72.07028 68.36356 70.30411 72.93697 70.36780 70.57415 69.31334
 [9] 70.78742 73.97362
> rowSums(tmp5,na.rm=TRUE)
 [1] 1835.296 1441.406 1367.271 1406.082 1458.739 1407.356 1411.483 1386.267
 [9] 1415.748 1405.499
> rowVars(tmp5,na.rm=TRUE)
 [1] 7844.80912   73.91243   90.38614   47.26330   57.93177   58.00896
 [7]   85.57708  127.62536   69.27712  104.72493
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.570927  8.597234  9.507162  6.874831  7.611293  7.616361  9.250788
 [8] 11.297139  8.323288 10.233520
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.89263  86.18911  86.98466  80.60651  84.23498  82.60388  87.20390
 [8]  99.28508  84.25129  93.59974
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.83028 58.81993 53.33362 59.17815 57.91282 53.85977 56.65068 55.25621
 [9] 56.71099 59.41010
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 106.65966  70.37301  73.38126  71.80939  69.18285  69.34583  69.35767
 [8]  72.71877  67.45077  69.05615  73.32779  75.75351  69.19725  73.47386
[15]  65.16500  69.25889  71.81766  77.12166  73.57879  72.76107
> colSums(tmp5,na.rm=TRUE)
 [1] 1066.5966  703.7301  733.8126  718.0939  691.8285  693.4583  693.5767
 [8]  727.1877  674.5077  690.5615  733.2779  757.5351  691.9725  734.7386
[15]  651.6500  692.5889  718.1766  771.2166  735.7879  654.8496
> colVars(tmp5,na.rm=TRUE)
 [1] 16047.28737    84.57727   113.99808    59.74168    61.60804    49.02796
 [7]    76.79489    78.70528    76.04674    54.15744    88.86333    37.19813
[13]    54.02772    72.74943    33.84290   104.88531    68.71138   125.22632
[19]   116.45488    89.26497
> colSd(tmp5,na.rm=TRUE)
 [1] 126.677888   9.196590  10.676989   7.729274   7.849079   7.001997
 [7]   8.763269   8.871600   8.720478   7.359174   9.426735   6.099027
[13]   7.350355   8.529328   5.817465  10.241353   8.289233  11.190457
[19]  10.791426   9.448014
> colMax(tmp5,na.rm=TRUE)
 [1] 466.89263  86.19313  86.98466  83.85041  81.69279  78.45082  80.90506
 [8]  85.10278  80.67383  77.51546  93.59974  83.15671  79.41399  87.20390
[15]  73.36752  87.26345  83.68776  99.28508  87.09852  84.25129
> colMin(tmp5,na.rm=TRUE)
 [1] 58.81993 55.25621 59.17815 58.01569 59.36300 56.36203 57.91282 55.25699
 [9] 53.33362 55.88554 58.87426 63.54825 56.78020 60.97557 56.65068 56.59448
[17] 60.83401 59.41010 53.85977 61.38577
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.76479 72.07028 68.36356 70.30411 72.93697 70.36780 70.57415 69.31334
 [9] 70.78742      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1835.296 1441.406 1367.271 1406.082 1458.739 1407.356 1411.483 1386.267
 [9] 1415.748    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 7844.80912   73.91243   90.38614   47.26330   57.93177   58.00896
 [7]   85.57708  127.62536   69.27712         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.570927  8.597234  9.507162  6.874831  7.611293  7.616361  9.250788
 [8] 11.297139  8.323288        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.89263  86.18911  86.98466  80.60651  84.23498  82.60388  87.20390
 [8]  99.28508  84.25129        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.83028 58.81993 53.33362 59.17815 57.91282 53.85977 56.65068 55.25621
 [9] 56.71099       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.07188  68.61522  73.79769  70.47150  68.83177  70.32773  68.44982
 [8]  73.53500  66.55940  69.67005  71.07535  76.36184  69.45070  73.82781
[15]  65.11965  67.25839  70.49876  79.08961  72.07660       NaN
> colSums(tmp5,na.rm=TRUE)
 [1] 999.6470 617.5370 664.1792 634.2435 619.4859 632.9495 616.0484 661.8150
 [9] 599.0346 627.0304 639.6781 687.2566 625.0563 664.4503 586.0769 605.3255
[17] 634.4888 711.8065 648.6894   0.0000
> colVars(tmp5,na.rm=TRUE)
 [1] 17834.18656    60.38885   126.29696    47.07242    67.92243    44.31006
 [7]    77.12228    81.04831    76.61408    56.68730    42.89458    37.68472
[13]    60.05852    80.43369    38.05012    72.97319    57.73094    97.31029
[19]   105.62520          NA
> colSd(tmp5,na.rm=TRUE)
 [1] 133.544699   7.771026  11.238192   6.860935   8.241506   6.656580
 [7]   8.781929   9.002683   8.752947   7.529097   6.549395   6.138788
[13]   7.749743   8.968483   6.168478   8.542434   7.598088   9.864598
[19]  10.277412         NA
> colMax(tmp5,na.rm=TRUE)
 [1] 466.89263  79.50564  86.98466  76.28955  81.69279  78.45082  80.90506
 [8]  85.10278  80.67383  77.51546  78.09743  83.15671  79.41399  87.20390
[15]  73.36752  81.42702  83.11113  99.28508  84.99841      -Inf
> colMin(tmp5,na.rm=TRUE)
 [1] 58.81993 55.25621 59.17815 58.01569 59.36300 56.36203 57.91282 55.25699
 [9] 53.33362 55.88554 58.87426 63.54825 56.78020 60.97557 56.65068 56.59448
[17] 60.83401 65.08252 53.85977      Inf
> 
> 
> 
> 
> 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] 180.4919 258.3827 253.1794 301.7204 193.5614 213.1570 169.5038 267.6973
 [9] 225.3764 195.2554
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 180.4919 258.3827 253.1794 301.7204 193.5614 213.1570 169.5038 267.6973
 [9] 225.3764 195.2554
> 
> 
> 
> 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]  1.421085e-13 -1.421085e-13 -2.842171e-14 -5.684342e-14  1.136868e-13
 [6] -2.273737e-13  5.684342e-14  0.000000e+00 -5.684342e-14 -2.842171e-14
[11]  2.842171e-13 -5.684342e-14 -2.842171e-14  2.842171e-13  0.000000e+00
[16]  5.684342e-14 -1.136868e-13 -1.136868e-13 -2.842171e-14  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## 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   9 
7   11 
7   1 
9   4 
4   17 
3   11 
2   12 
1   17 
2   1 
4   2 
9   20 
6   19 
1   13 
3   5 
3   14 
4   6 
7   17 
1   4 
5   8 
10   18 
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.754224
> Min(tmp)
[1] -3.357582
> mean(tmp)
[1] -0.03489907
> Sum(tmp)
[1] -3.489907
> Var(tmp)
[1] 1.021759
> 
> rowMeans(tmp)
[1] -0.03489907
> rowSums(tmp)
[1] -3.489907
> rowVars(tmp)
[1] 1.021759
> rowSd(tmp)
[1] 1.010821
> rowMax(tmp)
[1] 2.754224
> rowMin(tmp)
[1] -3.357582
> 
> colMeans(tmp)
  [1] -1.13573544  0.17081048 -0.89596461 -0.35975825  0.95578283  0.22167329
  [7] -1.10217303  1.45104762 -0.57757160  0.76461479 -0.74496110 -1.28627932
 [13]  0.73951991 -0.31268898 -0.26733306 -1.02805615 -0.79712453  0.63503481
 [19] -0.37379926 -1.00888358 -0.26905649 -0.78665805 -0.08460737 -0.54260181
 [25]  0.15324752 -1.39463997 -0.77727183  0.43561377  1.31236680 -0.77233473
 [31]  0.99898775  1.72372547  0.61034204 -2.41876864 -1.15043692 -0.03418723
 [37] -0.21539015 -0.16493187 -0.73157408  0.91048952  0.50978071  2.06849512
 [43] -0.01944232 -0.97996206  2.49128095 -0.04195505 -1.22864602  0.19531610
 [49] -0.40027722 -0.29582330 -1.21050802 -0.13935320  0.55160411  0.91157100
 [55]  0.34888419  0.38739220  0.66331324 -1.25338850 -0.22359671  0.47102445
 [61]  1.46699331  1.32128076  0.32557221 -0.01185674  0.72641511 -0.43068280
 [67]  0.03155065  1.24891216  0.54761157 -0.34724175 -0.82806131  0.07083034
 [73]  0.07429687  1.18351297  0.86572379 -0.79443356 -1.73309956  0.77942556
 [79] -0.20308934  1.02839823 -0.10448423  0.26872657 -1.00091317  0.06656402
 [85] -0.06381272 -3.35758217  0.08980416 -1.47682062 -1.06863540 -1.98964176
 [91]  1.08929685 -1.13487065  1.52384061  0.20844296  0.18027254 -0.45054388
 [97] -0.58197732  0.03237768  2.75422375  1.54758902
> colSums(tmp)
  [1] -1.13573544  0.17081048 -0.89596461 -0.35975825  0.95578283  0.22167329
  [7] -1.10217303  1.45104762 -0.57757160  0.76461479 -0.74496110 -1.28627932
 [13]  0.73951991 -0.31268898 -0.26733306 -1.02805615 -0.79712453  0.63503481
 [19] -0.37379926 -1.00888358 -0.26905649 -0.78665805 -0.08460737 -0.54260181
 [25]  0.15324752 -1.39463997 -0.77727183  0.43561377  1.31236680 -0.77233473
 [31]  0.99898775  1.72372547  0.61034204 -2.41876864 -1.15043692 -0.03418723
 [37] -0.21539015 -0.16493187 -0.73157408  0.91048952  0.50978071  2.06849512
 [43] -0.01944232 -0.97996206  2.49128095 -0.04195505 -1.22864602  0.19531610
 [49] -0.40027722 -0.29582330 -1.21050802 -0.13935320  0.55160411  0.91157100
 [55]  0.34888419  0.38739220  0.66331324 -1.25338850 -0.22359671  0.47102445
 [61]  1.46699331  1.32128076  0.32557221 -0.01185674  0.72641511 -0.43068280
 [67]  0.03155065  1.24891216  0.54761157 -0.34724175 -0.82806131  0.07083034
 [73]  0.07429687  1.18351297  0.86572379 -0.79443356 -1.73309956  0.77942556
 [79] -0.20308934  1.02839823 -0.10448423  0.26872657 -1.00091317  0.06656402
 [85] -0.06381272 -3.35758217  0.08980416 -1.47682062 -1.06863540 -1.98964176
 [91]  1.08929685 -1.13487065  1.52384061  0.20844296  0.18027254 -0.45054388
 [97] -0.58197732  0.03237768  2.75422375  1.54758902
> 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] -1.13573544  0.17081048 -0.89596461 -0.35975825  0.95578283  0.22167329
  [7] -1.10217303  1.45104762 -0.57757160  0.76461479 -0.74496110 -1.28627932
 [13]  0.73951991 -0.31268898 -0.26733306 -1.02805615 -0.79712453  0.63503481
 [19] -0.37379926 -1.00888358 -0.26905649 -0.78665805 -0.08460737 -0.54260181
 [25]  0.15324752 -1.39463997 -0.77727183  0.43561377  1.31236680 -0.77233473
 [31]  0.99898775  1.72372547  0.61034204 -2.41876864 -1.15043692 -0.03418723
 [37] -0.21539015 -0.16493187 -0.73157408  0.91048952  0.50978071  2.06849512
 [43] -0.01944232 -0.97996206  2.49128095 -0.04195505 -1.22864602  0.19531610
 [49] -0.40027722 -0.29582330 -1.21050802 -0.13935320  0.55160411  0.91157100
 [55]  0.34888419  0.38739220  0.66331324 -1.25338850 -0.22359671  0.47102445
 [61]  1.46699331  1.32128076  0.32557221 -0.01185674  0.72641511 -0.43068280
 [67]  0.03155065  1.24891216  0.54761157 -0.34724175 -0.82806131  0.07083034
 [73]  0.07429687  1.18351297  0.86572379 -0.79443356 -1.73309956  0.77942556
 [79] -0.20308934  1.02839823 -0.10448423  0.26872657 -1.00091317  0.06656402
 [85] -0.06381272 -3.35758217  0.08980416 -1.47682062 -1.06863540 -1.98964176
 [91]  1.08929685 -1.13487065  1.52384061  0.20844296  0.18027254 -0.45054388
 [97] -0.58197732  0.03237768  2.75422375  1.54758902
> colMin(tmp)
  [1] -1.13573544  0.17081048 -0.89596461 -0.35975825  0.95578283  0.22167329
  [7] -1.10217303  1.45104762 -0.57757160  0.76461479 -0.74496110 -1.28627932
 [13]  0.73951991 -0.31268898 -0.26733306 -1.02805615 -0.79712453  0.63503481
 [19] -0.37379926 -1.00888358 -0.26905649 -0.78665805 -0.08460737 -0.54260181
 [25]  0.15324752 -1.39463997 -0.77727183  0.43561377  1.31236680 -0.77233473
 [31]  0.99898775  1.72372547  0.61034204 -2.41876864 -1.15043692 -0.03418723
 [37] -0.21539015 -0.16493187 -0.73157408  0.91048952  0.50978071  2.06849512
 [43] -0.01944232 -0.97996206  2.49128095 -0.04195505 -1.22864602  0.19531610
 [49] -0.40027722 -0.29582330 -1.21050802 -0.13935320  0.55160411  0.91157100
 [55]  0.34888419  0.38739220  0.66331324 -1.25338850 -0.22359671  0.47102445
 [61]  1.46699331  1.32128076  0.32557221 -0.01185674  0.72641511 -0.43068280
 [67]  0.03155065  1.24891216  0.54761157 -0.34724175 -0.82806131  0.07083034
 [73]  0.07429687  1.18351297  0.86572379 -0.79443356 -1.73309956  0.77942556
 [79] -0.20308934  1.02839823 -0.10448423  0.26872657 -1.00091317  0.06656402
 [85] -0.06381272 -3.35758217  0.08980416 -1.47682062 -1.06863540 -1.98964176
 [91]  1.08929685 -1.13487065  1.52384061  0.20844296  0.18027254 -0.45054388
 [97] -0.58197732  0.03237768  2.75422375  1.54758902
> colMedians(tmp)
  [1] -1.13573544  0.17081048 -0.89596461 -0.35975825  0.95578283  0.22167329
  [7] -1.10217303  1.45104762 -0.57757160  0.76461479 -0.74496110 -1.28627932
 [13]  0.73951991 -0.31268898 -0.26733306 -1.02805615 -0.79712453  0.63503481
 [19] -0.37379926 -1.00888358 -0.26905649 -0.78665805 -0.08460737 -0.54260181
 [25]  0.15324752 -1.39463997 -0.77727183  0.43561377  1.31236680 -0.77233473
 [31]  0.99898775  1.72372547  0.61034204 -2.41876864 -1.15043692 -0.03418723
 [37] -0.21539015 -0.16493187 -0.73157408  0.91048952  0.50978071  2.06849512
 [43] -0.01944232 -0.97996206  2.49128095 -0.04195505 -1.22864602  0.19531610
 [49] -0.40027722 -0.29582330 -1.21050802 -0.13935320  0.55160411  0.91157100
 [55]  0.34888419  0.38739220  0.66331324 -1.25338850 -0.22359671  0.47102445
 [61]  1.46699331  1.32128076  0.32557221 -0.01185674  0.72641511 -0.43068280
 [67]  0.03155065  1.24891216  0.54761157 -0.34724175 -0.82806131  0.07083034
 [73]  0.07429687  1.18351297  0.86572379 -0.79443356 -1.73309956  0.77942556
 [79] -0.20308934  1.02839823 -0.10448423  0.26872657 -1.00091317  0.06656402
 [85] -0.06381272 -3.35758217  0.08980416 -1.47682062 -1.06863540 -1.98964176
 [91]  1.08929685 -1.13487065  1.52384061  0.20844296  0.18027254 -0.45054388
 [97] -0.58197732  0.03237768  2.75422375  1.54758902
> colRanges(tmp)
          [,1]      [,2]       [,3]       [,4]      [,5]      [,6]      [,7]
[1,] -1.135735 0.1708105 -0.8959646 -0.3597583 0.9557828 0.2216733 -1.102173
[2,] -1.135735 0.1708105 -0.8959646 -0.3597583 0.9557828 0.2216733 -1.102173
         [,8]       [,9]     [,10]      [,11]     [,12]     [,13]     [,14]
[1,] 1.451048 -0.5775716 0.7646148 -0.7449611 -1.286279 0.7395199 -0.312689
[2,] 1.451048 -0.5775716 0.7646148 -0.7449611 -1.286279 0.7395199 -0.312689
          [,15]     [,16]      [,17]     [,18]      [,19]     [,20]      [,21]
[1,] -0.2673331 -1.028056 -0.7971245 0.6350348 -0.3737993 -1.008884 -0.2690565
[2,] -0.2673331 -1.028056 -0.7971245 0.6350348 -0.3737993 -1.008884 -0.2690565
          [,22]       [,23]      [,24]     [,25]    [,26]      [,27]     [,28]
[1,] -0.7866581 -0.08460737 -0.5426018 0.1532475 -1.39464 -0.7772718 0.4356138
[2,] -0.7866581 -0.08460737 -0.5426018 0.1532475 -1.39464 -0.7772718 0.4356138
        [,29]      [,30]     [,31]    [,32]    [,33]     [,34]     [,35]
[1,] 1.312367 -0.7723347 0.9989878 1.723725 0.610342 -2.418769 -1.150437
[2,] 1.312367 -0.7723347 0.9989878 1.723725 0.610342 -2.418769 -1.150437
           [,36]      [,37]      [,38]      [,39]     [,40]     [,41]    [,42]
[1,] -0.03418723 -0.2153901 -0.1649319 -0.7315741 0.9104895 0.5097807 2.068495
[2,] -0.03418723 -0.2153901 -0.1649319 -0.7315741 0.9104895 0.5097807 2.068495
           [,43]      [,44]    [,45]       [,46]     [,47]     [,48]      [,49]
[1,] -0.01944232 -0.9799621 2.491281 -0.04195505 -1.228646 0.1953161 -0.4002772
[2,] -0.01944232 -0.9799621 2.491281 -0.04195505 -1.228646 0.1953161 -0.4002772
          [,50]     [,51]      [,52]     [,53]    [,54]     [,55]     [,56]
[1,] -0.2958233 -1.210508 -0.1393532 0.5516041 0.911571 0.3488842 0.3873922
[2,] -0.2958233 -1.210508 -0.1393532 0.5516041 0.911571 0.3488842 0.3873922
         [,57]     [,58]      [,59]     [,60]    [,61]    [,62]     [,63]
[1,] 0.6633132 -1.253388 -0.2235967 0.4710244 1.466993 1.321281 0.3255722
[2,] 0.6633132 -1.253388 -0.2235967 0.4710244 1.466993 1.321281 0.3255722
           [,64]     [,65]      [,66]      [,67]    [,68]     [,69]      [,70]
[1,] -0.01185674 0.7264151 -0.4306828 0.03155065 1.248912 0.5476116 -0.3472417
[2,] -0.01185674 0.7264151 -0.4306828 0.03155065 1.248912 0.5476116 -0.3472417
          [,71]      [,72]      [,73]    [,74]     [,75]      [,76]   [,77]
[1,] -0.8280613 0.07083034 0.07429687 1.183513 0.8657238 -0.7944336 -1.7331
[2,] -0.8280613 0.07083034 0.07429687 1.183513 0.8657238 -0.7944336 -1.7331
         [,78]      [,79]    [,80]      [,81]     [,82]     [,83]      [,84]
[1,] 0.7794256 -0.2030893 1.028398 -0.1044842 0.2687266 -1.000913 0.06656402
[2,] 0.7794256 -0.2030893 1.028398 -0.1044842 0.2687266 -1.000913 0.06656402
           [,85]     [,86]      [,87]     [,88]     [,89]     [,90]    [,91]
[1,] -0.06381272 -3.357582 0.08980416 -1.476821 -1.068635 -1.989642 1.089297
[2,] -0.06381272 -3.357582 0.08980416 -1.476821 -1.068635 -1.989642 1.089297
         [,92]    [,93]    [,94]     [,95]      [,96]      [,97]      [,98]
[1,] -1.134871 1.523841 0.208443 0.1802725 -0.4505439 -0.5819773 0.03237768
[2,] -1.134871 1.523841 0.208443 0.1802725 -0.4505439 -0.5819773 0.03237768
        [,99]   [,100]
[1,] 2.754224 1.547589
[2,] 2.754224 1.547589
> 
> 
> Max(tmp2)
[1] 2.681737
> Min(tmp2)
[1] -2.090442
> mean(tmp2)
[1] -0.14211
> Sum(tmp2)
[1] -14.211
> Var(tmp2)
[1] 1.051647
> 
> rowMeans(tmp2)
  [1] -0.436207444  2.681737404  1.480251732 -0.279429662 -0.608753483
  [6] -0.028479444 -0.372736208  0.648639709 -2.053584387  0.152918563
 [11]  0.859630382  1.101139388 -1.381681415 -1.516087474 -0.734526139
 [16] -0.995147780 -0.717557979 -1.662152160  1.561961564  1.226516927
 [21] -0.982889581  0.955336051  0.262269871 -0.353191512 -2.083800660
 [26]  0.300279320 -1.600515534  0.627068190 -0.174230591 -0.422526802
 [31]  0.672018960  0.062829239 -1.162151390  0.823770848 -1.958029408
 [36]  0.939022007  1.290243771  0.867429873 -0.879481045  0.050143864
 [41]  0.633893984  0.001198771  0.620158027  0.257563601 -0.194567953
 [46] -0.227131504 -0.258073833  0.211442175 -0.913177268 -0.557938703
 [51] -1.937854713  0.950128450  0.666435012  0.438674616 -1.970970011
 [56]  0.592146133  1.602155792  0.592363692  0.487781362 -0.983202424
 [61] -0.103375943 -1.828384246 -0.557529225 -0.818670928 -0.311719055
 [66]  0.057865708  0.053833704  0.956645601  0.277422876 -1.640802508
 [71] -0.595504149  0.124784941  0.166690542 -0.032277553  0.555363479
 [76] -1.017360358 -1.573588632  0.696120891 -0.851253906  1.278515816
 [81] -1.575010898  1.474764229  0.067154466  0.238758080 -1.369466072
 [86]  0.382900404  0.132496160 -2.090441826 -0.983367065 -0.610233365
 [91] -0.509788118  1.362298814  1.132849623 -1.005399863  1.845462395
 [96] -0.405617914 -1.077623971 -1.883108152  0.036805136 -0.382286235
> rowSums(tmp2)
  [1] -0.436207444  2.681737404  1.480251732 -0.279429662 -0.608753483
  [6] -0.028479444 -0.372736208  0.648639709 -2.053584387  0.152918563
 [11]  0.859630382  1.101139388 -1.381681415 -1.516087474 -0.734526139
 [16] -0.995147780 -0.717557979 -1.662152160  1.561961564  1.226516927
 [21] -0.982889581  0.955336051  0.262269871 -0.353191512 -2.083800660
 [26]  0.300279320 -1.600515534  0.627068190 -0.174230591 -0.422526802
 [31]  0.672018960  0.062829239 -1.162151390  0.823770848 -1.958029408
 [36]  0.939022007  1.290243771  0.867429873 -0.879481045  0.050143864
 [41]  0.633893984  0.001198771  0.620158027  0.257563601 -0.194567953
 [46] -0.227131504 -0.258073833  0.211442175 -0.913177268 -0.557938703
 [51] -1.937854713  0.950128450  0.666435012  0.438674616 -1.970970011
 [56]  0.592146133  1.602155792  0.592363692  0.487781362 -0.983202424
 [61] -0.103375943 -1.828384246 -0.557529225 -0.818670928 -0.311719055
 [66]  0.057865708  0.053833704  0.956645601  0.277422876 -1.640802508
 [71] -0.595504149  0.124784941  0.166690542 -0.032277553  0.555363479
 [76] -1.017360358 -1.573588632  0.696120891 -0.851253906  1.278515816
 [81] -1.575010898  1.474764229  0.067154466  0.238758080 -1.369466072
 [86]  0.382900404  0.132496160 -2.090441826 -0.983367065 -0.610233365
 [91] -0.509788118  1.362298814  1.132849623 -1.005399863  1.845462395
 [96] -0.405617914 -1.077623971 -1.883108152  0.036805136 -0.382286235
> 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.436207444  2.681737404  1.480251732 -0.279429662 -0.608753483
  [6] -0.028479444 -0.372736208  0.648639709 -2.053584387  0.152918563
 [11]  0.859630382  1.101139388 -1.381681415 -1.516087474 -0.734526139
 [16] -0.995147780 -0.717557979 -1.662152160  1.561961564  1.226516927
 [21] -0.982889581  0.955336051  0.262269871 -0.353191512 -2.083800660
 [26]  0.300279320 -1.600515534  0.627068190 -0.174230591 -0.422526802
 [31]  0.672018960  0.062829239 -1.162151390  0.823770848 -1.958029408
 [36]  0.939022007  1.290243771  0.867429873 -0.879481045  0.050143864
 [41]  0.633893984  0.001198771  0.620158027  0.257563601 -0.194567953
 [46] -0.227131504 -0.258073833  0.211442175 -0.913177268 -0.557938703
 [51] -1.937854713  0.950128450  0.666435012  0.438674616 -1.970970011
 [56]  0.592146133  1.602155792  0.592363692  0.487781362 -0.983202424
 [61] -0.103375943 -1.828384246 -0.557529225 -0.818670928 -0.311719055
 [66]  0.057865708  0.053833704  0.956645601  0.277422876 -1.640802508
 [71] -0.595504149  0.124784941  0.166690542 -0.032277553  0.555363479
 [76] -1.017360358 -1.573588632  0.696120891 -0.851253906  1.278515816
 [81] -1.575010898  1.474764229  0.067154466  0.238758080 -1.369466072
 [86]  0.382900404  0.132496160 -2.090441826 -0.983367065 -0.610233365
 [91] -0.509788118  1.362298814  1.132849623 -1.005399863  1.845462395
 [96] -0.405617914 -1.077623971 -1.883108152  0.036805136 -0.382286235
> rowMin(tmp2)
  [1] -0.436207444  2.681737404  1.480251732 -0.279429662 -0.608753483
  [6] -0.028479444 -0.372736208  0.648639709 -2.053584387  0.152918563
 [11]  0.859630382  1.101139388 -1.381681415 -1.516087474 -0.734526139
 [16] -0.995147780 -0.717557979 -1.662152160  1.561961564  1.226516927
 [21] -0.982889581  0.955336051  0.262269871 -0.353191512 -2.083800660
 [26]  0.300279320 -1.600515534  0.627068190 -0.174230591 -0.422526802
 [31]  0.672018960  0.062829239 -1.162151390  0.823770848 -1.958029408
 [36]  0.939022007  1.290243771  0.867429873 -0.879481045  0.050143864
 [41]  0.633893984  0.001198771  0.620158027  0.257563601 -0.194567953
 [46] -0.227131504 -0.258073833  0.211442175 -0.913177268 -0.557938703
 [51] -1.937854713  0.950128450  0.666435012  0.438674616 -1.970970011
 [56]  0.592146133  1.602155792  0.592363692  0.487781362 -0.983202424
 [61] -0.103375943 -1.828384246 -0.557529225 -0.818670928 -0.311719055
 [66]  0.057865708  0.053833704  0.956645601  0.277422876 -1.640802508
 [71] -0.595504149  0.124784941  0.166690542 -0.032277553  0.555363479
 [76] -1.017360358 -1.573588632  0.696120891 -0.851253906  1.278515816
 [81] -1.575010898  1.474764229  0.067154466  0.238758080 -1.369466072
 [86]  0.382900404  0.132496160 -2.090441826 -0.983367065 -0.610233365
 [91] -0.509788118  1.362298814  1.132849623 -1.005399863  1.845462395
 [96] -0.405617914 -1.077623971 -1.883108152  0.036805136 -0.382286235
> 
> colMeans(tmp2)
[1] -0.14211
> colSums(tmp2)
[1] -14.211
> colVars(tmp2)
[1] 1.051647
> colSd(tmp2)
[1] 1.025498
> colMax(tmp2)
[1] 2.681737
> colMin(tmp2)
[1] -2.090442
> colMedians(tmp2)
[1] -0.0303785
> colRanges(tmp2)
          [,1]
[1,] -2.090442
[2,]  2.681737
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.3388136  8.7324261 -0.7971716  2.2764847  4.6364646  1.3978307
 [7] 10.2172950  2.8763700 -0.1091605  1.6961567
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.2645312
[2,] -0.4534326
[3,]  0.2074173
[4,]  0.6992524
[5,]  1.3295380
> 
> rowApply(tmp,sum)
 [1]  2.4995205  2.1263301  0.2879000  3.5759247  4.2807803 -4.1891557
 [7]  9.1686047  9.3978883  0.7861408  4.3315754
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    1    5    2    6    5    6    5    3     7
 [2,]   10    5    7    5   10   10    7    7    1     8
 [3,]    1    3    4    8    3    2    9    2    7     4
 [4,]    2    7    1    1    8    7    5   10    5     9
 [5,]    7    9    6    3    4    3    8    6    4     6
 [6,]    8    6    2    4    1    9    1    8    9    10
 [7,]    3   10   10    9    9    6   10    3   10     5
 [8,]    9    8    3    6    2    8    2    9    6     3
 [9,]    6    2    8    7    7    1    3    4    8     2
[10,]    5    4    9   10    5    4    4    1    2     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.71424905  1.81588566 -0.07718397  0.37593274 -1.01800080  1.60937845
 [7] -0.96350287  6.19246997  0.04322233  1.25798398 -2.17961001 -0.24699385
[13]  0.34379320  1.55280713  1.17751452  0.13360187 -1.18161869  0.87777541
[19]  3.53853330  4.55812976
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5361289
[2,] -0.9683192
[3,] -0.3501732
[4,] -0.2337344
[5,]  0.3741065
> 
> rowApply(tmp,sum)
[1]  6.287033 -4.557662  5.701577  5.756607  1.908315
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    3   16    5    4    1
[2,]    8   20    7    9    4
[3,]    4    8    1   15   20
[4,]   13    2   10   19   13
[5,]    5    9   11   11   11
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]        [,4]        [,5]         [,6]
[1,] -0.9683192  0.05037483 -0.7878940  0.60074474 -0.66338836  1.116875098
[2,]  0.3741065  2.31387865 -0.9963710 -1.72655891 -0.91325121  1.454526448
[3,] -0.2337344 -0.14447561 -0.9679539  0.05434623  0.07719229 -0.005569981
[4,] -0.3501732  0.26826043  0.6911065  1.21221543  0.39196401 -1.124209763
[5,] -1.5361289 -0.67215264  1.9839284  0.23518525  0.08948247  0.167756648
           [,7]      [,8]        [,9]       [,10]      [,11]      [,12]
[1,] -0.1053142 0.2326084  1.00584552  0.22505302  0.8331492 -1.8788258
[2,]  0.2394338 1.1396065 -0.47592837 -1.84033055 -1.4609716  0.1750699
[3,]  1.5290536 1.2938813 -0.42628977  1.87125279  0.7558732  0.1259364
[4,] -1.7550097 3.0791661 -0.12586421  1.07385258 -0.8931625  0.3612860
[5,] -0.8716664 0.4472078  0.06545915 -0.07184385 -1.4144983  0.9695398
          [,13]      [,14]        [,15]      [,16]      [,17]       [,18]
[1,]  0.8990839  2.0045875  0.007803946  1.7895263 -1.4718316  0.16718830
[2,] -1.1227310 -0.3233430 -1.118238432 -1.5145095 -1.0450096 -0.01640626
[3,] -0.3828775 -0.1333759  0.700323140 -0.2152886  0.4014797  0.99575316
[4,] -0.2618576  0.6041505 -0.035858371  0.4587494  0.5756759 -0.03256651
[5,]  1.2121755 -0.5992118  1.623484240 -0.3848757  0.3580670 -0.23619328
          [,19]      [,20]
[1,]  0.5357970  2.6939682
[2,]  1.9335444  0.3658208
[3,]  0.6978069 -0.2917561
[4,]  0.8259839  0.7928985
[5,] -0.4545989  0.9971984
> 
> 
> 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.8-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.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  643  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  557  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.8-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.2905391 -0.9325353 -0.08490627 -0.746611 -0.85045 0.04060528 0.06394053
          col8       col9     col10    col11     col12      col13     col14
row1 -1.813229 -0.1884056 0.1388779 1.113085 0.4490033 -0.8496906 0.4162083
           col15    col16      col17   col18      col19      col20
row1 0.009345528 1.690581 -0.2138986 1.35455 -0.5313301 -0.2657279
> tmp[,"col10"]
           col10
row1  0.13887786
row2 -0.07486792
row3 -0.88109523
row4  0.48173002
row5 -0.40089194
> tmp[c("row1","row5"),]
           col1       col2        col3       col4      col5       col6
row1  0.2905391 -0.9325353 -0.08490627 -0.7466110 -0.850450 0.04060528
row5 -0.8971833  0.5179676  0.47470943 -0.1882778 -2.135144 0.69970460
           col7       col8       col9      col10      col11      col12
row1 0.06394053 -1.8132294 -0.1884056  0.1388779  1.1130852  0.4490033
row5 0.87786787 -0.5106481  0.4248070 -0.4008919 -0.2885663 -0.7074811
          col13       col14        col15     col16      col17     col18
row1 -0.8496906  0.41620831  0.009345528  1.690581 -0.2138986  1.354550
row5  1.0761467 -0.06406282 -0.118103210 -0.648123 -0.1103405 -2.786475
          col19      col20
row1 -0.5313301 -0.2657279
row5 -1.1735320 -1.8433311
> tmp[,c("col6","col20")]
           col6      col20
row1 0.04060528 -0.2657279
row2 0.81868426 -0.2513437
row3 0.26922739 -1.4924995
row4 0.88157828  1.5988669
row5 0.69970460 -1.8433311
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 0.04060528 -0.2657279
row5 0.69970460 -1.8433311
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.30718 49.94869 50.43461 48.97541 48.91302 104.9864 50.83509 51.02143
        col9    col10    col11    col12    col13    col14    col15    col16
row1 50.6437 50.11467 49.25833 49.49338 49.44654 50.85696 48.52124 50.56787
        col17    col18    col19    col20
row1 50.42166 48.91429 49.81684 104.9948
> tmp[,"col10"]
        col10
row1 50.11467
row2 29.52282
row3 30.21451
row4 28.70871
row5 50.89919
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.30718 49.94869 50.43461 48.97541 48.91302 104.9864 50.83509 51.02143
row5 47.51584 48.53017 49.56965 50.49397 48.52047 105.9783 50.26225 50.26876
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.64370 50.11467 49.25833 49.49338 49.44654 50.85696 48.52124 50.56787
row5 51.42971 50.89919 48.76895 50.97733 50.10945 50.16995 51.61175 50.05162
        col17    col18    col19    col20
row1 50.42166 48.91429 49.81684 104.9948
row5 50.70110 49.28128 50.89488 105.8236
> tmp[,c("col6","col20")]
          col6     col20
row1 104.98642 104.99479
row2  73.70939  74.90228
row3  75.62675  74.54802
row4  73.58783  75.65014
row5 105.97834 105.82359
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.9864 104.9948
row5 105.9783 105.8236
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.9864 104.9948
row5 105.9783 105.8236
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  1.0701514
[2,] -0.6574963
[3,]  0.7012744
[4,] -0.8878584
[5,]  0.8297635
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.1167038 -1.2775666
[2,] -0.5689732 -0.1853999
[3,] -0.4215021 -0.3857993
[4,] -0.6148156 -0.6231725
[5,] -1.8218320 -0.9042520
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  0.4662015  0.6014586
[2,] -0.1599493 -0.4289814
[3,]  0.8942368  1.6272848
[4,]  0.1575409 -0.2743861
[5,] -1.2837767  0.7360147
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.4662015
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.4662015
[2,] -0.1599493
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]       [,3]      [,4]      [,5]     [,6]      [,7]
row3  0.6098944 0.1157595 -0.7704562 -2.006088  2.163457 2.582757 -1.339126
row1 -0.7528881 0.3591003  0.3419658  1.378785 -1.111332 1.358603  1.164394
           [,8]       [,9]      [,10]       [,11]     [,12]      [,13]    [,14]
row3 -0.1936330  0.9204550  0.5909745 -1.47007987 0.4165462 -0.9292037 1.355748
row1  0.5221224 -0.4111198 -0.3330074 -0.06998837 0.5649999 -1.2006134 1.163559
         [,15]      [,16]      [,17]     [,18]      [,19]      [,20]
row3 0.2596327 -0.7498988 -1.8131255 -1.197491 -0.3189705 -0.6248689
row1 0.1915400  0.3036875 -0.8579107 -1.334231 -1.2919882 -0.6217537
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]      [,3]      [,4]       [,5]       [,6]      [,7]
row2 -1.179042 -0.9465975 -2.219232 0.8034382 -0.1560794 -0.8702692 -0.471342
          [,8]      [,9]     [,10]
row2 0.3781815 -1.415648 0.6572602
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]    [,2]      [,3]     [,4]      [,5]      [,6]       [,7]
row5 0.5091152 1.43795 0.5359517 0.507844 0.1263291 -2.360088 -0.1943933
             [,8]      [,9]      [,10]      [,11]    [,12]   [,13]      [,14]
row5 0.0009533452 0.2691409 -0.2344938 -0.3795952 1.332536 1.13373 -0.2987795
        [,15]     [,16]     [,17]     [,18]     [,19]       [,20]
row5 1.999441 -1.880204 0.6346099 0.1179567 0.7395513 -0.01517907
> 
> 
> 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: 0x7fee1090f0a0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef53dc36497"
 [2] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef56701152e"
 [3] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef57815b3d6"
 [4] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef558d1e431"
 [5] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef53bdc7a85"
 [6] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef57efd077" 
 [7] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef5115f38b3"
 [8] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef528378ae" 
 [9] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef5567e8cc" 
[10] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef568e4abd9"
[11] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef57cce695b"
[12] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef553671560"
[13] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef514ac7c67"
[14] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef5481b58cb"
[15] "/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BMaef57b629c68"
> 
> 
> ### 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: 0x7fee10a1d220>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7fee10a1d220>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7fee10a1d220>
> rowMedians(tmp)
  [1] -0.5009764428 -0.3540968173 -0.0866371953  0.1008297856  0.0070142945
  [6] -0.3101516633  0.0422044583  0.1378408815  0.3181615929  0.1641885750
 [11]  0.3795219767  0.3422677572  0.4797338459  0.4213034364  0.0927014909
 [16]  0.4003370166 -0.5081494687  0.4167316038 -0.0527502950  0.2332505820
 [21]  0.3138181228 -0.1777286964  0.1273990987 -0.2850495483 -0.2751253854
 [26]  0.3620596430  0.3925023227 -0.0722779775 -0.5455956894  0.5864404687
 [31]  0.5672820725 -0.3590009474 -0.2219899170  0.4203673600  0.3073265927
 [36]  0.4975873491  0.3247699824  0.0478649300  0.0110185050  0.0447579518
 [41] -0.8363714847 -0.1796406823  0.2923426614 -0.6537139587 -0.0805100686
 [46]  0.5671278719  0.2666966710  0.2489543420  0.3697042347  0.5052759295
 [51] -0.2021422483 -0.1835883529  0.0228998280 -0.3415146549 -0.0385469653
 [56] -0.2745469434  0.3222676012 -0.2826173336  0.2502629655  0.1188107913
 [61] -0.2881854651 -0.6076418282 -0.6284283839 -0.3302615060 -0.0598608982
 [66]  0.0680726520  0.0225548472  0.3070162873 -0.3624365457 -0.4150200800
 [71]  0.3626103027 -0.2094845469  0.3184103915  0.5386832233  0.0413011979
 [76] -0.0090102637  0.4549674086  0.5291525575 -0.6368240891  0.0867634800
 [81]  0.5166551252  0.5686413235  0.4853787646  0.1482289574 -0.1816918771
 [86]  0.0542755386  0.2719823004 -0.2858520143 -0.0556921374  0.1340066867
 [91]  0.0627473072  0.3392128945 -0.1485305602  0.1060231282  0.6528788202
 [96]  0.2836145751  0.5009882745  0.0660205660 -0.1916933993  0.0160248691
[101] -0.3887938193 -0.1234692183  0.3450933255 -0.0238386988  0.0102421040
[106]  0.0401045270  0.3249758875 -0.0843170622 -0.7437601271  0.2639752839
[111] -0.1180804498  0.2070545442  0.3535277349  0.1147677025 -0.1201714483
[116]  0.1796356100  0.3383529705 -0.3638372267 -0.0523299429  0.3653678751
[121] -0.3206494972  0.0503420066 -0.2371556493  0.2008756951 -0.1982642749
[126] -0.6224278527  0.3711058176  0.3129582727 -0.0077658911 -0.0114572051
[131] -0.2778664197  0.3147223461 -0.3124368674 -0.2795112469  0.2492618887
[136]  0.3263341320  0.7243567672 -0.3276480945 -0.1592973419  0.2543767266
[141] -0.2688713601  0.1666068784 -0.1147377648 -0.1253852554  0.3365643300
[146] -0.4600738468 -0.6457004585 -0.3979937872 -0.2834410193 -0.0005793893
[151] -0.2249461909 -0.0458173531 -0.0846546460  0.3155910702  0.1569853368
[156] -0.6968553269 -0.5007648053 -0.6341182119  0.1321429076  0.0886687153
[161] -0.1706406515 -0.3673330959  0.0894670414 -0.0791426349 -0.5034388559
[166] -0.3686084219  0.0671696824 -0.3682222104  0.0340995340 -0.0169454860
[171]  0.2654106198 -0.0641404971  0.6972261563  0.6223818795 -0.0741055637
[176] -0.3360948997  0.4877076080 -0.4677981149 -0.3504810865  0.2200612813
[181] -0.0219427268 -0.2144786037 -0.4431174196 -0.1529090618 -0.6128791213
[186] -0.2971584761  0.0530405609  0.1316630654 -0.1416115976 -0.3389767435
[191]  0.6377446384  0.8957868419 -0.1711809396 -0.2218348234 -0.4259309719
[196] -0.5580581102 -0.1205711234  0.5283505227  0.0309435097  0.1571762527
[201]  0.1776655891  0.4118539354  0.3345966332 -0.0557633717  0.2569716366
[206]  0.2445497534 -0.3944774407  0.3554538442  0.8107439116  0.4476532836
[211]  0.0706267302  0.5960960218 -0.1608916451  0.4878140283  0.2952681202
[216]  0.6838393018 -0.7089271210 -0.3239575597 -0.0524603580  0.0504133336
[221] -0.5104453721 -0.7162707382 -0.1677797689  0.2871132819 -0.3269947402
[226] -0.0518336231  0.3566531998  0.3679909639 -0.0918226599 -0.5381124704
> 
> proc.time()
   user  system elapsed 
  4.231   6.878  11.485 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.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: 0x7fe1d3331150>
> .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: 0x7fe1d3331150>
> .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: 0x7fe1d3331150>
> .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: 0x7fe1d3331150>
> 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: 0x7fe1ce61af80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fe1ce61af80>
> .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: 0x7fe1ce61af80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fe1ce61af80>
> .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: 0x7fe1ce61af80>
> 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: 0x7fe1d36078b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fe1d36078b0>
> .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: 0x7fe1d36078b0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fe1d36078b0>
> .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: 0x7fe1d36078b0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7fe1d36078b0>
> .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: 0x7fe1d36078b0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7fe1d36078b0>
> .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: 0x7fe1d36078b0>
> 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: 0x7fe1d3313570>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7fe1d3313570>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fe1d3313570>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fe1d3313570>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFileb25130de0662" "BufferedMatrixFileb251407524fe"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFileb25130de0662" "BufferedMatrixFileb251407524fe"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fe1d320d970>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fe1d320d970>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fe1d320d970>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fe1d320d970>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7fe1d320d970>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7fe1d320d970>
> .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: 0x7fe1d7801520>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fe1d7801520>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fe1d7801520>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7fe1d7801520>
> 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: 0x7fe1d361e320>
> .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: 0x7fe1d361e320>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.444   0.107   0.523 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.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.364   0.067   0.406 

Example timings