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

CHECK report for BufferedMatrix on malbec1

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

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

Summary

Package: BufferedMatrix
Version: 1.46.0
Command: /home/biocbuild/bbs-3.8-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.8-bioc/R/library --no-vignettes --timings BufferedMatrix_1.46.0.tar.gz
StartedAt: 2019-04-15 22:36:00 -0400 (Mon, 15 Apr 2019)
EndedAt: 2019-04-15 22:36:22 -0400 (Mon, 15 Apr 2019)
EllapsedTime: 22.0 seconds
RetCode: 0
Status:  OK 
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.320   0.020   0.339 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 406860 21.8     845382 45.2   634148 33.9
Vcells 736743  5.7    8388608 64.0  1798391 13.8
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Apr 15 22:36:16 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon Apr 15 22:36:16 2019"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x29dc370>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Apr 15 22:36:17 2019"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon Apr 15 22:36:17 2019"
> 
> ColMode(tmp2)
<pointer: 0x29dc370>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
              [,1]       [,2]          [,3]        [,4]
[1,] 100.663787494 -0.5559515  0.0001069126  0.04749422
[2,]  -1.044327131 -0.8824559 -0.2460498636  0.14421062
[3,]   0.003761096  0.8575826 -0.0558483858 -0.12486417
[4,]  -0.809117288 -0.3097809 -1.3413988975  1.57106919
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
             [,1]      [,2]         [,3]       [,4]
[1,] 1.006638e+02 0.5559515 0.0001069126 0.04749422
[2,] 1.044327e+00 0.8824559 0.2460498636 0.14421062
[3,] 3.761096e-03 0.8575826 0.0558483858 0.12486417
[4,] 8.091173e-01 0.3097809 1.3413988975 1.57106919
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]       [,3]      [,4]
[1,] 10.03313448 0.7456216 0.01033986 0.2179317
[2,]  1.02192325 0.9393912 0.49603414 0.3797507
[3,]  0.06132778 0.9260575 0.23632263 0.3533612
[4,]  0.89950947 0.5565797 1.15818776 1.2534230
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.99513 33.01217 25.10351 27.22681
[2,]  36.26356 35.27637 30.20639 28.94172
[3,]  25.61704 35.11816 27.41907 28.65848
[4,]  34.80421 30.87558 37.92328 39.10530
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x220a950>
> exp(tmp5)
<pointer: 0x220a950>
> log(tmp5,2)
<pointer: 0x220a950>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.3793
> Min(tmp5)
[1] 52.24966
> mean(tmp5)
[1] 73.21562
> Sum(tmp5)
[1] 14643.12
> Var(tmp5)
[1] 860.1706
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 86.89177 72.90897 67.13919 73.47513 73.87699 73.25367 70.00694 73.76497
 [9] 71.71662 69.12191
> rowSums(tmp5)
 [1] 1737.835 1458.179 1342.784 1469.503 1477.540 1465.073 1400.139 1475.299
 [9] 1434.332 1382.438
> rowVars(tmp5)
 [1] 8238.36618   46.87150   55.37921   46.06078   45.79126   55.36902
 [7]   38.73011   58.79547   80.34537   75.90652
> rowSd(tmp5)
 [1] 90.765446  6.846276  7.441721  6.786809  6.766924  7.441036  6.223352
 [8]  7.667820  8.963558  8.712435
> rowMax(tmp5)
 [1] 470.37926  83.10843  81.61502  82.74823  85.16877  84.52577  84.12462
 [8]  87.98395  85.63825  81.36823
> rowMin(tmp5)
 [1] 52.24966 60.23839 53.31851 59.07214 63.07937 57.02811 58.83207 61.07663
 [9] 54.76266 55.01603
> 
> colMeans(tmp5)
 [1] 110.52595  69.70236  69.55019  68.77290  68.88871  71.09743  72.87633
 [8]  73.80321  73.65258  70.05671  71.50693  70.63895  73.51437  70.71530
[15]  72.00661  71.25288  73.18283  72.87605  68.75673  70.93530
> colSums(tmp5)
 [1] 1105.2595  697.0236  695.5019  687.7290  688.8871  710.9743  728.7633
 [8]  738.0321  736.5258  700.5671  715.0693  706.3895  735.1437  707.1530
[15]  720.0661  712.5288  731.8283  728.7605  687.5673  709.3530
> colVars(tmp5)
 [1] 16058.99163    54.20005   120.33511    82.57215    67.75073    86.66954
 [7]    24.86061    90.98591    57.44705    35.18453    67.32797    23.17849
[13]    73.12204    55.35842    60.70293    61.07909    64.46535    98.08516
[19]    97.55413    52.98296
> colSd(tmp5)
 [1] 126.724077   7.362068  10.969736   9.086922   8.231083   9.309648
 [7]   4.986042   9.538653   7.579383   5.931655   8.205362   4.814405
[13]   8.551142   7.440324   7.791208   7.815311   8.029031   9.903795
[19]   9.876949   7.278940
> colMax(tmp5)
 [1] 470.37926  82.91893  84.28378  81.39256  82.39040  84.96853  79.93147
 [8]  85.16226  85.16877  81.16894  81.61502  78.04484  84.52577  80.42241
[15]  87.98395  84.73823  87.21393  85.63825  82.19474  81.91091
> colMin(tmp5)
 [1] 53.31851 59.43849 52.24966 56.66904 54.76266 59.07214 66.15697 58.62608
 [9] 60.43045 61.78363 58.95016 63.78512 63.75532 57.75302 63.06668 59.14362
[17] 55.01603 54.46010 53.22903 58.01656
> 
> 
> ### 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] 86.89177 72.90897 67.13919 73.47513       NA 73.25367 70.00694 73.76497
 [9] 71.71662 69.12191
> rowSums(tmp5)
 [1] 1737.835 1458.179 1342.784 1469.503       NA 1465.073 1400.139 1475.299
 [9] 1434.332 1382.438
> rowVars(tmp5)
 [1] 8238.36618   46.87150   55.37921   46.06078   47.10370   55.36902
 [7]   38.73011   58.79547   80.34537   75.90652
> rowSd(tmp5)
 [1] 90.765446  6.846276  7.441721  6.786809  6.863214  7.441036  6.223352
 [8]  7.667820  8.963558  8.712435
> rowMax(tmp5)
 [1] 470.37926  83.10843  81.61502  82.74823        NA  84.52577  84.12462
 [8]  87.98395  85.63825  81.36823
> rowMin(tmp5)
 [1] 52.24966 60.23839 53.31851 59.07214       NA 57.02811 58.83207 61.07663
 [9] 54.76266 55.01603
> 
> colMeans(tmp5)
 [1] 110.52595  69.70236  69.55019  68.77290  68.88871  71.09743  72.87633
 [8]  73.80321  73.65258  70.05671  71.50693  70.63895  73.51437        NA
[15]  72.00661  71.25288  73.18283  72.87605  68.75673  70.93530
> colSums(tmp5)
 [1] 1105.2595  697.0236  695.5019  687.7290  688.8871  710.9743  728.7633
 [8]  738.0321  736.5258  700.5671  715.0693  706.3895  735.1437        NA
[15]  720.0661  712.5288  731.8283  728.7605  687.5673  709.3530
> colVars(tmp5)
 [1] 16058.99163    54.20005   120.33511    82.57215    67.75073    86.66954
 [7]    24.86061    90.98591    57.44705    35.18453    67.32797    23.17849
[13]    73.12204          NA    60.70293    61.07909    64.46535    98.08516
[19]    97.55413    52.98296
> colSd(tmp5)
 [1] 126.724077   7.362068  10.969736   9.086922   8.231083   9.309648
 [7]   4.986042   9.538653   7.579383   5.931655   8.205362   4.814405
[13]   8.551142         NA   7.791208   7.815311   8.029031   9.903795
[19]   9.876949   7.278940
> colMax(tmp5)
 [1] 470.37926  82.91893  84.28378  81.39256  82.39040  84.96853  79.93147
 [8]  85.16226  85.16877  81.16894  81.61502  78.04484  84.52577        NA
[15]  87.98395  84.73823  87.21393  85.63825  82.19474  81.91091
> colMin(tmp5)
 [1] 53.31851 59.43849 52.24966 56.66904 54.76266 59.07214 66.15697 58.62608
 [9] 60.43045 61.78363 58.95016 63.78512 63.75532       NA 63.06668 59.14362
[17] 55.01603 54.46010 53.22903 58.01656
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.3793
> Min(tmp5,na.rm=TRUE)
[1] 52.24966
> mean(tmp5,na.rm=TRUE)
[1] 73.18923
> Sum(tmp5,na.rm=TRUE)
[1] 14564.66
> Var(tmp5,na.rm=TRUE)
[1] 864.375
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 86.89177 72.90897 67.13919 73.47513 73.63546 73.25367 70.00694 73.76497
 [9] 71.71662 69.12191
> rowSums(tmp5,na.rm=TRUE)
 [1] 1737.835 1458.179 1342.784 1469.503 1399.074 1465.073 1400.139 1475.299
 [9] 1434.332 1382.438
> rowVars(tmp5,na.rm=TRUE)
 [1] 8238.36618   46.87150   55.37921   46.06078   47.10370   55.36902
 [7]   38.73011   58.79547   80.34537   75.90652
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.765446  6.846276  7.441721  6.786809  6.863214  7.441036  6.223352
 [8]  7.667820  8.963558  8.712435
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.37926  83.10843  81.61502  82.74823  85.16877  84.52577  84.12462
 [8]  87.98395  85.63825  81.36823
> rowMin(tmp5,na.rm=TRUE)
 [1] 52.24966 60.23839 53.31851 59.07214 63.07937 57.02811 58.83207 61.07663
 [9] 54.76266 55.01603
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.52595  69.70236  69.55019  68.77290  68.88871  71.09743  72.87633
 [8]  73.80321  73.65258  70.05671  71.50693  70.63895  73.51437  69.85411
[15]  72.00661  71.25288  73.18283  72.87605  68.75673  70.93530
> colSums(tmp5,na.rm=TRUE)
 [1] 1105.2595  697.0236  695.5019  687.7290  688.8871  710.9743  728.7633
 [8]  738.0321  736.5258  700.5671  715.0693  706.3895  735.1437  628.6870
[15]  720.0661  712.5288  731.8283  728.7605  687.5673  709.3530
> colVars(tmp5,na.rm=TRUE)
 [1] 16058.99163    54.20005   120.33511    82.57215    67.75073    86.66954
 [7]    24.86061    90.98591    57.44705    35.18453    67.32797    23.17849
[13]    73.12204    53.93473    60.70293    61.07909    64.46535    98.08516
[19]    97.55413    52.98296
> colSd(tmp5,na.rm=TRUE)
 [1] 126.724077   7.362068  10.969736   9.086922   8.231083   9.309648
 [7]   4.986042   9.538653   7.579383   5.931655   8.205362   4.814405
[13]   8.551142   7.344027   7.791208   7.815311   8.029031   9.903795
[19]   9.876949   7.278940
> colMax(tmp5,na.rm=TRUE)
 [1] 470.37926  82.91893  84.28378  81.39256  82.39040  84.96853  79.93147
 [8]  85.16226  85.16877  81.16894  81.61502  78.04484  84.52577  80.42241
[15]  87.98395  84.73823  87.21393  85.63825  82.19474  81.91091
> colMin(tmp5,na.rm=TRUE)
 [1] 53.31851 59.43849 52.24966 56.66904 54.76266 59.07214 66.15697 58.62608
 [9] 60.43045 61.78363 58.95016 63.78512 63.75532 57.75302 63.06668 59.14362
[17] 55.01603 54.46010 53.22903 58.01656
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 86.89177 72.90897 67.13919 73.47513      NaN 73.25367 70.00694 73.76497
 [9] 71.71662 69.12191
> rowSums(tmp5,na.rm=TRUE)
 [1] 1737.835 1458.179 1342.784 1469.503    0.000 1465.073 1400.139 1475.299
 [9] 1434.332 1382.438
> rowVars(tmp5,na.rm=TRUE)
 [1] 8238.36618   46.87150   55.37921   46.06078         NA   55.36902
 [7]   38.73011   58.79547   80.34537   75.90652
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.765446  6.846276  7.441721  6.786809        NA  7.441036  6.223352
 [8]  7.667820  8.963558  8.712435
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.37926  83.10843  81.61502  82.74823        NA  84.52577  84.12462
 [8]  87.98395  85.63825  81.36823
> rowMin(tmp5,na.rm=TRUE)
 [1] 52.24966 60.23839 53.31851 59.07214       NA 57.02811 58.83207 61.07663
 [9] 54.76266 55.01603
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.09477  69.09667  70.24335  68.73717  68.45717  69.55619  73.20393
 [8]  74.99474  72.37300  69.88165  70.79335  70.27908  74.59871       NaN
[15]  72.36560  71.19019  73.57068  72.57280  67.26361  69.71579
> colSums(tmp5,na.rm=TRUE)
 [1] 1026.8529  621.8701  632.1902  618.6345  616.1145  626.0057  658.8354
 [8]  674.9527  651.3570  628.9349  637.1402  632.5117  671.3884    0.0000
[15]  651.2904  640.7117  662.1361  653.1552  605.3725  627.4421
> colVars(tmp5,na.rm=TRUE)
 [1] 17923.08026    56.84800   129.97166    92.87930    74.12449    70.77998
 [7]    26.76079    86.38684    46.20811    39.23783    70.01556    24.61887
[13]    69.03465          NA    66.84097    68.66976    70.83121   109.31129
[19]    84.66782    42.87470
> colSd(tmp5,na.rm=TRUE)
 [1] 133.877109   7.539761  11.400512   9.637391   8.609558   8.413084
 [7]   5.173083   9.294452   6.797654   6.264011   8.367530   4.961741
[13]   8.308709         NA   8.175633   8.286722   8.416128  10.455204
[19]   9.201512   6.547878
> colMax(tmp5,na.rm=TRUE)
 [1] 470.37926  82.91893  84.28378  81.39256  82.39040  82.74581  79.93147
 [8]  85.16226  82.74823  81.16894  81.61502  78.04484  84.52577      -Inf
[15]  87.98395  84.73823  87.21393  85.63825  81.36823  81.62904
> colMin(tmp5,na.rm=TRUE)
 [1] 53.31851 59.43849 52.24966 56.66904 54.76266 59.07214 66.15697 58.62608
 [9] 60.43045 61.78363 58.95016 63.78512 66.83898      Inf 63.06668 59.14362
[17] 55.01603 54.46010 53.22903 58.01656
> 
> 
> 
> 
> 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] 176.6884 213.6471 210.8850 214.5544 204.4230 122.6439 185.9767 175.7081
 [9] 134.5004 131.0195
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 176.6884 213.6471 210.8850 214.5544 204.4230 122.6439 185.9767 175.7081
 [9] 134.5004 131.0195
> 
> 
> 
> 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] -2.842171e-14  4.263256e-14 -2.842171e-14  1.421085e-14 -1.705303e-13
 [6]  0.000000e+00  5.684342e-14 -1.705303e-13  5.684342e-14 -2.842171e-14
[11] -2.842171e-14  5.684342e-14 -3.410605e-13 -1.421085e-13  1.421085e-14
[16]  0.000000e+00 -2.273737e-13 -4.263256e-14  2.273737e-13 -5.684342e-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)
+ }
1   11 
6   19 
6   8 
9   1 
3   11 
4   7 
7   11 
1   6 
6   20 
6   14 
7   17 
8   20 
6   12 
4   6 
2   12 
5   11 
6   3 
8   1 
4   14 
2   12 
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.325224
> Min(tmp)
[1] -2.565316
> mean(tmp)
[1] -0.02914097
> Sum(tmp)
[1] -2.914097
> Var(tmp)
[1] 0.9562141
> 
> rowMeans(tmp)
[1] -0.02914097
> rowSums(tmp)
[1] -2.914097
> rowVars(tmp)
[1] 0.9562141
> rowSd(tmp)
[1] 0.977862
> rowMax(tmp)
[1] 2.325224
> rowMin(tmp)
[1] -2.565316
> 
> colMeans(tmp)
  [1]  1.4541699352  1.4914947203 -1.2189079150  0.1063380335 -1.8185715333
  [6] -0.2597950967 -0.4029011139 -0.8926926521  0.0083599151  1.0854292598
 [11] -0.3881600711  0.6641545546  0.3122224127 -0.8604799718  0.0239186151
 [16]  0.2192066835 -0.8632118139 -2.5653163857 -0.6149168270  0.2705954683
 [21]  0.5475052029  1.2750898509  0.5911192314  0.7986655177  0.5202099658
 [26] -0.2666159738 -1.7806786203  0.0819753636 -1.5063085747  0.6714565911
 [31] -0.1904330309 -0.0559431939  0.0136169374  0.8746419411 -1.1003420682
 [36] -1.2467681769  1.5042333803 -0.7145552502 -2.4181332638  1.0590631038
 [41]  0.9923066752  1.4688699888 -0.2425458770 -1.1784689907 -1.6394480684
 [46] -1.2777663246  0.0001203863  0.0419465756 -0.6510042489 -0.9125070544
 [51]  0.5657268756  0.6303569241 -0.1596329475 -0.7403471284  0.9253689643
 [56]  0.1184405295 -1.2994730326 -0.5818616707  1.1788055063  0.3346169163
 [61]  1.2575908982 -0.7460221910  0.0733326000  0.3534498517  0.0223019548
 [66] -0.8865263993 -0.3117035091 -0.0193951076 -0.4378603282 -1.0969215392
 [71]  0.1198167932  1.2029848543  0.5462165179  1.5002282843 -0.8792829955
 [76]  1.2352176550  1.5541684232  0.2813462584 -1.9094642495 -1.1910572650
 [81]  2.3252236244  0.6340589120 -0.3721634767  0.1894640290 -0.0032617051
 [86] -1.8526179976  0.0791898862  1.3448043307  0.8554124489 -0.9092969251
 [91]  1.5053921932 -0.1467415276  0.4868831070  0.1713320620 -1.0665150681
 [96] -0.3070453348  0.6715369541  0.5701989676  0.0220483436  0.2373403678
> colSums(tmp)
  [1]  1.4541699352  1.4914947203 -1.2189079150  0.1063380335 -1.8185715333
  [6] -0.2597950967 -0.4029011139 -0.8926926521  0.0083599151  1.0854292598
 [11] -0.3881600711  0.6641545546  0.3122224127 -0.8604799718  0.0239186151
 [16]  0.2192066835 -0.8632118139 -2.5653163857 -0.6149168270  0.2705954683
 [21]  0.5475052029  1.2750898509  0.5911192314  0.7986655177  0.5202099658
 [26] -0.2666159738 -1.7806786203  0.0819753636 -1.5063085747  0.6714565911
 [31] -0.1904330309 -0.0559431939  0.0136169374  0.8746419411 -1.1003420682
 [36] -1.2467681769  1.5042333803 -0.7145552502 -2.4181332638  1.0590631038
 [41]  0.9923066752  1.4688699888 -0.2425458770 -1.1784689907 -1.6394480684
 [46] -1.2777663246  0.0001203863  0.0419465756 -0.6510042489 -0.9125070544
 [51]  0.5657268756  0.6303569241 -0.1596329475 -0.7403471284  0.9253689643
 [56]  0.1184405295 -1.2994730326 -0.5818616707  1.1788055063  0.3346169163
 [61]  1.2575908982 -0.7460221910  0.0733326000  0.3534498517  0.0223019548
 [66] -0.8865263993 -0.3117035091 -0.0193951076 -0.4378603282 -1.0969215392
 [71]  0.1198167932  1.2029848543  0.5462165179  1.5002282843 -0.8792829955
 [76]  1.2352176550  1.5541684232  0.2813462584 -1.9094642495 -1.1910572650
 [81]  2.3252236244  0.6340589120 -0.3721634767  0.1894640290 -0.0032617051
 [86] -1.8526179976  0.0791898862  1.3448043307  0.8554124489 -0.9092969251
 [91]  1.5053921932 -0.1467415276  0.4868831070  0.1713320620 -1.0665150681
 [96] -0.3070453348  0.6715369541  0.5701989676  0.0220483436  0.2373403678
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  1.4541699352  1.4914947203 -1.2189079150  0.1063380335 -1.8185715333
  [6] -0.2597950967 -0.4029011139 -0.8926926521  0.0083599151  1.0854292598
 [11] -0.3881600711  0.6641545546  0.3122224127 -0.8604799718  0.0239186151
 [16]  0.2192066835 -0.8632118139 -2.5653163857 -0.6149168270  0.2705954683
 [21]  0.5475052029  1.2750898509  0.5911192314  0.7986655177  0.5202099658
 [26] -0.2666159738 -1.7806786203  0.0819753636 -1.5063085747  0.6714565911
 [31] -0.1904330309 -0.0559431939  0.0136169374  0.8746419411 -1.1003420682
 [36] -1.2467681769  1.5042333803 -0.7145552502 -2.4181332638  1.0590631038
 [41]  0.9923066752  1.4688699888 -0.2425458770 -1.1784689907 -1.6394480684
 [46] -1.2777663246  0.0001203863  0.0419465756 -0.6510042489 -0.9125070544
 [51]  0.5657268756  0.6303569241 -0.1596329475 -0.7403471284  0.9253689643
 [56]  0.1184405295 -1.2994730326 -0.5818616707  1.1788055063  0.3346169163
 [61]  1.2575908982 -0.7460221910  0.0733326000  0.3534498517  0.0223019548
 [66] -0.8865263993 -0.3117035091 -0.0193951076 -0.4378603282 -1.0969215392
 [71]  0.1198167932  1.2029848543  0.5462165179  1.5002282843 -0.8792829955
 [76]  1.2352176550  1.5541684232  0.2813462584 -1.9094642495 -1.1910572650
 [81]  2.3252236244  0.6340589120 -0.3721634767  0.1894640290 -0.0032617051
 [86] -1.8526179976  0.0791898862  1.3448043307  0.8554124489 -0.9092969251
 [91]  1.5053921932 -0.1467415276  0.4868831070  0.1713320620 -1.0665150681
 [96] -0.3070453348  0.6715369541  0.5701989676  0.0220483436  0.2373403678
> colMin(tmp)
  [1]  1.4541699352  1.4914947203 -1.2189079150  0.1063380335 -1.8185715333
  [6] -0.2597950967 -0.4029011139 -0.8926926521  0.0083599151  1.0854292598
 [11] -0.3881600711  0.6641545546  0.3122224127 -0.8604799718  0.0239186151
 [16]  0.2192066835 -0.8632118139 -2.5653163857 -0.6149168270  0.2705954683
 [21]  0.5475052029  1.2750898509  0.5911192314  0.7986655177  0.5202099658
 [26] -0.2666159738 -1.7806786203  0.0819753636 -1.5063085747  0.6714565911
 [31] -0.1904330309 -0.0559431939  0.0136169374  0.8746419411 -1.1003420682
 [36] -1.2467681769  1.5042333803 -0.7145552502 -2.4181332638  1.0590631038
 [41]  0.9923066752  1.4688699888 -0.2425458770 -1.1784689907 -1.6394480684
 [46] -1.2777663246  0.0001203863  0.0419465756 -0.6510042489 -0.9125070544
 [51]  0.5657268756  0.6303569241 -0.1596329475 -0.7403471284  0.9253689643
 [56]  0.1184405295 -1.2994730326 -0.5818616707  1.1788055063  0.3346169163
 [61]  1.2575908982 -0.7460221910  0.0733326000  0.3534498517  0.0223019548
 [66] -0.8865263993 -0.3117035091 -0.0193951076 -0.4378603282 -1.0969215392
 [71]  0.1198167932  1.2029848543  0.5462165179  1.5002282843 -0.8792829955
 [76]  1.2352176550  1.5541684232  0.2813462584 -1.9094642495 -1.1910572650
 [81]  2.3252236244  0.6340589120 -0.3721634767  0.1894640290 -0.0032617051
 [86] -1.8526179976  0.0791898862  1.3448043307  0.8554124489 -0.9092969251
 [91]  1.5053921932 -0.1467415276  0.4868831070  0.1713320620 -1.0665150681
 [96] -0.3070453348  0.6715369541  0.5701989676  0.0220483436  0.2373403678
> colMedians(tmp)
  [1]  1.4541699352  1.4914947203 -1.2189079150  0.1063380335 -1.8185715333
  [6] -0.2597950967 -0.4029011139 -0.8926926521  0.0083599151  1.0854292598
 [11] -0.3881600711  0.6641545546  0.3122224127 -0.8604799718  0.0239186151
 [16]  0.2192066835 -0.8632118139 -2.5653163857 -0.6149168270  0.2705954683
 [21]  0.5475052029  1.2750898509  0.5911192314  0.7986655177  0.5202099658
 [26] -0.2666159738 -1.7806786203  0.0819753636 -1.5063085747  0.6714565911
 [31] -0.1904330309 -0.0559431939  0.0136169374  0.8746419411 -1.1003420682
 [36] -1.2467681769  1.5042333803 -0.7145552502 -2.4181332638  1.0590631038
 [41]  0.9923066752  1.4688699888 -0.2425458770 -1.1784689907 -1.6394480684
 [46] -1.2777663246  0.0001203863  0.0419465756 -0.6510042489 -0.9125070544
 [51]  0.5657268756  0.6303569241 -0.1596329475 -0.7403471284  0.9253689643
 [56]  0.1184405295 -1.2994730326 -0.5818616707  1.1788055063  0.3346169163
 [61]  1.2575908982 -0.7460221910  0.0733326000  0.3534498517  0.0223019548
 [66] -0.8865263993 -0.3117035091 -0.0193951076 -0.4378603282 -1.0969215392
 [71]  0.1198167932  1.2029848543  0.5462165179  1.5002282843 -0.8792829955
 [76]  1.2352176550  1.5541684232  0.2813462584 -1.9094642495 -1.1910572650
 [81]  2.3252236244  0.6340589120 -0.3721634767  0.1894640290 -0.0032617051
 [86] -1.8526179976  0.0791898862  1.3448043307  0.8554124489 -0.9092969251
 [91]  1.5053921932 -0.1467415276  0.4868831070  0.1713320620 -1.0665150681
 [96] -0.3070453348  0.6715369541  0.5701989676  0.0220483436  0.2373403678
> colRanges(tmp)
        [,1]     [,2]      [,3]     [,4]      [,5]       [,6]       [,7]
[1,] 1.45417 1.491495 -1.218908 0.106338 -1.818572 -0.2597951 -0.4029011
[2,] 1.45417 1.491495 -1.218908 0.106338 -1.818572 -0.2597951 -0.4029011
           [,8]        [,9]    [,10]      [,11]     [,12]     [,13]    [,14]
[1,] -0.8926927 0.008359915 1.085429 -0.3881601 0.6641546 0.3122224 -0.86048
[2,] -0.8926927 0.008359915 1.085429 -0.3881601 0.6641546 0.3122224 -0.86048
          [,15]     [,16]      [,17]     [,18]      [,19]     [,20]     [,21]
[1,] 0.02391862 0.2192067 -0.8632118 -2.565316 -0.6149168 0.2705955 0.5475052
[2,] 0.02391862 0.2192067 -0.8632118 -2.565316 -0.6149168 0.2705955 0.5475052
       [,22]     [,23]     [,24]   [,25]     [,26]     [,27]      [,28]
[1,] 1.27509 0.5911192 0.7986655 0.52021 -0.266616 -1.780679 0.08197536
[2,] 1.27509 0.5911192 0.7986655 0.52021 -0.266616 -1.780679 0.08197536
         [,29]     [,30]     [,31]       [,32]      [,33]     [,34]     [,35]
[1,] -1.506309 0.6714566 -0.190433 -0.05594319 0.01361694 0.8746419 -1.100342
[2,] -1.506309 0.6714566 -0.190433 -0.05594319 0.01361694 0.8746419 -1.100342
         [,36]    [,37]      [,38]     [,39]    [,40]     [,41]   [,42]
[1,] -1.246768 1.504233 -0.7145553 -2.418133 1.059063 0.9923067 1.46887
[2,] -1.246768 1.504233 -0.7145553 -2.418133 1.059063 0.9923067 1.46887
          [,43]     [,44]     [,45]     [,46]        [,47]      [,48]
[1,] -0.2425459 -1.178469 -1.639448 -1.277766 0.0001203863 0.04194658
[2,] -0.2425459 -1.178469 -1.639448 -1.277766 0.0001203863 0.04194658
          [,49]      [,50]     [,51]     [,52]      [,53]      [,54]    [,55]
[1,] -0.6510042 -0.9125071 0.5657269 0.6303569 -0.1596329 -0.7403471 0.925369
[2,] -0.6510042 -0.9125071 0.5657269 0.6303569 -0.1596329 -0.7403471 0.925369
         [,56]     [,57]      [,58]    [,59]     [,60]    [,61]      [,62]
[1,] 0.1184405 -1.299473 -0.5818617 1.178806 0.3346169 1.257591 -0.7460222
[2,] 0.1184405 -1.299473 -0.5818617 1.178806 0.3346169 1.257591 -0.7460222
         [,63]     [,64]      [,65]      [,66]      [,67]       [,68]
[1,] 0.0733326 0.3534499 0.02230195 -0.8865264 -0.3117035 -0.01939511
[2,] 0.0733326 0.3534499 0.02230195 -0.8865264 -0.3117035 -0.01939511
          [,69]     [,70]     [,71]    [,72]     [,73]    [,74]     [,75]
[1,] -0.4378603 -1.096922 0.1198168 1.202985 0.5462165 1.500228 -0.879283
[2,] -0.4378603 -1.096922 0.1198168 1.202985 0.5462165 1.500228 -0.879283
        [,76]    [,77]     [,78]     [,79]     [,80]    [,81]     [,82]
[1,] 1.235218 1.554168 0.2813463 -1.909464 -1.191057 2.325224 0.6340589
[2,] 1.235218 1.554168 0.2813463 -1.909464 -1.191057 2.325224 0.6340589
          [,83]    [,84]        [,85]     [,86]      [,87]    [,88]     [,89]
[1,] -0.3721635 0.189464 -0.003261705 -1.852618 0.07918989 1.344804 0.8554124
[2,] -0.3721635 0.189464 -0.003261705 -1.852618 0.07918989 1.344804 0.8554124
          [,90]    [,91]      [,92]     [,93]     [,94]     [,95]      [,96]
[1,] -0.9092969 1.505392 -0.1467415 0.4868831 0.1713321 -1.066515 -0.3070453
[2,] -0.9092969 1.505392 -0.1467415 0.4868831 0.1713321 -1.066515 -0.3070453
        [,97]    [,98]      [,99]    [,100]
[1,] 0.671537 0.570199 0.02204834 0.2373404
[2,] 0.671537 0.570199 0.02204834 0.2373404
> 
> 
> Max(tmp2)
[1] 2.349114
> Min(tmp2)
[1] -2.496334
> mean(tmp2)
[1] 0.0855046
> Sum(tmp2)
[1] 8.55046
> Var(tmp2)
[1] 1.056615
> 
> rowMeans(tmp2)
  [1] -0.42859357  0.38460762  0.41506400 -1.09746032  0.79175558 -1.08221771
  [7] -1.67468339  0.94200363  0.24352548 -0.71690521  1.02128842 -0.42782943
 [13]  1.33608283 -0.54216488 -0.05762457 -1.59486038 -0.24410381 -0.56945117
 [19] -1.72086464 -0.54930586  0.64590756  0.37474711  0.42929465 -2.21317095
 [25] -0.65226492 -1.42898394 -0.04830438 -1.38314044  0.33936602 -1.67606279
 [31]  0.10162258 -0.76130224  1.02428268 -0.68076759  2.34911366 -0.06844029
 [37]  1.08704799  0.34161602  0.97925992  0.77928629  2.17268049  1.14899215
 [43]  0.33350709  1.90125034 -0.64216414 -0.69678674 -0.01989826  0.60614654
 [49]  1.75515336 -0.28015916  0.79465149  0.85694183  0.42991796 -0.73015381
 [55] -2.15269243  0.55108463  0.36512390  1.21970955  0.16494676 -1.03311704
 [61]  1.84897712 -1.28993090  1.25751713 -0.54219357 -0.09380818 -1.34535449
 [67]  0.48847449 -0.60715518  0.40626332 -0.28179710  0.16144166 -0.22921122
 [73]  0.24674651  0.53214913  1.00249397  1.98392307 -1.43998029  0.02996704
 [79] -0.88619488  0.90544429 -0.68984340  1.26206287 -0.49463170  0.64166213
 [85]  0.63275539  0.37567906  0.31371993  1.36686936 -0.24247727  0.31746381
 [91] -0.24601949  0.89269738  1.07271680 -0.27681794  1.12407707  2.21873786
 [97] -2.49633408 -0.73752380 -0.50095660  1.15634689
> rowSums(tmp2)
  [1] -0.42859357  0.38460762  0.41506400 -1.09746032  0.79175558 -1.08221771
  [7] -1.67468339  0.94200363  0.24352548 -0.71690521  1.02128842 -0.42782943
 [13]  1.33608283 -0.54216488 -0.05762457 -1.59486038 -0.24410381 -0.56945117
 [19] -1.72086464 -0.54930586  0.64590756  0.37474711  0.42929465 -2.21317095
 [25] -0.65226492 -1.42898394 -0.04830438 -1.38314044  0.33936602 -1.67606279
 [31]  0.10162258 -0.76130224  1.02428268 -0.68076759  2.34911366 -0.06844029
 [37]  1.08704799  0.34161602  0.97925992  0.77928629  2.17268049  1.14899215
 [43]  0.33350709  1.90125034 -0.64216414 -0.69678674 -0.01989826  0.60614654
 [49]  1.75515336 -0.28015916  0.79465149  0.85694183  0.42991796 -0.73015381
 [55] -2.15269243  0.55108463  0.36512390  1.21970955  0.16494676 -1.03311704
 [61]  1.84897712 -1.28993090  1.25751713 -0.54219357 -0.09380818 -1.34535449
 [67]  0.48847449 -0.60715518  0.40626332 -0.28179710  0.16144166 -0.22921122
 [73]  0.24674651  0.53214913  1.00249397  1.98392307 -1.43998029  0.02996704
 [79] -0.88619488  0.90544429 -0.68984340  1.26206287 -0.49463170  0.64166213
 [85]  0.63275539  0.37567906  0.31371993  1.36686936 -0.24247727  0.31746381
 [91] -0.24601949  0.89269738  1.07271680 -0.27681794  1.12407707  2.21873786
 [97] -2.49633408 -0.73752380 -0.50095660  1.15634689
> 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.42859357  0.38460762  0.41506400 -1.09746032  0.79175558 -1.08221771
  [7] -1.67468339  0.94200363  0.24352548 -0.71690521  1.02128842 -0.42782943
 [13]  1.33608283 -0.54216488 -0.05762457 -1.59486038 -0.24410381 -0.56945117
 [19] -1.72086464 -0.54930586  0.64590756  0.37474711  0.42929465 -2.21317095
 [25] -0.65226492 -1.42898394 -0.04830438 -1.38314044  0.33936602 -1.67606279
 [31]  0.10162258 -0.76130224  1.02428268 -0.68076759  2.34911366 -0.06844029
 [37]  1.08704799  0.34161602  0.97925992  0.77928629  2.17268049  1.14899215
 [43]  0.33350709  1.90125034 -0.64216414 -0.69678674 -0.01989826  0.60614654
 [49]  1.75515336 -0.28015916  0.79465149  0.85694183  0.42991796 -0.73015381
 [55] -2.15269243  0.55108463  0.36512390  1.21970955  0.16494676 -1.03311704
 [61]  1.84897712 -1.28993090  1.25751713 -0.54219357 -0.09380818 -1.34535449
 [67]  0.48847449 -0.60715518  0.40626332 -0.28179710  0.16144166 -0.22921122
 [73]  0.24674651  0.53214913  1.00249397  1.98392307 -1.43998029  0.02996704
 [79] -0.88619488  0.90544429 -0.68984340  1.26206287 -0.49463170  0.64166213
 [85]  0.63275539  0.37567906  0.31371993  1.36686936 -0.24247727  0.31746381
 [91] -0.24601949  0.89269738  1.07271680 -0.27681794  1.12407707  2.21873786
 [97] -2.49633408 -0.73752380 -0.50095660  1.15634689
> rowMin(tmp2)
  [1] -0.42859357  0.38460762  0.41506400 -1.09746032  0.79175558 -1.08221771
  [7] -1.67468339  0.94200363  0.24352548 -0.71690521  1.02128842 -0.42782943
 [13]  1.33608283 -0.54216488 -0.05762457 -1.59486038 -0.24410381 -0.56945117
 [19] -1.72086464 -0.54930586  0.64590756  0.37474711  0.42929465 -2.21317095
 [25] -0.65226492 -1.42898394 -0.04830438 -1.38314044  0.33936602 -1.67606279
 [31]  0.10162258 -0.76130224  1.02428268 -0.68076759  2.34911366 -0.06844029
 [37]  1.08704799  0.34161602  0.97925992  0.77928629  2.17268049  1.14899215
 [43]  0.33350709  1.90125034 -0.64216414 -0.69678674 -0.01989826  0.60614654
 [49]  1.75515336 -0.28015916  0.79465149  0.85694183  0.42991796 -0.73015381
 [55] -2.15269243  0.55108463  0.36512390  1.21970955  0.16494676 -1.03311704
 [61]  1.84897712 -1.28993090  1.25751713 -0.54219357 -0.09380818 -1.34535449
 [67]  0.48847449 -0.60715518  0.40626332 -0.28179710  0.16144166 -0.22921122
 [73]  0.24674651  0.53214913  1.00249397  1.98392307 -1.43998029  0.02996704
 [79] -0.88619488  0.90544429 -0.68984340  1.26206287 -0.49463170  0.64166213
 [85]  0.63275539  0.37567906  0.31371993  1.36686936 -0.24247727  0.31746381
 [91] -0.24601949  0.89269738  1.07271680 -0.27681794  1.12407707  2.21873786
 [97] -2.49633408 -0.73752380 -0.50095660  1.15634689
> 
> colMeans(tmp2)
[1] 0.0855046
> colSums(tmp2)
[1] 8.55046
> colVars(tmp2)
[1] 1.056615
> colSd(tmp2)
[1] 1.027918
> colMax(tmp2)
[1] 2.349114
> colMin(tmp2)
[1] -2.496334
> colMedians(tmp2)
[1] 0.2042361
> colRanges(tmp2)
          [,1]
[1,] -2.496334
[2,]  2.349114
> 
> 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] -3.2212358 -1.3069340  0.9214186 -3.5610260  4.3074672  1.0793504
 [7]  4.4448464 -3.9905927  1.6581142 -1.3920900
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.0160251
[2,] -0.7243142
[3,] -0.4730149
[4,]  0.3212154
[5,]  1.4456752
> 
> rowApply(tmp,sum)
 [1]  0.30116207 -0.08278765 -4.35347099  1.49594635 -4.28830897  4.33596806
 [7]  1.75624519  0.37371449  1.31183572 -1.91098597
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    2    8    1    9    5    1    9    2    6     5
 [2,]    8    5    7    5    7    7    5    1    5     1
 [3,]    3    7    8    1    9    5    8    3    4     8
 [4,]    4    1    3    4    8    3    3    8    8     4
 [5,]    5    2    5    7   10   10    4    7   10     6
 [6,]    9    3    6   10    2    2    7    9    3    10
 [7,]    6    9   10    6    3    6    2   10    9     9
 [8,]    7    4    2    8    1    8    1    6    7     2
 [9,]   10    6    9    2    6    9    6    5    2     3
[10,]    1   10    4    3    4    4   10    4    1     7
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  4.15956533  3.81036125  4.65120364 -1.65329077 -0.68859709 -2.88770587
 [7] -0.96261651  1.79896021  1.61809877 -1.14513128 -2.01415138  2.42706925
[13] -0.96822803  1.31534467 -0.68136663 -0.01702816  2.91471622 -1.16034694
[19]  1.65884762  1.83587262
> colApply(tmp,quantile)[,1]
          [,1]
[1,] -1.251958
[2,]  1.051606
[3,]  1.141681
[4,]  1.313095
[5,]  1.905141
> 
> rowApply(tmp,sum)
[1] -1.4430877  5.2696808  0.6843615  8.1999748  1.3006477
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   20   18    3   19   18
[2,]   19   19   20    5    3
[3,]   18   12   18    9   17
[4,]   10    2    5    7   10
[5,]   16   14   13    6    1
> 
> 
> as.matrix(tmp)
          [,1]       [,2]       [,3]        [,4]       [,5]       [,6]
[1,]  1.905141  1.8975230 1.89051691 -0.22921207  0.5373358 -1.6020734
[2,]  1.051606  1.4170664 0.70733505 -1.00353786  0.8368433  1.5322354
[3,] -1.251958  2.3895053 0.84761226 -0.55313146  0.3550802 -0.5433679
[4,]  1.141681 -0.4009686 0.09089185  0.00145487 -0.1085418 -1.4692893
[5,]  1.313095 -1.4927647 1.11484758  0.13113575 -2.3093147 -0.8052107
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -0.3059224 -1.2418636 -0.3788175 -1.1032973 -2.3941275  0.1896369
[2,] -0.2920942  0.4147148  0.9007030 -0.7897903 -0.1490959 -0.3194832
[3,] -0.7325574  0.0105404  0.5990916  0.5490753  0.2155097  1.5678799
[4,]  1.0983709  1.1360399  1.0123014  2.0614461 -0.4987975 -0.4842540
[5,] -0.7304134  1.4795288 -0.5151798 -1.8625651  0.8123597  1.4732897
           [,13]      [,14]        [,15]      [,16]      [,17]      [,18]
[1,] -0.76680659 0.17874442  0.186959932  0.1256100  0.1002731  0.7568232
[2,]  0.32029952 0.05099819  0.002198126  0.7662940  0.8562494 -1.9334336
[3,] -1.54827754 0.52793295 -0.012689184 -1.5601295 -0.1123137 -0.3704628
[4,]  0.99339618 0.05750565 -0.636675265  0.4380616  1.0908552  0.8177796
[5,]  0.03316041 0.50016346 -0.221160235  0.2131358  0.9796523 -0.4310534
           [,19]      [,20]
[1,] -0.39579272 -0.7937391
[2,] -0.04647098  0.9470431
[3,] -0.07292729  0.3799489
[4,]  1.10494588  0.7537709
[5,]  1.06909273  0.5488489
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  637  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  552  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.8  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
         col1       col2      col3      col4       col5      col6     col7
row1 1.315015 -0.9807812 -1.046447 0.5553293 -0.3168411 0.7933034 1.300903
        col8       col9      col10    col11      col12     col13     col14
row1 1.25729 0.02574499 -0.7380887 1.809178 -0.2497582 0.3379987 -3.245631
         col15     col16       col17     col18     col19      col20
row1 -2.367348 0.1953975 -0.02156328 0.6975018 0.4987587 0.04520757
> tmp[,"col10"]
          col10
row1 -0.7380887
row2  0.8504904
row3 -1.5776141
row4 -0.9226608
row5 -0.6036448
> tmp[c("row1","row5"),]
         col1       col2      col3       col4       col5       col6        col7
row1 1.315015 -0.9807812 -1.046447  0.5553293 -0.3168411  0.7933034  1.30090348
row5 2.193225  0.5085676  1.195032 -0.9618516  1.4659494 -1.1921995 -0.01473277
          col8        col9      col10     col11      col12      col13
row1 1.2572902  0.02574499 -0.7380887  1.809178 -0.2497582  0.3379987
row5 0.9130997 -0.37582102 -0.6036448 -0.864833 -0.5919764 -1.2973473
          col14     col15      col16       col17     col18     col19
row1 -3.2456305 -2.367348  0.1953975 -0.02156328 0.6975018 0.4987587
row5 -0.5925086  1.269812 -0.2759846  0.71042384 0.5133483 0.7963685
           col20
row1  0.04520757
row5 -0.04452835
> tmp[,c("col6","col20")]
            col6       col20
row1  0.79330342  0.04520757
row2  0.06727398  0.92545049
row3  0.45360562  0.31455163
row4  1.03735798 -2.78817609
row5 -1.19219947 -0.04452835
> tmp[c("row1","row5"),c("col6","col20")]
           col6       col20
row1  0.7933034  0.04520757
row5 -1.1921995 -0.04452835
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4    col5     col6     col7     col8
row1 50.08586 48.73599 48.34086 49.75772 49.7365 104.0649 49.23485 49.11996
        col9   col10    col11    col12    col13    col14    col15    col16
row1 49.5135 50.9809 52.05665 48.25022 49.78014 51.72992 49.50406 47.60308
        col17    col18   col19   col20
row1 49.55177 50.46352 50.0389 105.327
> tmp[,"col10"]
        col10
row1 50.98090
row2 29.93265
row3 31.41351
row4 31.19344
row5 48.60368
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.08586 48.73599 48.34086 49.75772 49.73650 104.0649 49.23485 49.11996
row5 49.65443 50.42164 48.33521 50.16878 48.22609 105.2721 49.25379 50.47910
        col9    col10    col11    col12    col13    col14    col15    col16
row1 49.5135 50.98090 52.05665 48.25022 49.78014 51.72992 49.50406 47.60308
row5 51.4808 48.60368 49.39180 49.09865 50.69874 49.23037 50.46720 50.25374
        col17    col18   col19    col20
row1 49.55177 50.46352 50.0389 105.3270
row5 50.50646 49.00885 48.1275 107.8308
> tmp[,c("col6","col20")]
          col6     col20
row1 104.06491 105.32700
row2  75.62691  75.68051
row3  73.19335  75.13282
row4  74.97031  75.99445
row5 105.27212 107.83079
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.0649 105.3270
row5 105.2721 107.8308
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.0649 105.3270
row5 105.2721 107.8308
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -0.08002192
[2,]  1.30762706
[3,]  1.34707267
[4,]  1.52954351
[5,] -2.50842376
> tmp[,c("col17","col7")]
            col17       col7
[1,] -0.224283506  2.2117818
[2,] -0.007050453 -0.9763102
[3,] -0.970304246 -0.1882333
[4,] -0.715277098 -0.4393956
[5,]  0.688002868 -3.2225284
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -0.03095729 -0.9506363
[2,] -0.34624913  2.0989136
[3,]  0.25806031 -0.9797887
[4,]  0.21629169 -0.8680871
[5,] -0.49560770 -1.3911386
> subBufferedMatrix(tmp,1,c("col6"))[,1]
            col1
[1,] -0.03095729
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] -0.03095729
[2,] -0.34624913
> 
> 
> 
> 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 -1.0243708 -0.2625913  0.6163396 0.7623131 0.864299002 0.3381418
row1 -0.9223113 -2.0775676 -1.0622063 1.1722158 0.006804707 0.1177109
           [,7]        [,8]       [,9]     [,10]      [,11]    [,12]     [,13]
row3  0.1884464  0.98933536 -0.7412271 -2.637104 -0.3118599 1.839552 0.4623494
row1 -0.2171269 -0.08328488 -0.8790772 -1.010026 -0.4972213 1.605077 0.2417521
         [,14]      [,15]      [,16]       [,17]     [,18]      [,19]
row3 0.3679714 -0.2469195  0.4943146  0.12245331 -1.006512 -2.1278567
row1 1.2564628  0.9872492 -0.2517833 -0.05538798  1.620078 -0.2546317
          [,20]
row3  0.2615006
row1 -1.0418993
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]      [,2]      [,3]      [,4]      [,5]       [,6]     [,7]
row2 1.019855 0.8762093 0.3293389 -0.672569 0.3495172 -0.8512311 1.157007
          [,8]       [,9]      [,10]
row2 0.5570218 -0.6965661 -0.2308174
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]     [,3]        [,4]       [,5]       [,6]       [,7]
row5 0.4240216 0.4208928 1.049798 -0.03064316 -0.1089611 -0.6221041 -0.5109272
          [,8]      [,9]     [,10]      [,11]      [,12]      [,13]     [,14]
row5 0.9047699 0.8397531 0.1674296 -0.2192856 -0.9790948 -0.4176104 -1.033407
         [,15]     [,16]     [,17]     [,18]      [,19]     [,20]
row5 -1.659565 0.4337059 0.7837768 -1.365327 0.05801474 0.8034271
> 
> 
> 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: 0x1f8eb70>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c6df83649"
 [2] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c6159a09a"
 [3] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c711bbfb6"
 [4] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c7b94f9d6"
 [5] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c55217edc"
 [6] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c371bc932"
 [7] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c20037814"
 [8] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c40a85c9e"
 [9] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c47866eb2"
[10] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c3361f560"
[11] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c70257c68"
[12] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c44ed7b37"
[13] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c61f332d5"
[14] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c788b10dd"
[15] "/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a2c44bddcb2"
> 
> 
> ### 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: 0x1c68db0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x1c68db0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.8-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x1c68db0>
> rowMedians(tmp)
  [1]  0.229163614 -0.613371180 -0.020860477 -0.100809523 -0.275885267
  [6]  0.074400615  0.100525539  0.057292074 -0.161156338 -0.121208206
 [11]  0.309142359 -0.023959132  0.419992724 -0.361330873 -0.353537503
 [16] -0.074511328  0.326294860 -0.821307618  0.690436455  0.002487876
 [21]  0.333073986  0.320355714  0.239528264 -0.225760757  0.203084790
 [26]  0.139728074 -0.354629082 -0.191466452 -0.468718402  0.222246508
 [31]  0.032319193  0.194814860 -0.056276822  0.266648159  0.039523670
 [36]  0.232005959 -0.054358718  0.048341124 -0.113182479  0.199390986
 [41] -0.195793760 -0.216174592 -0.059055345  0.207979094 -0.160211143
 [46]  0.162832380 -0.195933945 -0.386277096 -0.069946176 -0.131331314
 [51]  0.271544280 -0.422154381  0.348418328 -0.031030821 -0.233484874
 [56] -0.245578591  0.576023081  0.690019760 -0.287791156  0.247630817
 [61]  0.141617051  0.431241580 -0.303759133 -0.459464188 -0.150697868
 [66] -0.106667363 -0.121070560 -0.221446257  0.190986993 -0.349019363
 [71]  0.089754610  0.700804201  0.089490353  0.225896275 -0.343972258
 [76] -0.030900743 -0.480707201  0.316058726 -0.053575397  0.300430657
 [81] -0.273073844 -0.008118840 -0.416675604 -0.018744360 -0.416197096
 [86] -0.054261422  0.077510515  0.401593034  0.046451032  0.055433622
 [91] -0.405061272 -0.734287101 -0.178875937 -0.458653356  0.520934586
 [96] -0.204990651  0.129570930 -0.023848249 -0.064097503 -0.183364431
[101]  0.014429275  0.212531132  0.258323893  0.001124651 -0.196849843
[106] -0.272256442  0.157636102 -0.083235000  0.401231501 -0.181163439
[111]  0.414017690 -0.249651021  0.231429515  0.065534568  0.106955643
[116] -0.277503705 -0.449486911 -0.171383633  0.274298805  0.393199354
[121]  0.095859846  0.206538704  0.201483559 -0.071206826  0.547497835
[126]  0.222087467 -0.246188596  0.340481755 -0.343755852  0.378733192
[131] -0.045352665  0.132692283  0.282987546 -0.123540719 -0.159672811
[136]  0.182610584 -0.217175828 -0.446459863 -0.354460913  0.239493419
[141] -0.632116019  0.255272247  0.180870304 -0.205686590 -0.194444435
[146] -0.054265304 -0.062953458  0.177272681  0.241432696  0.141628578
[151] -0.500412076  0.015538493 -0.158306969  0.131816456 -0.035366039
[156] -0.113849993  0.025629135  0.240290206 -0.275422980  0.131520391
[161] -0.430072729  0.251361088 -0.470685559  0.122755561  0.964258150
[166]  0.009326528 -0.428409980 -0.467191541  0.071594386 -0.420040122
[171] -0.108262729  0.007108700  0.305286263  0.500333434  0.503004699
[176] -0.025174701  0.097843091 -0.081895402  0.052108099 -0.056001931
[181] -0.156170346 -0.388109725 -0.075389606  0.204984104 -0.045025614
[186]  0.133046554 -0.487487064  0.424457453  0.175657281 -0.211171499
[191] -0.391793328  0.250046889  0.500490097  0.304773580 -0.524111799
[196] -0.264554272  0.020308271 -0.310035062  0.168130707 -0.163724431
[201] -0.196672894  0.540226123  0.509913677  0.203165894 -0.093936064
[206] -0.226202533  0.300699261  0.080659000 -0.525148221  0.001208246
[211]  0.088548115  0.156010319  0.038597953  0.243923617  0.118248419
[216]  0.267639297  0.003712841  0.343584204 -0.751468492 -0.372271891
[221]  0.085729327 -0.364400100 -0.513873010 -0.015775901  0.058438592
[226] -0.697152074 -0.093274255  0.320816753  0.296516464 -0.092028161
> 
> proc.time()
   user  system elapsed 
  1.992   0.844   2.863 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x3b76370>
> .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: 0x3b76370>
> .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: 0x3b76370>
> .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: 0x3b76370>
> 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: 0x2f6fb10>
> .Call("R_bm_AddColumn",P)
<pointer: 0x2f6fb10>
> .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: 0x2f6fb10>
> .Call("R_bm_AddColumn",P)
<pointer: 0x2f6fb10>
> .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: 0x2f6fb10>
> 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: 0x3442200>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3442200>
> .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: 0x3442200>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x3442200>
> .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: 0x3442200>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x3442200>
> .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: 0x3442200>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x3442200>
> .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: 0x3442200>
> 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: 0x2f7f890>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x2f7f890>
> .Call("R_bm_AddColumn",P)
<pointer: 0x2f7f890>
> .Call("R_bm_AddColumn",P)
<pointer: 0x2f7f890>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1bf63f618aba" "BufferedMatrixFile1bf64b0a4038"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1bf63f618aba" "BufferedMatrixFile1bf64b0a4038"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x44c34d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x44c34d0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x44c34d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x44c34d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x44c34d0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x44c34d0>
> .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: 0x36346c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x36346c0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x36346c0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x36346c0>
> 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: 0x3064f40>
> .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: 0x3064f40>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.312   0.048   0.354 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.352   0.032   0.378 

Example timings