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

CHECK report for BufferedMatrix on malbec2

This page was generated on 2019-10-16 11:56:23 -0400 (Wed, 16 Oct 2019).

Package 193/1741HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.48.0
Ben Bolstad
Snapshot Date: 2019-10-15 17:01:26 -0400 (Tue, 15 Oct 2019)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_9
Last Commit: 5368d45
Last Changed Date: 2019-05-02 11:53:07 -0400 (Thu, 02 May 2019)
malbec2 Linux (Ubuntu 18.04.2 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
celaya2 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.48.0
Command: /home/biocbuild/bbs-3.9-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.9-bioc/R/library --no-vignettes --timings BufferedMatrix_1.48.0.tar.gz
StartedAt: 2019-10-16 00:12:36 -0400 (Wed, 16 Oct 2019)
EndedAt: 2019-10-16 00:13:03 -0400 (Wed, 16 Oct 2019)
EllapsedTime: 27.0 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck’
* using R version 3.6.1 (2019-07-05)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.48.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 2 NOTEs
See
  ‘/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.9-bioc/R/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
gcc -I"/home/biocbuild/bbs-3.9-bioc/R/include" -DNDEBUG   -I/usr/local/include  -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.9-bioc/R/include" -DNDEBUG   -I/usr/local/include  -fpic  -g -O2  -Wall -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
   if (!(Matrix->readonly) & setting){
       ^~~~~~~~~~~~~~~~~~~
At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 static int sort_double(const double *a1,const double *a2){
            ^~~~~~~~~~~
gcc -I"/home/biocbuild/bbs-3.9-bioc/R/include" -DNDEBUG   -I/usr/local/include  -fpic  -g -O2  -Wall -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/bbs-3.9-bioc/R/include" -DNDEBUG   -I/usr/local/include  -fpic  -g -O2  -Wall -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/bbs-3.9-bioc/R/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/bbs-3.9-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.9-bioc/R/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix", "BufferedMatrix", .libPaths());.C("dbm_c_tester",integer(1))

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

Adding Additional Column
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 

Reassigning values
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 3
Buffer Cols: 3
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Activating Row Buffer
In row mode: 1
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Squaring Last Column
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 900.000000 

Square rooting Last Row, then turing off Row Buffer
In row mode: 0
Checking on value that should be not be in column buffer2.236068 
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
2.236068 3.162278 3.872983 4.472136 5.000000 30.000000 

Single Indexing. Assign each value its square
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Resizing Buffers Smaller
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Activating Row Mode.
Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
Activating ReadOnly Mode.
The results of assignment is: 0
Printing matrix reversed.
900.000000 625.000000 400.000000 225.000000 100.000000 25.000000 
841.000000 576.000000 361.000000 196.000000 81.000000 16.000000 
784.000000 529.000000 324.000000 169.000000 64.000000 9.000000 
729.000000 484.000000 289.000000 144.000000 49.000000 -30.000000 
676.000000 441.000000 256.000000 121.000000 -20.000000 -10.000000 

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.239   0.040   0.265 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 412188 22.1     857928 45.9   639502 34.2
Vcells 738921  5.7    8388608 64.0  1807591 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] "Wed Oct 16 00:12:56 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] "Wed Oct 16 00:12:56 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)

> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Oct 16 00:12:57 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] "Wed Oct 16 00:12:57 2019"
> 
> ColMode(tmp2)

> 
> 
> 
> ### 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,] 98.95247400 -0.4792002 0.99819913 -0.1507704
[2,]  0.05853488  0.2327322 1.96157666  0.5853327
[3,]  0.88003621 -1.0735564 0.08511377 -0.9320439
[4,]  1.54523058 -1.5156964 0.74131303 -0.3176398
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.9-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,] 98.95247400 0.4792002 0.99819913 0.1507704
[2,]  0.05853488 0.2327322 1.96157666 0.5853327
[3,]  0.88003621 1.0735564 0.08511377 0.9320439
[4,]  1.54523058 1.5156964 0.74131303 0.3176398
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.9-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.9474858 0.6922429 0.9990992 0.3882916
[2,] 0.2419398 0.4824233 1.4005630 0.7650704
[3,] 0.9381025 1.0361257 0.2917427 0.9654242
[4,] 1.2430730 1.2311362 0.8609954 0.5635954
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.9-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,] 223.42733 32.40163 35.98919 29.03369
[2,]  27.47793 30.05696 40.96721 33.23604
[3,]  35.26106 36.43481 28.00254 35.58629
[4,]  38.97596 38.82706 34.35127 30.95359
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)

> exp(tmp5)

> log(tmp5,2)

> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 465.0347
> Min(tmp5)
[1] 53.54752
> mean(tmp5)
[1] 72.18873
> Sum(tmp5)
[1] 14437.75
> Var(tmp5)
[1] 856.5686
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.24819 72.54689 72.68299 71.18718 68.43769 72.26689 64.37861 69.93785
 [9] 67.42784 70.77320
> rowSums(tmp5)
 [1] 1844.964 1450.938 1453.660 1423.744 1368.754 1445.338 1287.572 1398.757
 [9] 1348.557 1415.464
> rowVars(tmp5)
 [1] 7796.99752   81.33945   64.55438   69.55021   85.29625   96.13035
 [7]   64.37813   61.95822   61.26348   54.62637
> rowSd(tmp5)
 [1] 88.300609  9.018838  8.034574  8.339677  9.235597  9.804609  8.023598
 [8]  7.871355  7.827099  7.390965
> rowMax(tmp5)
 [1] 465.03472  86.48082  84.97577  83.23718  82.19136  97.12094  84.07308
 [8]  82.23716  80.37097  83.92876
> rowMin(tmp5)
 [1] 54.12009 56.32638 56.63828 59.51065 53.65360 55.17675 53.54752 57.80277
 [9] 55.70391 59.19899
> 
> colMeans(tmp5)
 [1] 105.63180  69.14745  70.50654  71.42346  76.90206  72.36530  73.45613
 [8]  72.07828  68.61107  70.56728  70.87035  65.21414  75.67418  68.60951
[15]  65.58497  69.07153  70.25242  70.45504  72.77513  64.57799
> colSums(tmp5)
 [1] 1056.3180  691.4745  705.0654  714.2346  769.0206  723.6530  734.5613
 [8]  720.7828  686.1107  705.6728  708.7035  652.1414  756.7418  686.0951
[15]  655.8497  690.7153  702.5242  704.5504  727.7513  645.7799
> colVars(tmp5)
 [1] 16033.39915    63.77488    72.81054    64.33918    89.59061    72.72944
 [7]    48.39035    90.26592    82.75765   108.53428   104.16931    65.60285
[13]    89.04887    25.79326    74.26694    71.96966    75.29929   110.59938
[19]    50.18959    30.49848
> colSd(tmp5)
 [1] 126.623059   7.985918   8.532909   8.021171   9.465232   8.528155
 [7]   6.956317   9.500838   9.097123  10.417979  10.206337   8.099559
[13]   9.436571   5.078707   8.617827   8.483493   8.677516  10.516624
[19]   7.084461   5.522543
> colMax(tmp5)
 [1] 465.03472  80.81344  85.26787  80.56854  85.44070  84.97577  84.48147
 [8]  83.92876  86.03217  86.48082  88.52588  77.35592  97.12094  77.57803
[15]  80.32132  81.57615  81.65816  85.55495  82.95738  72.72892
> colMin(tmp5)
 [1] 53.54752 59.19899 58.28362 60.42981 62.29799 59.51065 61.48282 56.99433
 [9] 55.70391 54.12009 54.07866 54.84995 61.67263 62.69680 55.07027 53.65360
[17] 55.17879 54.74938 62.54306 56.32638
> 
> 
> ### 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] 92.24819 72.54689 72.68299 71.18718 68.43769 72.26689 64.37861       NA
 [9] 67.42784 70.77320
> rowSums(tmp5)
 [1] 1844.964 1450.938 1453.660 1423.744 1368.754 1445.338 1287.572       NA
 [9] 1348.557 1415.464
> rowVars(tmp5)
 [1] 7796.99752   81.33945   64.55438   69.55021   85.29625   96.13035
 [7]   64.37813   65.40022   61.26348   54.62637
> rowSd(tmp5)
 [1] 88.300609  9.018838  8.034574  8.339677  9.235597  9.804609  8.023598
 [8]  8.087040  7.827099  7.390965
> rowMax(tmp5)
 [1] 465.03472  86.48082  84.97577  83.23718  82.19136  97.12094  84.07308
 [8]        NA  80.37097  83.92876
> rowMin(tmp5)
 [1] 54.12009 56.32638 56.63828 59.51065 53.65360 55.17675 53.54752       NA
 [9] 55.70391 59.19899
> 
> colMeans(tmp5)
 [1] 105.63180  69.14745  70.50654  71.42346  76.90206  72.36530  73.45613
 [8]  72.07828  68.61107  70.56728  70.87035  65.21414  75.67418  68.60951
[15]  65.58497  69.07153  70.25242  70.45504        NA  64.57799
> colSums(tmp5)
 [1] 1056.3180  691.4745  705.0654  714.2346  769.0206  723.6530  734.5613
 [8]  720.7828  686.1107  705.6728  708.7035  652.1414  756.7418  686.0951
[15]  655.8497  690.7153  702.5242  704.5504        NA  645.7799
> colVars(tmp5)
 [1] 16033.39915    63.77488    72.81054    64.33918    89.59061    72.72944
 [7]    48.39035    90.26592    82.75765   108.53428   104.16931    65.60285
[13]    89.04887    25.79326    74.26694    71.96966    75.29929   110.59938
[19]          NA    30.49848
> colSd(tmp5)
 [1] 126.623059   7.985918   8.532909   8.021171   9.465232   8.528155
 [7]   6.956317   9.500838   9.097123  10.417979  10.206337   8.099559
[13]   9.436571   5.078707   8.617827   8.483493   8.677516  10.516624
[19]         NA   5.522543
> colMax(tmp5)
 [1] 465.03472  80.81344  85.26787  80.56854  85.44070  84.97577  84.48147
 [8]  83.92876  86.03217  86.48082  88.52588  77.35592  97.12094  77.57803
[15]  80.32132  81.57615  81.65816  85.55495        NA  72.72892
> colMin(tmp5)
 [1] 53.54752 59.19899 58.28362 60.42981 62.29799 59.51065 61.48282 56.99433
 [9] 55.70391 54.12009 54.07866 54.84995 61.67263 62.69680 55.07027 53.65360
[17] 55.17879 54.74938       NA 56.32638
> 
> Max(tmp5,na.rm=TRUE)
[1] 465.0347
> Min(tmp5,na.rm=TRUE)
[1] 53.54752
> mean(tmp5,na.rm=TRUE)
[1] 72.20028
> Sum(tmp5,na.rm=TRUE)
[1] 14367.85
> Var(tmp5,na.rm=TRUE)
[1] 860.8679
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.24819 72.54689 72.68299 71.18718 68.43769 72.26689 64.37861 69.94029
 [9] 67.42784 70.77320
> rowSums(tmp5,na.rm=TRUE)
 [1] 1844.964 1450.938 1453.660 1423.744 1368.754 1445.338 1287.572 1328.865
 [9] 1348.557 1415.464
> rowVars(tmp5,na.rm=TRUE)
 [1] 7796.99752   81.33945   64.55438   69.55021   85.29625   96.13035
 [7]   64.37813   65.40022   61.26348   54.62637
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.300609  9.018838  8.034574  8.339677  9.235597  9.804609  8.023598
 [8]  8.087040  7.827099  7.390965
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.03472  86.48082  84.97577  83.23718  82.19136  97.12094  84.07308
 [8]  82.23716  80.37097  83.92876
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.12009 56.32638 56.63828 59.51065 53.65360 55.17675 53.54752 57.80277
 [9] 55.70391 59.19899
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 105.63180  69.14745  70.50654  71.42346  76.90206  72.36530  73.45613
 [8]  72.07828  68.61107  70.56728  70.87035  65.21414  75.67418  68.60951
[15]  65.58497  69.07153  70.25242  70.45504  73.09553  64.57799
> colSums(tmp5,na.rm=TRUE)
 [1] 1056.3180  691.4745  705.0654  714.2346  769.0206  723.6530  734.5613
 [8]  720.7828  686.1107  705.6728  708.7035  652.1414  756.7418  686.0951
[15]  655.8497  690.7153  702.5242  704.5504  657.8598  645.7799
> colVars(tmp5,na.rm=TRUE)
 [1] 16033.39915    63.77488    72.81054    64.33918    89.59061    72.72944
 [7]    48.39035    90.26592    82.75765   108.53428   104.16931    65.60285
[13]    89.04887    25.79326    74.26694    71.96966    75.29929   110.59938
[19]    55.30838    30.49848
> colSd(tmp5,na.rm=TRUE)
 [1] 126.623059   7.985918   8.532909   8.021171   9.465232   8.528155
 [7]   6.956317   9.500838   9.097123  10.417979  10.206337   8.099559
[13]   9.436571   5.078707   8.617827   8.483493   8.677516  10.516624
[19]   7.436960   5.522543
> colMax(tmp5,na.rm=TRUE)
 [1] 465.03472  80.81344  85.26787  80.56854  85.44070  84.97577  84.48147
 [8]  83.92876  86.03217  86.48082  88.52588  77.35592  97.12094  77.57803
[15]  80.32132  81.57615  81.65816  85.55495  82.95738  72.72892
> colMin(tmp5,na.rm=TRUE)
 [1] 53.54752 59.19899 58.28362 60.42981 62.29799 59.51065 61.48282 56.99433
 [9] 55.70391 54.12009 54.07866 54.84995 61.67263 62.69680 55.07027 53.65360
[17] 55.17879 54.74938 62.54306 56.32638
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.24819 72.54689 72.68299 71.18718 68.43769 72.26689 64.37861      NaN
 [9] 67.42784 70.77320
> rowSums(tmp5,na.rm=TRUE)
 [1] 1844.964 1450.938 1453.660 1423.744 1368.754 1445.338 1287.572    0.000
 [9] 1348.557 1415.464
> rowVars(tmp5,na.rm=TRUE)
 [1] 7796.99752   81.33945   64.55438   69.55021   85.29625   96.13035
 [7]   64.37813         NA   61.26348   54.62637
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.300609  9.018838  8.034574  8.339677  9.235597  9.804609  8.023598
 [8]        NA  7.827099  7.390965
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.03472  86.48082  84.97577  83.23718  82.19136  97.12094  84.07308
 [8]        NA  80.37097  83.92876
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.12009 56.32638 56.63828 59.51065 53.65360 55.17675 53.54752       NA
 [9] 55.70391 59.19899
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.94614  67.97687  71.76362  70.46432  78.38209  71.26843  73.85737
 [8]  71.48692  68.86385  71.56931  70.67653  63.86505  75.55486  68.49152
[15]  66.26296  68.58160  71.51830  69.92181       NaN  64.22953
> colSums(tmp5,na.rm=TRUE)
 [1] 998.5153 611.7918 645.8726 634.1788 705.4388 641.4158 664.7164 643.3823
 [9] 619.7747 644.1238 636.0888 574.7855 679.9938 616.4237 596.3666 617.2344
[17] 643.6647 629.2963   0.0000 578.0658
> colVars(tmp5,na.rm=TRUE)
 [1] 17719.84954    56.33121    64.13402    62.03197    76.14646    68.28540
 [7]    52.62795    97.61501    92.38352   110.80534   116.76787    53.32782
[13]   100.01982    28.86081    78.37909    78.26544    66.68417   121.22551
[19]          NA    32.94479
> colSd(tmp5,na.rm=TRUE)
 [1] 133.115925   7.505412   8.008372   7.876038   8.726194   8.263498
 [7]   7.254512   9.880031   9.611635  10.526411  10.805918   7.302590
[13]  10.000991   5.372225   8.853197   8.846776   8.166037  11.010246
[19]         NA   5.739755
> colMax(tmp5,na.rm=TRUE)
 [1] 465.03472  80.81344  85.26787  80.56854  85.44070  84.97577  84.48147
 [8]  83.92876  86.03217  86.48082  88.52588  76.33140  97.12094  77.57803
[15]  80.32132  81.57615  81.65816  85.55495      -Inf  72.72892
> colMin(tmp5,na.rm=TRUE)
 [1] 53.54752 59.19899 58.28362 60.42981 62.29799 59.51065 61.48282 56.99433
 [9] 55.70391 54.12009 54.07866 54.84995 61.67263 62.69680 55.07027 53.65360
[17] 55.17879 54.74938      Inf 56.32638
> 
> 
> 
> 
> 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] 242.5445 235.9308 271.9968 277.7289 328.6097 220.0889 199.1705 196.7868
 [9] 407.2232 280.4673
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 242.5445 235.9308 271.9968 277.7289 328.6097 220.0889 199.1705 196.7868
 [9] 407.2232 280.4673
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14 -5.684342e-14 -1.705303e-13  2.842171e-13  5.684342e-14
 [6]  1.136868e-13 -2.842171e-14  1.136868e-13  0.000000e+00  0.000000e+00
[11]  1.705303e-13 -1.421085e-14 -1.136868e-13  2.842171e-14  1.136868e-13
[16]  4.263256e-14  0.000000e+00  4.263256e-14 -1.136868e-13  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)
+ }
5   2 
8   10 
6   12 
7   8 
7   2 
5   8 
6   14 
2   2 
1   3 
5   15 
2   8 
6   10 
6   5 
2   7 
10   1 
6   3 
5   19 
9   11 
9   11 
7   4 
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.898046
> Min(tmp)
[1] -2.95789
> mean(tmp)
[1] 0.1771919
> Sum(tmp)
[1] 17.71919
> Var(tmp)
[1] 1.190984
> 
> rowMeans(tmp)
[1] 0.1771919
> rowSums(tmp)
[1] 17.71919
> rowVars(tmp)
[1] 1.190984
> rowSd(tmp)
[1] 1.091322
> rowMax(tmp)
[1] 2.898046
> rowMin(tmp)
[1] -2.95789
> 
> colMeans(tmp)
  [1] -0.87580614 -0.57617624  0.31813689  0.01854199 -0.61613299  0.74976548
  [7] -0.54450768  2.40453260 -0.20748689  1.90387459  0.24213362  0.45274542
 [13]  0.37415409  0.72526878  0.37668156 -1.26306264  2.22053486  0.23847307
 [19]  1.93316209  1.68170094  1.76142709  0.86630873 -1.04723924 -0.74029146
 [25]  1.30668657  0.48621475  0.55717236 -0.82886496  1.70488047  0.58889509
 [31] -0.18300864  1.95564536  0.71196531 -0.54662650 -0.44130421  2.10265795
 [37] -0.79953634 -0.79113856  0.38311002  1.33949490  0.62507859  1.15615217
 [43] -1.20949625  0.73820723 -0.71200538 -0.40604690  0.46319365 -0.65250278
 [49] -0.64462724  1.33784127 -0.43536910  1.74768271  0.22192162  1.19674636
 [55] -0.85342423  0.12221722 -2.95789042  0.30301936  1.07903907  0.67698870
 [61] -1.83684134  1.94253307 -0.54406865 -0.01728374  0.30654456  1.99364543
 [67]  0.35335797 -0.98561305  0.65540662  1.06021922  0.95827312  0.26742606
 [73]  1.31606462  0.23270512 -0.45694657 -0.64284684 -1.15221052 -1.36279219
 [79] -0.05547535 -0.36863639 -0.47406085  1.76509164  0.05012414 -1.46161916
 [85]  0.55837367 -1.13253220 -0.20623314 -0.77044263 -1.11883732 -0.49716520
 [91] -0.01121951 -0.60572163 -0.38606320  2.89804583  1.19216396 -0.66504102
 [97] -2.16877678 -0.92034297 -0.61239032  0.88266623
> colSums(tmp)
  [1] -0.87580614 -0.57617624  0.31813689  0.01854199 -0.61613299  0.74976548
  [7] -0.54450768  2.40453260 -0.20748689  1.90387459  0.24213362  0.45274542
 [13]  0.37415409  0.72526878  0.37668156 -1.26306264  2.22053486  0.23847307
 [19]  1.93316209  1.68170094  1.76142709  0.86630873 -1.04723924 -0.74029146
 [25]  1.30668657  0.48621475  0.55717236 -0.82886496  1.70488047  0.58889509
 [31] -0.18300864  1.95564536  0.71196531 -0.54662650 -0.44130421  2.10265795
 [37] -0.79953634 -0.79113856  0.38311002  1.33949490  0.62507859  1.15615217
 [43] -1.20949625  0.73820723 -0.71200538 -0.40604690  0.46319365 -0.65250278
 [49] -0.64462724  1.33784127 -0.43536910  1.74768271  0.22192162  1.19674636
 [55] -0.85342423  0.12221722 -2.95789042  0.30301936  1.07903907  0.67698870
 [61] -1.83684134  1.94253307 -0.54406865 -0.01728374  0.30654456  1.99364543
 [67]  0.35335797 -0.98561305  0.65540662  1.06021922  0.95827312  0.26742606
 [73]  1.31606462  0.23270512 -0.45694657 -0.64284684 -1.15221052 -1.36279219
 [79] -0.05547535 -0.36863639 -0.47406085  1.76509164  0.05012414 -1.46161916
 [85]  0.55837367 -1.13253220 -0.20623314 -0.77044263 -1.11883732 -0.49716520
 [91] -0.01121951 -0.60572163 -0.38606320  2.89804583  1.19216396 -0.66504102
 [97] -2.16877678 -0.92034297 -0.61239032  0.88266623
> 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.87580614 -0.57617624  0.31813689  0.01854199 -0.61613299  0.74976548
  [7] -0.54450768  2.40453260 -0.20748689  1.90387459  0.24213362  0.45274542
 [13]  0.37415409  0.72526878  0.37668156 -1.26306264  2.22053486  0.23847307
 [19]  1.93316209  1.68170094  1.76142709  0.86630873 -1.04723924 -0.74029146
 [25]  1.30668657  0.48621475  0.55717236 -0.82886496  1.70488047  0.58889509
 [31] -0.18300864  1.95564536  0.71196531 -0.54662650 -0.44130421  2.10265795
 [37] -0.79953634 -0.79113856  0.38311002  1.33949490  0.62507859  1.15615217
 [43] -1.20949625  0.73820723 -0.71200538 -0.40604690  0.46319365 -0.65250278
 [49] -0.64462724  1.33784127 -0.43536910  1.74768271  0.22192162  1.19674636
 [55] -0.85342423  0.12221722 -2.95789042  0.30301936  1.07903907  0.67698870
 [61] -1.83684134  1.94253307 -0.54406865 -0.01728374  0.30654456  1.99364543
 [67]  0.35335797 -0.98561305  0.65540662  1.06021922  0.95827312  0.26742606
 [73]  1.31606462  0.23270512 -0.45694657 -0.64284684 -1.15221052 -1.36279219
 [79] -0.05547535 -0.36863639 -0.47406085  1.76509164  0.05012414 -1.46161916
 [85]  0.55837367 -1.13253220 -0.20623314 -0.77044263 -1.11883732 -0.49716520
 [91] -0.01121951 -0.60572163 -0.38606320  2.89804583  1.19216396 -0.66504102
 [97] -2.16877678 -0.92034297 -0.61239032  0.88266623
> colMin(tmp)
  [1] -0.87580614 -0.57617624  0.31813689  0.01854199 -0.61613299  0.74976548
  [7] -0.54450768  2.40453260 -0.20748689  1.90387459  0.24213362  0.45274542
 [13]  0.37415409  0.72526878  0.37668156 -1.26306264  2.22053486  0.23847307
 [19]  1.93316209  1.68170094  1.76142709  0.86630873 -1.04723924 -0.74029146
 [25]  1.30668657  0.48621475  0.55717236 -0.82886496  1.70488047  0.58889509
 [31] -0.18300864  1.95564536  0.71196531 -0.54662650 -0.44130421  2.10265795
 [37] -0.79953634 -0.79113856  0.38311002  1.33949490  0.62507859  1.15615217
 [43] -1.20949625  0.73820723 -0.71200538 -0.40604690  0.46319365 -0.65250278
 [49] -0.64462724  1.33784127 -0.43536910  1.74768271  0.22192162  1.19674636
 [55] -0.85342423  0.12221722 -2.95789042  0.30301936  1.07903907  0.67698870
 [61] -1.83684134  1.94253307 -0.54406865 -0.01728374  0.30654456  1.99364543
 [67]  0.35335797 -0.98561305  0.65540662  1.06021922  0.95827312  0.26742606
 [73]  1.31606462  0.23270512 -0.45694657 -0.64284684 -1.15221052 -1.36279219
 [79] -0.05547535 -0.36863639 -0.47406085  1.76509164  0.05012414 -1.46161916
 [85]  0.55837367 -1.13253220 -0.20623314 -0.77044263 -1.11883732 -0.49716520
 [91] -0.01121951 -0.60572163 -0.38606320  2.89804583  1.19216396 -0.66504102
 [97] -2.16877678 -0.92034297 -0.61239032  0.88266623
> colMedians(tmp)
  [1] -0.87580614 -0.57617624  0.31813689  0.01854199 -0.61613299  0.74976548
  [7] -0.54450768  2.40453260 -0.20748689  1.90387459  0.24213362  0.45274542
 [13]  0.37415409  0.72526878  0.37668156 -1.26306264  2.22053486  0.23847307
 [19]  1.93316209  1.68170094  1.76142709  0.86630873 -1.04723924 -0.74029146
 [25]  1.30668657  0.48621475  0.55717236 -0.82886496  1.70488047  0.58889509
 [31] -0.18300864  1.95564536  0.71196531 -0.54662650 -0.44130421  2.10265795
 [37] -0.79953634 -0.79113856  0.38311002  1.33949490  0.62507859  1.15615217
 [43] -1.20949625  0.73820723 -0.71200538 -0.40604690  0.46319365 -0.65250278
 [49] -0.64462724  1.33784127 -0.43536910  1.74768271  0.22192162  1.19674636
 [55] -0.85342423  0.12221722 -2.95789042  0.30301936  1.07903907  0.67698870
 [61] -1.83684134  1.94253307 -0.54406865 -0.01728374  0.30654456  1.99364543
 [67]  0.35335797 -0.98561305  0.65540662  1.06021922  0.95827312  0.26742606
 [73]  1.31606462  0.23270512 -0.45694657 -0.64284684 -1.15221052 -1.36279219
 [79] -0.05547535 -0.36863639 -0.47406085  1.76509164  0.05012414 -1.46161916
 [85]  0.55837367 -1.13253220 -0.20623314 -0.77044263 -1.11883732 -0.49716520
 [91] -0.01121951 -0.60572163 -0.38606320  2.89804583  1.19216396 -0.66504102
 [97] -2.16877678 -0.92034297 -0.61239032  0.88266623
> colRanges(tmp)
           [,1]       [,2]      [,3]       [,4]      [,5]      [,6]       [,7]
[1,] -0.8758061 -0.5761762 0.3181369 0.01854199 -0.616133 0.7497655 -0.5445077
[2,] -0.8758061 -0.5761762 0.3181369 0.01854199 -0.616133 0.7497655 -0.5445077
         [,8]       [,9]    [,10]     [,11]     [,12]     [,13]     [,14]
[1,] 2.404533 -0.2074869 1.903875 0.2421336 0.4527454 0.3741541 0.7252688
[2,] 2.404533 -0.2074869 1.903875 0.2421336 0.4527454 0.3741541 0.7252688
         [,15]     [,16]    [,17]     [,18]    [,19]    [,20]    [,21]
[1,] 0.3766816 -1.263063 2.220535 0.2384731 1.933162 1.681701 1.761427
[2,] 0.3766816 -1.263063 2.220535 0.2384731 1.933162 1.681701 1.761427
         [,22]     [,23]      [,24]    [,25]     [,26]     [,27]     [,28]
[1,] 0.8663087 -1.047239 -0.7402915 1.306687 0.4862148 0.5571724 -0.828865
[2,] 0.8663087 -1.047239 -0.7402915 1.306687 0.4862148 0.5571724 -0.828865
       [,29]     [,30]      [,31]    [,32]     [,33]      [,34]      [,35]
[1,] 1.70488 0.5888951 -0.1830086 1.955645 0.7119653 -0.5466265 -0.4413042
[2,] 1.70488 0.5888951 -0.1830086 1.955645 0.7119653 -0.5466265 -0.4413042
        [,36]      [,37]      [,38]   [,39]    [,40]     [,41]    [,42]
[1,] 2.102658 -0.7995363 -0.7911386 0.38311 1.339495 0.6250786 1.156152
[2,] 2.102658 -0.7995363 -0.7911386 0.38311 1.339495 0.6250786 1.156152
         [,43]     [,44]      [,45]      [,46]     [,47]      [,48]      [,49]
[1,] -1.209496 0.7382072 -0.7120054 -0.4060469 0.4631937 -0.6525028 -0.6446272
[2,] -1.209496 0.7382072 -0.7120054 -0.4060469 0.4631937 -0.6525028 -0.6446272
        [,50]      [,51]    [,52]     [,53]    [,54]      [,55]     [,56]
[1,] 1.337841 -0.4353691 1.747683 0.2219216 1.196746 -0.8534242 0.1222172
[2,] 1.337841 -0.4353691 1.747683 0.2219216 1.196746 -0.8534242 0.1222172
        [,57]     [,58]    [,59]     [,60]     [,61]    [,62]      [,63]
[1,] -2.95789 0.3030194 1.079039 0.6769887 -1.836841 1.942533 -0.5440687
[2,] -2.95789 0.3030194 1.079039 0.6769887 -1.836841 1.942533 -0.5440687
           [,64]     [,65]    [,66]    [,67]     [,68]     [,69]    [,70]
[1,] -0.01728374 0.3065446 1.993645 0.353358 -0.985613 0.6554066 1.060219
[2,] -0.01728374 0.3065446 1.993645 0.353358 -0.985613 0.6554066 1.060219
         [,71]     [,72]    [,73]     [,74]      [,75]      [,76]     [,77]
[1,] 0.9582731 0.2674261 1.316065 0.2327051 -0.4569466 -0.6428468 -1.152211
[2,] 0.9582731 0.2674261 1.316065 0.2327051 -0.4569466 -0.6428468 -1.152211
         [,78]       [,79]      [,80]      [,81]    [,82]      [,83]     [,84]
[1,] -1.362792 -0.05547535 -0.3686364 -0.4740608 1.765092 0.05012414 -1.461619
[2,] -1.362792 -0.05547535 -0.3686364 -0.4740608 1.765092 0.05012414 -1.461619
         [,85]     [,86]      [,87]      [,88]     [,89]      [,90]       [,91]
[1,] 0.5583737 -1.132532 -0.2062331 -0.7704426 -1.118837 -0.4971652 -0.01121951
[2,] 0.5583737 -1.132532 -0.2062331 -0.7704426 -1.118837 -0.4971652 -0.01121951
          [,92]      [,93]    [,94]    [,95]     [,96]     [,97]     [,98]
[1,] -0.6057216 -0.3860632 2.898046 1.192164 -0.665041 -2.168777 -0.920343
[2,] -0.6057216 -0.3860632 2.898046 1.192164 -0.665041 -2.168777 -0.920343
          [,99]    [,100]
[1,] -0.6123903 0.8826662
[2,] -0.6123903 0.8826662
> 
> 
> Max(tmp2)
[1] 2.007197
> Min(tmp2)
[1] -1.911931
> mean(tmp2)
[1] -0.1039279
> Sum(tmp2)
[1] -10.39279
> Var(tmp2)
[1] 0.7190201
> 
> rowMeans(tmp2)
  [1]  0.720622864  0.670995737 -0.401151647 -0.413652161  0.230604788
  [6]  0.989870489 -0.554185885 -0.570907927  0.263699370 -1.590521361
 [11] -0.146422871 -0.227035841  0.631925894 -0.108198344 -0.238955347
 [16] -0.314888595 -0.851669004  0.007217767  0.836161580 -1.530371028
 [21]  0.520866898  0.012069285  0.049163131  0.236961156 -0.307373742
 [26] -0.711468530 -0.585090755  0.514355477  1.115010393 -0.081899979
 [31] -0.353070454  2.007197428 -0.352485202  1.255159367  0.247498385
 [36] -1.911930815  0.624407064 -1.477955190 -0.475533821  0.721904164
 [41]  0.655695067 -0.761257980 -1.112646397  0.304741188 -0.199883834
 [46]  0.519596176 -1.605407740 -0.936399059 -0.876997353 -0.562755549
 [51]  1.290612862  0.008788104 -0.889306944  0.199236880 -0.638056241
 [56] -1.046783459 -0.340249129  0.133440406  0.818899483 -0.111179344
 [61]  1.471021525 -0.004190175 -0.842863886 -0.279640964 -0.630133392
 [66] -0.682537878 -0.759449347  1.398078992  1.749497205  1.041931982
 [71]  1.497670146  0.242846924 -0.351087542 -0.102426071 -0.924992111
 [76] -1.758505236  0.632872236 -1.108991596 -0.434905698 -0.381550060
 [81]  1.064022444  0.640360672 -0.473779139 -0.805890909  1.948334660
 [86] -0.230811977 -0.236297010  0.225043029 -0.076437185  0.734058054
 [91]  0.129209346  1.037871312 -0.840468638 -1.319594994 -0.914241565
 [96] -0.568711675 -0.395804499 -1.326817437 -0.790290461 -1.266194511
> rowSums(tmp2)
  [1]  0.720622864  0.670995737 -0.401151647 -0.413652161  0.230604788
  [6]  0.989870489 -0.554185885 -0.570907927  0.263699370 -1.590521361
 [11] -0.146422871 -0.227035841  0.631925894 -0.108198344 -0.238955347
 [16] -0.314888595 -0.851669004  0.007217767  0.836161580 -1.530371028
 [21]  0.520866898  0.012069285  0.049163131  0.236961156 -0.307373742
 [26] -0.711468530 -0.585090755  0.514355477  1.115010393 -0.081899979
 [31] -0.353070454  2.007197428 -0.352485202  1.255159367  0.247498385
 [36] -1.911930815  0.624407064 -1.477955190 -0.475533821  0.721904164
 [41]  0.655695067 -0.761257980 -1.112646397  0.304741188 -0.199883834
 [46]  0.519596176 -1.605407740 -0.936399059 -0.876997353 -0.562755549
 [51]  1.290612862  0.008788104 -0.889306944  0.199236880 -0.638056241
 [56] -1.046783459 -0.340249129  0.133440406  0.818899483 -0.111179344
 [61]  1.471021525 -0.004190175 -0.842863886 -0.279640964 -0.630133392
 [66] -0.682537878 -0.759449347  1.398078992  1.749497205  1.041931982
 [71]  1.497670146  0.242846924 -0.351087542 -0.102426071 -0.924992111
 [76] -1.758505236  0.632872236 -1.108991596 -0.434905698 -0.381550060
 [81]  1.064022444  0.640360672 -0.473779139 -0.805890909  1.948334660
 [86] -0.230811977 -0.236297010  0.225043029 -0.076437185  0.734058054
 [91]  0.129209346  1.037871312 -0.840468638 -1.319594994 -0.914241565
 [96] -0.568711675 -0.395804499 -1.326817437 -0.790290461 -1.266194511
> 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.720622864  0.670995737 -0.401151647 -0.413652161  0.230604788
  [6]  0.989870489 -0.554185885 -0.570907927  0.263699370 -1.590521361
 [11] -0.146422871 -0.227035841  0.631925894 -0.108198344 -0.238955347
 [16] -0.314888595 -0.851669004  0.007217767  0.836161580 -1.530371028
 [21]  0.520866898  0.012069285  0.049163131  0.236961156 -0.307373742
 [26] -0.711468530 -0.585090755  0.514355477  1.115010393 -0.081899979
 [31] -0.353070454  2.007197428 -0.352485202  1.255159367  0.247498385
 [36] -1.911930815  0.624407064 -1.477955190 -0.475533821  0.721904164
 [41]  0.655695067 -0.761257980 -1.112646397  0.304741188 -0.199883834
 [46]  0.519596176 -1.605407740 -0.936399059 -0.876997353 -0.562755549
 [51]  1.290612862  0.008788104 -0.889306944  0.199236880 -0.638056241
 [56] -1.046783459 -0.340249129  0.133440406  0.818899483 -0.111179344
 [61]  1.471021525 -0.004190175 -0.842863886 -0.279640964 -0.630133392
 [66] -0.682537878 -0.759449347  1.398078992  1.749497205  1.041931982
 [71]  1.497670146  0.242846924 -0.351087542 -0.102426071 -0.924992111
 [76] -1.758505236  0.632872236 -1.108991596 -0.434905698 -0.381550060
 [81]  1.064022444  0.640360672 -0.473779139 -0.805890909  1.948334660
 [86] -0.230811977 -0.236297010  0.225043029 -0.076437185  0.734058054
 [91]  0.129209346  1.037871312 -0.840468638 -1.319594994 -0.914241565
 [96] -0.568711675 -0.395804499 -1.326817437 -0.790290461 -1.266194511
> rowMin(tmp2)
  [1]  0.720622864  0.670995737 -0.401151647 -0.413652161  0.230604788
  [6]  0.989870489 -0.554185885 -0.570907927  0.263699370 -1.590521361
 [11] -0.146422871 -0.227035841  0.631925894 -0.108198344 -0.238955347
 [16] -0.314888595 -0.851669004  0.007217767  0.836161580 -1.530371028
 [21]  0.520866898  0.012069285  0.049163131  0.236961156 -0.307373742
 [26] -0.711468530 -0.585090755  0.514355477  1.115010393 -0.081899979
 [31] -0.353070454  2.007197428 -0.352485202  1.255159367  0.247498385
 [36] -1.911930815  0.624407064 -1.477955190 -0.475533821  0.721904164
 [41]  0.655695067 -0.761257980 -1.112646397  0.304741188 -0.199883834
 [46]  0.519596176 -1.605407740 -0.936399059 -0.876997353 -0.562755549
 [51]  1.290612862  0.008788104 -0.889306944  0.199236880 -0.638056241
 [56] -1.046783459 -0.340249129  0.133440406  0.818899483 -0.111179344
 [61]  1.471021525 -0.004190175 -0.842863886 -0.279640964 -0.630133392
 [66] -0.682537878 -0.759449347  1.398078992  1.749497205  1.041931982
 [71]  1.497670146  0.242846924 -0.351087542 -0.102426071 -0.924992111
 [76] -1.758505236  0.632872236 -1.108991596 -0.434905698 -0.381550060
 [81]  1.064022444  0.640360672 -0.473779139 -0.805890909  1.948334660
 [86] -0.230811977 -0.236297010  0.225043029 -0.076437185  0.734058054
 [91]  0.129209346  1.037871312 -0.840468638 -1.319594994 -0.914241565
 [96] -0.568711675 -0.395804499 -1.326817437 -0.790290461 -1.266194511
> 
> colMeans(tmp2)
[1] -0.1039279
> colSums(tmp2)
[1] -10.39279
> colVars(tmp2)
[1] 0.7190201
> colSd(tmp2)
[1] 0.8479505
> colMax(tmp2)
[1] 2.007197
> colMin(tmp2)
[1] -1.911931
> colMedians(tmp2)
[1] -0.2289239
> colRanges(tmp2)
          [,1]
[1,] -1.911931
[2,]  2.007197
> 
> 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.015225  1.549149  5.965775 -4.549146 -1.474171 -0.192928  4.346110
 [8] -3.927250 -2.998784  4.437890
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.6428483
[2,] -0.6583455
[3,]  0.2568018
[4,]  0.9292599
[5,]  1.6193544
> 
> rowApply(tmp,sum)
 [1]  5.4946693  4.4963842 -2.4986475 -3.3218941 -0.5237355 -4.0479298
 [7] -3.2122829  2.1326027  8.8004857 -3.1477834
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   10    6    5    3   10    4    1    5    4    10
 [2,]    9    5    9    5    9    8    3    6    1     4
 [3,]    6   10    3    8    7    9    6   10    6     9
 [4,]    3    7    1    2    1    1    2    9    8     7
 [5,]    5    3    7    6    3    6    4    7    2     6
 [6,]    8    1    6    4    5    3    7    8    9     5
 [7,]    2    2    8    7    6   10    8    4   10     8
 [8,]    4    9    2    9    2    2    5    3    3     1
 [9,]    1    4    4    1    4    5    9    2    5     2
[10,]    7    8   10   10    8    7   10    1    7     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.4158162  2.4354836  0.5783760  2.4188316  3.7694038  1.4850356
 [7] -3.2188346  3.7374332  1.9881823  1.2655105 -2.1696732 -1.4636133
[13]  0.7691724  1.4872672 -1.3718514 -0.2089207 -1.0692872 -1.5413140
[19] -2.0261020 -0.1223338
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.74226739
[2,] -1.41943308
[3,] -0.01687566
[4,]  0.08658424
[5,]  1.67617570
> 
> rowApply(tmp,sum)
[1]  2.3970879 -0.5690914  1.2495634 -0.5408236  2.7902137
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   11    4   19    2   11
[2,]   17    8   10   19   16
[3,]    7   11    2   10   20
[4,]    9   17   13   17   15
[5,]   12   13   18   20   13
> 
> 
> as.matrix(tmp)
            [,1]         [,2]        [,3]       [,4]       [,5]       [,6]
[1,] -0.01687566  1.004590681 -0.36047833 -0.2941707 0.03953415 -0.7895078
[2,] -1.74226739 -0.128156601  0.20492092  1.0188203 0.47445198  0.5450981
[3,]  1.67617570  0.005916118 -1.74850777  0.2393284 1.60702811  0.8682926
[4,] -1.41943308  0.802586750  0.02118541  0.7197680 1.23556799 -0.2938281
[5,]  0.08658424  0.750546675  2.46125582  0.7350855 0.41282160  1.1549807
           [,7]        [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -2.1673049  0.79014446  1.0508263  0.5832760 -0.3090173  1.5391798
[2,]  0.8533449  2.63930631  1.9069797 -0.4611811 -2.6407037 -2.2938097
[3,] -0.5324462 -0.05794174 -0.5085974  1.5822363  0.3136155 -0.7908843
[4,] -0.5575236  0.17523031  0.3116670  0.4970439  0.7762637 -0.9755266
[5,] -0.8149048  0.19069382 -0.7726934 -0.9358645 -0.3098314  1.0574276
          [,13]      [,14]       [,15]       [,16]      [,17]       [,18]
[1,]  2.2834074 -0.5106750  0.42351523 -0.16246752 -0.6295713 -0.50264508
[2,] -1.7590932  0.6335410 -0.09779503 -0.64566047  1.0393266 -0.08019732
[3,]  1.7415940 -0.3182156 -1.75325807  0.04077210  0.5735568 -0.58003361
[4,] -0.6381417 -0.3966727  0.13729515  0.02070829 -1.4991806  0.60612331
[5,] -0.8585942  2.0792895 -0.08160866  0.53772689 -0.5534186 -0.98456136
          [,19]       [,20]
[1,] -0.5120231  0.93735069
[2,]  0.3275391 -0.36355583
[3,]  0.2070891 -1.31615683
[4,] -0.6298677  0.56591064
[5,] -1.4188394  0.05411754
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.8  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  631  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  547  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.8  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
         col1     col2       col3      col4     col5      col6      col7
row1 1.215101 0.565755 -0.7485253 -1.368808 3.631666 0.9291274 0.6812602
           col8      col9     col10     col11    col12    col13       col14
row1 -0.4878459 -1.549651 0.2378886 0.6529027 1.159608 1.049799 -0.03844412
        col15      col16     col17     col18      col19     col20
row1 1.337015 -0.7084791 0.4738634 0.7482714 -0.5701183 -1.245833
> tmp[,"col10"]
          col10
row1  0.2378886
row2  1.6525975
row3  0.3597993
row4  2.1415353
row5 -0.1498462
> tmp[c("row1","row5"),]
         col1        col2       col3       col4     col5      col6       col7
row1 1.215101  0.56575497 -0.7485253 -1.3688083 3.631666 0.9291274  0.6812602
row5 0.534946 -0.01735794  1.2945834 -0.6724845 1.442024 0.2237151 -0.7645207
           col8       col9      col10      col11     col12     col13
row1 -0.4878459 -1.5496514  0.2378886  0.6529027 1.1596078 1.0497992
row5  0.1825307 -0.9414998 -0.1498462 -2.1774655 0.6482932 0.9160959
           col14     col15      col16     col17       col18      col19
row1 -0.03844412 1.3370146 -0.7084791 0.4738634  0.74827137 -0.5701183
row5  0.47387916 0.1655164  1.8529517 0.6158661 -0.04376376 -0.8364838
          col20
row1 -1.2458325
row5  0.4283522
> tmp[,c("col6","col20")]
           col6      col20
row1  0.9291274 -1.2458325
row2 -0.7604898 -0.2997866
row3  1.2483629  0.1500262
row4  0.2409291 -0.5505318
row5  0.2237151  0.4283522
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 0.9291274 -1.2458325
row5 0.2237151  0.4283522
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.36612 49.59025 50.74993 51.09344 51.82627 104.2301 49.60528 48.95262
         col9    col10    col11    col12    col13    col14    col15   col16
row1 49.49952 50.74423 48.46674 49.19152 48.38966 49.23538 48.07787 50.6493
        col17    col18    col19   col20
row1 50.15542 49.89194 50.57008 104.813
> tmp[,"col10"]
        col10
row1 50.74423
row2 30.86723
row3 30.29624
row4 29.41159
row5 48.30044
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.36612 49.59025 50.74993 51.09344 51.82627 104.2301 49.60528 48.95262
row5 50.16394 50.77413 49.36667 51.06468 50.74358 104.4643 49.95755 48.64601
         col9    col10    col11    col12    col13    col14    col15   col16
row1 49.49952 50.74423 48.46674 49.19152 48.38966 49.23538 48.07787 50.6493
row5 50.90329 48.30044 53.03248 50.11609 50.35018 49.87032 49.85437 48.7613
        col17    col18    col19   col20
row1 50.15542 49.89194 50.57008 104.813
row5 49.43137 50.10952 50.77213 104.103
> tmp[,c("col6","col20")]
          col6     col20
row1 104.23012 104.81302
row2  74.93316  75.98624
row3  75.99755  74.28958
row4  74.94155  75.52532
row5 104.46429 104.10298
> tmp[c("row1","row5"),c("col6","col20")]
         col6   col20
row1 104.2301 104.813
row5 104.4643 104.103
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6   col20
row1 104.2301 104.813
row5 104.4643 104.103
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -1.0703519
[2,] -0.9983591
[3,]  1.0835026
[4,]  1.7279388
[5,]  0.3718186
> tmp[,c("col17","col7")]
           col17       col7
[1,] -0.22327636  0.7318607
[2,] -1.53822888 -0.9555203
[3,] -0.33595056 -1.0417958
[4,] -0.56770080 -0.4303123
[5,]  0.05539802 -1.0655746
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6        col20
[1,] -2.2845691  0.483035543
[2,] -1.0747893 -0.636377076
[3,] -0.6327408  0.003314354
[4,] -0.2465585  0.662287731
[5,] -0.6000832  0.388251566
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -2.284569
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] -2.284569
[2,] -1.074789
> 
> 
> 
> 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 1.2594249 -0.5148894 -2.0702653 -0.1267661 -1.856810 -0.3980276 0.1948698
row1 0.9984306 -0.6351132  0.8624412  0.7076202  2.593364 -0.1049648 0.2962113
           [,8]      [,9]      [,10]    [,11]      [,12]      [,13]    [,14]
row3 -0.8030661 -0.798124  0.8443972 1.490000 -1.1885043 0.72954384 2.232302
row1  0.1507134  1.858705 -0.8043377 1.399742 -0.1026796 0.02630805 1.339956
          [,15]     [,16]      [,17]      [,18]      [,19]      [,20]
row3 -0.6703168 -1.153475 -0.8770311 -0.1949876 -0.4986131 -1.3997940
row1 -0.3435061 -0.726937 -0.9286588  3.1580218  2.1840804 -0.4453285
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]      [,3]      [,4]         [,5]        [,6]      [,7]
row2 -1.809727 1.165252 -0.394022 -1.230976 -0.006994381 -0.01086769 0.3682717
         [,8]     [,9]      [,10]
row2 0.855629 0.236024 -0.3604105
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]     [,2]       [,3]      [,4]     [,5]       [,6]       [,7]
row5 -0.7488302 1.775546 0.01338494 -2.142486 1.144449 0.05672027 -0.4081914
          [,8]       [,9]      [,10]      [,11]    [,12]    [,13]    [,14]
row5 -1.010847 -0.6427123 -0.3853149 -0.5644911 0.564494 -2.44015 -0.38177
          [,15]     [,16]     [,17]      [,18]       [,19]     [,20]
row5 -0.5750133 0.3439617 -1.012511 -0.4714238 -0.04771581 0.4262016
> 
> 
> 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)

> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd8171d4981" 
 [2] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd817130048c"
 [3] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd816b9071c0"
 [4] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd814d892c9d"
 [5] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd81177bc71b"
 [6] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd814de1f456"
 [7] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd815c810468"
 [8] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd812bd6eb1e"
 [9] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd8113d267f" 
[10] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd81a8660bb" 
[11] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd81ba1a44f" 
[12] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd816690df34"
[13] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd8137d03977"
[14] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd8117fa63a5"
[15] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BMd81378ea754"
> 
> 
> ### 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)

> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)

Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)

> rowMedians(tmp)
  [1] -0.575465586 -0.600542044  0.092038817  0.150931265  0.208827859
  [6] -0.193260358 -0.225130101 -0.106672147 -0.237417222 -0.070249533
 [11]  0.009290566 -0.215928627  0.051242653  0.455416850  0.179676893
 [16]  0.393281702 -0.155304370  0.249988663 -0.171744400  0.098529776
 [21]  0.066151498 -0.611747130  0.293043895  0.250451400  0.281531767
 [26]  0.531033816 -0.297553503  0.209149693  0.226589567  0.416546596
 [31] -0.473659977  0.143860673 -0.078770144  0.397477561 -0.297841428
 [36]  0.202842589 -0.250817303 -0.094577761 -0.437264773  0.203651781
 [41] -0.163961658  0.060579088  0.127925152 -0.065290029 -0.305864900
 [46]  0.026983039  0.485905268 -0.453117024  0.434376946  0.438419285
 [51] -0.537621789  0.275805750  0.345618518  0.209791169  0.431323745
 [56] -0.024286007  0.290567777  0.075874494  0.252370156 -0.818104682
 [61]  0.312151032 -0.737824773  0.374994238 -0.591749169  0.136966045
 [66]  0.260438386  0.125998905 -0.069556572  0.498281443 -0.454006763
 [71] -0.078726958  0.701381769 -0.426540517  0.112931346  0.068224716
 [76]  0.405368362 -0.100878565  0.091414868 -0.077318737  0.037102815
 [81] -0.321838380 -0.054251664  0.048794490 -0.339847838 -0.240993625
 [86] -0.246508670  0.115097053 -0.617590837  0.273952137  0.678292929
 [91] -0.340448529 -0.494181510  0.272056673 -0.400427647 -0.347570154
 [96] -0.196184100  0.116846019 -0.176844003 -0.616160391  0.122973206
[101]  0.101304797  0.079842069  0.366360800 -0.374122121  0.057982939
[106] -0.034267153 -0.036775192 -0.432836247 -0.057425414 -0.336163322
[111] -0.355253698  0.088624208 -0.011264286  0.166121648 -0.502283745
[116]  0.067824253  0.287869667  0.344873867 -0.353332791 -0.433261592
[121] -0.803804310  0.163968082  0.507082316  0.412920580  0.095784202
[126] -0.223961159  0.162755548  0.331312763 -0.310252714  0.464391882
[131] -0.040410136 -0.191618941  0.290690605  0.033801904  0.019077867
[136] -0.054058083  0.058296977 -0.221381057  0.050580924  0.050592913
[141] -0.360816798  0.448029826 -0.097253341 -0.303325424 -0.025948432
[146] -0.099011726  0.016522638 -0.048151531 -0.070600968 -0.250733464
[151] -0.483551799 -0.171123517 -0.367896573  0.636508819 -0.392724524
[156] -0.445654439  0.055396323  0.074669564  0.425131170  0.166404872
[161]  0.858755478  0.129889976  0.063559342  0.284098174  0.574659806
[166]  0.275087822 -0.728972898 -0.396416753 -0.197075741 -0.331525667
[171] -0.391516404  0.216250905 -0.140580214 -0.196495482  0.056925921
[176] -0.018087949  0.137735945  0.116210154  0.269934476  0.313203438
[181] -0.058766970 -0.542709373  0.435914316  0.234723148  0.242951380
[186]  0.430408982 -0.135964456  0.293630506  0.813653188 -0.469784950
[191] -0.196874327  0.173277000 -0.292481113 -0.308971983 -0.475613439
[196]  0.316490380  0.608747618 -0.349102502 -0.155334541  0.126802988
[201]  0.305532226  0.076026979  0.002657199  0.455579513  0.723081173
[206] -0.189705928 -0.244594248  0.095401573 -0.154513964  0.128335873
[211] -0.440673618 -0.187000967  0.566693179  0.263166044 -0.368931926
[216]  0.282071298 -0.117128013  0.429446464 -0.242440956  0.207015149
[221] -0.143088045 -0.418672288  0.145209052 -0.004776312 -0.134084811
[226] -0.086568201  0.164490534  0.453576121 -0.088251865 -0.771328401
> 
> proc.time()
   user  system elapsed 
  2.269   1.045   3.395 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> prefix <- "dbmtest"
> directory <- getwd()
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 


> .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 


> .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 


> .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 


> 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







> .Call("R_bm_AddColumn",P)

> .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 


> .Call("R_bm_AddColumn",P)

> .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 


> rm(P)
> 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,5)
[1] TRUE
> .Call("R_bm_AddColumn",P)

> .Call("R_bm_AddColumn",P)

> .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 


> 
> .Call("R_bm_ResizeBuffer",P,5,5)

> .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 


> 
> .Call("R_bm_RowMode",P)

> .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 


> 
> .Call("R_bm_ColMode",P)

> .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 


> rm(P)
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)

> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")

> .Call("R_bm_AddColumn",P)

> .Call("R_bm_AddColumn",P)

> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile109839333170" "BufferedMatrixFile1098762a4ca5"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile109839333170" "BufferedMatrixFile1098762a4ca5"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)

> .Call("R_bm_AddColumn",P)

> .Call("R_bm_ReadOnlyModeToggle",P)

> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)

> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)

> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)

> .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)

> .Call("R_bm_AddColumn",P)

> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)

> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)

> 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 


> .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 


> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.251   0.030   0.265 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.375   0.051   0.411 

Example timings