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-04-09 11:25:16 -0400 (Tue, 09 Apr 2019).

Package 190/1703HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.47.0
Ben Bolstad
Snapshot Date: 2019-04-08 17:01:18 -0400 (Mon, 08 Apr 2019)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: master
Last Commit: eca2e36
Last Changed Date: 2018-10-30 11:54:27 -0400 (Tue, 30 Oct 2018)
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
merida2 OS X 10.11.6 El Capitan / x86_64  OK  OK  OK  OK 

Summary

Package: BufferedMatrix
Version: 1.47.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.47.0.tar.gz
StartedAt: 2019-04-08 23:08:24 -0400 (Mon, 08 Apr 2019)
EndedAt: 2019-04-08 23:08:50 -0400 (Mon, 08 Apr 2019)
EllapsedTime: 26.2 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.47.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2019-03-18 r76245)
* 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.47.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 Under development (unstable) (2019-03-18 r76245) -- "Unsuffered Consequences"
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.394   0.023   0.405 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2019-03-18 r76245) -- "Unsuffered Consequences"
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 410344 22.0     851668 45.5   641485 34.3
Vcells 735377  5.7    8388608 64.0  1798268 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  8 23:08:43 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  8 23:08:44 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: 0x55717a71beb0>
> 
> 
> 
> 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  8 23:08:44 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  8 23:08:44 2019"
> 
> ColMode(tmp2)
<pointer: 0x55717a71beb0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]       [,3]       [,4]
[1,] 100.9127160  1.1710903  1.0688444 -0.3460070
[2,]  -0.2950978 -0.5481263  0.6575957 -0.2904070
[3,]  -0.9275532  1.1843278 -0.9985650 -0.2089852
[4,]  -0.6758983  0.7402822 -0.5949168 -0.4747719
> 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,] 100.9127160 1.1710903 1.0688444 0.3460070
[2,]   0.2950978 0.5481263 0.6575957 0.2904070
[3,]   0.9275532 1.1843278 0.9985650 0.2089852
[4,]   0.6758983 0.7402822 0.5949168 0.4747719
> 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,] 10.0455321 1.0821692 1.0338493 0.5882236
[2,]  0.5432290 0.7403555 0.8109227 0.5388942
[3,]  0.9630957 1.0882682 0.9992823 0.4571489
[4,]  0.8221303 0.8603965 0.7713085 0.6890370
> 
> 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,] 226.36804 36.99278 36.40734 31.22824
[2,]  30.72739 32.95168 33.76682 30.67935
[3,]  35.55851 37.06701 35.99139 29.78047
[4,]  33.89720 34.34425 33.30800 32.36514
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x55717bafebd0>
> exp(tmp5)
<pointer: 0x55717bafebd0>
> log(tmp5,2)
<pointer: 0x55717bafebd0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.1554
> Min(tmp5)
[1] 54.54702
> mean(tmp5)
[1] 73.42346
> Sum(tmp5)
[1] 14684.69
> Var(tmp5)
[1] 867.802
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.82216 69.13712 70.74222 70.41594 71.19825 71.84829 70.05765 72.27652
 [9] 75.16755 72.56891
> rowSums(tmp5)
 [1] 1816.443 1382.742 1414.844 1408.319 1423.965 1436.966 1401.153 1445.530
 [9] 1503.351 1451.378
> rowVars(tmp5)
 [1] 8057.30602   50.90173   57.79061   72.40995   94.15952   61.66959
 [7]   73.95488  147.74932   52.44504   40.51745
> rowSd(tmp5)
 [1] 89.762498  7.134545  7.602014  8.509404  9.703583  7.852999  8.599702
 [8] 12.155218  7.241894  6.365332
> rowMax(tmp5)
 [1] 471.15541  82.32262  86.45470  82.25187  94.50346  86.54296  84.77334
 [8]  95.82432  84.56878  87.59895
> rowMin(tmp5)
 [1] 56.06672 55.12802 58.25907 54.93560 57.73970 54.54702 57.41862 55.42956
 [9] 58.65656 64.24087
> 
> colMeans(tmp5)
 [1] 112.32620  74.80609  79.53955  67.03448  71.28412  70.73927  71.31208
 [8]  72.68234  70.38738  73.04560  69.45489  67.56332  71.37358  74.25183
[15]  70.06541  70.08215  72.92174  74.37607  70.97332  64.24980
> colSums(tmp5)
 [1] 1123.2620  748.0609  795.3955  670.3448  712.8412  707.3927  713.1208
 [8]  726.8234  703.8738  730.4560  694.5489  675.6332  713.7358  742.5183
[15]  700.6541  700.8215  729.2174  743.7607  709.7332  642.4980
> colVars(tmp5)
 [1] 15923.69254    33.61644    72.62038    61.28007   106.41039    74.00448
 [7]    85.07599    92.53364    57.92585   112.42371    51.10797    24.88804
[13]    53.80381    70.59029   128.71970    73.78077    49.16339    80.26758
[19]    19.64590    29.35040
> colSd(tmp5)
 [1] 126.189114   5.797969   8.521759   7.828159  10.315541   8.602585
 [7]   9.223665   9.619441   7.610904  10.603005   7.148984   4.988792
[13]   7.335108   8.401803  11.345470   8.589574   7.011661   8.959217
[19]   4.432369   5.417601
> colMax(tmp5)
 [1] 471.15541  82.38813  94.50346  84.77334  95.82432  88.95726  84.79989
 [8]  84.64350  80.79628  86.54296  83.94560  75.70615  87.59895  86.45470
[15]  91.30202  83.20710  84.17243  87.81040  77.99789  72.25163
> colMin(tmp5)
 [1] 63.95503 62.53572 69.32624 54.54702 54.93560 60.02003 56.06672 55.42956
 [9] 57.74262 59.59166 61.00741 61.26328 62.82026 57.50995 55.12802 57.41862
[17] 63.25244 59.62588 63.97622 57.73970
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 90.82216 69.13712 70.74222 70.41594 71.19825 71.84829 70.05765 72.27652
 [9]       NA 72.56891
> rowSums(tmp5)
 [1] 1816.443 1382.742 1414.844 1408.319 1423.965 1436.966 1401.153 1445.530
 [9]       NA 1451.378
> rowVars(tmp5)
 [1] 8057.30602   50.90173   57.79061   72.40995   94.15952   61.66959
 [7]   73.95488  147.74932   52.81488   40.51745
> rowSd(tmp5)
 [1] 89.762498  7.134545  7.602014  8.509404  9.703583  7.852999  8.599702
 [8] 12.155218  7.267385  6.365332
> rowMax(tmp5)
 [1] 471.15541  82.32262  86.45470  82.25187  94.50346  86.54296  84.77334
 [8]  95.82432        NA  87.59895
> rowMin(tmp5)
 [1] 56.06672 55.12802 58.25907 54.93560 57.73970 54.54702 57.41862 55.42956
 [9]       NA 64.24087
> 
> colMeans(tmp5)
 [1] 112.32620  74.80609  79.53955  67.03448  71.28412  70.73927  71.31208
 [8]  72.68234  70.38738  73.04560  69.45489  67.56332  71.37358  74.25183
[15]  70.06541  70.08215  72.92174  74.37607  70.97332        NA
> colSums(tmp5)
 [1] 1123.2620  748.0609  795.3955  670.3448  712.8412  707.3927  713.1208
 [8]  726.8234  703.8738  730.4560  694.5489  675.6332  713.7358  742.5183
[15]  700.6541  700.8215  729.2174  743.7607  709.7332        NA
> colVars(tmp5)
 [1] 15923.69254    33.61644    72.62038    61.28007   106.41039    74.00448
 [7]    85.07599    92.53364    57.92585   112.42371    51.10797    24.88804
[13]    53.80381    70.59029   128.71970    73.78077    49.16339    80.26758
[19]    19.64590          NA
> colSd(tmp5)
 [1] 126.189114   5.797969   8.521759   7.828159  10.315541   8.602585
 [7]   9.223665   9.619441   7.610904  10.603005   7.148984   4.988792
[13]   7.335108   8.401803  11.345470   8.589574   7.011661   8.959217
[19]   4.432369         NA
> colMax(tmp5)
 [1] 471.15541  82.38813  94.50346  84.77334  95.82432  88.95726  84.79989
 [8]  84.64350  80.79628  86.54296  83.94560  75.70615  87.59895  86.45470
[15]  91.30202  83.20710  84.17243  87.81040  77.99789        NA
> colMin(tmp5)
 [1] 63.95503 62.53572 69.32624 54.54702 54.93560 60.02003 56.06672 55.42956
 [9] 57.74262 59.59166 61.00741 61.26328 62.82026 57.50995 55.12802 57.41862
[17] 63.25244 59.62588 63.97622       NA
> 
> Max(tmp5,na.rm=TRUE)
[1] 471.1554
> Min(tmp5,na.rm=TRUE)
[1] 54.54702
> mean(tmp5,na.rm=TRUE)
[1] 73.44784
> Sum(tmp5,na.rm=TRUE)
[1] 14616.12
> Var(tmp5,na.rm=TRUE)
[1] 872.0653
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.82216 69.13712 70.74222 70.41594 71.19825 71.84829 70.05765 72.27652
 [9] 75.51467 72.56891
> rowSums(tmp5,na.rm=TRUE)
 [1] 1816.443 1382.742 1414.844 1408.319 1423.965 1436.966 1401.153 1445.530
 [9] 1434.779 1451.378
> rowVars(tmp5,na.rm=TRUE)
 [1] 8057.30602   50.90173   57.79061   72.40995   94.15952   61.66959
 [7]   73.95488  147.74932   52.81488   40.51745
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.762498  7.134545  7.602014  8.509404  9.703583  7.852999  8.599702
 [8] 12.155218  7.267385  6.365332
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.15541  82.32262  86.45470  82.25187  94.50346  86.54296  84.77334
 [8]  95.82432  84.56878  87.59895
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.06672 55.12802 58.25907 54.93560 57.73970 54.54702 57.41862 55.42956
 [9] 58.65656 64.24087
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.32620  74.80609  79.53955  67.03448  71.28412  70.73927  71.31208
 [8]  72.68234  70.38738  73.04560  69.45489  67.56332  71.37358  74.25183
[15]  70.06541  70.08215  72.92174  74.37607  70.97332  63.76954
> colSums(tmp5,na.rm=TRUE)
 [1] 1123.2620  748.0609  795.3955  670.3448  712.8412  707.3927  713.1208
 [8]  726.8234  703.8738  730.4560  694.5489  675.6332  713.7358  742.5183
[15]  700.6541  700.8215  729.2174  743.7607  709.7332  573.9258
> colVars(tmp5,na.rm=TRUE)
 [1] 15923.69254    33.61644    72.62038    61.28007   106.41039    74.00448
 [7]    85.07599    92.53364    57.92585   112.42371    51.10797    24.88804
[13]    53.80381    70.59029   128.71970    73.78077    49.16339    80.26758
[19]    19.64590    30.42431
> colSd(tmp5,na.rm=TRUE)
 [1] 126.189114   5.797969   8.521759   7.828159  10.315541   8.602585
 [7]   9.223665   9.619441   7.610904  10.603005   7.148984   4.988792
[13]   7.335108   8.401803  11.345470   8.589574   7.011661   8.959217
[19]   4.432369   5.515824
> colMax(tmp5,na.rm=TRUE)
 [1] 471.15541  82.38813  94.50346  84.77334  95.82432  88.95726  84.79989
 [8]  84.64350  80.79628  86.54296  83.94560  75.70615  87.59895  86.45470
[15]  91.30202  83.20710  84.17243  87.81040  77.99789  72.25163
> colMin(tmp5,na.rm=TRUE)
 [1] 63.95503 62.53572 69.32624 54.54702 54.93560 60.02003 56.06672 55.42956
 [9] 57.74262 59.59166 61.00741 61.26328 62.82026 57.50995 55.12802 57.41862
[17] 63.25244 59.62588 63.97622 57.73970
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.82216 69.13712 70.74222 70.41594 71.19825 71.84829 70.05765 72.27652
 [9]      NaN 72.56891
> rowSums(tmp5,na.rm=TRUE)
 [1] 1816.443 1382.742 1414.844 1408.319 1423.965 1436.966 1401.153 1445.530
 [9]    0.000 1451.378
> rowVars(tmp5,na.rm=TRUE)
 [1] 8057.30602   50.90173   57.79061   72.40995   94.15952   61.66959
 [7]   73.95488  147.74932         NA   40.51745
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.762498  7.134545  7.602014  8.509404  9.703583  7.852999  8.599702
 [8] 12.155218        NA  6.365332
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.15541  82.32262  86.45470  82.25187  94.50346  86.54296  84.77334
 [8]  95.82432        NA  87.59895
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.06672 55.12802 58.25907 54.93560 57.73970 54.54702 57.41862 55.42956
 [9]       NA 64.24087
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.75935  74.54224  79.13093  67.21662  71.06049  69.64739  71.11057
 [8]  72.06367  69.62885  71.76525  70.32643  66.91184  71.05600  74.26510
[15]  71.33306  68.62382  71.67166  74.10640  70.60428       NaN
> colSums(tmp5,na.rm=TRUE)
 [1] 1041.8342  670.8802  712.1783  604.9496  639.5444  626.8265  639.9951
 [8]  648.5730  626.6596  645.8872  632.9379  602.2065  639.5040  668.3859
[15]  641.9975  617.6144  645.0449  666.9576  635.4385    0.0000
> colVars(tmp5,na.rm=TRUE)
 [1] 17781.55511    37.03529    79.81952    68.56685   119.14909    69.84258
 [7]    95.25368    99.79430    58.69369   108.03452    48.95119    23.22423
[13]    59.39460    79.41209   126.73165    59.07777    37.72851    89.48294
[19]    20.56946          NA
> colSd(tmp5,na.rm=TRUE)
 [1] 133.347498   6.085663   8.934177   8.280510  10.915543   8.357187
 [7]   9.759799   9.989710   7.661181  10.393965   6.996513   4.819153
[13]   7.706789   8.911346  11.257515   7.686206   6.142354   9.459542
[19]   4.535356         NA
> colMax(tmp5,na.rm=TRUE)
 [1] 471.15541  82.38813  94.50346  84.77334  95.82432  88.95726  84.79989
 [8]  84.64350  80.79628  86.54296  83.94560  75.70615  87.59895  86.45470
[15]  91.30202  81.56233  81.74255  87.81040  77.99789      -Inf
> colMin(tmp5,na.rm=TRUE)
 [1] 63.95503 62.53572 69.32624 54.54702 54.93560 60.02003 56.06672 55.42956
 [9] 57.74262 59.59166 61.00741 61.26328 62.82026 57.50995 55.12802 57.41862
[17] 63.25244 59.62588 63.97622      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] 208.22558 172.66213 184.83680 242.26949 190.45299  87.44262 180.84554
 [8] 176.17029 162.97101 260.06257
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 208.22558 172.66213 184.83680 242.26949 190.45299  87.44262 180.84554
 [8] 176.17029 162.97101 260.06257
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  8.526513e-14 -5.684342e-14 -5.684342e-14  5.684342e-14 -5.684342e-14
 [6] -5.684342e-14  1.136868e-13  8.526513e-14  8.526513e-14  1.421085e-13
[11]  5.684342e-14 -3.552714e-14 -1.136868e-13  0.000000e+00  5.684342e-14
[16] -5.684342e-14 -5.684342e-14 -5.684342e-14 -4.263256e-14  2.273737e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
3   2 
4   12 
10   8 
4   16 
6   15 
5   6 
6   17 
7   1 
4   10 
2   7 
4   4 
7   7 
2   11 
7   4 
6   8 
10   15 
2   15 
6   7 
6   4 
5   17 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.488906
> Min(tmp)
[1] -2.811957
> mean(tmp)
[1] -0.09163743
> Sum(tmp)
[1] -9.163743
> Var(tmp)
[1] 1.293574
> 
> rowMeans(tmp)
[1] -0.09163743
> rowSums(tmp)
[1] -9.163743
> rowVars(tmp)
[1] 1.293574
> rowSd(tmp)
[1] 1.137354
> rowMax(tmp)
[1] 2.488906
> rowMin(tmp)
[1] -2.811957
> 
> colMeans(tmp)
  [1]  0.58671527 -0.13083691  0.02262191 -0.65927622  0.36089749 -0.68094205
  [7]  1.30199812  0.08968268  1.58718692 -1.58247841  0.11313630 -0.05634244
 [13]  0.22832780  1.91608423 -0.68001989 -0.38844553 -1.50377031 -0.64857062
 [19]  0.28899362  0.16129043 -1.06746904 -0.85649157  0.89435894  0.50197867
 [25] -2.00372485 -1.09431081 -1.51300369  0.20140738 -0.33872222  1.43421754
 [31]  0.98956642  1.48187698 -1.71650817  1.83206186  0.04810629  0.09568335
 [37]  0.22856085  0.06295550  1.75937230 -0.44723768 -0.29102298 -1.41469474
 [43]  2.38698787  0.29437680 -1.52416912  0.81413425 -0.77440825  1.24818275
 [49] -0.06559625  0.26130023  0.57550009  0.78199059  0.37384099 -1.16987246
 [55]  1.49346288 -1.90438612 -1.17454573 -2.37247843 -0.62439911 -2.14983046
 [61] -1.84459674 -0.70413793  0.65613468  0.29765326  1.19458533 -0.67278414
 [67] -0.31691189  1.09755928 -1.31151400 -0.69127563 -0.30545396 -1.36572909
 [73]  0.22532199 -0.49117390 -2.81195688 -0.05569302 -1.40686576  1.49453654
 [79]  0.49684646  0.08653357  0.73894648  1.57433958  1.76447181  2.07481944
 [85]  0.48233243 -0.47396855  0.41115130  0.36276061 -0.26008412  0.30702404
 [91] -0.29368181 -0.86478435  0.03309782 -1.36140404 -2.41086040 -0.15329354
 [97] -1.18432223  2.48890571  0.12553952 -1.67911442
> colSums(tmp)
  [1]  0.58671527 -0.13083691  0.02262191 -0.65927622  0.36089749 -0.68094205
  [7]  1.30199812  0.08968268  1.58718692 -1.58247841  0.11313630 -0.05634244
 [13]  0.22832780  1.91608423 -0.68001989 -0.38844553 -1.50377031 -0.64857062
 [19]  0.28899362  0.16129043 -1.06746904 -0.85649157  0.89435894  0.50197867
 [25] -2.00372485 -1.09431081 -1.51300369  0.20140738 -0.33872222  1.43421754
 [31]  0.98956642  1.48187698 -1.71650817  1.83206186  0.04810629  0.09568335
 [37]  0.22856085  0.06295550  1.75937230 -0.44723768 -0.29102298 -1.41469474
 [43]  2.38698787  0.29437680 -1.52416912  0.81413425 -0.77440825  1.24818275
 [49] -0.06559625  0.26130023  0.57550009  0.78199059  0.37384099 -1.16987246
 [55]  1.49346288 -1.90438612 -1.17454573 -2.37247843 -0.62439911 -2.14983046
 [61] -1.84459674 -0.70413793  0.65613468  0.29765326  1.19458533 -0.67278414
 [67] -0.31691189  1.09755928 -1.31151400 -0.69127563 -0.30545396 -1.36572909
 [73]  0.22532199 -0.49117390 -2.81195688 -0.05569302 -1.40686576  1.49453654
 [79]  0.49684646  0.08653357  0.73894648  1.57433958  1.76447181  2.07481944
 [85]  0.48233243 -0.47396855  0.41115130  0.36276061 -0.26008412  0.30702404
 [91] -0.29368181 -0.86478435  0.03309782 -1.36140404 -2.41086040 -0.15329354
 [97] -1.18432223  2.48890571  0.12553952 -1.67911442
> 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.58671527 -0.13083691  0.02262191 -0.65927622  0.36089749 -0.68094205
  [7]  1.30199812  0.08968268  1.58718692 -1.58247841  0.11313630 -0.05634244
 [13]  0.22832780  1.91608423 -0.68001989 -0.38844553 -1.50377031 -0.64857062
 [19]  0.28899362  0.16129043 -1.06746904 -0.85649157  0.89435894  0.50197867
 [25] -2.00372485 -1.09431081 -1.51300369  0.20140738 -0.33872222  1.43421754
 [31]  0.98956642  1.48187698 -1.71650817  1.83206186  0.04810629  0.09568335
 [37]  0.22856085  0.06295550  1.75937230 -0.44723768 -0.29102298 -1.41469474
 [43]  2.38698787  0.29437680 -1.52416912  0.81413425 -0.77440825  1.24818275
 [49] -0.06559625  0.26130023  0.57550009  0.78199059  0.37384099 -1.16987246
 [55]  1.49346288 -1.90438612 -1.17454573 -2.37247843 -0.62439911 -2.14983046
 [61] -1.84459674 -0.70413793  0.65613468  0.29765326  1.19458533 -0.67278414
 [67] -0.31691189  1.09755928 -1.31151400 -0.69127563 -0.30545396 -1.36572909
 [73]  0.22532199 -0.49117390 -2.81195688 -0.05569302 -1.40686576  1.49453654
 [79]  0.49684646  0.08653357  0.73894648  1.57433958  1.76447181  2.07481944
 [85]  0.48233243 -0.47396855  0.41115130  0.36276061 -0.26008412  0.30702404
 [91] -0.29368181 -0.86478435  0.03309782 -1.36140404 -2.41086040 -0.15329354
 [97] -1.18432223  2.48890571  0.12553952 -1.67911442
> colMin(tmp)
  [1]  0.58671527 -0.13083691  0.02262191 -0.65927622  0.36089749 -0.68094205
  [7]  1.30199812  0.08968268  1.58718692 -1.58247841  0.11313630 -0.05634244
 [13]  0.22832780  1.91608423 -0.68001989 -0.38844553 -1.50377031 -0.64857062
 [19]  0.28899362  0.16129043 -1.06746904 -0.85649157  0.89435894  0.50197867
 [25] -2.00372485 -1.09431081 -1.51300369  0.20140738 -0.33872222  1.43421754
 [31]  0.98956642  1.48187698 -1.71650817  1.83206186  0.04810629  0.09568335
 [37]  0.22856085  0.06295550  1.75937230 -0.44723768 -0.29102298 -1.41469474
 [43]  2.38698787  0.29437680 -1.52416912  0.81413425 -0.77440825  1.24818275
 [49] -0.06559625  0.26130023  0.57550009  0.78199059  0.37384099 -1.16987246
 [55]  1.49346288 -1.90438612 -1.17454573 -2.37247843 -0.62439911 -2.14983046
 [61] -1.84459674 -0.70413793  0.65613468  0.29765326  1.19458533 -0.67278414
 [67] -0.31691189  1.09755928 -1.31151400 -0.69127563 -0.30545396 -1.36572909
 [73]  0.22532199 -0.49117390 -2.81195688 -0.05569302 -1.40686576  1.49453654
 [79]  0.49684646  0.08653357  0.73894648  1.57433958  1.76447181  2.07481944
 [85]  0.48233243 -0.47396855  0.41115130  0.36276061 -0.26008412  0.30702404
 [91] -0.29368181 -0.86478435  0.03309782 -1.36140404 -2.41086040 -0.15329354
 [97] -1.18432223  2.48890571  0.12553952 -1.67911442
> colMedians(tmp)
  [1]  0.58671527 -0.13083691  0.02262191 -0.65927622  0.36089749 -0.68094205
  [7]  1.30199812  0.08968268  1.58718692 -1.58247841  0.11313630 -0.05634244
 [13]  0.22832780  1.91608423 -0.68001989 -0.38844553 -1.50377031 -0.64857062
 [19]  0.28899362  0.16129043 -1.06746904 -0.85649157  0.89435894  0.50197867
 [25] -2.00372485 -1.09431081 -1.51300369  0.20140738 -0.33872222  1.43421754
 [31]  0.98956642  1.48187698 -1.71650817  1.83206186  0.04810629  0.09568335
 [37]  0.22856085  0.06295550  1.75937230 -0.44723768 -0.29102298 -1.41469474
 [43]  2.38698787  0.29437680 -1.52416912  0.81413425 -0.77440825  1.24818275
 [49] -0.06559625  0.26130023  0.57550009  0.78199059  0.37384099 -1.16987246
 [55]  1.49346288 -1.90438612 -1.17454573 -2.37247843 -0.62439911 -2.14983046
 [61] -1.84459674 -0.70413793  0.65613468  0.29765326  1.19458533 -0.67278414
 [67] -0.31691189  1.09755928 -1.31151400 -0.69127563 -0.30545396 -1.36572909
 [73]  0.22532199 -0.49117390 -2.81195688 -0.05569302 -1.40686576  1.49453654
 [79]  0.49684646  0.08653357  0.73894648  1.57433958  1.76447181  2.07481944
 [85]  0.48233243 -0.47396855  0.41115130  0.36276061 -0.26008412  0.30702404
 [91] -0.29368181 -0.86478435  0.03309782 -1.36140404 -2.41086040 -0.15329354
 [97] -1.18432223  2.48890571  0.12553952 -1.67911442
> colRanges(tmp)
          [,1]       [,2]       [,3]       [,4]      [,5]       [,6]     [,7]
[1,] 0.5867153 -0.1308369 0.02262191 -0.6592762 0.3608975 -0.6809421 1.301998
[2,] 0.5867153 -0.1308369 0.02262191 -0.6592762 0.3608975 -0.6809421 1.301998
           [,8]     [,9]     [,10]     [,11]       [,12]     [,13]    [,14]
[1,] 0.08968268 1.587187 -1.582478 0.1131363 -0.05634244 0.2283278 1.916084
[2,] 0.08968268 1.587187 -1.582478 0.1131363 -0.05634244 0.2283278 1.916084
          [,15]      [,16]    [,17]      [,18]     [,19]     [,20]     [,21]
[1,] -0.6800199 -0.3884455 -1.50377 -0.6485706 0.2889936 0.1612904 -1.067469
[2,] -0.6800199 -0.3884455 -1.50377 -0.6485706 0.2889936 0.1612904 -1.067469
          [,22]     [,23]     [,24]     [,25]     [,26]     [,27]     [,28]
[1,] -0.8564916 0.8943589 0.5019787 -2.003725 -1.094311 -1.513004 0.2014074
[2,] -0.8564916 0.8943589 0.5019787 -2.003725 -1.094311 -1.513004 0.2014074
          [,29]    [,30]     [,31]    [,32]     [,33]    [,34]      [,35]
[1,] -0.3387222 1.434218 0.9895664 1.481877 -1.716508 1.832062 0.04810629
[2,] -0.3387222 1.434218 0.9895664 1.481877 -1.716508 1.832062 0.04810629
          [,36]     [,37]     [,38]    [,39]      [,40]     [,41]     [,42]
[1,] 0.09568335 0.2285608 0.0629555 1.759372 -0.4472377 -0.291023 -1.414695
[2,] 0.09568335 0.2285608 0.0629555 1.759372 -0.4472377 -0.291023 -1.414695
        [,43]     [,44]     [,45]     [,46]      [,47]    [,48]       [,49]
[1,] 2.386988 0.2943768 -1.524169 0.8141342 -0.7744083 1.248183 -0.06559625
[2,] 2.386988 0.2943768 -1.524169 0.8141342 -0.7744083 1.248183 -0.06559625
         [,50]     [,51]     [,52]    [,53]     [,54]    [,55]     [,56]
[1,] 0.2613002 0.5755001 0.7819906 0.373841 -1.169872 1.493463 -1.904386
[2,] 0.2613002 0.5755001 0.7819906 0.373841 -1.169872 1.493463 -1.904386
         [,57]     [,58]      [,59]    [,60]     [,61]      [,62]     [,63]
[1,] -1.174546 -2.372478 -0.6243991 -2.14983 -1.844597 -0.7041379 0.6561347
[2,] -1.174546 -2.372478 -0.6243991 -2.14983 -1.844597 -0.7041379 0.6561347
         [,64]    [,65]      [,66]      [,67]    [,68]     [,69]      [,70]
[1,] 0.2976533 1.194585 -0.6727841 -0.3169119 1.097559 -1.311514 -0.6912756
[2,] 0.2976533 1.194585 -0.6727841 -0.3169119 1.097559 -1.311514 -0.6912756
         [,71]     [,72]    [,73]      [,74]     [,75]       [,76]     [,77]
[1,] -0.305454 -1.365729 0.225322 -0.4911739 -2.811957 -0.05569302 -1.406866
[2,] -0.305454 -1.365729 0.225322 -0.4911739 -2.811957 -0.05569302 -1.406866
        [,78]     [,79]      [,80]     [,81]   [,82]    [,83]    [,84]
[1,] 1.494537 0.4968465 0.08653357 0.7389465 1.57434 1.764472 2.074819
[2,] 1.494537 0.4968465 0.08653357 0.7389465 1.57434 1.764472 2.074819
         [,85]      [,86]     [,87]     [,88]      [,89]    [,90]      [,91]
[1,] 0.4823324 -0.4739686 0.4111513 0.3627606 -0.2600841 0.307024 -0.2936818
[2,] 0.4823324 -0.4739686 0.4111513 0.3627606 -0.2600841 0.307024 -0.2936818
          [,92]      [,93]     [,94]    [,95]      [,96]     [,97]    [,98]
[1,] -0.8647844 0.03309782 -1.361404 -2.41086 -0.1532935 -1.184322 2.488906
[2,] -0.8647844 0.03309782 -1.361404 -2.41086 -0.1532935 -1.184322 2.488906
         [,99]    [,100]
[1,] 0.1255395 -1.679114
[2,] 0.1255395 -1.679114
> 
> 
> Max(tmp2)
[1] 2.722728
> Min(tmp2)
[1] -2.147122
> mean(tmp2)
[1] -0.07656063
> Sum(tmp2)
[1] -7.656063
> Var(tmp2)
[1] 0.9481336
> 
> rowMeans(tmp2)
  [1] -1.03597633 -1.58837136  1.49833713 -0.92272205  0.62489812  1.51070602
  [7]  0.22922014  2.72272752  0.56081457 -0.36898842 -0.10679892 -0.20265153
 [13]  0.07067372  1.53614869 -1.62174302 -0.16746846 -0.86546114  0.24548061
 [19] -1.21619995 -0.15527895  1.10566667  1.90366814  0.83751485  0.77453564
 [25]  0.14084048 -0.94442933  0.20570289  0.66978581 -1.30311885 -1.30394816
 [31] -0.18103285  0.74452957 -0.94201948 -0.74942076  0.28332827 -0.05454525
 [37]  0.04378590 -1.32370212 -0.75952932  1.49929257  0.99982894  0.13443698
 [43] -0.95028414  0.10738106  0.77372763 -1.00109860 -0.46532243 -0.50965435
 [49] -0.89330982  0.53403571  0.44361558  0.09166104 -1.84721263  0.05991611
 [55]  0.59538579 -0.15409958  0.66252805 -0.73424425 -0.21118468  1.31661413
 [61]  1.34503588  0.22250837  0.63399767 -1.55908652  0.57279208 -0.93056778
 [67] -0.29421408  0.90930271  0.42383451  1.51468073  0.90416955 -1.21779144
 [73] -0.48560011  0.42922099 -1.75382682 -0.48209509  1.20690108  0.12098332
 [79]  1.19995145 -1.18566799 -2.14712189  0.04625135 -0.37645444  0.56198998
 [85] -0.82213466 -0.10478742 -1.63921884  0.60130305 -0.21347259  0.08034925
 [91]  0.52192215 -0.80895096 -0.20151527  1.00532154 -1.65935801  0.26316560
 [97] -0.18907796 -1.12613692 -1.80485334 -1.56478328
> rowSums(tmp2)
  [1] -1.03597633 -1.58837136  1.49833713 -0.92272205  0.62489812  1.51070602
  [7]  0.22922014  2.72272752  0.56081457 -0.36898842 -0.10679892 -0.20265153
 [13]  0.07067372  1.53614869 -1.62174302 -0.16746846 -0.86546114  0.24548061
 [19] -1.21619995 -0.15527895  1.10566667  1.90366814  0.83751485  0.77453564
 [25]  0.14084048 -0.94442933  0.20570289  0.66978581 -1.30311885 -1.30394816
 [31] -0.18103285  0.74452957 -0.94201948 -0.74942076  0.28332827 -0.05454525
 [37]  0.04378590 -1.32370212 -0.75952932  1.49929257  0.99982894  0.13443698
 [43] -0.95028414  0.10738106  0.77372763 -1.00109860 -0.46532243 -0.50965435
 [49] -0.89330982  0.53403571  0.44361558  0.09166104 -1.84721263  0.05991611
 [55]  0.59538579 -0.15409958  0.66252805 -0.73424425 -0.21118468  1.31661413
 [61]  1.34503588  0.22250837  0.63399767 -1.55908652  0.57279208 -0.93056778
 [67] -0.29421408  0.90930271  0.42383451  1.51468073  0.90416955 -1.21779144
 [73] -0.48560011  0.42922099 -1.75382682 -0.48209509  1.20690108  0.12098332
 [79]  1.19995145 -1.18566799 -2.14712189  0.04625135 -0.37645444  0.56198998
 [85] -0.82213466 -0.10478742 -1.63921884  0.60130305 -0.21347259  0.08034925
 [91]  0.52192215 -0.80895096 -0.20151527  1.00532154 -1.65935801  0.26316560
 [97] -0.18907796 -1.12613692 -1.80485334 -1.56478328
> 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] -1.03597633 -1.58837136  1.49833713 -0.92272205  0.62489812  1.51070602
  [7]  0.22922014  2.72272752  0.56081457 -0.36898842 -0.10679892 -0.20265153
 [13]  0.07067372  1.53614869 -1.62174302 -0.16746846 -0.86546114  0.24548061
 [19] -1.21619995 -0.15527895  1.10566667  1.90366814  0.83751485  0.77453564
 [25]  0.14084048 -0.94442933  0.20570289  0.66978581 -1.30311885 -1.30394816
 [31] -0.18103285  0.74452957 -0.94201948 -0.74942076  0.28332827 -0.05454525
 [37]  0.04378590 -1.32370212 -0.75952932  1.49929257  0.99982894  0.13443698
 [43] -0.95028414  0.10738106  0.77372763 -1.00109860 -0.46532243 -0.50965435
 [49] -0.89330982  0.53403571  0.44361558  0.09166104 -1.84721263  0.05991611
 [55]  0.59538579 -0.15409958  0.66252805 -0.73424425 -0.21118468  1.31661413
 [61]  1.34503588  0.22250837  0.63399767 -1.55908652  0.57279208 -0.93056778
 [67] -0.29421408  0.90930271  0.42383451  1.51468073  0.90416955 -1.21779144
 [73] -0.48560011  0.42922099 -1.75382682 -0.48209509  1.20690108  0.12098332
 [79]  1.19995145 -1.18566799 -2.14712189  0.04625135 -0.37645444  0.56198998
 [85] -0.82213466 -0.10478742 -1.63921884  0.60130305 -0.21347259  0.08034925
 [91]  0.52192215 -0.80895096 -0.20151527  1.00532154 -1.65935801  0.26316560
 [97] -0.18907796 -1.12613692 -1.80485334 -1.56478328
> rowMin(tmp2)
  [1] -1.03597633 -1.58837136  1.49833713 -0.92272205  0.62489812  1.51070602
  [7]  0.22922014  2.72272752  0.56081457 -0.36898842 -0.10679892 -0.20265153
 [13]  0.07067372  1.53614869 -1.62174302 -0.16746846 -0.86546114  0.24548061
 [19] -1.21619995 -0.15527895  1.10566667  1.90366814  0.83751485  0.77453564
 [25]  0.14084048 -0.94442933  0.20570289  0.66978581 -1.30311885 -1.30394816
 [31] -0.18103285  0.74452957 -0.94201948 -0.74942076  0.28332827 -0.05454525
 [37]  0.04378590 -1.32370212 -0.75952932  1.49929257  0.99982894  0.13443698
 [43] -0.95028414  0.10738106  0.77372763 -1.00109860 -0.46532243 -0.50965435
 [49] -0.89330982  0.53403571  0.44361558  0.09166104 -1.84721263  0.05991611
 [55]  0.59538579 -0.15409958  0.66252805 -0.73424425 -0.21118468  1.31661413
 [61]  1.34503588  0.22250837  0.63399767 -1.55908652  0.57279208 -0.93056778
 [67] -0.29421408  0.90930271  0.42383451  1.51468073  0.90416955 -1.21779144
 [73] -0.48560011  0.42922099 -1.75382682 -0.48209509  1.20690108  0.12098332
 [79]  1.19995145 -1.18566799 -2.14712189  0.04625135 -0.37645444  0.56198998
 [85] -0.82213466 -0.10478742 -1.63921884  0.60130305 -0.21347259  0.08034925
 [91]  0.52192215 -0.80895096 -0.20151527  1.00532154 -1.65935801  0.26316560
 [97] -0.18907796 -1.12613692 -1.80485334 -1.56478328
> 
> colMeans(tmp2)
[1] -0.07656063
> colSums(tmp2)
[1] -7.656063
> colVars(tmp2)
[1] 0.9481336
> colSd(tmp2)
[1] 0.9737215
> colMax(tmp2)
[1] 2.722728
> colMin(tmp2)
[1] -2.147122
> colMedians(tmp2)
[1] -0.00537967
> colRanges(tmp2)
          [,1]
[1,] -2.147122
[2,]  2.722728
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.5963384  0.1707731 -6.3058303 -1.2093193  3.8567021 -2.3127413
 [7]  3.5102731  1.0227416 -0.8190850 -2.9824206
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1494816
[2,] -0.6375577
[3,]  0.5186938
[4,]  0.9455473
[5,]  1.5476311
> 
> rowApply(tmp,sum)
 [1] -1.4604870  0.1418563  2.0510264 -5.8352911  1.4711242 -3.5956417
 [7]  1.0461191 -0.4158474  3.0820623  1.0425107
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    3    9    9    3   10    6    1    9     3
 [2,]    3    6    5    4    9    8    2    2    5     7
 [3,]    4   10    2    6    1    1    8    4    4     1
 [4,]    5    2   10    5    6    7    7    6    3     2
 [5,]   10    4    6    2    8    3    4    9   10     9
 [6,]    7    9    1    3    5    2    9    7    2     5
 [7,]    2    1    8   10    7    9    3   10    7     8
 [8,]    8    5    4    8    4    5    5    8    8     4
 [9,]    6    7    3    1   10    6    1    3    6     6
[10,]    1    8    7    7    2    4   10    5    1    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.95047582 -1.88910719 -1.68108638 -1.40931633 -1.34991315  4.78072194
 [7] -0.86194222  2.73138004 -3.81357209 -1.17656864 -2.80207870  1.41948030
[13] -0.87251100 -0.07007238 -3.39134334  2.56812980  0.90436650 -0.40429975
[19]  1.84881502  1.67757359
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.8840693
[2,] -0.3233033
[3,] -0.1636277
[4,]  0.1038486
[5,]  0.3166759
> 
> rowApply(tmp,sum)
[1]  8.548492 -1.068096 -3.569317 -5.083125 -3.569773
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   10    5   15   11   10
[2,]    1    8    8   19    4
[3,]    2   10    6   12    6
[4,]   12    2   12   15    9
[5,]    6   12   20    6    1
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]        [,5]        [,6]
[1,]  0.1038486 -1.2735355 -0.2980029  0.33291126 -0.04390776  1.60388238
[2,] -0.8840693 -0.3018443  0.1347386 -1.55583433  0.30291617  1.57363838
[3,]  0.3166759 -0.3401575 -0.6052797 -0.03459215  1.10195044 -0.03990668
[4,] -0.1636277  1.1342740 -0.1204004  0.25054301 -0.58419815  0.77450619
[5,] -0.3233033 -1.1078439 -0.7921419 -0.40234412 -2.12667385  0.86860167
           [,7]         [,8]         [,9]      [,10]      [,11]      [,12]
[1,] -0.1651065  1.916930724  0.007339376  0.0295138 -0.0968702 0.02404894
[2,] -2.2174590  0.957006408 -0.764606195  0.4787613 -0.9518364 0.40890905
[3,] -0.2253215 -0.006587229 -0.709943820 -0.4911506  0.7559958 0.15609643
[4,]  1.3426553  0.435138658 -0.710811587 -1.0045412 -2.3141324 0.53849681
[5,]  0.4032895 -0.571108524 -1.635549861 -0.1891520 -0.1952355 0.29192906
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,]  1.1643298 -0.1606199  0.3771804  0.8815051  1.7400397  0.9442688
[2,] -0.2831692  0.2136202 -1.2389204  0.9780862  1.1913047 -0.4300859
[3,] -0.8356635 -1.3597174 -1.0913025  0.6395855  0.4297960  0.6193808
[4,] -0.3320072 -0.7412456 -0.5840941 -0.4920164 -2.3388076 -0.4187143
[5,] -0.5860009  1.9778902 -0.8542067  0.5609695 -0.1179663 -1.1191493
           [,19]      [,20]
[1,]  0.17616484  1.2845709
[2,]  0.64833499  0.6724130
[3,] -0.07334291 -1.7758327
[4,]  0.03736667  0.2084903
[5,]  1.06029144  1.2879321
> 
> 
> 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.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  638  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 :  553  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.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.5276654 1.120377 -0.9992015 -0.7592543 -0.1346965 0.7390214 1.733621
           col8     col9     col10     col11    col12     col13     col14
row1 -0.2161316 1.525517 0.2312316 0.2198432 1.478311 -1.278617 -1.705303
          col15      col16     col17     col18     col19     col20
row1 0.09978991 -0.8171269 -1.055939 -2.157685 -1.317728 0.1319528
> tmp[,"col10"]
          col10
row1  0.2312316
row2 -0.7326713
row3 -0.8094812
row4 -1.2975500
row5 -1.2718556
> tmp[c("row1","row5"),]
           col1      col2       col3       col4       col5      col6       col7
row1  0.5276654 1.1203767 -0.9992015 -0.7592543 -0.1346965 0.7390214  1.7336205
row5 -0.7801364 0.2620684 -0.3831661  0.3364085  0.8986511 0.8229092 -0.2317166
           col8     col9      col10     col11     col12      col13      col14
row1 -0.2161316 1.525517  0.2312316 0.2198432 1.4783108 -1.2786171 -1.7053025
row5  0.1363965 1.492951 -1.2718556 0.4704211 0.8660578 -0.5479028 -0.4562783
          col15       col16      col17     col18      col19      col20
row1 0.09978991 -0.81712686 -1.0559389 -2.157685 -1.3177278  0.1319528
row5 0.49040682 -0.07151715 -0.9289506 -0.904602 -0.6028296 -1.0946405
> tmp[,c("col6","col20")]
           col6      col20
row1  0.7390214  0.1319528
row2  0.8423524 -0.2190360
row3  0.3370725  0.9740469
row4 -0.7615667  1.6262656
row5  0.8229092 -1.0946405
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 0.7390214  0.1319528
row5 0.8229092 -1.0946405
> 
> 
> 
> 
> 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.14609 49.60087 49.7795 49.01361 49.2201 106.1652 49.92027 51.59351
       col9    col10    col11    col12    col13    col14    col15    col16
row1 49.606 51.27413 52.77985 49.91565 51.48544 49.63922 48.36849 51.13287
        col17    col18    col19    col20
row1 51.08095 49.70577 49.91428 104.0697
> tmp[,"col10"]
        col10
row1 51.27413
row2 29.91020
row3 31.21309
row4 29.56005
row5 49.15041
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.14609 49.60087 49.77950 49.01361 49.22010 106.1652 49.92027 51.59351
row5 48.85278 50.32193 48.65088 49.86378 49.02212 103.8758 49.87171 50.69007
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.60600 51.27413 52.77985 49.91565 51.48544 49.63922 48.36849 51.13287
row5 50.21404 49.15041 49.33601 50.32421 51.35481 50.48900 50.77302 51.36451
        col17    col18    col19    col20
row1 51.08095 49.70577 49.91428 104.0697
row5 50.77681 50.58448 48.89882 106.4910
> tmp[,c("col6","col20")]
          col6     col20
row1 106.16520 104.06970
row2  75.00730  75.03940
row3  74.54527  75.58065
row4  75.89739  73.88792
row5 103.87581 106.49097
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.1652 104.0697
row5 103.8758 106.4910
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.1652 104.0697
row5 103.8758 106.4910
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.9250659
[2,]  1.4665791
[3,]  1.5611584
[4,]  0.8134554
[5,]  0.8588359
> tmp[,c("col17","col7")]
           col17       col7
[1,]  1.75448401 -1.7207469
[2,] -0.56474453  1.5717600
[3,]  0.03950901  0.1400496
[4,] -0.64240217  0.7504719
[5,] -0.83975332 -0.1757483
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -1.0386499  0.7992295
[2,] -0.5979688  0.2914956
[3,] -0.4668978 -0.9216234
[4,]  0.4908331 -1.2031791
[5,] -0.5231784  2.3200065
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] -1.03865
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -1.0386499
[2,] -0.5979688
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]      [,2]       [,3]       [,4]        [,5]      [,6]
row3 2.2313554 0.9406455  0.9727136 -2.0774899  0.96375738 0.1992275
row1 0.9322706 1.5231455 -1.3526320  0.6265953 -0.08037458 0.6515793
            [,7]      [,8]      [,9]      [,10]      [,11]      [,12]
row3  0.02341069 0.6279958 0.2449760 -0.9538646 -1.2435982 -0.4845892
row1 -0.70777739 2.2747534 0.8446895  0.4085539  0.3312079 -0.6714621
           [,13]       [,14]     [,15]     [,16]      [,17]       [,18]
row3 -0.08849605 -0.37234974 1.6674477 0.1027889  1.2326782 -0.03488008
row1  0.12839464  0.01216302 0.8022021 0.9466081 -0.5068463  0.73039273
         [,19]       [,20]
row3  1.203377 -0.49937738
row1 -1.049639 -0.04415624
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]      [,3]       [,4]     [,5]       [,6]     [,7]
row2 -1.773356 1.473774 0.4766734 -0.8268108 0.264947 -0.8856416 2.703495
         [,8]      [,9]     [,10]
row2 1.877182 -0.892799 0.4315649
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]      [,4]      [,5]     [,6]      [,7]
row5 -0.337232 0.2372468 0.06142855 0.4661817 0.7143503 1.245774 -1.681172
           [,8]      [,9]    [,10]     [,11]    [,12]      [,13]     [,14]
row5 -0.1918216 0.7737025 1.060714 0.6872023 1.340709 0.06908025 0.6948704
          [,15]    [,16]      [,17]    [,18]   [,19]   [,20]
row5 -0.9641091 1.141733 -0.2614444 1.013516 1.53328 0.53046
> 
> 
> 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: 0x55717a65b440>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f956a052e7"
 [2] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f965d3dff7"
 [3] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f932c7378c"
 [4] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f9307bba71"
 [5] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f94b8b4e41"
 [6] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f937b7d913"
 [7] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f9386f7be6"
 [8] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f921c892d3"
 [9] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f938e1e39e"
[10] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f9532d4d73"
[11] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f927f97ef" 
[12] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f92630e9c4"
[13] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f96f0d75a3"
[14] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f916a0b259"
[15] "/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests/BM45f91c579644"
> 
> 
> ### 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: 0x55717ac9c340>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x55717ac9c340>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.9-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x55717ac9c340>
> rowMedians(tmp)
  [1] -0.3154067612 -0.0466088941  0.3222203683  0.0225561425 -0.1134779793
  [6]  0.5377632919  0.2858095020 -0.2441070131  0.5499293509 -0.5361750210
 [11] -0.0852569498 -0.0208058807  0.0223641413  0.4067452659 -0.0052545749
 [16]  0.6699641782 -0.2657777187  0.2943252318 -0.1604110538 -0.2841689584
 [21]  0.1019825138  0.3391979473  0.2144121735 -0.8716119818  0.0283821278
 [26]  0.2148049184 -0.1984449749  0.4406298061 -0.8218627807 -0.0427040586
 [31] -0.0746459831 -0.4103211733  0.7051961342 -0.3422615093 -0.2228437875
 [36] -0.4310919620 -0.2789280317  0.6728952447 -0.2686759324 -0.6305610290
 [41]  0.0231365742  0.4105367412  0.0812898480  0.1032420097  0.0545097259
 [46]  0.1804147048 -0.1876372200  0.0183412938  0.1199805430  0.0409024786
 [51] -0.5087727363 -0.0045216032 -0.5515069942 -0.1669770054  0.2163768492
 [56] -0.0363481967 -0.7250023439  0.1001938987 -0.3705007389  0.0406738611
 [61] -0.3394661887 -0.1748621104  0.4546705061 -0.1365787349 -0.3586402579
 [66] -0.1454843337 -0.1861344837  0.1853772069  0.1826017952 -0.7271449786
 [71] -0.6381460062  0.1866232518 -0.3431594621  0.2635404266 -0.3763654087
 [76] -0.1998263401  0.1362071441  0.2119389828  0.0064847130  0.0531515980
 [81]  0.4655085862 -0.1589529601  0.4051475863  0.1492768193 -0.2831152389
 [86]  0.4077943224 -0.9711902694  0.3384996354 -0.0608624686 -0.3477536941
 [91] -0.1974415359  0.2902872384  0.1111219115 -0.0662491204 -0.3555866585
 [96] -0.2703235008 -0.2214426322 -0.1953992927  0.0375009959  0.4192400562
[101] -0.2095735340 -0.1458688397  0.1052943589  0.3201435833  0.1722085803
[106]  0.0265370925 -0.1146238492  0.0616837447 -0.2077271702  0.1240471855
[111] -0.1491628784  0.1489890058 -0.2524622404  0.2268694022  0.2180252433
[116]  0.3962464942 -0.3369396704 -0.7055964785  0.1529900936  0.4699287754
[121]  0.0012993427 -0.1270675643 -0.1777515599  0.1834645454 -0.4668798550
[126]  0.4187340437 -0.1520610814 -0.0981769301 -0.0388054454 -0.0668364630
[131]  0.0838149201 -0.5041913128  0.4696760938 -0.1432534453 -0.0586058532
[136] -0.2643459190  0.0382194196  0.0269274700 -0.1372617041 -0.7212019577
[141]  0.2684506702 -0.2977697553  0.2253218669  0.1305312745 -0.0854938763
[146]  0.4660882498  0.5861828515  0.2132814360 -0.2347569791  0.3047989290
[151]  0.0285462985  0.1381751527 -0.0281556510 -0.2190915357 -0.1210985732
[156] -0.3941199362 -0.1965459746 -0.6068458995  0.2108582915  0.2837564554
[161]  0.5417702727  0.2288275048  0.3693094666  0.0693501186  0.0645095214
[166]  0.4256695702 -0.1395815065 -0.0918829701  0.4033169726 -0.0841517870
[171]  0.1212043394  0.1406288768  0.1637403347 -0.1849130572 -0.0555794744
[176]  0.1064240484  0.4808474812  0.2042996665 -0.0131452372  0.4261681129
[181] -0.4305159729  0.4048876795 -0.0004917439 -0.0546793435  0.4231056824
[186] -0.5708316391 -0.4155664823 -0.5203821343 -0.3387432368 -0.1672616729
[191]  0.1236987032 -0.1979839415  0.0144161138  0.0994771576 -0.0435917849
[196] -0.0701873266  0.3602514718 -0.1192198647 -0.3342331526 -0.0114523837
[201] -0.2055226387 -0.2712755233 -0.0649756861 -0.2428369863 -0.2275737636
[206] -0.1873845912 -0.1118779235  0.1468163756  0.3044762192  0.5759306943
[211] -0.3805062892 -0.0760231346 -0.0409650121  0.0540040846  0.5513186162
[216] -0.1620935529  0.1665447250  0.1524243404 -0.0411294694 -0.2868261480
[221]  0.2225245587  0.0049123404  0.3380183893 -0.8159282017 -0.0066890773
[226]  0.0605083113  0.2460433991 -0.2985254354 -0.6171409943 -0.1105749088
> 
> proc.time()
   user  system elapsed 
  2.249   1.068   3.317 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2019-03-18 r76245) -- "Unsuffered Consequences"
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 

<pointer: 0x56495bd33eb0>
> .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: 0x56495bd33eb0>
> .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: 0x56495bd33eb0>
> .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: 0x56495bd33eb0>
> 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: 0x56495bb8ab70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56495bb8ab70>
> .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: 0x56495bb8ab70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56495bb8ab70>
> .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: 0x56495bb8ab70>
> 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: 0x56495c7db670>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56495c7db670>
> .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: 0x56495c7db670>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x56495c7db670>
> .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: 0x56495c7db670>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x56495c7db670>
> .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: 0x56495c7db670>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x56495c7db670>
> .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: 0x56495c7db670>
> 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: 0x56495be6a7d0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x56495be6a7d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56495be6a7d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56495be6a7d0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile48845a7ec639" "BufferedMatrixFile48847ffd000f"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile48845a7ec639" "BufferedMatrixFile48847ffd000f"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x56495b5881b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56495b5881b0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x56495b5881b0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x56495b5881b0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x56495b5881b0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x56495b5881b0>
> .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: 0x56495d902f70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x56495d902f70>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x56495d902f70>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x56495d902f70>
> 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: 0x56495bc31890>
> .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: 0x56495bc31890>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.380   0.041   0.407 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2019-03-18 r76245) -- "Unsuffered Consequences"
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.257   0.044   0.291 

Example timings