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

CHECK report for BufferedMatrix on veracruz1

This page was generated on 2018-04-12 13:32:17 -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: /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R CMD check --no-vignettes --timings BufferedMatrix_1.42.0.tar.gz
StartedAt: 2018-04-12 01:10:06 -0400 (Thu, 12 Apr 2018)
EndedAt: 2018-04-12 01:10:39 -0400 (Thu, 12 Apr 2018)
EllapsedTime: 33.3 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R CMD check --no-vignettes --timings BufferedMatrix_1.42.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck’
* using R version 3.4.4 (2018-03-15)
* using platform: x86_64-apple-darwin15.6.0 (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.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 sizes of PDF files under ‘inst/doc’ ... 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
  ‘/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

* installing *source* package ‘BufferedMatrix’ ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ˜
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c init_package.c -o init_package.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/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-apple-darwin15.6.0 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.331   0.060   0.379 

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-apple-darwin15.6.0 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/Users/biocbuild/bbs-3.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 400646 21.4     750400 40.1   592000 31.7
Vcells 722398  5.6    1308461 10.0  1002163  7.7
> 
> 
> 
> 
> ##
> ## 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] "Thu Apr 12 01:10:28 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] "Thu Apr 12 01:10:28 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: 0x7f8dbcb0ea20>
> 
> 
> 
> 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] "Thu Apr 12 01:10:30 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] "Thu Apr 12 01:10:30 2018"
> 
> ColMode(tmp2)
<pointer: 0x7f8dbcb0ea20>
> 
> 
> 
> ### 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,] 97.7812159 -1.8783312 -0.6692386 -0.5683364
[2,]  0.3658068 -1.1242566  0.6628609  0.1320353
[3,] -0.7770437 -0.2441641 -2.1696744 -0.4972014
[4,] -1.4399090 -0.2386567 -1.5064557 -0.5744913
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/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,] 97.7812159 1.8783312 0.6692386 0.5683364
[2,]  0.3658068 1.1242566 0.6628609 0.1320353
[3,]  0.7770437 0.2441641 2.1696744 0.4972014
[4,]  1.4399090 0.2386567 1.5064557 0.5744913
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/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.8884385 1.3705222 0.8180700 0.7538809
[2,] 0.6048197 1.0603096 0.8141627 0.3633666
[3,] 0.8815008 0.4941297 1.4729815 0.7051251
[4,] 1.1999621 0.4885250 1.2273776 0.7579520
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.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,] 221.66560 40.58355 33.84994 33.10715
[2,]  31.41400 36.72735 33.80449 28.76570
[3,]  34.59205 30.18546 41.89949 32.54845
[4,]  38.43953 30.12391 38.78023 33.15401
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7f8db9d06830>
> exp(tmp5)
<pointer: 0x7f8db9d06830>
> log(tmp5,2)
<pointer: 0x7f8db9d06830>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 461.3679
> Min(tmp5)
[1] 53.35388
> mean(tmp5)
[1] 72.36306
> Sum(tmp5)
[1] 14472.61
> Var(tmp5)
[1] 832.7582
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.10424 69.09386 71.38286 69.31186 71.06670 72.29756 68.47820 72.12836
 [9] 68.69619 69.07076
> rowSums(tmp5)
 [1] 1842.085 1381.877 1427.657 1386.237 1421.334 1445.951 1369.564 1442.567
 [9] 1373.924 1381.415
> rowVars(tmp5)
 [1] 7609.66552   69.08663   78.34799   75.75831   70.54550   82.56488
 [7]   66.35231   78.52614   67.15086   48.48087
> rowSd(tmp5)
 [1] 87.233397  8.311837  8.851440  8.703925  8.399137  9.086522  8.145692
 [8]  8.861498  8.194563  6.962821
> rowMax(tmp5)
 [1] 461.36791  90.29501  87.20830  91.93601  86.20213  86.47303  84.63153
 [8]  91.48393  80.32889  81.66150
> rowMin(tmp5)
 [1] 61.33792 55.67578 56.69988 58.38060 58.87520 54.38896 56.53119 57.98046
 [9] 53.35388 55.25531
> 
> colMeans(tmp5)
 [1] 111.11127  70.72807  68.88678  72.20015  70.79783  72.91566  65.15197
 [8]  72.00118  72.12403  73.09370  67.01434  68.90989  66.93235  71.08283
[15]  68.46275  71.84894  71.21059  74.43492  68.75623  69.59769
> colSums(tmp5)
 [1] 1111.1127  707.2807  688.8678  722.0015  707.9783  729.1566  651.5197
 [8]  720.0118  721.2403  730.9370  670.1434  689.0989  669.3235  710.8283
[15]  684.6275  718.4894  712.1059  744.3492  687.5623  695.9769
> colVars(tmp5)
 [1] 15225.47104    58.77428    91.17554    61.29768   109.75907    37.55701
 [7]    27.59868   102.50241    28.49217    31.37683    44.35431    61.96822
[13]    42.98303   133.14118    67.34958    40.15404    79.23323    40.26331
[19]    81.95742   175.46357
> colSd(tmp5)
 [1] 123.391536   7.666439   9.548588   7.829284  10.476596   6.128377
 [7]   5.253445  10.124347   5.337806   5.601502   6.659903   7.871989
[13]   6.556145  11.538682   8.206679   6.336722   8.901305   6.345338
[19]   9.053034  13.246266
> colMax(tmp5)
 [1] 461.36791  84.46935  87.20830  82.32739  91.93601  80.43263  72.63211
 [8]  91.48393  78.17607  79.82877  79.88704  86.19246  75.84274  86.20213
[15]  79.48068  80.58707  86.23155  84.77267  81.14743  90.29501
> colMin(tmp5)
 [1] 56.02156 62.69896 58.67529 59.87204 57.57836 61.11016 58.38060 55.25531
 [9] 60.71498 63.78554 56.69988 57.98046 54.38896 56.33868 56.53119 63.50212
[17] 59.28237 66.11656 55.67578 53.35388
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 92.10424 69.09386 71.38286 69.31186 71.06670       NA 68.47820 72.12836
 [9] 68.69619 69.07076
> rowSums(tmp5)
 [1] 1842.085 1381.877 1427.657 1386.237 1421.334       NA 1369.564 1442.567
 [9] 1373.924 1381.415
> rowVars(tmp5)
 [1] 7609.66552   69.08663   78.34799   75.75831   70.54550   81.23870
 [7]   66.35231   78.52614   67.15086   48.48087
> rowSd(tmp5)
 [1] 87.233397  8.311837  8.851440  8.703925  8.399137  9.013251  8.145692
 [8]  8.861498  8.194563  6.962821
> rowMax(tmp5)
 [1] 461.36791  90.29501  87.20830  91.93601  86.20213        NA  84.63153
 [8]  91.48393  80.32889  81.66150
> rowMin(tmp5)
 [1] 61.33792 55.67578 56.69988 58.38060 58.87520       NA 56.53119 57.98046
 [9] 53.35388 55.25531
> 
> colMeans(tmp5)
 [1] 111.11127  70.72807  68.88678  72.20015  70.79783  72.91566  65.15197
 [8]  72.00118  72.12403  73.09370        NA  68.90989  66.93235  71.08283
[15]  68.46275  71.84894  71.21059  74.43492  68.75623  69.59769
> colSums(tmp5)
 [1] 1111.1127  707.2807  688.8678  722.0015  707.9783  729.1566  651.5197
 [8]  720.0118  721.2403  730.9370        NA  689.0989  669.3235  710.8283
[15]  684.6275  718.4894  712.1059  744.3492  687.5623  695.9769
> colVars(tmp5)
 [1] 15225.47104    58.77428    91.17554    61.29768   109.75907    37.55701
 [7]    27.59868   102.50241    28.49217    31.37683          NA    61.96822
[13]    42.98303   133.14118    67.34958    40.15404    79.23323    40.26331
[19]    81.95742   175.46357
> colSd(tmp5)
 [1] 123.391536   7.666439   9.548588   7.829284  10.476596   6.128377
 [7]   5.253445  10.124347   5.337806   5.601502         NA   7.871989
[13]   6.556145  11.538682   8.206679   6.336722   8.901305   6.345338
[19]   9.053034  13.246266
> colMax(tmp5)
 [1] 461.36791  84.46935  87.20830  82.32739  91.93601  80.43263  72.63211
 [8]  91.48393  78.17607  79.82877        NA  86.19246  75.84274  86.20213
[15]  79.48068  80.58707  86.23155  84.77267  81.14743  90.29501
> colMin(tmp5)
 [1] 56.02156 62.69896 58.67529 59.87204 57.57836 61.11016 58.38060 55.25531
 [9] 60.71498 63.78554       NA 57.98046 54.38896 56.33868 56.53119 63.50212
[17] 59.28237 66.11656 55.67578 53.35388
> 
> Max(tmp5,na.rm=TRUE)
[1] 461.3679
> Min(tmp5,na.rm=TRUE)
[1] 53.35388
> mean(tmp5,na.rm=TRUE)
[1] 72.41392
> Sum(tmp5,na.rm=TRUE)
[1] 14410.37
> Var(tmp5,na.rm=TRUE)
[1] 836.4441
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.10424 69.09386 71.38286 69.31186 71.06670 72.82680 68.47820 72.12836
 [9] 68.69619 69.07076
> rowSums(tmp5,na.rm=TRUE)
 [1] 1842.085 1381.877 1427.657 1386.237 1421.334 1383.709 1369.564 1442.567
 [9] 1373.924 1381.415
> rowVars(tmp5,na.rm=TRUE)
 [1] 7609.66552   69.08663   78.34799   75.75831   70.54550   81.23870
 [7]   66.35231   78.52614   67.15086   48.48087
> rowSd(tmp5,na.rm=TRUE)
 [1] 87.233397  8.311837  8.851440  8.703925  8.399137  9.013251  8.145692
 [8]  8.861498  8.194563  6.962821
> rowMax(tmp5,na.rm=TRUE)
 [1] 461.36791  90.29501  87.20830  91.93601  86.20213  86.47303  84.63153
 [8]  91.48393  80.32889  81.66150
> rowMin(tmp5,na.rm=TRUE)
 [1] 61.33792 55.67578 56.69988 58.38060 58.87520 54.38896 56.53119 57.98046
 [9] 53.35388 55.25531
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.11127  70.72807  68.88678  72.20015  70.79783  72.91566  65.15197
 [8]  72.00118  72.12403  73.09370  67.54460  68.90989  66.93235  71.08283
[15]  68.46275  71.84894  71.21059  74.43492  68.75623  69.59769
> colSums(tmp5,na.rm=TRUE)
 [1] 1111.1127  707.2807  688.8678  722.0015  707.9783  729.1566  651.5197
 [8]  720.0118  721.2403  730.9370  607.9014  689.0989  669.3235  710.8283
[15]  684.6275  718.4894  712.1059  744.3492  687.5623  695.9769
> colVars(tmp5,na.rm=TRUE)
 [1] 15225.47104    58.77428    91.17554    61.29768   109.75907    37.55701
 [7]    27.59868   102.50241    28.49217    31.37683    46.73537    61.96822
[13]    42.98303   133.14118    67.34958    40.15404    79.23323    40.26331
[19]    81.95742   175.46357
> colSd(tmp5,na.rm=TRUE)
 [1] 123.391536   7.666439   9.548588   7.829284  10.476596   6.128377
 [7]   5.253445  10.124347   5.337806   5.601502   6.836327   7.871989
[13]   6.556145  11.538682   8.206679   6.336722   8.901305   6.345338
[19]   9.053034  13.246266
> colMax(tmp5,na.rm=TRUE)
 [1] 461.36791  84.46935  87.20830  82.32739  91.93601  80.43263  72.63211
 [8]  91.48393  78.17607  79.82877  79.88704  86.19246  75.84274  86.20213
[15]  79.48068  80.58707  86.23155  84.77267  81.14743  90.29501
> colMin(tmp5,na.rm=TRUE)
 [1] 56.02156 62.69896 58.67529 59.87204 57.57836 61.11016 58.38060 55.25531
 [9] 60.71498 63.78554 56.69988 57.98046 54.38896 56.33868 56.53119 63.50212
[17] 59.28237 66.11656 55.67578 53.35388
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.10424 69.09386 71.38286 69.31186 71.06670      NaN 68.47820 72.12836
 [9] 68.69619 69.07076
> rowSums(tmp5,na.rm=TRUE)
 [1] 1842.085 1381.877 1427.657 1386.237 1421.334    0.000 1369.564 1442.567
 [9] 1373.924 1381.415
> rowVars(tmp5,na.rm=TRUE)
 [1] 7609.66552   69.08663   78.34799   75.75831   70.54550         NA
 [7]   66.35231   78.52614   67.15086   48.48087
> rowSd(tmp5,na.rm=TRUE)
 [1] 87.233397  8.311837  8.851440  8.703925  8.399137        NA  8.145692
 [8]  8.861498  8.194563  6.962821
> rowMax(tmp5,na.rm=TRUE)
 [1] 461.36791  90.29501  87.20830  91.93601  86.20213        NA  84.63153
 [8]  91.48393  80.32889  81.66150
> rowMin(tmp5,na.rm=TRUE)
 [1] 61.33792 55.67578 56.69988 58.38060 58.87520       NA 56.53119 57.98046
 [9] 53.35388 55.25531
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.84885  69.88660  68.39807  71.07490  70.45854  73.37655  64.32085
 [8]  72.66903  71.89874  72.34536       NaN  69.08483  68.32606  70.24846
[15]  69.58144  71.36764  69.54160  74.85888  67.73771  70.83803
> colSums(tmp5,na.rm=TRUE)
 [1] 1024.6397  628.9794  615.5827  639.6741  634.1268  660.3890  578.8876
 [8]  654.0213  647.0887  651.1082    0.0000  621.7635  614.9346  632.2361
[15]  626.2330  642.3087  625.8744  673.7299  609.6394  637.5423
> colVars(tmp5,na.rm=TRUE)
 [1] 17044.34341    58.15524    99.88566    54.71531   122.18384    39.86195
 [7]    23.27735   110.29745    31.48270    28.99877          NA    69.36995
[13]    26.50361   141.95181    61.68912    42.56717    57.79999    43.27413
[19]    80.53167   180.08903
> colSd(tmp5,na.rm=TRUE)
 [1] 130.553987   7.625959   9.994281   7.396980  11.053680   6.313632
 [7]   4.824660  10.502259   5.610944   5.385051         NA   8.328862
[13]   5.148166  11.914353   7.854242   6.524352   7.602631   6.578307
[19]   8.973944  13.419725
> colMax(tmp5,na.rm=TRUE)
 [1] 461.36791  84.46935  87.20830  81.66150  91.93601  80.43263  70.85920
 [8]  91.48393  78.17607  78.56815      -Inf  86.19246  75.84274  86.20213
[15]  79.48068  80.58707  82.44117  84.77267  81.14743  90.29501
> colMin(tmp5,na.rm=TRUE)
 [1] 56.02156 62.69896 58.67529 59.87204 57.57836 61.11016 58.38060 55.25531
 [9] 60.71498 63.78554      Inf 57.98046 61.03500 56.33868 56.53119 63.50212
[17] 59.28237 66.11656 55.67578 53.35388
> 
> 
> 
> 
> 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] 159.0335 236.4528 146.4398 335.8111 194.0143 261.1082 352.1552 170.1634
 [9] 209.6251 173.4408
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 159.0335 236.4528 146.4398 335.8111 194.0143 261.1082 352.1552 170.1634
 [9] 209.6251 173.4408
> 
> 
> 
> 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]  0.000000e+00  2.842171e-14  0.000000e+00  0.000000e+00 -5.684342e-14
 [6] -1.705303e-13  0.000000e+00 -1.136868e-13  5.684342e-14 -8.526513e-14
[11] -1.705303e-13  2.273737e-13  8.526513e-14  0.000000e+00  0.000000e+00
[16]  2.557954e-13  0.000000e+00  2.842171e-14  1.136868e-13  8.526513e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
3   2 
5   6 
9   10 
4   3 
2   15 
9   2 
10   8 
8   12 
9   7 
10   11 
1   9 
10   20 
2   6 
5   19 
5   1 
8   3 
2   9 
2   12 
2   5 
3   1 
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.590037
> Min(tmp)
[1] -1.966184
> mean(tmp)
[1] 0.03919081
> Sum(tmp)
[1] 3.919081
> Var(tmp)
[1] 0.6955838
> 
> rowMeans(tmp)
[1] 0.03919081
> rowSums(tmp)
[1] 3.919081
> rowVars(tmp)
[1] 0.6955838
> rowSd(tmp)
[1] 0.8340167
> rowMax(tmp)
[1] 2.590037
> rowMin(tmp)
[1] -1.966184
> 
> colMeans(tmp)
  [1]  0.896048775  1.712847441 -1.853282038  1.027119791  0.409829150
  [6]  0.212010263  0.412780401  0.408802813 -0.037605871  0.524423770
 [11] -0.041436951  0.144455256 -1.756946668  0.681600963 -0.099394492
 [16]  0.360305468 -1.347206355  1.101638196 -0.034133578  0.512450148
 [21] -0.844776351 -0.266365289  0.559200969 -0.062126011 -0.428158342
 [26]  2.590037474  0.477946368  1.505726868 -0.416905616  0.550727328
 [31] -0.872776847  0.164194227 -0.238244931  0.184348190  0.941443838
 [36]  0.974196460 -1.966183526  0.798583993  1.093344409  0.003524626
 [41] -0.153658189  1.355079225 -0.336923403 -0.378318248 -0.473499422
 [46] -0.647786044 -1.560182829 -1.234849251 -1.419694160 -0.490687548
 [51] -0.669991686 -0.821782983 -0.926514620 -0.548902661 -0.076001460
 [56]  0.987609921 -0.724925244  0.308843311  1.155445592 -0.190938931
 [61]  0.148917719  0.328385173  0.609247236  0.674773432  0.050797804
 [66] -0.085293431  0.604843351  0.224816821 -0.177030831  1.878996409
 [71] -0.512229946  0.095891202  0.560740939 -1.478236279  0.524306978
 [76] -0.098487693 -0.385948380  0.610094022 -0.810308068 -0.268481769
 [81] -0.096698096  0.732751595  0.374009577  1.313377143 -0.265295915
 [86] -0.955305965 -1.278401204  0.593845697 -1.106082802 -0.230498681
 [91] -0.205467206  0.068662669  0.510933475  0.848359754 -0.227727830
 [96]  0.064220935 -0.242674538  1.275193036 -0.070040198 -0.814240716
> colSums(tmp)
  [1]  0.896048775  1.712847441 -1.853282038  1.027119791  0.409829150
  [6]  0.212010263  0.412780401  0.408802813 -0.037605871  0.524423770
 [11] -0.041436951  0.144455256 -1.756946668  0.681600963 -0.099394492
 [16]  0.360305468 -1.347206355  1.101638196 -0.034133578  0.512450148
 [21] -0.844776351 -0.266365289  0.559200969 -0.062126011 -0.428158342
 [26]  2.590037474  0.477946368  1.505726868 -0.416905616  0.550727328
 [31] -0.872776847  0.164194227 -0.238244931  0.184348190  0.941443838
 [36]  0.974196460 -1.966183526  0.798583993  1.093344409  0.003524626
 [41] -0.153658189  1.355079225 -0.336923403 -0.378318248 -0.473499422
 [46] -0.647786044 -1.560182829 -1.234849251 -1.419694160 -0.490687548
 [51] -0.669991686 -0.821782983 -0.926514620 -0.548902661 -0.076001460
 [56]  0.987609921 -0.724925244  0.308843311  1.155445592 -0.190938931
 [61]  0.148917719  0.328385173  0.609247236  0.674773432  0.050797804
 [66] -0.085293431  0.604843351  0.224816821 -0.177030831  1.878996409
 [71] -0.512229946  0.095891202  0.560740939 -1.478236279  0.524306978
 [76] -0.098487693 -0.385948380  0.610094022 -0.810308068 -0.268481769
 [81] -0.096698096  0.732751595  0.374009577  1.313377143 -0.265295915
 [86] -0.955305965 -1.278401204  0.593845697 -1.106082802 -0.230498681
 [91] -0.205467206  0.068662669  0.510933475  0.848359754 -0.227727830
 [96]  0.064220935 -0.242674538  1.275193036 -0.070040198 -0.814240716
> 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.896048775  1.712847441 -1.853282038  1.027119791  0.409829150
  [6]  0.212010263  0.412780401  0.408802813 -0.037605871  0.524423770
 [11] -0.041436951  0.144455256 -1.756946668  0.681600963 -0.099394492
 [16]  0.360305468 -1.347206355  1.101638196 -0.034133578  0.512450148
 [21] -0.844776351 -0.266365289  0.559200969 -0.062126011 -0.428158342
 [26]  2.590037474  0.477946368  1.505726868 -0.416905616  0.550727328
 [31] -0.872776847  0.164194227 -0.238244931  0.184348190  0.941443838
 [36]  0.974196460 -1.966183526  0.798583993  1.093344409  0.003524626
 [41] -0.153658189  1.355079225 -0.336923403 -0.378318248 -0.473499422
 [46] -0.647786044 -1.560182829 -1.234849251 -1.419694160 -0.490687548
 [51] -0.669991686 -0.821782983 -0.926514620 -0.548902661 -0.076001460
 [56]  0.987609921 -0.724925244  0.308843311  1.155445592 -0.190938931
 [61]  0.148917719  0.328385173  0.609247236  0.674773432  0.050797804
 [66] -0.085293431  0.604843351  0.224816821 -0.177030831  1.878996409
 [71] -0.512229946  0.095891202  0.560740939 -1.478236279  0.524306978
 [76] -0.098487693 -0.385948380  0.610094022 -0.810308068 -0.268481769
 [81] -0.096698096  0.732751595  0.374009577  1.313377143 -0.265295915
 [86] -0.955305965 -1.278401204  0.593845697 -1.106082802 -0.230498681
 [91] -0.205467206  0.068662669  0.510933475  0.848359754 -0.227727830
 [96]  0.064220935 -0.242674538  1.275193036 -0.070040198 -0.814240716
> colMin(tmp)
  [1]  0.896048775  1.712847441 -1.853282038  1.027119791  0.409829150
  [6]  0.212010263  0.412780401  0.408802813 -0.037605871  0.524423770
 [11] -0.041436951  0.144455256 -1.756946668  0.681600963 -0.099394492
 [16]  0.360305468 -1.347206355  1.101638196 -0.034133578  0.512450148
 [21] -0.844776351 -0.266365289  0.559200969 -0.062126011 -0.428158342
 [26]  2.590037474  0.477946368  1.505726868 -0.416905616  0.550727328
 [31] -0.872776847  0.164194227 -0.238244931  0.184348190  0.941443838
 [36]  0.974196460 -1.966183526  0.798583993  1.093344409  0.003524626
 [41] -0.153658189  1.355079225 -0.336923403 -0.378318248 -0.473499422
 [46] -0.647786044 -1.560182829 -1.234849251 -1.419694160 -0.490687548
 [51] -0.669991686 -0.821782983 -0.926514620 -0.548902661 -0.076001460
 [56]  0.987609921 -0.724925244  0.308843311  1.155445592 -0.190938931
 [61]  0.148917719  0.328385173  0.609247236  0.674773432  0.050797804
 [66] -0.085293431  0.604843351  0.224816821 -0.177030831  1.878996409
 [71] -0.512229946  0.095891202  0.560740939 -1.478236279  0.524306978
 [76] -0.098487693 -0.385948380  0.610094022 -0.810308068 -0.268481769
 [81] -0.096698096  0.732751595  0.374009577  1.313377143 -0.265295915
 [86] -0.955305965 -1.278401204  0.593845697 -1.106082802 -0.230498681
 [91] -0.205467206  0.068662669  0.510933475  0.848359754 -0.227727830
 [96]  0.064220935 -0.242674538  1.275193036 -0.070040198 -0.814240716
> colMedians(tmp)
  [1]  0.896048775  1.712847441 -1.853282038  1.027119791  0.409829150
  [6]  0.212010263  0.412780401  0.408802813 -0.037605871  0.524423770
 [11] -0.041436951  0.144455256 -1.756946668  0.681600963 -0.099394492
 [16]  0.360305468 -1.347206355  1.101638196 -0.034133578  0.512450148
 [21] -0.844776351 -0.266365289  0.559200969 -0.062126011 -0.428158342
 [26]  2.590037474  0.477946368  1.505726868 -0.416905616  0.550727328
 [31] -0.872776847  0.164194227 -0.238244931  0.184348190  0.941443838
 [36]  0.974196460 -1.966183526  0.798583993  1.093344409  0.003524626
 [41] -0.153658189  1.355079225 -0.336923403 -0.378318248 -0.473499422
 [46] -0.647786044 -1.560182829 -1.234849251 -1.419694160 -0.490687548
 [51] -0.669991686 -0.821782983 -0.926514620 -0.548902661 -0.076001460
 [56]  0.987609921 -0.724925244  0.308843311  1.155445592 -0.190938931
 [61]  0.148917719  0.328385173  0.609247236  0.674773432  0.050797804
 [66] -0.085293431  0.604843351  0.224816821 -0.177030831  1.878996409
 [71] -0.512229946  0.095891202  0.560740939 -1.478236279  0.524306978
 [76] -0.098487693 -0.385948380  0.610094022 -0.810308068 -0.268481769
 [81] -0.096698096  0.732751595  0.374009577  1.313377143 -0.265295915
 [86] -0.955305965 -1.278401204  0.593845697 -1.106082802 -0.230498681
 [91] -0.205467206  0.068662669  0.510933475  0.848359754 -0.227727830
 [96]  0.064220935 -0.242674538  1.275193036 -0.070040198 -0.814240716
> colRanges(tmp)
          [,1]     [,2]      [,3]    [,4]      [,5]      [,6]      [,7]
[1,] 0.8960488 1.712847 -1.853282 1.02712 0.4098291 0.2120103 0.4127804
[2,] 0.8960488 1.712847 -1.853282 1.02712 0.4098291 0.2120103 0.4127804
          [,8]        [,9]     [,10]       [,11]     [,12]     [,13]    [,14]
[1,] 0.4088028 -0.03760587 0.5244238 -0.04143695 0.1444553 -1.756947 0.681601
[2,] 0.4088028 -0.03760587 0.5244238 -0.04143695 0.1444553 -1.756947 0.681601
           [,15]     [,16]     [,17]    [,18]       [,19]     [,20]      [,21]
[1,] -0.09939449 0.3603055 -1.347206 1.101638 -0.03413358 0.5124501 -0.8447764
[2,] -0.09939449 0.3603055 -1.347206 1.101638 -0.03413358 0.5124501 -0.8447764
          [,22]    [,23]       [,24]      [,25]    [,26]     [,27]    [,28]
[1,] -0.2663653 0.559201 -0.06212601 -0.4281583 2.590037 0.4779464 1.505727
[2,] -0.2663653 0.559201 -0.06212601 -0.4281583 2.590037 0.4779464 1.505727
          [,29]     [,30]      [,31]     [,32]      [,33]     [,34]     [,35]
[1,] -0.4169056 0.5507273 -0.8727768 0.1641942 -0.2382449 0.1843482 0.9414438
[2,] -0.4169056 0.5507273 -0.8727768 0.1641942 -0.2382449 0.1843482 0.9414438
         [,36]     [,37]    [,38]    [,39]       [,40]      [,41]    [,42]
[1,] 0.9741965 -1.966184 0.798584 1.093344 0.003524626 -0.1536582 1.355079
[2,] 0.9741965 -1.966184 0.798584 1.093344 0.003524626 -0.1536582 1.355079
          [,43]      [,44]      [,45]     [,46]     [,47]     [,48]     [,49]
[1,] -0.3369234 -0.3783182 -0.4734994 -0.647786 -1.560183 -1.234849 -1.419694
[2,] -0.3369234 -0.3783182 -0.4734994 -0.647786 -1.560183 -1.234849 -1.419694
          [,50]      [,51]     [,52]      [,53]      [,54]       [,55]
[1,] -0.4906875 -0.6699917 -0.821783 -0.9265146 -0.5489027 -0.07600146
[2,] -0.4906875 -0.6699917 -0.821783 -0.9265146 -0.5489027 -0.07600146
         [,56]      [,57]     [,58]    [,59]      [,60]     [,61]     [,62]
[1,] 0.9876099 -0.7249252 0.3088433 1.155446 -0.1909389 0.1489177 0.3283852
[2,] 0.9876099 -0.7249252 0.3088433 1.155446 -0.1909389 0.1489177 0.3283852
         [,63]     [,64]     [,65]       [,66]     [,67]     [,68]      [,69]
[1,] 0.6092472 0.6747734 0.0507978 -0.08529343 0.6048434 0.2248168 -0.1770308
[2,] 0.6092472 0.6747734 0.0507978 -0.08529343 0.6048434 0.2248168 -0.1770308
        [,70]      [,71]     [,72]     [,73]     [,74]    [,75]       [,76]
[1,] 1.878996 -0.5122299 0.0958912 0.5607409 -1.478236 0.524307 -0.09848769
[2,] 1.878996 -0.5122299 0.0958912 0.5607409 -1.478236 0.524307 -0.09848769
          [,77]    [,78]      [,79]      [,80]      [,81]     [,82]     [,83]
[1,] -0.3859484 0.610094 -0.8103081 -0.2684818 -0.0966981 0.7327516 0.3740096
[2,] -0.3859484 0.610094 -0.8103081 -0.2684818 -0.0966981 0.7327516 0.3740096
        [,84]      [,85]     [,86]     [,87]     [,88]     [,89]      [,90]
[1,] 1.313377 -0.2652959 -0.955306 -1.278401 0.5938457 -1.106083 -0.2304987
[2,] 1.313377 -0.2652959 -0.955306 -1.278401 0.5938457 -1.106083 -0.2304987
          [,91]      [,92]     [,93]     [,94]      [,95]      [,96]      [,97]
[1,] -0.2054672 0.06866267 0.5109335 0.8483598 -0.2277278 0.06422094 -0.2426745
[2,] -0.2054672 0.06866267 0.5109335 0.8483598 -0.2277278 0.06422094 -0.2426745
        [,98]      [,99]     [,100]
[1,] 1.275193 -0.0700402 -0.8142407
[2,] 1.275193 -0.0700402 -0.8142407
> 
> 
> Max(tmp2)
[1] 2.535566
> Min(tmp2)
[1] -2.795231
> mean(tmp2)
[1] -0.04046953
> Sum(tmp2)
[1] -4.046953
> Var(tmp2)
[1] 0.962633
> 
> rowMeans(tmp2)
  [1]  0.838359258 -0.144687815 -1.247660630 -0.492959520 -0.107116293
  [6]  0.249806239 -0.573593522  0.779443748 -0.462952541  1.379609063
 [11]  0.841958575  0.308875322 -0.678213519 -0.071832051 -0.687506960
 [16] -0.613647830  0.026767860 -0.644844065  0.318815544  0.799892595
 [21] -0.367854066  1.991197399 -1.272177265  0.013753982  0.659169287
 [26]  0.800642553 -0.919840092 -0.009428884 -1.008109953  0.149673006
 [31]  2.535566410 -0.766342324 -0.439022510 -0.239899713 -0.350577960
 [36] -0.667965206 -0.895248996 -0.702213474 -2.408846306  0.506890784
 [41]  2.129149893  1.171321388  1.326099305 -0.449075477 -2.795230885
 [46] -0.294050194 -0.365957128 -0.103774257  0.774591392  1.819722961
 [51]  0.419283242 -0.502072225  0.326888789 -1.098263292 -0.433813908
 [56]  0.567958237  1.203556337  0.598756403 -0.171101461  0.208530866
 [61]  0.351375846  1.693766689 -1.330352167  1.238818266 -0.335547574
 [66] -0.136900412  1.584790023  0.236031160 -0.755785839 -0.039200565
 [71] -0.810142568 -0.254293892 -0.211062456  0.370775301 -1.168936518
 [76] -2.639610920  0.276821390  0.702566826 -0.020375694  0.480995487
 [81]  1.622395770  0.301117085 -0.100438509  0.110079089 -2.139376005
 [86]  0.827497808  0.087319461 -0.518310078 -0.513827129 -0.002051534
 [91] -0.586164165 -2.240091770  0.078559655 -0.312529112  1.164570404
 [96] -1.297082959 -0.898952978 -0.567697110  0.961976735 -0.018080128
> rowSums(tmp2)
  [1]  0.838359258 -0.144687815 -1.247660630 -0.492959520 -0.107116293
  [6]  0.249806239 -0.573593522  0.779443748 -0.462952541  1.379609063
 [11]  0.841958575  0.308875322 -0.678213519 -0.071832051 -0.687506960
 [16] -0.613647830  0.026767860 -0.644844065  0.318815544  0.799892595
 [21] -0.367854066  1.991197399 -1.272177265  0.013753982  0.659169287
 [26]  0.800642553 -0.919840092 -0.009428884 -1.008109953  0.149673006
 [31]  2.535566410 -0.766342324 -0.439022510 -0.239899713 -0.350577960
 [36] -0.667965206 -0.895248996 -0.702213474 -2.408846306  0.506890784
 [41]  2.129149893  1.171321388  1.326099305 -0.449075477 -2.795230885
 [46] -0.294050194 -0.365957128 -0.103774257  0.774591392  1.819722961
 [51]  0.419283242 -0.502072225  0.326888789 -1.098263292 -0.433813908
 [56]  0.567958237  1.203556337  0.598756403 -0.171101461  0.208530866
 [61]  0.351375846  1.693766689 -1.330352167  1.238818266 -0.335547574
 [66] -0.136900412  1.584790023  0.236031160 -0.755785839 -0.039200565
 [71] -0.810142568 -0.254293892 -0.211062456  0.370775301 -1.168936518
 [76] -2.639610920  0.276821390  0.702566826 -0.020375694  0.480995487
 [81]  1.622395770  0.301117085 -0.100438509  0.110079089 -2.139376005
 [86]  0.827497808  0.087319461 -0.518310078 -0.513827129 -0.002051534
 [91] -0.586164165 -2.240091770  0.078559655 -0.312529112  1.164570404
 [96] -1.297082959 -0.898952978 -0.567697110  0.961976735 -0.018080128
> 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.838359258 -0.144687815 -1.247660630 -0.492959520 -0.107116293
  [6]  0.249806239 -0.573593522  0.779443748 -0.462952541  1.379609063
 [11]  0.841958575  0.308875322 -0.678213519 -0.071832051 -0.687506960
 [16] -0.613647830  0.026767860 -0.644844065  0.318815544  0.799892595
 [21] -0.367854066  1.991197399 -1.272177265  0.013753982  0.659169287
 [26]  0.800642553 -0.919840092 -0.009428884 -1.008109953  0.149673006
 [31]  2.535566410 -0.766342324 -0.439022510 -0.239899713 -0.350577960
 [36] -0.667965206 -0.895248996 -0.702213474 -2.408846306  0.506890784
 [41]  2.129149893  1.171321388  1.326099305 -0.449075477 -2.795230885
 [46] -0.294050194 -0.365957128 -0.103774257  0.774591392  1.819722961
 [51]  0.419283242 -0.502072225  0.326888789 -1.098263292 -0.433813908
 [56]  0.567958237  1.203556337  0.598756403 -0.171101461  0.208530866
 [61]  0.351375846  1.693766689 -1.330352167  1.238818266 -0.335547574
 [66] -0.136900412  1.584790023  0.236031160 -0.755785839 -0.039200565
 [71] -0.810142568 -0.254293892 -0.211062456  0.370775301 -1.168936518
 [76] -2.639610920  0.276821390  0.702566826 -0.020375694  0.480995487
 [81]  1.622395770  0.301117085 -0.100438509  0.110079089 -2.139376005
 [86]  0.827497808  0.087319461 -0.518310078 -0.513827129 -0.002051534
 [91] -0.586164165 -2.240091770  0.078559655 -0.312529112  1.164570404
 [96] -1.297082959 -0.898952978 -0.567697110  0.961976735 -0.018080128
> rowMin(tmp2)
  [1]  0.838359258 -0.144687815 -1.247660630 -0.492959520 -0.107116293
  [6]  0.249806239 -0.573593522  0.779443748 -0.462952541  1.379609063
 [11]  0.841958575  0.308875322 -0.678213519 -0.071832051 -0.687506960
 [16] -0.613647830  0.026767860 -0.644844065  0.318815544  0.799892595
 [21] -0.367854066  1.991197399 -1.272177265  0.013753982  0.659169287
 [26]  0.800642553 -0.919840092 -0.009428884 -1.008109953  0.149673006
 [31]  2.535566410 -0.766342324 -0.439022510 -0.239899713 -0.350577960
 [36] -0.667965206 -0.895248996 -0.702213474 -2.408846306  0.506890784
 [41]  2.129149893  1.171321388  1.326099305 -0.449075477 -2.795230885
 [46] -0.294050194 -0.365957128 -0.103774257  0.774591392  1.819722961
 [51]  0.419283242 -0.502072225  0.326888789 -1.098263292 -0.433813908
 [56]  0.567958237  1.203556337  0.598756403 -0.171101461  0.208530866
 [61]  0.351375846  1.693766689 -1.330352167  1.238818266 -0.335547574
 [66] -0.136900412  1.584790023  0.236031160 -0.755785839 -0.039200565
 [71] -0.810142568 -0.254293892 -0.211062456  0.370775301 -1.168936518
 [76] -2.639610920  0.276821390  0.702566826 -0.020375694  0.480995487
 [81]  1.622395770  0.301117085 -0.100438509  0.110079089 -2.139376005
 [86]  0.827497808  0.087319461 -0.518310078 -0.513827129 -0.002051534
 [91] -0.586164165 -2.240091770  0.078559655 -0.312529112  1.164570404
 [96] -1.297082959 -0.898952978 -0.567697110  0.961976735 -0.018080128
> 
> colMeans(tmp2)
[1] -0.04046953
> colSums(tmp2)
[1] -4.046953
> colVars(tmp2)
[1] 0.962633
> colSd(tmp2)
[1] 0.9811386
> colMax(tmp2)
[1] 2.535566
> colMin(tmp2)
[1] -2.795231
> colMedians(tmp2)
[1] -0.08613528
> colRanges(tmp2)
          [,1]
[1,] -2.795231
[2,]  2.535566
> 
> 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]   0.7361696   2.0187598  -2.0329841  -1.3529840 -11.7396184  -4.4762796
 [7]   0.7446427  -3.6750511  -2.4056705  -0.5686555
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.85853215
[2,] -0.43631114
[3,]  0.01014676
[4,]  0.37222170
[5,]  1.37084999
> 
> rowApply(tmp,sum)
 [1] -2.3781317 -0.4736017 -8.4368473 -2.9462401 -3.8739694  0.2616084
 [7] -1.9992801  2.1864692 -4.6422300 -0.4494486
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    6    4    4    4   10    9    7    5    6     6
 [2,]    5    9   10    5    3    6    3    4   10    10
 [3,]   10    8    1   10    6    7    6    6    7     1
 [4,]    3    1    7    8    9   10    5    9    3     2
 [5,]    2    3    9    1    2    1    8    1    2     3
 [6,]    7    7    3    2    8    3    4    7    1     4
 [7,]    4   10    2    7    4    5    9    8    9     7
 [8,]    8    2    6    9    1    4    2    3    4     8
 [9,]    9    6    8    3    7    8    1    2    8     5
[10,]    1    5    5    6    5    2   10   10    5     9
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.1085212  0.5155605  0.7063328  0.7050758 -1.4217747  1.3362469
 [7]  2.1442587  0.9917600 -0.2679717  0.2308818  0.5431408 -1.4628295
[13] -1.4384834 -0.6204181  3.7982459  3.8269809  4.5360838 -0.3622376
[19] -3.4995537 -1.2217891
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.3654361
[2,] -0.8705091
[3,] -0.0985044
[4,]  1.5604543
[5,]  2.8825165
> 
> rowApply(tmp,sum)
[1] -1.201464 -3.796849  7.127649  6.000855  3.017840
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    3   13   17   20    1
[2,]   18    5    1   15   11
[3,]   12   11   16   11    4
[4,]   15   18   15    3   10
[5,]    2    9   10    9   12
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]        [,5]       [,6]
[1,] -0.8705091  0.9970749  0.1423792  0.4516297 -0.88850402 -0.3620050
[2,] -0.0985044 -0.6753532 -0.1175945  0.7492905 -0.52138413 -0.5520356
[3,]  1.5604543 -0.8323111  1.0706973  0.6480950 -0.08892457 -0.5053202
[4,]  2.8825165  0.8388327  0.4550766 -1.2397159 -0.13022970  1.3674915
[5,] -1.3654361  0.1873173 -0.8442259  0.0957764  0.20726769  1.3881162
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,]  0.6077365  0.1849255 -0.8117871 -0.4441524 -0.1789406 -0.1611566
[2,]  0.1093953 -1.0653182 -0.6162324 -0.1030120  0.5448070 -1.1075685
[3,]  2.2197979  0.3762247 -0.3447608  0.5441378  0.4622804 -0.4634893
[4,] -0.6864014 -0.3897952  2.6768226 -0.6127979 -1.5446734  0.6003938
[5,] -0.1062696  1.8857231 -1.1720139  0.8467063  1.2596674 -0.3310090
          [,13]      [,14]     [,15]        [,16]       [,17]       [,18]
[1,]  1.3555260  1.2605271 0.3290676 -0.510260694  0.76783119 -0.69527287
[2,] -0.7505804 -0.3197530 0.8419878  0.006949206  0.95687265  0.49960572
[3,] -0.7868118 -0.1273291 0.5232555  1.600482949  3.05151014 -0.58933519
[4,] -1.7746730 -0.5971992 1.6881751  1.281762712 -0.20843813  0.04834923
[5,]  0.5180558 -0.8366639 0.4157599  1.448046712 -0.03169204  0.37441555
          [,19]       [,20]
[1,] -1.8065044 -0.56906838
[2,] -0.5511195 -1.02730151
[3,] -0.8006354 -0.39036946
[4,]  0.5069149  0.83844346
[5,] -0.8482094 -0.07349322
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.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:    /Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  644  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  558  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.6-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.1698641 2.25908 1.700553 0.1764344 -1.46221 0.2955077 0.7108774
          col8      col9     col10      col11     col12      col13     col14
row1 0.5457724 -1.002212 -1.826702 -0.4728517 -1.905608 -0.3525888 -0.545446
          col15     col16      col17     col18     col19     col20
row1 -0.8464497 -1.624757 -0.3784619 -1.035745 0.5350151 0.4068957
> tmp[,"col10"]
            col10
row1 -1.826701862
row2  0.004998823
row3 -0.263799396
row4 -0.110357333
row5  0.098792408
> tmp[c("row1","row5"),]
           col1       col2      col3       col4      col5       col6       col7
row1 -0.1698641  2.2590800 1.7005533  0.1764344 -1.462210  0.2955077  0.7108774
row5 -1.2189511 -0.6417032 0.9081926 -0.7359549  2.195868 -1.4707095 -0.6152910
           col8       col9       col10      col11     col12      col13
row1  0.5457724 -1.0022120 -1.82670186 -0.4728517 -1.905608 -0.3525888
row5 -1.4139787  0.6058675  0.09879241 -1.2274960  1.337708 -0.1526020
         col14      col15      col16      col17      col18     col19     col20
row1 -0.545446 -0.8464497 -1.6247567 -0.3784619 -1.0357450 0.5350151 0.4068957
row5 -1.263972  0.2450051  0.3461861  2.5928330  0.9582051 0.8304592 0.9450485
> tmp[,c("col6","col20")]
            col6       col20
row1  0.29550767  0.40689575
row2  0.65957014 -1.32371057
row3  0.63285311 -0.61437963
row4  0.05021991 -0.01743781
row5 -1.47070950  0.94504846
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1  0.2955077 0.4068957
row5 -1.4707095 0.9450485
> 
> 
> 
> 
> 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 48.76343 50.8156 50.56734 50.01987 51.59103 106.2159 48.63481 49.72179
        col9    col10    col11    col12    col13    col14    col15    col16
row1 50.6131 50.60781 50.96616 52.71379 51.25875 49.91762 49.61067 50.50402
        col17    col18    col19    col20
row1 49.63249 51.01247 49.74683 105.4333
> tmp[,"col10"]
        col10
row1 50.60781
row2 30.70664
row3 29.20898
row4 30.03078
row5 50.46528
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.76343 50.81560 50.56734 50.01987 51.59103 106.2159 48.63481 49.72179
row5 49.47363 50.75543 49.53279 49.78808 49.87917 105.2233 50.05650 49.81294
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.61310 50.60781 50.96616 52.71379 51.25875 49.91762 49.61067 50.50402
row5 51.35043 50.46528 50.00566 49.13526 49.70929 50.08563 49.99763 48.18047
        col17    col18    col19    col20
row1 49.63249 51.01247 49.74683 105.4333
row5 49.74003 49.79043 50.56751 105.8619
> tmp[,c("col6","col20")]
          col6     col20
row1 106.21594 105.43328
row2  75.15332  73.67189
row3  72.71943  75.48872
row4  75.62774  75.66506
row5 105.22327 105.86189
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.2159 105.4333
row5 105.2233 105.8619
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.2159 105.4333
row5 105.2233 105.8619
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.9584331
[2,]  1.2162461
[3,] -0.6263415
[4,]  0.9990860
[5,]  0.5500561
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.5203118 -0.2986721
[2,]  0.9722900  0.5322498
[3,] -0.1675745  1.1930267
[4,] -0.9954921 -0.5814914
[5,] -1.7963077 -0.2643167
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.3406079 -0.5989864
[2,]  1.3699477 -0.0535281
[3,] -0.6295580  0.2312536
[4,] -1.2973703 -1.5599605
[5,] -0.6594747  1.7261684
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.3406079
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.3406079
[2,]  1.3699477
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]      [,4]       [,5]       [,6]
row3 -0.1375269 -0.9907649 -1.0548778 -0.931438 -0.2584585  0.3112933
row1  0.4171530 -0.6568405 -0.1455673  1.105656 -0.9749489 -0.6634518
            [,7]      [,8]      [,9]      [,10]      [,11]      [,12]
row3 -0.05054088 1.2189305 1.5160184 -0.4610972  0.5367708  0.7594679
row1 -1.03171867 0.2706551 0.5986037  0.4845208 -1.2712864 -1.2568203
          [,13]      [,14]      [,15]    [,16]      [,17]      [,18]
row3 -2.1860285  0.3174410 -0.6174318 0.828377 -1.4855702 -0.8883978
row1 -0.3348751 -0.1384401  1.3240166 1.451058 -0.5307702  0.3595560
           [,19]     [,20]
row3 -0.07524667 -0.157345
row1  0.14238430 -1.001296
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
row2 -0.7230813 -0.1617093 -0.4702508 0.01713954 -0.5164873 -0.5141303
          [,7]      [,8]       [,9]     [,10]
row2 0.1251291 0.5749143 0.03523805 -1.068626
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]       [,3]      [,4]       [,5]      [,6]       [,7]
row5 0.8402937 -0.2795535 -0.5424386 -2.020344 -0.7628825 -1.177353 -0.2260681
           [,8]      [,9]     [,10]     [,11]      [,12]    [,13]     [,14]
row5 -0.9980972 0.1184532 0.1664307 -1.201399 -0.7392467 1.104942 0.1754503
          [,15]     [,16]     [,17]    [,18]    [,19]    [,20]
row5 -0.5007124 0.1899512 0.4623083 0.429871 1.723687 -1.21218
> 
> 
> 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: 0x7f8dbca48320>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef1285772f"
 [2] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef7853b828"
 [3] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef405f87cf"
 [4] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef3fcd480d"
 [5] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef3e356e34"
 [6] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef25d637d4"
 [7] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef12eb52b4"
 [8] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef1782b120"
 [9] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef53ab7ef" 
[10] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef5201ae97"
[11] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef6c6d6590"
[12] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef227088d" 
[13] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef50a26215"
[14] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4ef54d57a0e"
[15] "/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests/BMb4efb4058a5" 
> 
> 
> ### 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: 0x7f8db9c37510>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7f8db9c37510>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.6-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7f8db9c37510>
> rowMedians(tmp)
  [1]  0.608261897  0.531784012  0.277849336  0.062282056  0.023944173
  [6] -0.336121008 -0.034042223 -0.056480061 -0.128460797 -0.242443902
 [11]  0.102298205 -0.349883696  0.441319196  0.425682030  0.448024577
 [16] -0.186801346  0.070343824 -0.309555993 -0.195102843  0.239392475
 [21] -0.483110409 -0.254160304 -0.079886115  0.222685824  0.055451584
 [26]  0.065091371 -0.295404284  0.301257955 -0.211090313  0.068311148
 [31] -0.183280776  0.361212943  0.442355659 -0.216482294  0.140341771
 [36] -0.462577061 -0.310538173  0.637044385  0.609471069  0.565187478
 [41] -0.399742910  0.314283908 -0.274241342 -0.395500931  0.017522885
 [46] -0.014460527  0.038094844 -0.107399231 -0.201947973  0.070785229
 [51] -0.235487861  0.105118626 -0.121544793 -0.011072109 -0.075015946
 [56]  0.372118704  0.157188971  0.509641773  0.057917299  0.216706459
 [61]  0.008754496  0.232946339 -0.275609038  0.273341169  0.151003230
 [66] -0.317023523  0.145360284  0.069432658 -0.354919174 -0.492113051
 [71]  0.022281091 -0.453801138  0.006101679 -0.386864123  0.305684391
 [76]  0.156024260  0.309654998 -0.439551630 -0.090911030  0.181671320
 [81] -0.128179642 -0.013186776  0.321388302  0.174801493  0.091884109
 [86]  0.348019404  0.200380173 -0.225489930  0.014670195  0.242086092
 [91]  0.227928646  0.291351968 -0.009759798  0.244678062 -0.619983262
 [96]  0.191346023  0.317609929  0.698845825 -0.140618961  0.022262424
[101] -0.219437955  0.187355486  0.344642401  1.120464155  0.008456351
[106]  0.039270827 -0.164387522 -0.319285001 -0.115759598 -0.201517101
[111] -0.206841567 -0.333283360 -0.820272194 -0.346025239 -0.085179936
[116]  0.082077811 -0.065377079 -0.079185654 -0.043563016 -0.337634822
[121]  0.228077196  0.252277931 -0.027541718 -0.068129137 -0.108134248
[126]  0.497270845 -0.336541304  0.668613011 -0.411705499 -0.292398866
[131]  0.665218266  0.440421783  0.208007498  0.046505111  0.411190859
[136] -0.174823803  0.209757249 -0.140372753 -0.085082524  0.001508235
[141]  0.108992471 -0.180890006 -0.153948009 -0.102243121 -0.405627047
[146] -0.366193837 -0.891669627 -0.355069355  0.205127336 -0.121279397
[151] -0.011608061 -0.776260921 -0.572953912 -0.055187190  0.621867161
[156]  0.092717780 -0.287243844 -0.076686898  0.069840953  0.389830478
[161] -0.329996118  0.200569954 -0.163793796  0.751332690  0.295892445
[166]  0.554903349  0.409107744 -0.225885800 -0.233586542  0.277663831
[171]  0.174212337 -0.028571589  0.096513533  0.219025429  0.017519747
[176] -0.348952581  0.258357998 -0.186671077  0.041115161  0.012832365
[181] -0.460343660 -0.416263118 -0.128054416 -0.793233643 -0.226283638
[186] -0.481582491 -0.066140456 -0.065124591  0.463494052  0.041772270
[191]  0.068332028 -0.203134054  0.126775236 -0.631755647 -0.605948388
[196]  0.110980497 -0.831452914  0.708760848  0.169655387 -0.341800285
[201] -0.108576657  0.637259783  0.045110085  0.045147482  0.057774600
[206] -0.143541272 -0.147367812 -0.126171585 -0.334507613  0.557376197
[211]  0.521944770 -0.036652249 -0.124388556 -0.427136470 -0.427668474
[216]  0.432034222 -0.196399168 -0.043816881  0.300253165 -0.106206723
[221]  0.395694875  0.075439187 -0.490719826  0.110356465  0.189219153
[226]  0.271787517 -0.434441797  0.101276169  0.409711494  0.126198701
> 
> proc.time()
   user  system elapsed 
  3.314   4.694   8.171 

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-apple-darwin15.6.0 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x7fd5dda4bb40>
> .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: 0x7fd5dda4bb40>
> .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: 0x7fd5dda4bb40>
> .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: 0x7fd5dda4bb40>
> 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: 0x7fd5ddb4b930>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fd5ddb4b930>
> .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: 0x7fd5ddb4b930>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fd5ddb4b930>
> .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: 0x7fd5ddb4b930>
> 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: 0x7fd5ddb16260>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fd5ddb16260>
> .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: 0x7fd5ddb16260>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fd5ddb16260>
> .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: 0x7fd5ddb16260>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7fd5ddb16260>
> .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: 0x7fd5ddb16260>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7fd5ddb16260>
> .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: 0x7fd5ddb16260>
> 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: 0x7fd5dda24810>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7fd5dda24810>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fd5dda24810>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fd5dda24810>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFileb51c32b2f1c0" "BufferedMatrixFileb51c777732f6"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFileb51c32b2f1c0" "BufferedMatrixFileb51c777732f6"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fd5dae01eb0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fd5dae01eb0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fd5dae01eb0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fd5dae01eb0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7fd5dae01eb0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7fd5dae01eb0>
> .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: 0x7fd5ddb1ce90>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fd5ddb1ce90>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fd5ddb1ce90>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7fd5ddb1ce90>
> 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: 0x7fd5dac16860>
> .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: 0x7fd5dac16860>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.362   0.067   0.411 

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-apple-darwin15.6.0 (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.333   0.044   0.362 

Example timings