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

This page was generated on 2021-10-15 15:05:36 -0400 (Fri, 15 Oct 2021).

CHECK results for BufferedMatrix on nebbiolo1

To the developers/maintainers of the BufferedMatrix package:
- Please allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to
reflect on this report. See How and When does the builder pull? When will my changes propagate? here for more information.
- Make sure to use the following settings in order to reproduce any error or warning you see on this page.

raw results

Package 220/2041HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.56.0  (landing page)
Ben Bolstad
Snapshot Date: 2021-10-14 04:50:12 -0400 (Thu, 14 Oct 2021)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_13
git_last_commit: 64ce6a6
git_last_commit_date: 2021-05-19 11:38:39 -0400 (Wed, 19 May 2021)
nebbiolo1Linux (Ubuntu 20.04.2 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
tokay2Windows Server 2012 R2 Standard / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
machv2macOS 10.14.6 Mojave / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published

Summary

Package: BufferedMatrix
Version: 1.56.0
Command: /home/biocbuild/bbs-3.13-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.13-bioc/R/library --no-vignettes --timings BufferedMatrix_1.56.0.tar.gz
StartedAt: 2021-10-14 09:06:27 -0400 (Thu, 14 Oct 2021)
EndedAt: 2021-10-14 09:06:48 -0400 (Thu, 14 Oct 2021)
EllapsedTime: 21.2 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.1.1 (2021-08-10)
* 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.56.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.13-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 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.301   0.049   0.335 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 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.13-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 440595 23.6     931294 49.8   655097 35.0
Vcells 793405  6.1    8388608 64.0  2013076 15.4
> 
> 
> 
> 
> ##
> ## 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 Oct 14 09:06:43 2021"
> 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 Oct 14 09:06:43 2021"
> 
> 
> 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: 0x55d103cb7e40>
> 
> 
> 
> 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 Oct 14 09:06:43 2021"
> 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 Oct 14 09:06:43 2021"
> 
> ColMode(tmp2)
<pointer: 0x55d103cb7e40>
> 
> 
> 
> ### 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,] 99.43739012 -0.9044897  0.7601256  0.4686092
[2,]  2.43657911  0.1635811  0.3447145 -0.3715492
[3,]  0.61521453 -0.6123723  0.8329995  0.7072454
[4,] -0.03330469 -1.7402938 -0.1635472 -0.5268385
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 99.43739012 0.9044897 0.7601256 0.4686092
[2,]  2.43657911 0.1635811 0.3447145 0.3715492
[3,]  0.61521453 0.6123723 0.8329995 0.7072454
[4,]  0.03330469 1.7402938 0.1635472 0.5268385
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9718298 0.9510467 0.8718518 0.6845504
[2,] 1.5609546 0.4044516 0.5871239 0.6095484
[3,] 0.7843561 0.7825422 0.9126881 0.8409788
[4,] 0.1824957 1.3192019 0.4044097 0.7258364
> 
> 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.13-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.15569 35.41496 34.47864 32.31411
[2,]  43.04612 29.20810 31.21595 31.46703
[3,]  33.45878 33.43779 34.95988 34.11703
[4,]  26.85826 39.93231 29.20764 32.78520
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x55d103ae26c0>
> exp(tmp5)
<pointer: 0x55d103ae26c0>
> log(tmp5,2)
<pointer: 0x55d103ae26c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.5507
> Min(tmp5)
[1] 53.20633
> mean(tmp5)
[1] 72.51536
> Sum(tmp5)
[1] 14503.07
> Var(tmp5)
[1] 852.1671
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 88.36519 70.04716 72.47162 68.82515 70.08721 74.10720 71.49521 69.72570
 [9] 70.58348 69.44564
> rowSums(tmp5)
 [1] 1767.304 1400.943 1449.432 1376.503 1401.744 1482.144 1429.904 1394.514
 [9] 1411.670 1388.913
> rowVars(tmp5)
 [1] 7941.53776   66.31001  120.22386   91.71570   97.90684   67.27634
 [7]   52.60509   63.26214   42.20003   65.09449
> rowSd(tmp5)
 [1] 89.115306  8.143096 10.964664  9.576832  9.894788  8.202215  7.252937
 [8]  7.953750  6.496155  8.068116
> rowMax(tmp5)
 [1] 466.55070  89.59487  94.17639  90.28322  90.45060  86.79382  84.54782
 [8]  81.65888  79.28092  81.23311
> rowMin(tmp5)
 [1] 57.98376 59.21162 53.20633 55.90195 53.83445 59.34405 58.41608 53.29001
 [9] 58.56120 55.20532
> 
> colMeans(tmp5)
 [1] 111.81794  69.23337  71.22219  69.04613  67.25820  71.21062  71.70555
 [8]  66.14220  69.77010  72.87527  68.43763  71.69380  70.80322  72.55569
[15]  68.25656  73.96470  70.93454  68.53534  71.24800  73.59608
> colSums(tmp5)
 [1] 1118.1794  692.3337  712.2219  690.4613  672.5820  712.1062  717.0555
 [8]  661.4220  697.7010  728.7527  684.3763  716.9380  708.0322  725.5569
[15]  682.5656  739.6470  709.3454  685.3534  712.4800  735.9608
> colVars(tmp5)
 [1] 15635.43907    95.76294   103.58491    37.81610    84.18409    37.28136
 [7]    37.55127    81.78272    48.56178    41.57290    43.80562   119.76228
[13]    24.85968    79.71518    38.18518    53.16697    73.78438    80.67097
[19]    79.13369   146.80775
> colSd(tmp5)
 [1] 125.041749   9.785854  10.177667   6.149480   9.175189   6.105847
 [7]   6.127909   9.043380   6.968628   6.447705   6.618581  10.943596
[13]   4.985948   8.928336   6.179416   7.291569   8.589784   8.981702
[19]   8.895712  12.116425
> colMax(tmp5)
 [1] 466.55070  83.11388  84.42789  79.47249  86.79382  78.40277  82.02174
 [8]  79.88899  80.60967  84.54782  84.03036  91.99264  79.53532  90.28322
[15]  78.72760  90.45060  86.50331  81.01130  90.30506  94.17639
> colMin(tmp5)
 [1] 55.90195 53.83445 54.61834 57.52990 55.20532 58.84592 64.33219 53.29001
 [9] 57.98376 64.35505 61.22054 55.47569 65.13363 61.33062 58.70340 65.02846
[17] 57.57988 53.20633 57.63737 56.89412
> 
> 
> ### 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] 88.36519 70.04716 72.47162 68.82515 70.08721 74.10720 71.49521       NA
 [9] 70.58348 69.44564
> rowSums(tmp5)
 [1] 1767.304 1400.943 1449.432 1376.503 1401.744 1482.144 1429.904       NA
 [9] 1411.670 1388.913
> rowVars(tmp5)
 [1] 7941.53776   66.31001  120.22386   91.71570   97.90684   67.27634
 [7]   52.60509   65.03895   42.20003   65.09449
> rowSd(tmp5)
 [1] 89.115306  8.143096 10.964664  9.576832  9.894788  8.202215  7.252937
 [8]  8.064673  6.496155  8.068116
> rowMax(tmp5)
 [1] 466.55070  89.59487  94.17639  90.28322  90.45060  86.79382  84.54782
 [8]        NA  79.28092  81.23311
> rowMin(tmp5)
 [1] 57.98376 59.21162 53.20633 55.90195 53.83445 59.34405 58.41608       NA
 [9] 58.56120 55.20532
> 
> colMeans(tmp5)
 [1] 111.81794  69.23337  71.22219  69.04613        NA  71.21062  71.70555
 [8]  66.14220  69.77010  72.87527  68.43763  71.69380  70.80322  72.55569
[15]  68.25656  73.96470  70.93454  68.53534  71.24800  73.59608
> colSums(tmp5)
 [1] 1118.1794  692.3337  712.2219  690.4613        NA  712.1062  717.0555
 [8]  661.4220  697.7010  728.7527  684.3763  716.9380  708.0322  725.5569
[15]  682.5656  739.6470  709.3454  685.3534  712.4800  735.9608
> colVars(tmp5)
 [1] 15635.43907    95.76294   103.58491    37.81610          NA    37.28136
 [7]    37.55127    81.78272    48.56178    41.57290    43.80562   119.76228
[13]    24.85968    79.71518    38.18518    53.16697    73.78438    80.67097
[19]    79.13369   146.80775
> colSd(tmp5)
 [1] 125.041749   9.785854  10.177667   6.149480         NA   6.105847
 [7]   6.127909   9.043380   6.968628   6.447705   6.618581  10.943596
[13]   4.985948   8.928336   6.179416   7.291569   8.589784   8.981702
[19]   8.895712  12.116425
> colMax(tmp5)
 [1] 466.55070  83.11388  84.42789  79.47249        NA  78.40277  82.02174
 [8]  79.88899  80.60967  84.54782  84.03036  91.99264  79.53532  90.28322
[15]  78.72760  90.45060  86.50331  81.01130  90.30506  94.17639
> colMin(tmp5)
 [1] 55.90195 53.83445 54.61834 57.52990       NA 58.84592 64.33219 53.29001
 [9] 57.98376 64.35505 61.22054 55.47569 65.13363 61.33062 58.70340 65.02846
[17] 57.57988 53.20633 57.63737 56.89412
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.5507
> Min(tmp5,na.rm=TRUE)
[1] 53.20633
> mean(tmp5,na.rm=TRUE)
[1] 72.55677
> Sum(tmp5,na.rm=TRUE)
[1] 14438.8
> Var(tmp5,na.rm=TRUE)
[1] 856.1262
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.36519 70.04716 72.47162 68.82515 70.08721 74.10720 71.49521 70.01260
 [9] 70.58348 69.44564
> rowSums(tmp5,na.rm=TRUE)
 [1] 1767.304 1400.943 1449.432 1376.503 1401.744 1482.144 1429.904 1330.239
 [9] 1411.670 1388.913
> rowVars(tmp5,na.rm=TRUE)
 [1] 7941.53776   66.31001  120.22386   91.71570   97.90684   67.27634
 [7]   52.60509   65.03895   42.20003   65.09449
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.115306  8.143096 10.964664  9.576832  9.894788  8.202215  7.252937
 [8]  8.064673  6.496155  8.068116
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.55070  89.59487  94.17639  90.28322  90.45060  86.79382  84.54782
 [8]  81.65888  79.28092  81.23311
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.98376 59.21162 53.20633 55.90195 53.83445 59.34405 58.41608 53.29001
 [9] 58.56120 55.20532
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.81794  69.23337  71.22219  69.04613  67.58972  71.21062  71.70555
 [8]  66.14220  69.77010  72.87527  68.43763  71.69380  70.80322  72.55569
[15]  68.25656  73.96470  70.93454  68.53534  71.24800  73.59608
> colSums(tmp5,na.rm=TRUE)
 [1] 1118.1794  692.3337  712.2219  690.4613  608.3075  712.1062  717.0555
 [8]  661.4220  697.7010  728.7527  684.3763  716.9380  708.0322  725.5569
[15]  682.5656  739.6470  709.3454  685.3534  712.4800  735.9608
> colVars(tmp5,na.rm=TRUE)
 [1] 15635.43907    95.76294   103.58491    37.81610    93.47064    37.28136
 [7]    37.55127    81.78272    48.56178    41.57290    43.80562   119.76228
[13]    24.85968    79.71518    38.18518    53.16697    73.78438    80.67097
[19]    79.13369   146.80775
> colSd(tmp5,na.rm=TRUE)
 [1] 125.041749   9.785854  10.177667   6.149480   9.668021   6.105847
 [7]   6.127909   9.043380   6.968628   6.447705   6.618581  10.943596
[13]   4.985948   8.928336   6.179416   7.291569   8.589784   8.981702
[19]   8.895712  12.116425
> colMax(tmp5,na.rm=TRUE)
 [1] 466.55070  83.11388  84.42789  79.47249  86.79382  78.40277  82.02174
 [8]  79.88899  80.60967  84.54782  84.03036  91.99264  79.53532  90.28322
[15]  78.72760  90.45060  86.50331  81.01130  90.30506  94.17639
> colMin(tmp5,na.rm=TRUE)
 [1] 55.90195 53.83445 54.61834 57.52990 55.20532 58.84592 64.33219 53.29001
 [9] 57.98376 64.35505 61.22054 55.47569 65.13363 61.33062 58.70340 65.02846
[17] 57.57988 53.20633 57.63737 56.89412
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.36519 70.04716 72.47162 68.82515 70.08721 74.10720 71.49521      NaN
 [9] 70.58348 69.44564
> rowSums(tmp5,na.rm=TRUE)
 [1] 1767.304 1400.943 1449.432 1376.503 1401.744 1482.144 1429.904    0.000
 [9] 1411.670 1388.913
> rowVars(tmp5,na.rm=TRUE)
 [1] 7941.53776   66.31001  120.22386   91.71570   97.90684   67.27634
 [7]   52.60509         NA   42.20003   65.09449
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.115306  8.143096 10.964664  9.576832  9.894788  8.202215  7.252937
 [8]        NA  6.496155  8.068116
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.55070  89.59487  94.17639  90.28322  90.45060  86.79382  84.54782
 [8]        NA  79.28092  81.23311
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.98376 59.21162 53.20633 55.90195 53.83445 59.34405 58.41608       NA
 [9] 58.56120 55.20532
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.60568  67.85276  73.06706  68.81524       NaN  71.07794  71.93335
 [8]  67.57022  68.56570  73.82196  68.86667  71.20738  71.31133  71.96553
[15]  68.30965  74.95761  71.70169  68.00546  71.33285  72.94856
> colSums(tmp5,na.rm=TRUE)
 [1] 1040.4511  610.6748  657.6036  619.3372    0.0000  639.7014  647.4002
 [8]  608.1319  617.0913  664.3976  619.8001  640.8664  641.8020  647.6897
[15]  614.7869  674.6185  645.3152  612.0492  641.9957  656.5371
> colVars(tmp5,na.rm=TRUE)
 [1] 17428.46586    86.28980    78.24304    41.94339          NA    41.74349
 [7]    41.66139    69.06409    38.31306    36.68699    47.21045   132.07075
[13]    25.06271    85.76127    42.92661    48.72167    76.38665    87.59614
[19]    88.94440   160.44185
> colSd(tmp5,na.rm=TRUE)
 [1] 132.016915   9.289230   8.845510   6.476371         NA   6.460920
 [7]   6.454563   8.310481   6.189755   6.056979   6.870986  11.492204
[13]   5.006267   9.260738   6.551841   6.980091   8.739946   9.359281
[19]   9.431034  12.666564
> colMax(tmp5,na.rm=TRUE)
 [1] 466.55070  83.11388  84.42789  79.47249      -Inf  78.40277  82.02174
 [8]  79.88899  77.53926  84.54782  84.03036  91.99264  79.53532  90.28322
[15]  78.72760  90.45060  86.50331  81.01130  90.30506  94.17639
> colMin(tmp5,na.rm=TRUE)
 [1] 55.90195 53.83445 60.79188 57.52990      Inf 58.84592 64.33219 56.47534
 [9] 57.98376 65.75810 61.22054 55.47569 65.13363 61.33062 58.70340 69.03547
[17] 57.57988 53.20633 57.63737 56.89412
> 
> 
> 
> 
> 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] 132.2004 164.7700 270.1511 218.9274 160.3203 333.7520 231.8513 317.4320
 [9] 208.6443 135.7260
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 132.2004 164.7700 270.1511 218.9274 160.3203 333.7520 231.8513 317.4320
 [9] 208.6443 135.7260
> 
> 
> 
> 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  1.989520e-13 -8.526513e-14 -8.526513e-14
 [6] -2.842171e-14  0.000000e+00  7.105427e-14  2.842171e-14  1.136868e-13
[11] -2.842171e-14  0.000000e+00  1.421085e-13  5.684342e-14  5.684342e-14
[16]  0.000000e+00 -2.842171e-14 -8.526513e-14 -1.136868e-13 -1.136868e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
2   1 
5   11 
3   17 
5   16 
6   8 
6   18 
8   13 
7   13 
6   10 
4   5 
1   1 
4   18 
10   19 
9   14 
3   15 
9   16 
1   19 
9   1 
8   7 
10   7 
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.572171
> Min(tmp)
[1] -2.809493
> mean(tmp)
[1] -0.04838313
> Sum(tmp)
[1] -4.838313
> Var(tmp)
[1] 0.9511432
> 
> rowMeans(tmp)
[1] -0.04838313
> rowSums(tmp)
[1] -4.838313
> rowVars(tmp)
[1] 0.9511432
> rowSd(tmp)
[1] 0.9752657
> rowMax(tmp)
[1] 2.572171
> rowMin(tmp)
[1] -2.809493
> 
> colMeans(tmp)
  [1]  0.15109533  0.33899709 -0.63118516  0.45498771 -0.94225028 -0.53659682
  [7] -0.55224161 -0.11038090 -0.10278041 -0.49158193 -0.02851368  0.27899845
 [13] -0.31710652  0.41718080 -1.21143310 -0.04265048 -1.42533188  0.08619243
 [19]  0.20954010 -0.36876224 -0.38752280 -0.51507749 -0.27332055 -1.33837861
 [25]  1.58615435  1.04291718  0.30885884  0.37763977 -1.53169739 -0.28491994
 [31]  0.19543538  0.52505444  0.68611977 -1.46509791 -0.45454515  1.97785687
 [37]  1.43376772 -0.27314116 -0.03794893 -2.15790528  0.45527049  0.63853125
 [43] -0.11762081  0.48073833  0.61022647  0.26758837 -0.59843505 -0.53368330
 [49] -0.22031275 -1.02701236 -0.56654000  0.38703112 -0.28422517  0.63597677
 [55]  1.02266285  0.94226880  0.46832407  0.78761370 -1.43826195 -1.50503176
 [61] -2.13082641 -0.06560649  2.10672184 -0.89355564 -1.18374123 -2.80949292
 [67]  0.39172904 -0.03057422  0.39077463 -0.29823891 -1.05670238  0.31232724
 [73]  2.57217130  0.42575493  1.47333531 -0.55330915  0.57445383 -1.21385632
 [79]  1.61587807 -0.20751716  1.33033102  0.68325467  0.05705096  0.55701380
 [85]  1.00901901 -0.54789991  2.01003089 -0.39496969 -0.79798954 -0.03989009
 [91] -0.37109453 -0.43248034 -2.23320322 -0.88029243 -0.26907411 -1.66504354
 [97]  0.21907935  0.94865451  0.51508676  1.04884335
> colSums(tmp)
  [1]  0.15109533  0.33899709 -0.63118516  0.45498771 -0.94225028 -0.53659682
  [7] -0.55224161 -0.11038090 -0.10278041 -0.49158193 -0.02851368  0.27899845
 [13] -0.31710652  0.41718080 -1.21143310 -0.04265048 -1.42533188  0.08619243
 [19]  0.20954010 -0.36876224 -0.38752280 -0.51507749 -0.27332055 -1.33837861
 [25]  1.58615435  1.04291718  0.30885884  0.37763977 -1.53169739 -0.28491994
 [31]  0.19543538  0.52505444  0.68611977 -1.46509791 -0.45454515  1.97785687
 [37]  1.43376772 -0.27314116 -0.03794893 -2.15790528  0.45527049  0.63853125
 [43] -0.11762081  0.48073833  0.61022647  0.26758837 -0.59843505 -0.53368330
 [49] -0.22031275 -1.02701236 -0.56654000  0.38703112 -0.28422517  0.63597677
 [55]  1.02266285  0.94226880  0.46832407  0.78761370 -1.43826195 -1.50503176
 [61] -2.13082641 -0.06560649  2.10672184 -0.89355564 -1.18374123 -2.80949292
 [67]  0.39172904 -0.03057422  0.39077463 -0.29823891 -1.05670238  0.31232724
 [73]  2.57217130  0.42575493  1.47333531 -0.55330915  0.57445383 -1.21385632
 [79]  1.61587807 -0.20751716  1.33033102  0.68325467  0.05705096  0.55701380
 [85]  1.00901901 -0.54789991  2.01003089 -0.39496969 -0.79798954 -0.03989009
 [91] -0.37109453 -0.43248034 -2.23320322 -0.88029243 -0.26907411 -1.66504354
 [97]  0.21907935  0.94865451  0.51508676  1.04884335
> 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.15109533  0.33899709 -0.63118516  0.45498771 -0.94225028 -0.53659682
  [7] -0.55224161 -0.11038090 -0.10278041 -0.49158193 -0.02851368  0.27899845
 [13] -0.31710652  0.41718080 -1.21143310 -0.04265048 -1.42533188  0.08619243
 [19]  0.20954010 -0.36876224 -0.38752280 -0.51507749 -0.27332055 -1.33837861
 [25]  1.58615435  1.04291718  0.30885884  0.37763977 -1.53169739 -0.28491994
 [31]  0.19543538  0.52505444  0.68611977 -1.46509791 -0.45454515  1.97785687
 [37]  1.43376772 -0.27314116 -0.03794893 -2.15790528  0.45527049  0.63853125
 [43] -0.11762081  0.48073833  0.61022647  0.26758837 -0.59843505 -0.53368330
 [49] -0.22031275 -1.02701236 -0.56654000  0.38703112 -0.28422517  0.63597677
 [55]  1.02266285  0.94226880  0.46832407  0.78761370 -1.43826195 -1.50503176
 [61] -2.13082641 -0.06560649  2.10672184 -0.89355564 -1.18374123 -2.80949292
 [67]  0.39172904 -0.03057422  0.39077463 -0.29823891 -1.05670238  0.31232724
 [73]  2.57217130  0.42575493  1.47333531 -0.55330915  0.57445383 -1.21385632
 [79]  1.61587807 -0.20751716  1.33033102  0.68325467  0.05705096  0.55701380
 [85]  1.00901901 -0.54789991  2.01003089 -0.39496969 -0.79798954 -0.03989009
 [91] -0.37109453 -0.43248034 -2.23320322 -0.88029243 -0.26907411 -1.66504354
 [97]  0.21907935  0.94865451  0.51508676  1.04884335
> colMin(tmp)
  [1]  0.15109533  0.33899709 -0.63118516  0.45498771 -0.94225028 -0.53659682
  [7] -0.55224161 -0.11038090 -0.10278041 -0.49158193 -0.02851368  0.27899845
 [13] -0.31710652  0.41718080 -1.21143310 -0.04265048 -1.42533188  0.08619243
 [19]  0.20954010 -0.36876224 -0.38752280 -0.51507749 -0.27332055 -1.33837861
 [25]  1.58615435  1.04291718  0.30885884  0.37763977 -1.53169739 -0.28491994
 [31]  0.19543538  0.52505444  0.68611977 -1.46509791 -0.45454515  1.97785687
 [37]  1.43376772 -0.27314116 -0.03794893 -2.15790528  0.45527049  0.63853125
 [43] -0.11762081  0.48073833  0.61022647  0.26758837 -0.59843505 -0.53368330
 [49] -0.22031275 -1.02701236 -0.56654000  0.38703112 -0.28422517  0.63597677
 [55]  1.02266285  0.94226880  0.46832407  0.78761370 -1.43826195 -1.50503176
 [61] -2.13082641 -0.06560649  2.10672184 -0.89355564 -1.18374123 -2.80949292
 [67]  0.39172904 -0.03057422  0.39077463 -0.29823891 -1.05670238  0.31232724
 [73]  2.57217130  0.42575493  1.47333531 -0.55330915  0.57445383 -1.21385632
 [79]  1.61587807 -0.20751716  1.33033102  0.68325467  0.05705096  0.55701380
 [85]  1.00901901 -0.54789991  2.01003089 -0.39496969 -0.79798954 -0.03989009
 [91] -0.37109453 -0.43248034 -2.23320322 -0.88029243 -0.26907411 -1.66504354
 [97]  0.21907935  0.94865451  0.51508676  1.04884335
> colMedians(tmp)
  [1]  0.15109533  0.33899709 -0.63118516  0.45498771 -0.94225028 -0.53659682
  [7] -0.55224161 -0.11038090 -0.10278041 -0.49158193 -0.02851368  0.27899845
 [13] -0.31710652  0.41718080 -1.21143310 -0.04265048 -1.42533188  0.08619243
 [19]  0.20954010 -0.36876224 -0.38752280 -0.51507749 -0.27332055 -1.33837861
 [25]  1.58615435  1.04291718  0.30885884  0.37763977 -1.53169739 -0.28491994
 [31]  0.19543538  0.52505444  0.68611977 -1.46509791 -0.45454515  1.97785687
 [37]  1.43376772 -0.27314116 -0.03794893 -2.15790528  0.45527049  0.63853125
 [43] -0.11762081  0.48073833  0.61022647  0.26758837 -0.59843505 -0.53368330
 [49] -0.22031275 -1.02701236 -0.56654000  0.38703112 -0.28422517  0.63597677
 [55]  1.02266285  0.94226880  0.46832407  0.78761370 -1.43826195 -1.50503176
 [61] -2.13082641 -0.06560649  2.10672184 -0.89355564 -1.18374123 -2.80949292
 [67]  0.39172904 -0.03057422  0.39077463 -0.29823891 -1.05670238  0.31232724
 [73]  2.57217130  0.42575493  1.47333531 -0.55330915  0.57445383 -1.21385632
 [79]  1.61587807 -0.20751716  1.33033102  0.68325467  0.05705096  0.55701380
 [85]  1.00901901 -0.54789991  2.01003089 -0.39496969 -0.79798954 -0.03989009
 [91] -0.37109453 -0.43248034 -2.23320322 -0.88029243 -0.26907411 -1.66504354
 [97]  0.21907935  0.94865451  0.51508676  1.04884335
> colRanges(tmp)
          [,1]      [,2]       [,3]      [,4]       [,5]       [,6]       [,7]
[1,] 0.1510953 0.3389971 -0.6311852 0.4549877 -0.9422503 -0.5365968 -0.5522416
[2,] 0.1510953 0.3389971 -0.6311852 0.4549877 -0.9422503 -0.5365968 -0.5522416
           [,8]       [,9]      [,10]       [,11]     [,12]      [,13]
[1,] -0.1103809 -0.1027804 -0.4915819 -0.02851368 0.2789985 -0.3171065
[2,] -0.1103809 -0.1027804 -0.4915819 -0.02851368 0.2789985 -0.3171065
         [,14]     [,15]       [,16]     [,17]      [,18]     [,19]      [,20]
[1,] 0.4171808 -1.211433 -0.04265048 -1.425332 0.08619243 0.2095401 -0.3687622
[2,] 0.4171808 -1.211433 -0.04265048 -1.425332 0.08619243 0.2095401 -0.3687622
          [,21]      [,22]      [,23]     [,24]    [,25]    [,26]     [,27]
[1,] -0.3875228 -0.5150775 -0.2733206 -1.338379 1.586154 1.042917 0.3088588
[2,] -0.3875228 -0.5150775 -0.2733206 -1.338379 1.586154 1.042917 0.3088588
         [,28]     [,29]      [,30]     [,31]     [,32]     [,33]     [,34]
[1,] 0.3776398 -1.531697 -0.2849199 0.1954354 0.5250544 0.6861198 -1.465098
[2,] 0.3776398 -1.531697 -0.2849199 0.1954354 0.5250544 0.6861198 -1.465098
          [,35]    [,36]    [,37]      [,38]       [,39]     [,40]     [,41]
[1,] -0.4545452 1.977857 1.433768 -0.2731412 -0.03794893 -2.157905 0.4552705
[2,] -0.4545452 1.977857 1.433768 -0.2731412 -0.03794893 -2.157905 0.4552705
         [,42]      [,43]     [,44]     [,45]     [,46]     [,47]      [,48]
[1,] 0.6385313 -0.1176208 0.4807383 0.6102265 0.2675884 -0.598435 -0.5336833
[2,] 0.6385313 -0.1176208 0.4807383 0.6102265 0.2675884 -0.598435 -0.5336833
          [,49]     [,50]    [,51]     [,52]      [,53]     [,54]    [,55]
[1,] -0.2203128 -1.027012 -0.56654 0.3870311 -0.2842252 0.6359768 1.022663
[2,] -0.2203128 -1.027012 -0.56654 0.3870311 -0.2842252 0.6359768 1.022663
         [,56]     [,57]     [,58]     [,59]     [,60]     [,61]       [,62]
[1,] 0.9422688 0.4683241 0.7876137 -1.438262 -1.505032 -2.130826 -0.06560649
[2,] 0.9422688 0.4683241 0.7876137 -1.438262 -1.505032 -2.130826 -0.06560649
        [,63]      [,64]     [,65]     [,66]    [,67]       [,68]     [,69]
[1,] 2.106722 -0.8935556 -1.183741 -2.809493 0.391729 -0.03057422 0.3907746
[2,] 2.106722 -0.8935556 -1.183741 -2.809493 0.391729 -0.03057422 0.3907746
          [,70]     [,71]     [,72]    [,73]     [,74]    [,75]      [,76]
[1,] -0.2982389 -1.056702 0.3123272 2.572171 0.4257549 1.473335 -0.5533092
[2,] -0.2982389 -1.056702 0.3123272 2.572171 0.4257549 1.473335 -0.5533092
         [,77]     [,78]    [,79]      [,80]    [,81]     [,82]      [,83]
[1,] 0.5744538 -1.213856 1.615878 -0.2075172 1.330331 0.6832547 0.05705096
[2,] 0.5744538 -1.213856 1.615878 -0.2075172 1.330331 0.6832547 0.05705096
         [,84]    [,85]      [,86]    [,87]      [,88]      [,89]       [,90]
[1,] 0.5570138 1.009019 -0.5478999 2.010031 -0.3949697 -0.7979895 -0.03989009
[2,] 0.5570138 1.009019 -0.5478999 2.010031 -0.3949697 -0.7979895 -0.03989009
          [,91]      [,92]     [,93]      [,94]      [,95]     [,96]     [,97]
[1,] -0.3710945 -0.4324803 -2.233203 -0.8802924 -0.2690741 -1.665044 0.2190793
[2,] -0.3710945 -0.4324803 -2.233203 -0.8802924 -0.2690741 -1.665044 0.2190793
         [,98]     [,99]   [,100]
[1,] 0.9486545 0.5150868 1.048843
[2,] 0.9486545 0.5150868 1.048843
> 
> 
> Max(tmp2)
[1] 2.178027
> Min(tmp2)
[1] -2.646211
> mean(tmp2)
[1] -0.1805399
> Sum(tmp2)
[1] -18.05399
> Var(tmp2)
[1] 1.321197
> 
> rowMeans(tmp2)
  [1] -1.74699331 -2.48532783 -0.32307932  0.61959967  0.20324381  1.09115700
  [7] -0.75759565  1.25282577  0.12294908  1.67414094  0.15510905 -2.43832199
 [13] -0.32568304 -2.27162319  1.29591222 -1.13962239  1.98322369  0.03793058
 [19]  1.67051976  0.65151082 -0.09146585 -0.67981015 -1.07879053 -0.59813314
 [25] -0.41392073 -0.13749059 -1.04591181 -1.72221591  0.70651324 -0.28636172
 [31]  0.52427445 -1.02211774 -0.48819197 -1.20448101  1.17739799 -1.07317799
 [37] -0.84478208  0.24955314 -0.79019429 -1.87195669  1.29080028 -2.64621105
 [43]  0.37078792  0.87790405  1.18758234 -1.02430015  0.47044986 -0.63172888
 [49]  1.78781967 -0.62107983  0.50553906 -0.03757047 -0.10160285  1.57946644
 [55] -0.54454706  0.42559387  0.09569717  1.07999791 -2.30352909  1.25142381
 [61]  0.93260456 -1.91752465  0.32701738 -1.19392626 -0.59507836 -1.62018585
 [67]  2.17041543 -0.90929568 -0.34661478 -1.81383140  0.42267344 -0.69535807
 [73] -0.26692183 -0.96864914 -1.11738928  1.41351672 -0.27502382 -0.10206817
 [79] -0.77243412  0.76053149 -0.91941510 -1.87375205 -1.56848019 -0.06435102
 [85]  0.26405817  1.24748249 -2.49298866  1.00123946 -0.68441680 -0.34985123
 [91]  2.17802681  0.53365372 -0.16328533  0.13950282 -1.01212977 -0.77309890
 [97]  0.20168230 -0.70319862 -0.11151646  2.07328914
> rowSums(tmp2)
  [1] -1.74699331 -2.48532783 -0.32307932  0.61959967  0.20324381  1.09115700
  [7] -0.75759565  1.25282577  0.12294908  1.67414094  0.15510905 -2.43832199
 [13] -0.32568304 -2.27162319  1.29591222 -1.13962239  1.98322369  0.03793058
 [19]  1.67051976  0.65151082 -0.09146585 -0.67981015 -1.07879053 -0.59813314
 [25] -0.41392073 -0.13749059 -1.04591181 -1.72221591  0.70651324 -0.28636172
 [31]  0.52427445 -1.02211774 -0.48819197 -1.20448101  1.17739799 -1.07317799
 [37] -0.84478208  0.24955314 -0.79019429 -1.87195669  1.29080028 -2.64621105
 [43]  0.37078792  0.87790405  1.18758234 -1.02430015  0.47044986 -0.63172888
 [49]  1.78781967 -0.62107983  0.50553906 -0.03757047 -0.10160285  1.57946644
 [55] -0.54454706  0.42559387  0.09569717  1.07999791 -2.30352909  1.25142381
 [61]  0.93260456 -1.91752465  0.32701738 -1.19392626 -0.59507836 -1.62018585
 [67]  2.17041543 -0.90929568 -0.34661478 -1.81383140  0.42267344 -0.69535807
 [73] -0.26692183 -0.96864914 -1.11738928  1.41351672 -0.27502382 -0.10206817
 [79] -0.77243412  0.76053149 -0.91941510 -1.87375205 -1.56848019 -0.06435102
 [85]  0.26405817  1.24748249 -2.49298866  1.00123946 -0.68441680 -0.34985123
 [91]  2.17802681  0.53365372 -0.16328533  0.13950282 -1.01212977 -0.77309890
 [97]  0.20168230 -0.70319862 -0.11151646  2.07328914
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -1.74699331 -2.48532783 -0.32307932  0.61959967  0.20324381  1.09115700
  [7] -0.75759565  1.25282577  0.12294908  1.67414094  0.15510905 -2.43832199
 [13] -0.32568304 -2.27162319  1.29591222 -1.13962239  1.98322369  0.03793058
 [19]  1.67051976  0.65151082 -0.09146585 -0.67981015 -1.07879053 -0.59813314
 [25] -0.41392073 -0.13749059 -1.04591181 -1.72221591  0.70651324 -0.28636172
 [31]  0.52427445 -1.02211774 -0.48819197 -1.20448101  1.17739799 -1.07317799
 [37] -0.84478208  0.24955314 -0.79019429 -1.87195669  1.29080028 -2.64621105
 [43]  0.37078792  0.87790405  1.18758234 -1.02430015  0.47044986 -0.63172888
 [49]  1.78781967 -0.62107983  0.50553906 -0.03757047 -0.10160285  1.57946644
 [55] -0.54454706  0.42559387  0.09569717  1.07999791 -2.30352909  1.25142381
 [61]  0.93260456 -1.91752465  0.32701738 -1.19392626 -0.59507836 -1.62018585
 [67]  2.17041543 -0.90929568 -0.34661478 -1.81383140  0.42267344 -0.69535807
 [73] -0.26692183 -0.96864914 -1.11738928  1.41351672 -0.27502382 -0.10206817
 [79] -0.77243412  0.76053149 -0.91941510 -1.87375205 -1.56848019 -0.06435102
 [85]  0.26405817  1.24748249 -2.49298866  1.00123946 -0.68441680 -0.34985123
 [91]  2.17802681  0.53365372 -0.16328533  0.13950282 -1.01212977 -0.77309890
 [97]  0.20168230 -0.70319862 -0.11151646  2.07328914
> rowMin(tmp2)
  [1] -1.74699331 -2.48532783 -0.32307932  0.61959967  0.20324381  1.09115700
  [7] -0.75759565  1.25282577  0.12294908  1.67414094  0.15510905 -2.43832199
 [13] -0.32568304 -2.27162319  1.29591222 -1.13962239  1.98322369  0.03793058
 [19]  1.67051976  0.65151082 -0.09146585 -0.67981015 -1.07879053 -0.59813314
 [25] -0.41392073 -0.13749059 -1.04591181 -1.72221591  0.70651324 -0.28636172
 [31]  0.52427445 -1.02211774 -0.48819197 -1.20448101  1.17739799 -1.07317799
 [37] -0.84478208  0.24955314 -0.79019429 -1.87195669  1.29080028 -2.64621105
 [43]  0.37078792  0.87790405  1.18758234 -1.02430015  0.47044986 -0.63172888
 [49]  1.78781967 -0.62107983  0.50553906 -0.03757047 -0.10160285  1.57946644
 [55] -0.54454706  0.42559387  0.09569717  1.07999791 -2.30352909  1.25142381
 [61]  0.93260456 -1.91752465  0.32701738 -1.19392626 -0.59507836 -1.62018585
 [67]  2.17041543 -0.90929568 -0.34661478 -1.81383140  0.42267344 -0.69535807
 [73] -0.26692183 -0.96864914 -1.11738928  1.41351672 -0.27502382 -0.10206817
 [79] -0.77243412  0.76053149 -0.91941510 -1.87375205 -1.56848019 -0.06435102
 [85]  0.26405817  1.24748249 -2.49298866  1.00123946 -0.68441680 -0.34985123
 [91]  2.17802681  0.53365372 -0.16328533  0.13950282 -1.01212977 -0.77309890
 [97]  0.20168230 -0.70319862 -0.11151646  2.07328914
> 
> colMeans(tmp2)
[1] -0.1805399
> colSums(tmp2)
[1] -18.05399
> colVars(tmp2)
[1] 1.321197
> colSd(tmp2)
[1] 1.149434
> colMax(tmp2)
[1] 2.178027
> colMin(tmp2)
[1] -2.646211
> colMedians(tmp2)
[1] -0.2151036
> colRanges(tmp2)
          [,1]
[1,] -2.646211
[2,]  2.178027
> 
> 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.55009380  0.06034151  3.73709499 -4.87464818  2.42486548  2.65253503
 [7] -0.03343562  3.25754348  4.57155243 -2.20057440
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.8888735
[2,] -0.3873603
[3,]  0.7299207
[4,]  1.4435291
[5,]  1.6941795
> 
> rowApply(tmp,sum)
 [1]  6.4319560  3.3738621 -0.6638741 -2.5947762  3.2793064  0.4501089
 [7]  1.7881958 -0.4576040  0.9219704  0.6162233
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   10    9    7    1    9    9    3    2   10     6
 [2,]    8    7    8    2    6    7    6    4    1     3
 [3,]    3    6    3    5    8    8    1    8    8     9
 [4,]    1    1    5    7    1    1    8    9    5     5
 [5,]    7    4    6    8    5    6    5    6    6     4
 [6,]    6    2    9    6    3    3    9   10    3     7
 [7,]    9    3    2   10   10    4    2    3    4     1
 [8,]    2   10    4    3    2   10   10    7    2     8
 [9,]    4    8   10    4    4    5    7    5    9    10
[10,]    5    5    1    9    7    2    4    1    7     2
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.5017653 -3.4987488  3.9259644  1.1976719  0.8679631 -3.3206523
 [7] -5.3537464  0.4842716  2.7961839 -1.6313869 -2.8066977 -1.4113236
[13] -0.5007665  0.7772251 -1.7623329 -1.1121870 -1.4215954 -1.9155872
[19] -0.2891241  4.1426915
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.9613094
[2,] -0.4385818
[3,] -0.2117638
[4,]  0.6144217
[5,]  1.4989987
> 
> rowApply(tmp,sum)
[1] -2.510517 -3.139431 -3.073669 -6.812793  5.205998
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   18    8   15   11    3
[2,]    1    3    3   17   11
[3,]   19   14   17   12   13
[4,]   20   16    9    7    9
[5,]   16    7   11   10   15
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]        [,6]
[1,]  1.4989987 -1.7346724  2.0044807  2.2013402  1.1228641 -1.55588176
[2,] -0.4385818 -0.9317799  0.1677095  0.2848347 -0.6372476  0.07106812
[3,]  0.6144217 -1.6591730  1.3156280 -0.7120721 -0.2725655  0.35765378
[4,] -0.2117638  0.3431779 -0.2095057 -0.8388319 -0.2989205 -0.13064682
[5,] -0.9613094  0.4836985  0.6476519  0.2624010  0.9538326 -2.06284565
           [,7]        [,8]      [,9]      [,10]       [,11]       [,12]
[1,] -1.2232730 -0.46229073 0.3279891 -0.4147486 -0.06859623 -0.61964384
[2,] -0.1575605  0.75421009 0.2655082  1.2889239 -0.88542946 -0.01112071
[3,] -2.0618673 -0.92580983 0.3248913 -1.3123435 -1.27351589 -0.36733133
[4,] -1.6782199 -0.01623222 0.8004919 -0.9962428 -1.20578196 -0.53422950
[5,] -0.2328256  1.13439429 1.0773034 -0.1969759  0.62662581  0.12100174
          [,13]       [,14]      [,15]      [,16]      [,17]      [,18]
[1,]  1.1868745 -0.98548201 -1.1146073 -0.8265976 -0.5713149  0.1783142
[2,] -2.3054710 -0.34522411 -1.8715908 -0.8421177 -0.1554023 -0.9111503
[3,]  2.0793405  0.60208871 -2.0348403  1.1170264 -0.7896132  1.3721685
[4,] -0.6136818 -0.09476112  2.4243079  0.7851042 -1.0640775 -1.7755751
[5,] -0.8478286  1.60060364  0.8343976 -1.3456023  1.1588125 -0.7793446
          [,19]      [,20]
[1,] -0.4802414 -0.9740291
[2,]  2.4436812  1.0773094
[3,] -1.0516643  1.6039086
[4,] -1.6204557  0.1230510
[5,]  0.4195561  2.3124517
> 
> 
> 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.13-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.13-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.13-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 1.803059 -0.0002182497 0.3519268 -0.3817751 1.441945 0.1073764 0.5453452
         col8     col9     col10      col11        col12    col13       col14
row1 1.772046 1.649568 0.5626254 0.05454181 -0.006534198 1.170828 -0.02145208
          col15    col16    col17      col18     col19    col20
row1 -0.9837916 1.887737 1.749948 -0.3300696 -1.302355 1.821243
> tmp[,"col10"]
           col10
row1  0.56262544
row2  0.02810039
row3 -0.27014737
row4 -1.29809995
row5  1.05577174
> tmp[c("row1","row5"),]
          col1          col2       col3        col4       col5      col6
row1  1.803059 -0.0002182497  0.3519268 -0.38177509  1.4419454 0.1073764
row5 -1.338748 -1.4277300813 -0.1466625 -0.08849856 -0.7550111 0.5504584
           col7        col8      col9     col10      col11        col12
row1  0.5453452  1.77204613  1.649568 0.5626254 0.05454181 -0.006534198
row5 -0.3094840 -0.02123464 -1.988322 1.0557717 1.04332212 -1.000653122
        col13       col14      col15     col16      col17      col18      col19
row1 1.170828 -0.02145208 -0.9837916 1.8877374  1.7499483 -0.3300696 -1.3023546
row5 1.362583  1.20128119  1.2526583 0.2143699 -0.5025682 -0.4928046 -0.4292016
        col20
row1 1.821243
row5 1.000986
> tmp[,c("col6","col20")]
           col6      col20
row1  0.1073764  1.8212427
row2  0.8120002  1.1297221
row3  0.7481949 -0.2166020
row4 -0.4413924  0.5302178
row5  0.5504584  1.0009857
> tmp[c("row1","row5"),c("col6","col20")]
          col6    col20
row1 0.1073764 1.821243
row5 0.5504584 1.000986
> 
> 
> 
> 
> 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.04287 50.00645 50.62493 50.32496 51.32943 103.6374 50.59731 49.6091
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.19235 51.02158 48.85125 48.13308 50.47962 48.93378 49.99649 50.46873
        col17    col18    col19   col20
row1 50.57401 49.88866 49.57867 104.175
> tmp[,"col10"]
        col10
row1 51.02158
row2 32.01850
row3 29.66177
row4 28.99920
row5 48.66793
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.04287 50.00645 50.62493 50.32496 51.32943 103.6374 50.59731 49.60910
row5 48.81994 49.06958 51.28219 49.23796 48.93545 103.0914 48.98176 49.36936
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.19235 51.02158 48.85125 48.13308 50.47962 48.93378 49.99649 50.46873
row5 49.26770 48.66793 49.38705 49.28428 50.94930 49.84772 49.65276 51.07143
        col17    col18    col19    col20
row1 50.57401 49.88866 49.57867 104.1750
row5 49.72156 48.01020 49.27346 103.7676
> tmp[,c("col6","col20")]
          col6     col20
row1 103.63740 104.17496
row2  76.53713  74.08900
row3  74.84017  74.42741
row4  75.87154  76.77789
row5 103.09137 103.76759
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.6374 104.1750
row5 103.0914 103.7676
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.6374 104.1750
row5 103.0914 103.7676
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  1.2640322
[2,]  1.2765782
[3,] -0.5956504
[4,] -0.5958342
[5,]  2.9976408
> tmp[,c("col17","col7")]
          col17       col7
[1,] 1.70086127 -2.3325123
[2,] 2.30147601  0.2697307
[3,] 0.73507137  0.5486491
[4,] 0.05371092  1.2215007
[5,] 0.34294429  2.0567096
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,]  0.1781597  1.12387516
[2,] -0.8922881 -0.69436043
[3,]  1.6590296 -0.37688758
[4,] -0.5581464  0.01203421
[5,] -1.4647174 -0.87226025
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.1781597
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.1781597
[2,] -0.8922881
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]      [,3]        [,4]       [,5]       [,6]      [,7]
row3 0.8377024  0.7744824 0.5560146 -0.05392819  0.2898703 -0.5405862 1.1145955
row1 0.2948882 -1.1344609 0.2342711  0.43545964 -1.2810809  1.0062168 0.1386291
           [,8]      [,9]     [,10]      [,11]      [,12]     [,13]     [,14]
row3 -1.7029216 0.9553084 -1.394688  0.4431662 -0.5092678 -1.420270 -2.170254
row1  0.7587867 1.2113758 -0.767509 -0.8247597 -0.6300664  1.153906 -1.267485
         [,15]      [,16]      [,17]      [,18]     [,19]      [,20]
row3  0.780165 0.05098667 -0.4286775 -0.7503945 -1.537570 -0.2929728
row1 -0.408044 0.64427636  0.7615676 -0.7785921  1.572407  0.1455138
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
        [,1]       [,2]      [,3]       [,4]      [,5]       [,6]       [,7]
row2 1.46306 -0.2242697 0.0575739 -0.5721491 -1.579408 -0.1227466 -0.6204317
           [,8]     [,9]     [,10]
row2 0.09751625 1.535582 -2.273497
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]      [,2]       [,3]      [,4]       [,5]      [,6]      [,7]
row5 -0.2600587 -2.609028 -0.5824154 -1.333154 -0.6121733 0.5086133 0.1890482
         [,8]       [,9]      [,10]      [,11]      [,12]        [,13]
row5 0.397118 -0.5298924 -0.8755338 -0.9529571 -0.3308074 -0.009359541
          [,14]     [,15]    [,16]      [,17]      [,18]     [,19]     [,20]
row5 -0.1408245 0.6250395 1.285174 -0.4929864 -0.6018477 -1.651811 0.4938605
> 
> 
> 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: 0x55d105aba220>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9ae674052" 
 [2] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a251d7ae4"
 [3] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a2f744f64"
 [4] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a65984ef5"
 [5] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a4e826aa" 
 [6] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a21b9ee2c"
 [7] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a4d2450aa"
 [8] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a5384c2e7"
 [9] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a360de8cd"
[10] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a5d53fc85"
[11] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a5954770c"
[12] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a330d4d51"
[13] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a6ac931da"
[14] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a36089cb5"
[15] "/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests/BM3e9b9a7b2761d" 
> 
> 
> ### 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: 0x55d104d9db00>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x55d104d9db00>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.13-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x55d104d9db00>
> rowMedians(tmp)
  [1] -0.3387767546 -0.1713215025 -0.0273328275  0.0629806578 -0.4022025471
  [6]  0.3525325383 -0.5357303204  0.2884563680  0.2916892071  0.6088161783
 [11] -0.1827934064  0.2289751882 -0.4182576340  0.2854839510  0.3340785862
 [16] -0.4537113299 -0.1853921224  0.4890452720  0.1478243180 -0.2902885204
 [21] -0.2572134202  0.1419401815  0.4593125167  0.1435721910  0.0246922434
 [26]  0.0399487057  0.2071452517 -0.5004855803  0.2491803506  0.4320341506
 [31]  0.5531430825  0.0280194765  0.4587878947  0.3790151861 -0.5963074697
 [36]  0.5413481068 -0.7829876004  0.0070572580  0.3981240264 -0.1428414172
 [41]  0.2867870268  0.1810970271 -0.0817980813  0.1375552721  0.0453476752
 [46] -0.0413280690 -0.4560663121 -0.6470041529 -0.3307176269  0.0431922347
 [51] -0.9314597217  0.1292300018  0.0629415084  0.3827950719 -0.1099259188
 [56]  0.3152645625  0.0590740037 -0.1651794365  0.0994117717  0.2386906239
 [61]  0.1734282104 -0.4222089471  0.2846925555  0.4391037377  0.3394173747
 [66]  0.1272110530  0.4519679314  0.3492896730 -0.3514465534  0.1471611033
 [71]  0.1457377772  0.1773297956  0.2326060051 -0.3271101146  0.0446163107
 [76] -0.1891153865  0.1223949174  0.2090372146  0.0142231176 -0.0511110952
 [81] -0.2890905258 -0.0836691706 -0.1320974438  0.0549497775 -0.6532343755
 [86] -0.2578311058  0.4232924459 -0.1126635260 -0.1347416149  0.6240440771
 [91]  0.0793341017  0.2208189974  0.2870489109 -0.0878763497 -0.2629386272
 [96]  0.2877576072  0.2003644611 -0.1429520413 -0.1145656590  0.1304409413
[101]  0.0936571679 -0.3480319159  0.3857016020 -0.0861990022 -0.0789184233
[106] -0.6256291521 -0.0797066588 -0.0524181870 -0.6860521515 -0.1367752776
[111]  0.4936325676 -0.1409579213  0.4194288705  0.2713453778  0.3159122153
[116]  0.1644407880 -0.1363571984  0.4003696189  0.3211506074  0.4414971452
[121] -0.0455429327  0.1387061622  0.1728517490  0.0744549194 -0.0761755530
[126]  0.6053521837  0.3455790322  0.0439959203  0.1148763985 -0.2059716024
[131]  0.6018492369  0.3502853099 -0.1960579951 -0.0134914315 -0.1589238207
[136]  0.2931563514 -0.1164444693  0.0418945193 -0.3336867364 -0.0822215701
[141]  0.0429557675 -0.0008392129 -0.1787193343 -0.1901792447 -0.2393462882
[146] -0.0066371521 -0.4644376233 -0.1295291023  0.2279466326  0.0153728717
[151] -0.0770281308  0.3790019015 -0.0345285197  0.2381195572 -0.6883067690
[156]  0.3134793218  0.7669346448 -0.6213759449 -0.0601207513 -0.0194798699
[161]  0.7315443653 -0.0340770631 -0.1203804157 -0.4200314336 -0.3380396479
[166]  0.4668553471 -0.0314907116  0.3895299012 -0.0759059282  0.3105271608
[171] -0.2647703314  0.5736193119  0.6800978213  0.4702604370  0.6759610667
[176] -0.0195601875  0.1356343452  0.5455930778 -0.5597913878 -0.0679073023
[181]  0.1552441372 -0.0391471735  0.1729700497  0.2460358031 -0.3086644578
[186] -0.3425855910 -0.4006167468 -0.6895584369  0.0616115218 -0.3593096849
[191] -0.1417067165  0.4035418117  0.4032716891  0.0474891847 -0.0109062174
[196]  0.3079553066  0.1044216879 -0.0850971671  0.3845666781  0.2438628221
[201] -0.0222608761  0.1848244732  0.2398864865  0.4557328680  0.2501488969
[206] -0.2254985135 -0.6048809997  0.0385542907  0.3848040745 -0.2497428339
[211] -0.6474824658  0.2425970034  0.2238213798  0.0009628953 -0.0858203117
[216] -0.0895703298 -0.0372654999  0.1260416387 -0.2553788717  0.2911820924
[221]  0.0202497620 -0.5689270373 -0.0028407812  0.1665705990 -0.2218101470
[226]  0.3127399652  0.2568994860 -0.0293464772 -0.1788848857 -0.0167900481
> 
> proc.time()
   user  system elapsed 
  1.402   1.626   3.034 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 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: 0x5629bc99fa10>
> .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: 0x5629bc99fa10>
> .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: 0x5629bc99fa10>
> .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: 0x5629bc99fa10>
> 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: 0x5629bbfc2140>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5629bbfc2140>
> .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: 0x5629bbfc2140>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5629bbfc2140>
> .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: 0x5629bbfc2140>
> 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: 0x5629bc551850>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5629bc551850>
> .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: 0x5629bc551850>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5629bc551850>
> .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: 0x5629bc551850>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5629bc551850>
> .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: 0x5629bc551850>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5629bc551850>
> .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: 0x5629bc551850>
> 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: 0x5629bbea8520>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5629bbea8520>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5629bbea8520>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5629bbea8520>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3e9e91216d193e" "BufferedMatrixFile3e9e912d25108c"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3e9e91216d193e" "BufferedMatrixFile3e9e912d25108c"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5629bb9bbbb0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5629bb9bbbb0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5629bb9bbbb0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5629bb9bbbb0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5629bb9bbbb0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5629bb9bbbb0>
> .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: 0x5629bbc86e40>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5629bbc86e40>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5629bbc86e40>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5629bbc86e40>
> 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: 0x5629bbd747c0>
> .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: 0x5629bbd747c0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.284   0.031   0.303 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 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.281   0.051   0.318 

Example timings