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

CHECK report for BufferedMatrix on malbec1

This page was generated on 2018-04-12 13:07:52 -0400 (Thu, 12 Apr 2018).

Package 165/1472HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.42.0
Ben Bolstad
Snapshot Date: 2018-04-11 16:45:18 -0400 (Wed, 11 Apr 2018)
URL: https://git.bioconductor.org/packages/BufferedMatrix
Branch: RELEASE_3_6
Last Commit: 4631078
Last Changed Date: 2017-10-30 12:39:19 -0400 (Mon, 30 Oct 2017)
malbec1 Linux (Ubuntu 16.04.1 LTS) / x86_64  OK  OK [ OK ]UNNEEDED, same version exists in internal repository
tokay1 Windows Server 2012 R2 Standard / x64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository
veracruz1 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.42.0
Command: /home/biocbuild/bbs-3.6-bioc/R/bin/R CMD check --no-vignettes --timings BufferedMatrix_1.42.0.tar.gz
StartedAt: 2018-04-11 21:55:54 -0400 (Wed, 11 Apr 2018)
EndedAt: 2018-04-11 21:56:20 -0400 (Wed, 11 Apr 2018)
EllapsedTime: 25.5 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.6-bioc/R/bin/R CMD check --no-vignettes --timings BufferedMatrix_1.42.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck’
* using R version 3.4.4 (2018-03-15)
* 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.42.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 ... NOTE
Warning: no function found corresponding to methods exports from ‘BufferedMatrix’ for: ‘coerce’, ‘show’

A namespace must be able to be loaded with just the base namespace
loaded: otherwise if the namespace gets loaded by a saved object, the
session will be unable to start.

Probably some imports need to be declared in the NAMESPACE file.
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... NOTE
Package in Depends field not imported from: ‘methods’
  These packages need to be imported from (in the NAMESPACE file)
  for when this namespace is loaded but not attached.
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
NB: .First.lib is obsolete and will not be used in R >= 3.0.0

as.BufferedMatrix: warning in createBufferedMatrix(rows = dim(x)[1],
  cols = dim(x)[2], bufferrows = bufferrows, buffercols = buffercols,
  director = directory): partial argument match of 'director' to
  'directory'
createBufferedMatrix: no visible global function definition for ‘new’
colApply,BufferedMatrix: no visible global function definition for
  ‘new’
duplicate,BufferedMatrix: no visible global function definition for
  ‘new’
rowApply,BufferedMatrix: no visible global function definition for
  ‘new’
subBufferedMatrix,BufferedMatrix: no visible global function definition
  for ‘new’
Undefined global functions or variables:
  new
Consider adding
  importFrom("methods", "new")
to your NAMESPACE file (and ensure that your DESCRIPTION Imports field
contains 'methods').
* 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 ... OK
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

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



Installation output

BufferedMatrix.Rcheck/00install.out

* installing *source* package ‘BufferedMatrix’ ...
** libs
gcc -I/home/biocbuild/bbs-3.6-bioc/R/include -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I/home/biocbuild/bbs-3.6-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){
       ^
doubleBufferedMatrix.c: 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.6-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.6-bioc/R/include -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c init_package.c -o init_package.o
g++ -shared -L/home/biocbuild/bbs-3.6-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.6-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/BufferedMatrix/libs
** R
** inst
** preparing package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.292   0.008   0.296 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.6-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 397293 21.3     750400 40.1   592000 31.7
Vcells 714338  5.5    1308461 10.0  1023717  7.9
> 
> 
> 
> 
> ##
> ## 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 Apr 11 21:56:15 2018"
> 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 Apr 11 21:56:15 2018"
> 
> 
> 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: 0x1060270>
> 
> 
> 
> 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 Apr 11 21:56:15 2018"
> 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 Apr 11 21:56:16 2018"
> 
> ColMode(tmp2)
<pointer: 0x1060270>
> 
> 
> 
> ### 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.3901894 -0.8673140  0.6861522  0.6930709
[2,] -0.3404710 -1.0602325 -1.9453152 -1.4659976
[3,] -0.2058548  0.6866618  0.7173020 -0.1110814
[4,] -0.6744732  1.4670931  0.3944062 -0.2159552
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.6-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.3901894 0.8673140 0.6861522 0.6930709
[2,]  0.3404710 1.0602325 1.9453152 1.4659976
[3,]  0.2058548 0.6866618 0.7173020 0.1110814
[4,]  0.6744732 1.4670931 0.3944062 0.2159552
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.6-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.9191829 0.9312970 0.8283430 0.8325088
[2,] 0.5834989 1.0296759 1.3947456 1.2107839
[3,] 0.4537122 0.8286506 0.8469368 0.3332887
[4,] 0.8212632 1.2112362 0.6280177 0.4647098
> 
> 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.6-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,] 222.58202 35.18028 33.96958 34.01816
[2,]  31.17546 36.35699 40.89277 38.57384
[3,]  29.74298 33.97317 34.18667 28.44397
[4,]  33.88710 38.57945 31.67458 29.86305
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x2c55fc0>
> exp(tmp5)
<pointer: 0x2c55fc0>
> log(tmp5,2)
<pointer: 0x2c55fc0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 463.2753
> Min(tmp5)
[1] 53.66261
> mean(tmp5)
[1] 72.80922
> Sum(tmp5)
[1] 14561.84
> Var(tmp5)
[1] 837.2545
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.48311 71.30194 68.72428 69.11100 71.12676 70.94234 72.19222 72.29985
 [9] 70.56119 70.34954
> rowSums(tmp5)
 [1] 1829.662 1426.039 1374.486 1382.220 1422.535 1418.847 1443.844 1445.997
 [9] 1411.224 1406.991
> rowVars(tmp5)
 [1] 7713.68004   50.55391   48.31485   81.35216   66.16234   50.18899
 [7]   83.87525   79.86579  107.96974   66.74553
> rowSd(tmp5)
 [1] 87.827559  7.110127  6.950889  9.019543  8.134024  7.084419  9.158343
 [8]  8.936766 10.390849  8.169794
> rowMax(tmp5)
 [1] 463.27531  85.11295  80.14176  84.21550  94.61019  84.84383  87.38726
 [8]  92.34483  93.48271  88.55355
> rowMin(tmp5)
 [1] 58.85947 60.37758 55.43956 53.66261 59.78769 59.08577 54.32227 60.79265
 [9] 55.11036 58.28744
> 
> colMeans(tmp5)
 [1] 107.54539  72.21486  73.18799  69.37434  71.29024  75.16442  70.27342
 [8]  72.51186  72.88581  74.22694  69.06902  68.32285  68.23279  72.46759
[15]  69.26972  68.96274  67.38948  70.93814  72.56886  70.28800
> colSums(tmp5)
 [1] 1075.4539  722.1486  731.8799  693.7434  712.9024  751.6442  702.7342
 [8]  725.1186  728.8581  742.2694  690.6902  683.2285  682.3279  724.6759
[15]  692.6972  689.6274  673.8948  709.3814  725.6886  702.8800
> colVars(tmp5)
 [1] 15653.30965    25.77971    67.26356    67.44785   104.64770    48.67056
 [7]   107.46846   116.64863    58.58346   102.62347    89.78841    61.10497
[13]    50.24552   104.00248    89.51393    88.24426    33.88148    15.71305
[19]    55.99961    63.82965
> colSd(tmp5)
 [1] 125.113187   5.077372   8.201436   8.212664  10.229746   6.976429
 [7]  10.366700  10.800400   7.653983  10.130324   9.475675   7.816967
[13]   7.088408  10.198161   9.461180   9.393842   5.820780   3.963969
[19]   7.483289   7.989346
> colMax(tmp5)
 [1] 463.27531  80.29808  85.11295  80.28639  88.55355  84.21550  91.34549
 [8]  93.48271  86.23288  92.34483  87.38726  81.73156  77.68455  94.61019
[15]  86.12816  87.13890  76.03177  77.22462  85.43586  79.66923
> colMin(tmp5)
 [1] 61.00287 62.40149 61.72897 55.11036 59.00803 59.78769 55.43956 59.60227
 [9] 62.55371 60.37758 53.66261 58.85947 56.87325 55.23699 59.08577 54.32227
[17] 58.28744 66.03921 60.44820 59.40060
> 
> 
> ### 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]       NA 71.30194 68.72428 69.11100 71.12676 70.94234 72.19222 72.29985
 [9] 70.56119 70.34954
> rowSums(tmp5)
 [1]       NA 1426.039 1374.486 1382.220 1422.535 1418.847 1443.844 1445.997
 [9] 1411.224 1406.991
> rowVars(tmp5)
 [1] 8108.15422   50.55391   48.31485   81.35216   66.16234   50.18899
 [7]   83.87525   79.86579  107.96974   66.74553
> rowSd(tmp5)
 [1] 90.045290  7.110127  6.950889  9.019543  8.134024  7.084419  9.158343
 [8]  8.936766 10.390849  8.169794
> rowMax(tmp5)
 [1]       NA 85.11295 80.14176 84.21550 94.61019 84.84383 87.38726 92.34483
 [9] 93.48271 88.55355
> rowMin(tmp5)
 [1]       NA 60.37758 55.43956 53.66261 59.78769 59.08577 54.32227 60.79265
 [9] 55.11036 58.28744
> 
> colMeans(tmp5)
 [1] 107.54539  72.21486  73.18799  69.37434  71.29024  75.16442  70.27342
 [8]  72.51186        NA  74.22694  69.06902  68.32285  68.23279  72.46759
[15]  69.26972  68.96274  67.38948  70.93814  72.56886  70.28800
> colSums(tmp5)
 [1] 1075.4539  722.1486  731.8799  693.7434  712.9024  751.6442  702.7342
 [8]  725.1186        NA  742.2694  690.6902  683.2285  682.3279  724.6759
[15]  692.6972  689.6274  673.8948  709.3814  725.6886  702.8800
> colVars(tmp5)
 [1] 15653.30965    25.77971    67.26356    67.44785   104.64770    48.67056
 [7]   107.46846   116.64863          NA   102.62347    89.78841    61.10497
[13]    50.24552   104.00248    89.51393    88.24426    33.88148    15.71305
[19]    55.99961    63.82965
> colSd(tmp5)
 [1] 125.113187   5.077372   8.201436   8.212664  10.229746   6.976429
 [7]  10.366700  10.800400         NA  10.130324   9.475675   7.816967
[13]   7.088408  10.198161   9.461180   9.393842   5.820780   3.963969
[19]   7.483289   7.989346
> colMax(tmp5)
 [1] 463.27531  80.29808  85.11295  80.28639  88.55355  84.21550  91.34549
 [8]  93.48271        NA  92.34483  87.38726  81.73156  77.68455  94.61019
[15]  86.12816  87.13890  76.03177  77.22462  85.43586  79.66923
> colMin(tmp5)
 [1] 61.00287 62.40149 61.72897 55.11036 59.00803 59.78769 55.43956 59.60227
 [9]       NA 60.37758 53.66261 58.85947 56.87325 55.23699 59.08577 54.32227
[17] 58.28744 66.03921 60.44820 59.40060
> 
> Max(tmp5,na.rm=TRUE)
[1] 463.2753
> Min(tmp5,na.rm=TRUE)
[1] 53.66261
> mean(tmp5,na.rm=TRUE)
[1] 72.83667
> Sum(tmp5,na.rm=TRUE)
[1] 14494.5
> Var(tmp5,na.rm=TRUE)
[1] 841.3317
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.75336 71.30194 68.72428 69.11100 71.12676 70.94234 72.19222 72.29985
 [9] 70.56119 70.34954
> rowSums(tmp5,na.rm=TRUE)
 [1] 1762.314 1426.039 1374.486 1382.220 1422.535 1418.847 1443.844 1445.997
 [9] 1411.224 1406.991
> rowVars(tmp5,na.rm=TRUE)
 [1] 8108.15422   50.55391   48.31485   81.35216   66.16234   50.18899
 [7]   83.87525   79.86579  107.96974   66.74553
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.045290  7.110127  6.950889  9.019543  8.134024  7.084419  9.158343
 [8]  8.936766 10.390849  8.169794
> rowMax(tmp5,na.rm=TRUE)
 [1] 463.27531  85.11295  80.14176  84.21550  94.61019  84.84383  87.38726
 [8]  92.34483  93.48271  88.55355
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.85947 60.37758 55.43956 53.66261 59.78769 59.08577 54.32227 60.79265
 [9] 55.11036 58.28744
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 107.54539  72.21486  73.18799  69.37434  71.29024  75.16442  70.27342
 [8]  72.51186  73.50109  74.22694  69.06902  68.32285  68.23279  72.46759
[15]  69.26972  68.96274  67.38948  70.93814  72.56886  70.28800
> colSums(tmp5,na.rm=TRUE)
 [1] 1075.4539  722.1486  731.8799  693.7434  712.9024  751.6442  702.7342
 [8]  725.1186  661.5098  742.2694  690.6902  683.2285  682.3279  724.6759
[15]  692.6972  689.6274  673.8948  709.3814  725.6886  702.8800
> colVars(tmp5,na.rm=TRUE)
 [1] 15653.30965    25.77971    67.26356    67.44785   104.64770    48.67056
 [7]   107.46846   116.64863    61.64755   102.62347    89.78841    61.10497
[13]    50.24552   104.00248    89.51393    88.24426    33.88148    15.71305
[19]    55.99961    63.82965
> colSd(tmp5,na.rm=TRUE)
 [1] 125.113187   5.077372   8.201436   8.212664  10.229746   6.976429
 [7]  10.366700  10.800400   7.851595  10.130324   9.475675   7.816967
[13]   7.088408  10.198161   9.461180   9.393842   5.820780   3.963969
[19]   7.483289   7.989346
> colMax(tmp5,na.rm=TRUE)
 [1] 463.27531  80.29808  85.11295  80.28639  88.55355  84.21550  91.34549
 [8]  93.48271  86.23288  92.34483  87.38726  81.73156  77.68455  94.61019
[15]  86.12816  87.13890  76.03177  77.22462  85.43586  79.66923
> colMin(tmp5,na.rm=TRUE)
 [1] 61.00287 62.40149 61.72897 55.11036 59.00803 59.78769 55.43956 59.60227
 [9] 62.55371 60.37758 53.66261 58.85947 56.87325 55.23699 59.08577 54.32227
[17] 58.28744 66.03921 60.44820 59.40060
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1]      NaN 71.30194 68.72428 69.11100 71.12676 70.94234 72.19222 72.29985
 [9] 70.56119 70.34954
> rowSums(tmp5,na.rm=TRUE)
 [1]    0.000 1426.039 1374.486 1382.220 1422.535 1418.847 1443.844 1445.997
 [9] 1411.224 1406.991
> rowVars(tmp5,na.rm=TRUE)
 [1]        NA  50.55391  48.31485  81.35216  66.16234  50.18899  83.87525
 [8]  79.86579 107.96974  66.74553
> rowSd(tmp5,na.rm=TRUE)
 [1]        NA  7.110127  6.950889  9.019543  8.134024  7.084419  9.158343
 [8]  8.936766 10.390849  8.169794
> rowMax(tmp5,na.rm=TRUE)
 [1]       NA 85.11295 80.14176 84.21550 94.61019 84.84383 87.38726 92.34483
 [9] 93.48271 88.55355
> rowMin(tmp5,na.rm=TRUE)
 [1]       NA 60.37758 55.43956 53.66261 59.78769 59.08577 54.32227 60.79265
 [9] 55.11036 58.28744
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 68.01985 72.10282 73.46408 69.21545 72.39719 75.15758 69.86602 71.93666
 [9]      NaN 74.22538 67.89255 69.37433 68.14864 72.75227 67.39656 66.94317
[17] 67.39191 71.31924 73.91560 69.66657
> colSums(tmp5,na.rm=TRUE)
 [1] 612.1786 648.9254 661.1767 622.9390 651.5747 676.4182 628.7942 647.4299
 [9]   0.0000 668.0284 611.0330 624.3690 613.3378 654.7704 606.5690 602.4885
[17] 606.5272 641.8732 665.2404 626.9991
> colVars(tmp5,na.rm=TRUE)
 [1]  34.44923  28.86097  74.81400  75.59482 103.94364  54.75385 119.03481
 [8] 127.50749        NA 115.45138  85.44104  56.30483  56.44655 116.09105
[15]  61.22998  53.38968  38.11660  16.04329  42.59532  67.46378
> colSd(tmp5,na.rm=TRUE)
 [1]  5.869347  5.372241  8.649508  8.694528 10.195275  7.399585 10.910308
 [8] 11.291922        NA 10.744830  9.243433  7.503654  7.513092 10.774556
[15]  7.824959  7.306824  6.173864  4.005407  6.526509  8.213634
> colMax(tmp5,na.rm=TRUE)
 [1] 79.94285 80.29808 85.11295 80.28639 88.55355 84.21550 91.34549 93.48271
 [9]     -Inf 92.34483 87.38726 81.73156 77.68455 94.61019 84.50477 80.14176
[17] 76.03177 77.22462 85.43586 79.66923
> colMin(tmp5,na.rm=TRUE)
 [1] 61.00287 62.40149 61.72897 55.11036 59.00803 59.78769 55.43956 59.60227
 [9]      Inf 60.37758 53.66261 59.32226 56.87325 55.23699 59.08577 54.32227
[17] 58.28744 66.03921 65.84347 59.40060
> 
> 
> 
> 
> 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] 236.4923 366.0504 142.7587 231.3600 292.4623 119.3910 226.0731 225.5880
 [9] 241.6129 239.0931
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 236.4923 366.0504 142.7587 231.3600 292.4623 119.3910 226.0731 225.5880
 [9] 241.6129 239.0931
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -5.684342e-14 -2.842171e-14 -1.421085e-14  0.000000e+00 -1.705303e-13
 [6] -1.421085e-14 -2.273737e-13 -5.684342e-14 -5.684342e-14 -4.263256e-14
[11]  0.000000e+00  5.684342e-14  0.000000e+00 -1.421085e-13  1.278977e-13
[16] -1.136868e-13  0.000000e+00  2.273737e-13 -1.705303e-13  1.705303e-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)
+ }
10   12 
4   15 
6   19 
2   20 
2   17 
2   7 
6   9 
1   6 
1   16 
9   15 
8   12 
9   19 
4   20 
10   20 
3   9 
7   2 
2   18 
5   20 
4   17 
1   18 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.115912
> Min(tmp)
[1] -2.695442
> mean(tmp)
[1] -0.04505655
> Sum(tmp)
[1] -4.505655
> Var(tmp)
[1] 1.076178
> 
> rowMeans(tmp)
[1] -0.04505655
> rowSums(tmp)
[1] -4.505655
> rowVars(tmp)
[1] 1.076178
> rowSd(tmp)
[1] 1.03739
> rowMax(tmp)
[1] 2.115912
> rowMin(tmp)
[1] -2.695442
> 
> colMeans(tmp)
  [1]  0.006105224 -0.410861561 -0.474064741  1.204687283  1.084020258
  [6]  0.035390405 -1.678425597 -1.858173076  1.038382854 -1.970812688
 [11]  0.705194514 -0.204189475 -1.419653645 -1.119601548  0.649013854
 [16]  0.761374479  0.079216070 -0.047076358  0.048005606  0.803706259
 [21]  1.026936948 -0.982802991 -0.352876753 -0.151101677  1.139576574
 [26]  0.566931603 -2.695441945  0.517515350 -0.569762390  0.301076289
 [31] -1.378830934 -0.190647096 -0.949261756  0.690159337 -2.262553854
 [36] -1.355433278  0.791192218 -1.578385241 -0.079269657  1.264299408
 [41] -0.137181784  1.695853484 -0.179751765  0.099069447  1.743069839
 [46]  0.352633463 -0.935614720 -0.314127479  0.066712722  0.286286679
 [51]  1.838819801  1.084029487  1.057272617 -1.801963222 -0.660234620
 [56] -0.296034428  0.801640949 -0.788716356 -0.770969964  0.703842784
 [61]  1.502657651 -0.243458140  1.098965528  0.029309612  0.238192180
 [66] -0.030169043 -1.179150814 -0.389364866  2.115912166  0.429672656
 [71] -0.476540697 -0.269174577  0.209144055 -0.387414051 -0.401585135
 [76] -0.776716977  1.178734530  1.870337398 -1.175044335 -0.165546674
 [81] -0.182395645  0.489376482 -0.120802225 -0.265748883  1.923334256
 [86] -0.547764518 -0.701806261  1.106601733  0.178339449 -0.488635291
 [91] -0.026896825 -0.075688225 -1.837171829 -1.615462544  0.285272299
 [96]  2.085230010  0.950516376 -1.082423211 -0.341966835 -2.244518679
> colSums(tmp)
  [1]  0.006105224 -0.410861561 -0.474064741  1.204687283  1.084020258
  [6]  0.035390405 -1.678425597 -1.858173076  1.038382854 -1.970812688
 [11]  0.705194514 -0.204189475 -1.419653645 -1.119601548  0.649013854
 [16]  0.761374479  0.079216070 -0.047076358  0.048005606  0.803706259
 [21]  1.026936948 -0.982802991 -0.352876753 -0.151101677  1.139576574
 [26]  0.566931603 -2.695441945  0.517515350 -0.569762390  0.301076289
 [31] -1.378830934 -0.190647096 -0.949261756  0.690159337 -2.262553854
 [36] -1.355433278  0.791192218 -1.578385241 -0.079269657  1.264299408
 [41] -0.137181784  1.695853484 -0.179751765  0.099069447  1.743069839
 [46]  0.352633463 -0.935614720 -0.314127479  0.066712722  0.286286679
 [51]  1.838819801  1.084029487  1.057272617 -1.801963222 -0.660234620
 [56] -0.296034428  0.801640949 -0.788716356 -0.770969964  0.703842784
 [61]  1.502657651 -0.243458140  1.098965528  0.029309612  0.238192180
 [66] -0.030169043 -1.179150814 -0.389364866  2.115912166  0.429672656
 [71] -0.476540697 -0.269174577  0.209144055 -0.387414051 -0.401585135
 [76] -0.776716977  1.178734530  1.870337398 -1.175044335 -0.165546674
 [81] -0.182395645  0.489376482 -0.120802225 -0.265748883  1.923334256
 [86] -0.547764518 -0.701806261  1.106601733  0.178339449 -0.488635291
 [91] -0.026896825 -0.075688225 -1.837171829 -1.615462544  0.285272299
 [96]  2.085230010  0.950516376 -1.082423211 -0.341966835 -2.244518679
> 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.006105224 -0.410861561 -0.474064741  1.204687283  1.084020258
  [6]  0.035390405 -1.678425597 -1.858173076  1.038382854 -1.970812688
 [11]  0.705194514 -0.204189475 -1.419653645 -1.119601548  0.649013854
 [16]  0.761374479  0.079216070 -0.047076358  0.048005606  0.803706259
 [21]  1.026936948 -0.982802991 -0.352876753 -0.151101677  1.139576574
 [26]  0.566931603 -2.695441945  0.517515350 -0.569762390  0.301076289
 [31] -1.378830934 -0.190647096 -0.949261756  0.690159337 -2.262553854
 [36] -1.355433278  0.791192218 -1.578385241 -0.079269657  1.264299408
 [41] -0.137181784  1.695853484 -0.179751765  0.099069447  1.743069839
 [46]  0.352633463 -0.935614720 -0.314127479  0.066712722  0.286286679
 [51]  1.838819801  1.084029487  1.057272617 -1.801963222 -0.660234620
 [56] -0.296034428  0.801640949 -0.788716356 -0.770969964  0.703842784
 [61]  1.502657651 -0.243458140  1.098965528  0.029309612  0.238192180
 [66] -0.030169043 -1.179150814 -0.389364866  2.115912166  0.429672656
 [71] -0.476540697 -0.269174577  0.209144055 -0.387414051 -0.401585135
 [76] -0.776716977  1.178734530  1.870337398 -1.175044335 -0.165546674
 [81] -0.182395645  0.489376482 -0.120802225 -0.265748883  1.923334256
 [86] -0.547764518 -0.701806261  1.106601733  0.178339449 -0.488635291
 [91] -0.026896825 -0.075688225 -1.837171829 -1.615462544  0.285272299
 [96]  2.085230010  0.950516376 -1.082423211 -0.341966835 -2.244518679
> colMin(tmp)
  [1]  0.006105224 -0.410861561 -0.474064741  1.204687283  1.084020258
  [6]  0.035390405 -1.678425597 -1.858173076  1.038382854 -1.970812688
 [11]  0.705194514 -0.204189475 -1.419653645 -1.119601548  0.649013854
 [16]  0.761374479  0.079216070 -0.047076358  0.048005606  0.803706259
 [21]  1.026936948 -0.982802991 -0.352876753 -0.151101677  1.139576574
 [26]  0.566931603 -2.695441945  0.517515350 -0.569762390  0.301076289
 [31] -1.378830934 -0.190647096 -0.949261756  0.690159337 -2.262553854
 [36] -1.355433278  0.791192218 -1.578385241 -0.079269657  1.264299408
 [41] -0.137181784  1.695853484 -0.179751765  0.099069447  1.743069839
 [46]  0.352633463 -0.935614720 -0.314127479  0.066712722  0.286286679
 [51]  1.838819801  1.084029487  1.057272617 -1.801963222 -0.660234620
 [56] -0.296034428  0.801640949 -0.788716356 -0.770969964  0.703842784
 [61]  1.502657651 -0.243458140  1.098965528  0.029309612  0.238192180
 [66] -0.030169043 -1.179150814 -0.389364866  2.115912166  0.429672656
 [71] -0.476540697 -0.269174577  0.209144055 -0.387414051 -0.401585135
 [76] -0.776716977  1.178734530  1.870337398 -1.175044335 -0.165546674
 [81] -0.182395645  0.489376482 -0.120802225 -0.265748883  1.923334256
 [86] -0.547764518 -0.701806261  1.106601733  0.178339449 -0.488635291
 [91] -0.026896825 -0.075688225 -1.837171829 -1.615462544  0.285272299
 [96]  2.085230010  0.950516376 -1.082423211 -0.341966835 -2.244518679
> colMedians(tmp)
  [1]  0.006105224 -0.410861561 -0.474064741  1.204687283  1.084020258
  [6]  0.035390405 -1.678425597 -1.858173076  1.038382854 -1.970812688
 [11]  0.705194514 -0.204189475 -1.419653645 -1.119601548  0.649013854
 [16]  0.761374479  0.079216070 -0.047076358  0.048005606  0.803706259
 [21]  1.026936948 -0.982802991 -0.352876753 -0.151101677  1.139576574
 [26]  0.566931603 -2.695441945  0.517515350 -0.569762390  0.301076289
 [31] -1.378830934 -0.190647096 -0.949261756  0.690159337 -2.262553854
 [36] -1.355433278  0.791192218 -1.578385241 -0.079269657  1.264299408
 [41] -0.137181784  1.695853484 -0.179751765  0.099069447  1.743069839
 [46]  0.352633463 -0.935614720 -0.314127479  0.066712722  0.286286679
 [51]  1.838819801  1.084029487  1.057272617 -1.801963222 -0.660234620
 [56] -0.296034428  0.801640949 -0.788716356 -0.770969964  0.703842784
 [61]  1.502657651 -0.243458140  1.098965528  0.029309612  0.238192180
 [66] -0.030169043 -1.179150814 -0.389364866  2.115912166  0.429672656
 [71] -0.476540697 -0.269174577  0.209144055 -0.387414051 -0.401585135
 [76] -0.776716977  1.178734530  1.870337398 -1.175044335 -0.165546674
 [81] -0.182395645  0.489376482 -0.120802225 -0.265748883  1.923334256
 [86] -0.547764518 -0.701806261  1.106601733  0.178339449 -0.488635291
 [91] -0.026896825 -0.075688225 -1.837171829 -1.615462544  0.285272299
 [96]  2.085230010  0.950516376 -1.082423211 -0.341966835 -2.244518679
> colRanges(tmp)
            [,1]       [,2]       [,3]     [,4]    [,5]      [,6]      [,7]
[1,] 0.006105224 -0.4108616 -0.4740647 1.204687 1.08402 0.0353904 -1.678426
[2,] 0.006105224 -0.4108616 -0.4740647 1.204687 1.08402 0.0353904 -1.678426
          [,8]     [,9]     [,10]     [,11]      [,12]     [,13]     [,14]
[1,] -1.858173 1.038383 -1.970813 0.7051945 -0.2041895 -1.419654 -1.119602
[2,] -1.858173 1.038383 -1.970813 0.7051945 -0.2041895 -1.419654 -1.119602
         [,15]     [,16]      [,17]       [,18]      [,19]     [,20]    [,21]
[1,] 0.6490139 0.7613745 0.07921607 -0.04707636 0.04800561 0.8037063 1.026937
[2,] 0.6490139 0.7613745 0.07921607 -0.04707636 0.04800561 0.8037063 1.026937
         [,22]      [,23]      [,24]    [,25]     [,26]     [,27]     [,28]
[1,] -0.982803 -0.3528768 -0.1511017 1.139577 0.5669316 -2.695442 0.5175153
[2,] -0.982803 -0.3528768 -0.1511017 1.139577 0.5669316 -2.695442 0.5175153
          [,29]     [,30]     [,31]      [,32]      [,33]     [,34]     [,35]
[1,] -0.5697624 0.3010763 -1.378831 -0.1906471 -0.9492618 0.6901593 -2.262554
[2,] -0.5697624 0.3010763 -1.378831 -0.1906471 -0.9492618 0.6901593 -2.262554
         [,36]     [,37]     [,38]       [,39]    [,40]      [,41]    [,42]
[1,] -1.355433 0.7911922 -1.578385 -0.07926966 1.264299 -0.1371818 1.695853
[2,] -1.355433 0.7911922 -1.578385 -0.07926966 1.264299 -0.1371818 1.695853
          [,43]      [,44]   [,45]     [,46]      [,47]      [,48]      [,49]
[1,] -0.1797518 0.09906945 1.74307 0.3526335 -0.9356147 -0.3141275 0.06671272
[2,] -0.1797518 0.09906945 1.74307 0.3526335 -0.9356147 -0.3141275 0.06671272
         [,50]   [,51]    [,52]    [,53]     [,54]      [,55]      [,56]
[1,] 0.2862867 1.83882 1.084029 1.057273 -1.801963 -0.6602346 -0.2960344
[2,] 0.2862867 1.83882 1.084029 1.057273 -1.801963 -0.6602346 -0.2960344
         [,57]      [,58]    [,59]     [,60]    [,61]      [,62]    [,63]
[1,] 0.8016409 -0.7887164 -0.77097 0.7038428 1.502658 -0.2434581 1.098966
[2,] 0.8016409 -0.7887164 -0.77097 0.7038428 1.502658 -0.2434581 1.098966
          [,64]     [,65]       [,66]     [,67]      [,68]    [,69]     [,70]
[1,] 0.02930961 0.2381922 -0.03016904 -1.179151 -0.3893649 2.115912 0.4296727
[2,] 0.02930961 0.2381922 -0.03016904 -1.179151 -0.3893649 2.115912 0.4296727
          [,71]      [,72]     [,73]      [,74]      [,75]     [,76]    [,77]
[1,] -0.4765407 -0.2691746 0.2091441 -0.3874141 -0.4015851 -0.776717 1.178735
[2,] -0.4765407 -0.2691746 0.2091441 -0.3874141 -0.4015851 -0.776717 1.178735
        [,78]     [,79]      [,80]      [,81]     [,82]      [,83]      [,84]
[1,] 1.870337 -1.175044 -0.1655467 -0.1823956 0.4893765 -0.1208022 -0.2657489
[2,] 1.870337 -1.175044 -0.1655467 -0.1823956 0.4893765 -0.1208022 -0.2657489
        [,85]      [,86]      [,87]    [,88]     [,89]      [,90]       [,91]
[1,] 1.923334 -0.5477645 -0.7018063 1.106602 0.1783394 -0.4886353 -0.02689682
[2,] 1.923334 -0.5477645 -0.7018063 1.106602 0.1783394 -0.4886353 -0.02689682
           [,92]     [,93]     [,94]     [,95]   [,96]     [,97]     [,98]
[1,] -0.07568822 -1.837172 -1.615463 0.2852723 2.08523 0.9505164 -1.082423
[2,] -0.07568822 -1.837172 -1.615463 0.2852723 2.08523 0.9505164 -1.082423
          [,99]    [,100]
[1,] -0.3419668 -2.244519
[2,] -0.3419668 -2.244519
> 
> 
> Max(tmp2)
[1] 3.006057
> Min(tmp2)
[1] -3.035523
> mean(tmp2)
[1] 0.09661932
> Sum(tmp2)
[1] 9.661932
> Var(tmp2)
[1] 1.1839
> 
> rowMeans(tmp2)
  [1] -0.083820354  0.304315945  3.006057344  0.663928957 -0.552878786
  [6]  1.313321101 -0.424690580 -0.655771359  1.561952618 -2.062165667
 [11] -0.006638628 -0.835976004  1.413452604  1.375225073 -1.138345680
 [16] -0.220404954  2.276900545 -3.035523456  0.734404135  0.828226486
 [21] -0.664594153 -0.583562885  0.097049457  2.062795078  1.003397411
 [26] -2.156132291  1.647789019 -0.810702664 -0.973247036 -0.448192343
 [31] -1.170292032  1.354859974  0.327499458 -0.481743000  1.655611571
 [36] -1.622133773  0.848739766 -1.279664900  0.749116049 -1.873379366
 [41]  1.209309086 -1.025963193  0.433871753  0.499821010  0.719749453
 [46] -0.579902902 -0.781268834 -0.148631435  1.469601422  1.189867824
 [51] -0.905988703  0.728725652  1.019954842  0.224361245  1.867798618
 [56] -0.184395181 -1.010948399 -0.181159023 -0.714901464  0.832243240
 [61]  1.034981989 -0.452430059 -1.003677417 -0.423958334  0.797594936
 [66]  0.758644856 -0.144751289 -0.822461549  0.507765068 -1.379370065
 [71] -0.325303673  0.281892307 -0.551857438  0.068095215 -0.546354517
 [76]  0.595857012 -0.467096711  0.820880037 -0.125821908 -0.379664730
 [81]  1.471205287 -0.730110001 -1.171588897 -0.452767566 -1.473658317
 [86] -0.548862440 -0.242748374  2.028245359  1.543142590  1.838161344
 [91] -0.508410148 -0.807677248  1.099893054  1.135666073 -0.351262521
 [96]  0.719297640  0.078985742  0.381347987 -0.428981730  1.032163205
> rowSums(tmp2)
  [1] -0.083820354  0.304315945  3.006057344  0.663928957 -0.552878786
  [6]  1.313321101 -0.424690580 -0.655771359  1.561952618 -2.062165667
 [11] -0.006638628 -0.835976004  1.413452604  1.375225073 -1.138345680
 [16] -0.220404954  2.276900545 -3.035523456  0.734404135  0.828226486
 [21] -0.664594153 -0.583562885  0.097049457  2.062795078  1.003397411
 [26] -2.156132291  1.647789019 -0.810702664 -0.973247036 -0.448192343
 [31] -1.170292032  1.354859974  0.327499458 -0.481743000  1.655611571
 [36] -1.622133773  0.848739766 -1.279664900  0.749116049 -1.873379366
 [41]  1.209309086 -1.025963193  0.433871753  0.499821010  0.719749453
 [46] -0.579902902 -0.781268834 -0.148631435  1.469601422  1.189867824
 [51] -0.905988703  0.728725652  1.019954842  0.224361245  1.867798618
 [56] -0.184395181 -1.010948399 -0.181159023 -0.714901464  0.832243240
 [61]  1.034981989 -0.452430059 -1.003677417 -0.423958334  0.797594936
 [66]  0.758644856 -0.144751289 -0.822461549  0.507765068 -1.379370065
 [71] -0.325303673  0.281892307 -0.551857438  0.068095215 -0.546354517
 [76]  0.595857012 -0.467096711  0.820880037 -0.125821908 -0.379664730
 [81]  1.471205287 -0.730110001 -1.171588897 -0.452767566 -1.473658317
 [86] -0.548862440 -0.242748374  2.028245359  1.543142590  1.838161344
 [91] -0.508410148 -0.807677248  1.099893054  1.135666073 -0.351262521
 [96]  0.719297640  0.078985742  0.381347987 -0.428981730  1.032163205
> 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.083820354  0.304315945  3.006057344  0.663928957 -0.552878786
  [6]  1.313321101 -0.424690580 -0.655771359  1.561952618 -2.062165667
 [11] -0.006638628 -0.835976004  1.413452604  1.375225073 -1.138345680
 [16] -0.220404954  2.276900545 -3.035523456  0.734404135  0.828226486
 [21] -0.664594153 -0.583562885  0.097049457  2.062795078  1.003397411
 [26] -2.156132291  1.647789019 -0.810702664 -0.973247036 -0.448192343
 [31] -1.170292032  1.354859974  0.327499458 -0.481743000  1.655611571
 [36] -1.622133773  0.848739766 -1.279664900  0.749116049 -1.873379366
 [41]  1.209309086 -1.025963193  0.433871753  0.499821010  0.719749453
 [46] -0.579902902 -0.781268834 -0.148631435  1.469601422  1.189867824
 [51] -0.905988703  0.728725652  1.019954842  0.224361245  1.867798618
 [56] -0.184395181 -1.010948399 -0.181159023 -0.714901464  0.832243240
 [61]  1.034981989 -0.452430059 -1.003677417 -0.423958334  0.797594936
 [66]  0.758644856 -0.144751289 -0.822461549  0.507765068 -1.379370065
 [71] -0.325303673  0.281892307 -0.551857438  0.068095215 -0.546354517
 [76]  0.595857012 -0.467096711  0.820880037 -0.125821908 -0.379664730
 [81]  1.471205287 -0.730110001 -1.171588897 -0.452767566 -1.473658317
 [86] -0.548862440 -0.242748374  2.028245359  1.543142590  1.838161344
 [91] -0.508410148 -0.807677248  1.099893054  1.135666073 -0.351262521
 [96]  0.719297640  0.078985742  0.381347987 -0.428981730  1.032163205
> rowMin(tmp2)
  [1] -0.083820354  0.304315945  3.006057344  0.663928957 -0.552878786
  [6]  1.313321101 -0.424690580 -0.655771359  1.561952618 -2.062165667
 [11] -0.006638628 -0.835976004  1.413452604  1.375225073 -1.138345680
 [16] -0.220404954  2.276900545 -3.035523456  0.734404135  0.828226486
 [21] -0.664594153 -0.583562885  0.097049457  2.062795078  1.003397411
 [26] -2.156132291  1.647789019 -0.810702664 -0.973247036 -0.448192343
 [31] -1.170292032  1.354859974  0.327499458 -0.481743000  1.655611571
 [36] -1.622133773  0.848739766 -1.279664900  0.749116049 -1.873379366
 [41]  1.209309086 -1.025963193  0.433871753  0.499821010  0.719749453
 [46] -0.579902902 -0.781268834 -0.148631435  1.469601422  1.189867824
 [51] -0.905988703  0.728725652  1.019954842  0.224361245  1.867798618
 [56] -0.184395181 -1.010948399 -0.181159023 -0.714901464  0.832243240
 [61]  1.034981989 -0.452430059 -1.003677417 -0.423958334  0.797594936
 [66]  0.758644856 -0.144751289 -0.822461549  0.507765068 -1.379370065
 [71] -0.325303673  0.281892307 -0.551857438  0.068095215 -0.546354517
 [76]  0.595857012 -0.467096711  0.820880037 -0.125821908 -0.379664730
 [81]  1.471205287 -0.730110001 -1.171588897 -0.452767566 -1.473658317
 [86] -0.548862440 -0.242748374  2.028245359  1.543142590  1.838161344
 [91] -0.508410148 -0.807677248  1.099893054  1.135666073 -0.351262521
 [96]  0.719297640  0.078985742  0.381347987 -0.428981730  1.032163205
> 
> colMeans(tmp2)
[1] 0.09661932
> colSums(tmp2)
[1] 9.661932
> colVars(tmp2)
[1] 1.1839
> colSd(tmp2)
[1] 1.088072
> colMax(tmp2)
[1] 3.006057
> colMin(tmp2)
[1] -3.035523
> colMedians(tmp2)
[1] -0.1048211
> colRanges(tmp2)
          [,1]
[1,] -3.035523
[2,]  3.006057
> 
> 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] -5.197535 -1.179188  2.327021 -2.659806  2.923370 -1.892635  2.310058
 [8]  2.131973 -2.379456 -2.253661
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.93881172
[2,] -0.97717809
[3,] -0.50174404
[4,]  0.08773703
[5,]  0.60366308
> 
> rowApply(tmp,sum)
 [1]  0.6017453 -1.6997138  2.8911185 -5.0524821  3.0638195  2.0773366
 [7] -7.1539985  0.3480884  0.5335659 -1.4793409
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    8    2    8    3    1    1    6    3     1
 [2,]    6    2    5    3    6    6    9    5    6     4
 [3,]    1    9    1    4    5   10   10    9    5     7
 [4,]    3    3   10    2    1    7    4   10    1     5
 [5,]    5    6    9   10   10    9    6    7    2     2
 [6,]   10    1    4    7    8    8    2    3    9     3
 [7,]    2   10    8    6    7    3    7    8    7     9
 [8,]    7    7    7    9    2    4    8    1   10     8
 [9,]    8    5    6    5    9    2    3    4    8     6
[10,]    9    4    3    1    4    5    5    2    4    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -3.1334244 -1.6505952  1.1715536 -0.6246708 -3.5524208  1.9881549
 [7] -2.5758342  2.1496583  2.1957308  2.1882210 -1.8386031  3.2901991
[13] -0.7692685 -3.0967969  2.6000557 -4.9770464 -0.4464758 -3.0004064
[19]  1.0170401  2.2241624
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8934173
[2,] -1.1467522
[3,] -1.0225285
[4,]  0.4056973
[5,]  0.5235764
> 
> rowApply(tmp,sum)
[1] -7.985256 -6.401701 -4.185610 10.204370  1.527430
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    7    3   16   11    2
[2,]    8    6    7    6   13
[3,]   10   10   18   19    4
[4,]    6    2   13   18   19
[5,]    1   13   12    1   10
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]          [,5]        [,6]
[1,] -1.1467522 -0.9863097 -0.3242913 -1.32383596 -2.8240401877  0.73826616
[2,] -1.8934173 -0.7067302 -0.3389106 -1.92423635  0.1391693654  0.81143767
[3,]  0.4056973 -0.4308953  1.1885529  0.02680278  0.0002496161 -0.09848779
[4,]  0.5235764  0.2133980  1.3482128  1.30881113 -0.8828756900  0.16192203
[5,] -1.0225285  0.2599420 -0.7020102  1.28778763  0.0150760687  0.37501680
           [,7]       [,8]        [,9]      [,10]       [,11]      [,12]
[1,]  0.9682241  1.3315451 -0.69551007  0.8996349  0.08374199 -0.2656645
[2,] -1.8906485  0.3591614 -0.09590728  0.7745609 -2.49401045  0.6757115
[3,] -1.4469853 -0.3182502  1.67787960 -1.3939901  0.19031698  0.4311275
[4,]  0.6724360  0.8320546  0.37803791  1.4957190  0.45486724 -0.3666145
[5,] -0.8788605 -0.0548526  0.93123061  0.4122962 -0.07351889  2.8156391
          [,13]      [,14]       [,15]      [,16]      [,17]      [,18]
[1,] -1.6518725 -1.4398712  1.08245950 -2.0957024  0.2537136 -1.3650690
[2,] -0.3919360 -0.5111904  0.68423387 -0.8860603  0.9845784 -0.6914255
[3,]  0.3343268 -1.3442080 -0.19018028 -0.2361545 -2.7348274 -1.0381998
[4,]  0.1582254  0.7768766  1.06756286  0.4165605  0.9392616 -0.5309941
[5,]  0.7819879 -0.5784038 -0.04402021 -2.1756897  0.1107980  0.6252820
          [,19]       [,20]
[1,] -0.1423699  0.91844801
[2,]  0.1365712  0.85734738
[3,]  1.2405032 -0.44888772
[4,]  0.4377671  0.79956515
[5,] -0.6554315  0.09768954
> 
> 
> 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.6-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.6-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.6-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.6-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 -0.1120071 0.2491538 -0.3772114 -1.178938 0.6157469 -0.7821927 0.004687201
           col8       col9    col10      col11     col12     col13     col14
row1 -0.6030268 0.04660236 1.889848 -0.9589836 0.2895034 0.3256659 -0.319793
         col15    col16      col17      col18     col19     col20
row1 -1.169613 1.061976 -0.5581538 -0.2753477 -0.455979 0.1376503
> tmp[,"col10"]
           col10
row1  1.88984813
row2  3.15941098
row3  0.05933375
row4  1.38391099
row5 -1.45090290
> tmp[c("row1","row5"),]
           col1      col2       col3       col4       col5       col6
row1 -0.1120071 0.2491538 -0.3772114 -1.1789384  0.6157469 -0.7821927
row5  0.3019150 0.4252724 -0.9185938  0.1551437 -1.2178312 -0.1049755
            col7       col8        col9     col10      col11      col12
row1 0.004687201 -0.6030268 0.046602358  1.889848 -0.9589836  0.2895034
row5 0.347146994 -0.2797253 0.001107999 -1.450903 -0.0599264 -0.1912365
          col13      col14      col15      col16      col17      col18
row1  0.3256659 -0.3197930 -1.1696130  1.0619757 -0.5581538 -0.2753477
row5 -1.5333600 -0.7032757  0.7089121 -0.5640659  0.4006929 -0.5067187
         col19      col20
row1 -0.455979  0.1376503
row5 -1.037014 -0.1995909
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.7821927  0.1376503
row2  1.3374497 -0.1856861
row3 -1.0617455 -1.2036574
row4  0.2799270 -0.9137427
row5 -0.1049755 -0.1995909
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.7821927  0.1376503
row5 -0.1049755 -0.1995909
> 
> 
> 
> 
> 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.42749 50.35359 50.6902 51.33625 49.70886 103.1446 49.14975 51.18142
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.92124 50.11302 50.42604 47.55546 49.17777 52.22079 50.05067 50.19457
        col17    col18    col19   col20
row1 48.98332 50.70332 49.31776 103.812
> tmp[,"col10"]
        col10
row1 50.11302
row2 29.81308
row3 31.85571
row4 30.17923
row5 49.97784
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.42749 50.35359 50.69020 51.33625 49.70886 103.1446 49.14975 51.18142
row5 50.32044 49.13804 50.11501 51.36642 48.82901 105.2964 48.60573 49.78482
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.92124 50.11302 50.42604 47.55546 49.17777 52.22079 50.05067 50.19457
row5 50.30496 49.97784 50.04944 50.06399 49.49849 50.46312 49.19002 50.14560
        col17    col18    col19    col20
row1 48.98332 50.70332 49.31776 103.8120
row5 48.40827 51.21660 48.00310 105.8427
> tmp[,c("col6","col20")]
          col6     col20
row1 103.14463 103.81200
row2  74.02284  74.54810
row3  77.11272  76.08649
row4  77.47604  75.77058
row5 105.29639 105.84274
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.1446 103.8120
row5 105.2964 105.8427
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.1446 103.8120
row5 105.2964 105.8427
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.1345526
[2,]  0.7328273
[3,] -0.3529183
[4,] -0.5327931
[5,]  0.8643351
> tmp[,c("col17","col7")]
          col17       col7
[1,] 0.01331204 -0.3801978
[2,] 1.61178119  0.3775634
[3,] 0.54439371 -1.4698984
[4,] 0.54503163  0.6542313
[5,] 0.55955754 -1.6592824
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6       col20
[1,]  0.33559131  0.05312402
[2,]  0.19578484 -2.37289480
[3,] -0.13441651 -0.45144370
[4,]  0.42904848  0.25563616
[5,] -0.09276531  0.24042042
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.3355913
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.3355913
[2,] 0.1957848
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]       [,3]      [,4]      [,5]        [,6]      [,7]
row3 0.3078124 -0.8719461  0.8104947 -2.715400 0.2175602 -0.26622421 0.9142003
row1 0.9141347  0.1703747 -0.5430919 -0.429049 2.1526251 -0.01998006 0.4924446
            [,8]       [,9]     [,10]      [,11]      [,12]      [,13]
row3  0.34168850  0.9045999 -1.023403  0.3521884  0.9171778 0.02106631
row1 -0.02406553 -0.3769560  0.417004 -0.1171901 -1.1171682 0.84722578
          [,14]      [,15]       [,16]       [,17]      [,18]     [,19]
row3 -0.3835475 -0.2587168 0.084276785 1.679414919 -0.6170555 -1.100297
row1  0.3720597  2.0832350 0.001549922 0.008352935  0.6240564  0.215103
          [,20]
row3  0.8694485
row1 -0.8575601
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]     [,2]       [,3]      [,4]     [,5]      [,6]       [,7]
row2 1.253794 1.288295 -0.1343655 -1.204064 2.159241 0.3454611 -0.6245427
         [,8]       [,9]      [,10]
row2 0.196283 -0.6063349 -0.9033798
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]     [,4]       [,5]     [,6]      [,7]
row5 0.1932429 0.5830883 -0.1114945 1.221766 -0.5266395 1.535642 -2.389571
          [,8]     [,9]      [,10]     [,11]      [,12]      [,13]    [,14]
row5 0.5526089 1.390894 -0.5274244 0.1007067 -0.2111941 -0.7288791 -1.12807
         [,15]    [,16]      [,17]    [,18]      [,19]   [,20]
row5 -1.081855 0.805432 -0.5695603 2.122637 -0.6443446 1.95269
> 
> 
> 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: 0x3338f60>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e662bc55a"
 [2] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e15023faa"
 [3] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e207df347"
 [4] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e3d49fba2"
 [5] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e3ee29541"
 [6] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e424b83d3"
 [7] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e678a681c"
 [8] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e65887f3b"
 [9] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e6aeff6e9"
[10] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e36d65cdc"
[11] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e2cf77592"
[12] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696ef17532a" 
[13] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e3fe630b9"
[14] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e2c4cf57" 
[15] "/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BM696e1b7df674"
> 
> 
> ### 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: 0x2c645e0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x2c645e0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x2c645e0>
> rowMedians(tmp)
  [1] -0.184506267  0.092679696  0.073479510  0.035683819 -0.475450843
  [6] -0.353511666 -0.477463965  0.078832057  0.630428176  0.257241625
 [11] -0.028299960 -0.064392327 -0.153399264  0.155008555  0.178231814
 [16] -0.058464515  0.252375441 -0.662054212 -0.262494764  0.122517791
 [21] -0.149221825 -0.404156746 -0.361460726  0.798536273 -0.093476423
 [26] -0.176360253  0.468215967  0.082715319 -0.058447063 -0.363851218
 [31]  0.189218901 -0.581237620  0.256274680 -0.278342473  0.190037827
 [36]  0.284859642  0.247732194 -0.339956416  0.454093248  0.245285674
 [41]  0.065838225 -0.196220711  0.199598005 -0.587951715 -0.200758767
 [46] -0.268311363  0.858207350 -0.269530451 -0.479121764 -0.019890835
 [51] -0.237190517  0.283468831  0.058356943  0.043989039 -0.214386690
 [56]  0.273929370 -0.151731052 -0.009608394 -0.159806961  0.133862016
 [61]  0.685937398 -0.413444689 -0.757378711 -0.233946410 -0.233773947
 [66] -0.130116130  0.055497852  0.279438400  0.456876990 -0.010159853
 [71]  0.125161005  0.294750415 -0.096106683  0.268904329  0.581258005
 [76]  0.141204884  0.041198802  0.039813820  0.232705786  0.331728359
 [81] -0.842460361  0.407665131  0.019049557  0.007786455  0.234581241
 [86]  0.243488374  0.090130288  0.191203646  0.042967410 -0.418190260
 [91] -0.360646538  0.136394128  0.143775550  0.497493316 -0.404972554
 [96] -0.319099795 -0.635749325 -0.126161012  0.269294038  0.062928009
[101]  0.287727019 -0.160549141 -0.218746643  0.156576550  0.352408615
[106]  0.417773911  0.384323216 -0.042194538  0.129892163 -0.192801131
[111] -0.269017956 -0.106596145  0.458655732 -0.433277320  0.604819292
[116] -0.049003293 -0.097033459  0.274779608  0.577983305 -0.457432491
[121]  0.177739341 -0.071445746 -0.503313557 -0.019567169 -0.156676318
[126]  0.370488982 -0.132695325 -0.320519839 -0.062073380 -0.146924434
[131] -0.344696651  0.289261052 -0.065290545  0.287271552  0.208959281
[136]  0.440215061  0.476242346  0.361397632  0.388882185  0.270047922
[141]  0.158576847  0.094180750  0.099616530  0.180932317  0.096042746
[146] -0.125749276 -0.322204888  0.457546113 -0.282236392  0.648151141
[151]  0.185507850 -0.269918290  0.009040792 -0.051767080 -0.098652454
[156] -0.488393999 -0.194066205  0.320932878  0.126200898  0.028275889
[161]  0.047082377  0.322894896  0.224276301  0.385511895 -0.316814179
[166]  0.011892569  0.313901869 -0.664145631 -0.334495841 -0.460385060
[171]  0.026275806 -0.404972832 -0.281552493  0.228052941  0.027186654
[176] -0.011381094 -0.207205869  0.077180955  0.086483787 -0.004090017
[181]  0.242347322 -0.261295875 -0.115609264  0.076768413  0.190558660
[186] -0.264953961  0.364931214 -0.582135943 -0.179637422 -0.366631404
[191]  0.004936028 -0.315500734 -0.010720419  0.111433801  0.300161874
[196]  0.454249040  0.518862679  0.291109185 -0.328493894 -0.713699462
[201]  0.406990778  0.045700188  0.311759247  0.070610853  0.302323107
[206] -0.419715029  0.385306435  0.100042867 -0.225802575  0.096618730
[211] -0.262824997  0.190560852 -0.553092063  0.044066230  0.183774881
[216]  0.230900010 -0.289463380 -0.163713658 -0.254570576 -0.067334230
[221]  0.118435438  0.163313397 -0.227632441 -0.259630480  0.243327272
[226] -0.325158555 -0.068980988 -0.157048173 -0.370387994 -0.303432615
> 
> proc.time()
   user  system elapsed 
  2.076   0.792   2.890 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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: 0xa99270>
> .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: 0xa99270>
> .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: 0xa99270>
> .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: 0xa99270>
> 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: 0xbef530>
> .Call("R_bm_AddColumn",P)
<pointer: 0xbef530>
> .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: 0xbef530>
> .Call("R_bm_AddColumn",P)
<pointer: 0xbef530>
> .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: 0xbef530>
> 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: 0x1f11ae0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1f11ae0>
> .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: 0x1f11ae0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x1f11ae0>
> .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: 0x1f11ae0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x1f11ae0>
> .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: 0x1f11ae0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x1f11ae0>
> .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: 0x1f11ae0>
> 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: 0x1720740>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x1720740>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1720740>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1720740>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile6a443a247145" "BufferedMatrixFile6a443ff890ac"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile6a443a247145" "BufferedMatrixFile6a443ff890ac"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x1b93970>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1b93970>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x1b93970>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x1b93970>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x1b93970>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x1b93970>
> .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: 0x1637320>
> .Call("R_bm_AddColumn",P)
<pointer: 0x1637320>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x1637320>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x1637320>
> 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: 0xb9c3d0>
> .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: 0xb9c3d0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.372   0.036   0.405 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 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.272   0.012   0.280 

Example timings