Back to Build/check report for BioC 3.17
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

This page was generated on 2023-02-23 01:33:47 -0000 (Thu, 23 Feb 2023).

HostnameOSArch (*)R versionInstalled pkgs
kunpeng1Linux (Ubuntu 22.04.1 LTS)aarch64R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences" 4245
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

CHECK results for BufferedMatrix on kunpeng1


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? 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 228/2164HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.63.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-02-21 12:29:53 -0000 (Tue, 21 Feb 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: master
git_last_commit: e95ad0a
git_last_commit_date: 2022-11-01 14:42:48 -0000 (Tue, 01 Nov 2022)
kunpeng1Linux (Ubuntu 22.04.1 LTS) / aarch64  OK    OK    OK  

Summary

Package: BufferedMatrix
Version: 1.63.0
Command: /home/biocbuild/bbs-3.17-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.17-bioc/R/library --timings BufferedMatrix_1.63.0.tar.gz
StartedAt: 2023-02-22 01:43:43 -0000 (Wed, 22 Feb 2023)
EndedAt: 2023-02-22 01:44:19 -0000 (Wed, 22 Feb 2023)
EllapsedTime: 36.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2023-01-14 r83615)
* using platform: aarch64-unknown-linux-gnu (64-bit)
* R was compiled by
    gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
    GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
* running under: Ubuntu 22.04.1 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.63.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
* used C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
* 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 ...
  ‘BufferedMatrix.Rnw’... OK
 OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.17-bioc/R/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
gcc -I"/home/biocbuild/bbs-3.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.17-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.17-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.17-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.17-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.17-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.17-bioc/R/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-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.333   0.051   0.366 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-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.17-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 456993 24.5     979984 52.4   651420 34.8
Vcells 842364  6.5    8388608 64.0  2047783 15.7
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Feb 22 01:44:05 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Feb 22 01:44:05 2023"
> 
> 
> 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: 0xaaaaf964e900>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Feb 22 01:44:06 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Feb 22 01:44:06 2023"
> 
> ColMode(tmp2)
<pointer: 0xaaaaf964e900>
> 
> 
> 
> ### 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,] 101.3146274 -0.4190882 -1.2446499 -0.7652680
[2,]   0.7685334  1.3092979  0.8957551  1.7755597
[3,]  -1.4247691  0.3884643  0.2165343 -0.4760658
[4,]   0.9288718 -1.2324747  2.1720450  0.2898474
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-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,] 101.3146274 0.4190882 1.2446499 0.7652680
[2,]   0.7685334 1.3092979 0.8957551 1.7755597
[3,]   1.4247691 0.3884643 0.2165343 0.4760658
[4,]   0.9288718 1.2324747 2.1720450 0.2898474
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-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,] 10.0655167 0.6473702 1.1156388 0.8747960
[2,]  0.8766604 1.1442455 0.9464434 1.3325013
[3,]  1.1936369 0.6232691 0.4653324 0.6899752
[4,]  0.9637799 1.1101688 1.4737859 0.5383748
> 
> 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.17-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,] 226.96979 31.89279 37.40104 34.51323
[2,]  34.53514 37.75175 35.36019 40.10057
[3,]  38.36114 31.62115 29.86986 32.37582
[4,]  35.56667 37.33416 41.90990 30.67360
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0xaaaaf8dcd470>
> exp(tmp5)
<pointer: 0xaaaaf8dcd470>
> log(tmp5,2)
<pointer: 0xaaaaf8dcd470>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 472.4079
> Min(tmp5)
[1] 54.06578
> mean(tmp5)
[1] 72.94053
> Sum(tmp5)
[1] 14588.11
> Var(tmp5)
[1] 878.4971
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 94.94512 73.04498 69.87693 69.68672 69.21639 72.03941 71.93570 69.76769
 [9] 69.96812 68.92426
> rowSums(tmp5)
 [1] 1898.902 1460.900 1397.539 1393.734 1384.328 1440.788 1438.714 1395.354
 [9] 1399.362 1378.485
> rowVars(tmp5)
 [1] 7991.58299   63.12627   57.15575   64.02718   52.31970   85.50394
 [7]   80.75941   74.41472   74.07467   74.02145
> rowSd(tmp5)
 [1] 89.395654  7.945204  7.560143  8.001699  7.233236  9.246834  8.986624
 [8]  8.626397  8.606664  8.603572
> rowMax(tmp5)
 [1] 472.40789  84.96963  82.72132  87.22997  85.37042  96.47844  90.71066
 [8]  85.37145  89.44831  84.28284
> rowMin(tmp5)
 [1] 62.81566 59.06481 58.69630 57.93775 57.73871 55.90180 54.06578 55.96710
 [9] 54.36994 58.93427
> 
> colMeans(tmp5)
 [1] 110.45613  69.26819  68.69063  69.93642  67.66414  70.46041  70.05577
 [8]  65.39128  72.06136  74.33442  66.77410  72.47743  73.11734  72.27998
[15]  75.68641  75.37331  69.80137  70.26193  70.06864  74.65140
> colSums(tmp5)
 [1] 1104.5613  692.6819  686.9063  699.3642  676.6414  704.6041  700.5577
 [8]  653.9128  720.6136  743.3442  667.7410  724.7743  731.1734  722.7998
[15]  756.8641  753.7331  698.0137  702.6193  700.6864  746.5140
> colVars(tmp5)
 [1] 16236.03862    40.12281   123.71661    53.26866    19.56366    21.19038
 [7]    41.55871    43.17457    71.31673   145.49593    54.88722   135.09725
[13]    61.56050    68.56115   130.38897    86.01632   101.73048    83.74893
[19]    54.67195    40.90118
> colSd(tmp5)
 [1] 127.420715   6.334257  11.122797   7.298538   4.423082   4.603301
 [7]   6.446604   6.570736   8.444923  12.062170   7.408591  11.623134
[13]   7.846050   8.280166  11.418799   9.274498  10.086153   9.151444
[19]   7.394049   6.395403
> colMax(tmp5)
 [1] 472.40789  78.57533  87.22997  83.46409  73.55746  77.07827  82.54680
 [8]  75.26673  84.96963  95.31484  77.67804  90.71066  84.72466  83.94572
[15]  94.88921  96.47844  96.35658  85.37145  82.72132  84.25774
> colMin(tmp5)
 [1] 54.36994 59.35034 55.47905 59.64302 58.42151 64.12621 57.73871 54.06578
 [9] 61.10551 59.61253 55.90180 55.96710 58.69630 59.88266 57.93775 62.17783
[17] 61.41420 59.06481 58.93427 62.75270
> 
> 
> ### 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] 94.94512 73.04498 69.87693 69.68672       NA 72.03941 71.93570 69.76769
 [9] 69.96812 68.92426
> rowSums(tmp5)
 [1] 1898.902 1460.900 1397.539 1393.734       NA 1440.788 1438.714 1395.354
 [9] 1399.362 1378.485
> rowVars(tmp5)
 [1] 7991.58299   63.12627   57.15575   64.02718   54.82184   85.50394
 [7]   80.75941   74.41472   74.07467   74.02145
> rowSd(tmp5)
 [1] 89.395654  7.945204  7.560143  8.001699  7.404177  9.246834  8.986624
 [8]  8.626397  8.606664  8.603572
> rowMax(tmp5)
 [1] 472.40789  84.96963  82.72132  87.22997        NA  96.47844  90.71066
 [8]  85.37145  89.44831  84.28284
> rowMin(tmp5)
 [1] 62.81566 59.06481 58.69630 57.93775       NA 55.90180 54.06578 55.96710
 [9] 54.36994 58.93427
> 
> colMeans(tmp5)
 [1]       NA 69.26819 68.69063 69.93642 67.66414 70.46041 70.05577 65.39128
 [9] 72.06136 74.33442 66.77410 72.47743 73.11734 72.27998 75.68641 75.37331
[17] 69.80137 70.26193 70.06864 74.65140
> colSums(tmp5)
 [1]       NA 692.6819 686.9063 699.3642 676.6414 704.6041 700.5577 653.9128
 [9] 720.6136 743.3442 667.7410 724.7743 731.1734 722.7998 756.8641 753.7331
[17] 698.0137 702.6193 700.6864 746.5140
> colVars(tmp5)
 [1]        NA  40.12281 123.71661  53.26866  19.56366  21.19038  41.55871
 [8]  43.17457  71.31673 145.49593  54.88722 135.09725  61.56050  68.56115
[15] 130.38897  86.01632 101.73048  83.74893  54.67195  40.90118
> colSd(tmp5)
 [1]        NA  6.334257 11.122797  7.298538  4.423082  4.603301  6.446604
 [8]  6.570736  8.444923 12.062170  7.408591 11.623134  7.846050  8.280166
[15] 11.418799  9.274498 10.086153  9.151444  7.394049  6.395403
> colMax(tmp5)
 [1]       NA 78.57533 87.22997 83.46409 73.55746 77.07827 82.54680 75.26673
 [9] 84.96963 95.31484 77.67804 90.71066 84.72466 83.94572 94.88921 96.47844
[17] 96.35658 85.37145 82.72132 84.25774
> colMin(tmp5)
 [1]       NA 59.35034 55.47905 59.64302 58.42151 64.12621 57.73871 54.06578
 [9] 61.10551 59.61253 55.90180 55.96710 58.69630 59.88266 57.93775 62.17783
[17] 61.41420 59.06481 58.93427 62.75270
> 
> Max(tmp5,na.rm=TRUE)
[1] 472.4079
> Min(tmp5,na.rm=TRUE)
[1] 54.06578
> mean(tmp5,na.rm=TRUE)
[1] 72.97246
> Sum(tmp5,na.rm=TRUE)
[1] 14521.52
> Var(tmp5,na.rm=TRUE)
[1] 882.729
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 94.94512 73.04498 69.87693 69.68672 69.35481 72.03941 71.93570 69.76769
 [9] 69.96812 68.92426
> rowSums(tmp5,na.rm=TRUE)
 [1] 1898.902 1460.900 1397.539 1393.734 1317.741 1440.788 1438.714 1395.354
 [9] 1399.362 1378.485
> rowVars(tmp5,na.rm=TRUE)
 [1] 7991.58299   63.12627   57.15575   64.02718   54.82184   85.50394
 [7]   80.75941   74.41472   74.07467   74.02145
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.395654  7.945204  7.560143  8.001699  7.404177  9.246834  8.986624
 [8]  8.626397  8.606664  8.603572
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.40789  84.96963  82.72132  87.22997  85.37042  96.47844  90.71066
 [8]  85.37145  89.44831  84.28284
> rowMin(tmp5,na.rm=TRUE)
 [1] 62.81566 59.06481 58.69630 57.93775 57.73871 55.90180 54.06578 55.96710
 [9] 54.36994 58.93427
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.33055  69.26819  68.69063  69.93642  67.66414  70.46041  70.05577
 [8]  65.39128  72.06136  74.33442  66.77410  72.47743  73.11734  72.27998
[15]  75.68641  75.37331  69.80137  70.26193  70.06864  74.65140
> colSums(tmp5,na.rm=TRUE)
 [1] 1037.9750  692.6819  686.9063  699.3642  676.6414  704.6041  700.5577
 [8]  653.9128  720.6136  743.3442  667.7410  724.7743  731.1734  722.7998
[15]  756.8641  753.7331  698.0137  702.6193  700.6864  746.5140
> colVars(tmp5,na.rm=TRUE)
 [1] 17998.24371    40.12281   123.71661    53.26866    19.56366    21.19038
 [7]    41.55871    43.17457    71.31673   145.49593    54.88722   135.09725
[13]    61.56050    68.56115   130.38897    86.01632   101.73048    83.74893
[19]    54.67195    40.90118
> colSd(tmp5,na.rm=TRUE)
 [1] 134.157533   6.334257  11.122797   7.298538   4.423082   4.603301
 [7]   6.446604   6.570736   8.444923  12.062170   7.408591  11.623134
[13]   7.846050   8.280166  11.418799   9.274498  10.086153   9.151444
[19]   7.394049   6.395403
> colMax(tmp5,na.rm=TRUE)
 [1] 472.40789  78.57533  87.22997  83.46409  73.55746  77.07827  82.54680
 [8]  75.26673  84.96963  95.31484  77.67804  90.71066  84.72466  83.94572
[15]  94.88921  96.47844  96.35658  85.37145  82.72132  84.25774
> colMin(tmp5,na.rm=TRUE)
 [1] 54.36994 59.35034 55.47905 59.64302 58.42151 64.12621 57.73871 54.06578
 [9] 61.10551 59.61253 55.90180 55.96710 58.69630 59.88266 57.93775 62.17783
[17] 61.41420 59.06481 58.93427 62.75270
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 94.94512 73.04498 69.87693 69.68672      NaN 72.03941 71.93570 69.76769
 [9] 69.96812 68.92426
> rowSums(tmp5,na.rm=TRUE)
 [1] 1898.902 1460.900 1397.539 1393.734    0.000 1440.788 1438.714 1395.354
 [9] 1399.362 1378.485
> rowVars(tmp5,na.rm=TRUE)
 [1] 7991.58299   63.12627   57.15575   64.02718         NA   85.50394
 [7]   80.75941   74.41472   74.07467   74.02145
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.395654  7.945204  7.560143  8.001699        NA  9.246834  8.986624
 [8]  8.626397  8.606664  8.603572
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.40789  84.96963  82.72132  87.22997        NA  96.47844  90.71066
 [8]  85.37145  89.44831  84.28284
> rowMin(tmp5,na.rm=TRUE)
 [1] 62.81566 59.06481 58.69630 57.93775       NA 55.90180 54.06578 55.96710
 [9] 54.36994 58.93427
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1]      NaN 69.68637 69.88362 71.08013 67.18379 70.33861 71.42433 64.80051
 [9] 73.07190 75.26138 66.08460 71.54483 73.16946 71.69851 74.61040 76.83947
[17] 70.00682 70.19713 69.96766 74.90643
> colSums(tmp5,na.rm=TRUE)
 [1]   0.0000 627.1774 628.9525 639.7212 604.6541 633.0475 642.8190 583.2046
 [9] 657.6471 677.3524 594.7614 643.9034 658.5252 645.2866 671.4936 691.5552
[17] 630.0614 631.7742 629.7090 674.1579
> colVars(tmp5,na.rm=TRUE)
 [1]        NA  43.17079 123.16988  45.21141  19.41339  23.67228  25.68274
 [8]  44.64506  68.74302 154.01637  56.39978 142.19964  69.22500  73.32768
[15] 133.66258  72.58492 113.97192  94.17032  61.39125  45.28210
> colSd(tmp5,na.rm=TRUE)
 [1]        NA  6.570448 11.098193  6.723943  4.406063  4.865416  5.067814
 [8]  6.681696  8.291141 12.410333  7.509978 11.924749  8.320156  8.563158
[15] 11.561253  8.519679 10.675763  9.704139  7.835257  6.729198
> colMax(tmp5,na.rm=TRUE)
 [1]     -Inf 78.57533 87.22997 83.46409 73.55746 77.07827 82.54680 75.26673
 [9] 84.96963 95.31484 77.67804 90.71066 84.72466 83.94572 94.88921 96.47844
[17] 96.35658 85.37145 82.72132 84.25774
> colMin(tmp5,na.rm=TRUE)
 [1]      Inf 59.35034 55.47905 62.42632 58.42151 64.12621 65.84136 54.06578
 [9] 61.10551 59.61253 55.90180 55.96710 58.69630 59.88266 57.93775 68.46763
[17] 61.41420 59.06481 58.93427 62.75270
> 
> 
> 
> 
> 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] 184.8999 162.1871 219.2929 131.2242 231.3635 128.8120 171.8491 192.4025
 [9] 290.5847 128.8327
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 184.8999 162.1871 219.2929 131.2242 231.3635 128.8120 171.8491 192.4025
 [9] 290.5847 128.8327
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -5.684342e-14  5.684342e-14  1.136868e-13 -1.705303e-13  1.705303e-13
 [6]  0.000000e+00  2.842171e-14 -2.842171e-13  5.684342e-14  5.684342e-14
[11] -5.684342e-14 -2.273737e-13  0.000000e+00  2.842171e-14  5.684342e-14
[16]  5.684342e-14  0.000000e+00 -1.136868e-13  5.684342e-14 -1.705303e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
8   17 
7   4 
10   13 
6   13 
3   8 
6   16 
1   13 
9   10 
4   15 
4   18 
5   6 
3   7 
9   18 
10   12 
2   1 
6   19 
6   10 
7   6 
9   3 
8   4 
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.459175
> Min(tmp)
[1] -2.657352
> mean(tmp)
[1] 0.04967805
> Sum(tmp)
[1] 4.967805
> Var(tmp)
[1] 0.8444353
> 
> rowMeans(tmp)
[1] 0.04967805
> rowSums(tmp)
[1] 4.967805
> rowVars(tmp)
[1] 0.8444353
> rowSd(tmp)
[1] 0.9189316
> rowMax(tmp)
[1] 2.459175
> rowMin(tmp)
[1] -2.657352
> 
> colMeans(tmp)
  [1] -0.769311354 -0.491474023  1.345768490  0.517671242 -0.039568179
  [6] -0.479443000 -0.028805477  0.640414735 -0.473971425 -0.064108876
 [11]  0.996114497 -0.533626490  1.056777167 -1.321333952  0.410301245
 [16]  0.767444551 -0.095529476  0.588261059 -0.889299059  0.315291117
 [21]  0.087189511  1.475012505  0.220668229  0.821743287 -1.578969529
 [26] -1.550022184  0.448023666 -1.782599862  0.262399299  1.158478812
 [31]  0.625767232 -0.958235343  0.416292630  0.832385750 -0.496830126
 [36]  0.247964475  0.944951485 -2.657351985 -0.103134161 -0.652695845
 [41]  0.063099785  0.970235102  1.258432633 -0.193953390 -1.174451957
 [46] -0.633254811  0.433626632  1.235755998  1.772250023 -0.755933476
 [51] -0.157007713 -1.090952905  0.346109815  1.078331508 -1.078381163
 [56]  0.344258510 -0.375883584  0.066027792  0.302213668 -1.262899921
 [61]  0.101416574 -0.430023257  0.743649480  1.428285351 -0.288723909
 [66]  0.704892127 -0.742108809  1.417705120  0.782199387 -0.249226384
 [71]  2.459174804 -1.014203247 -1.146450778  0.006884204 -0.649600787
 [76] -0.975239401  1.781727743  1.164108781 -1.701929655  0.596257555
 [81] -0.042985186  0.732687407 -0.538698394 -0.728930578 -0.845158298
 [86]  0.719966334 -0.086203378  0.399675505  0.442269422  0.326523939
 [91]  1.476218302  0.362207302 -0.132078972 -1.319243394  0.208268589
 [96] -1.069972576  0.886751438  0.142304540  0.776330464 -1.091155684
> colSums(tmp)
  [1] -0.769311354 -0.491474023  1.345768490  0.517671242 -0.039568179
  [6] -0.479443000 -0.028805477  0.640414735 -0.473971425 -0.064108876
 [11]  0.996114497 -0.533626490  1.056777167 -1.321333952  0.410301245
 [16]  0.767444551 -0.095529476  0.588261059 -0.889299059  0.315291117
 [21]  0.087189511  1.475012505  0.220668229  0.821743287 -1.578969529
 [26] -1.550022184  0.448023666 -1.782599862  0.262399299  1.158478812
 [31]  0.625767232 -0.958235343  0.416292630  0.832385750 -0.496830126
 [36]  0.247964475  0.944951485 -2.657351985 -0.103134161 -0.652695845
 [41]  0.063099785  0.970235102  1.258432633 -0.193953390 -1.174451957
 [46] -0.633254811  0.433626632  1.235755998  1.772250023 -0.755933476
 [51] -0.157007713 -1.090952905  0.346109815  1.078331508 -1.078381163
 [56]  0.344258510 -0.375883584  0.066027792  0.302213668 -1.262899921
 [61]  0.101416574 -0.430023257  0.743649480  1.428285351 -0.288723909
 [66]  0.704892127 -0.742108809  1.417705120  0.782199387 -0.249226384
 [71]  2.459174804 -1.014203247 -1.146450778  0.006884204 -0.649600787
 [76] -0.975239401  1.781727743  1.164108781 -1.701929655  0.596257555
 [81] -0.042985186  0.732687407 -0.538698394 -0.728930578 -0.845158298
 [86]  0.719966334 -0.086203378  0.399675505  0.442269422  0.326523939
 [91]  1.476218302  0.362207302 -0.132078972 -1.319243394  0.208268589
 [96] -1.069972576  0.886751438  0.142304540  0.776330464 -1.091155684
> 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.769311354 -0.491474023  1.345768490  0.517671242 -0.039568179
  [6] -0.479443000 -0.028805477  0.640414735 -0.473971425 -0.064108876
 [11]  0.996114497 -0.533626490  1.056777167 -1.321333952  0.410301245
 [16]  0.767444551 -0.095529476  0.588261059 -0.889299059  0.315291117
 [21]  0.087189511  1.475012505  0.220668229  0.821743287 -1.578969529
 [26] -1.550022184  0.448023666 -1.782599862  0.262399299  1.158478812
 [31]  0.625767232 -0.958235343  0.416292630  0.832385750 -0.496830126
 [36]  0.247964475  0.944951485 -2.657351985 -0.103134161 -0.652695845
 [41]  0.063099785  0.970235102  1.258432633 -0.193953390 -1.174451957
 [46] -0.633254811  0.433626632  1.235755998  1.772250023 -0.755933476
 [51] -0.157007713 -1.090952905  0.346109815  1.078331508 -1.078381163
 [56]  0.344258510 -0.375883584  0.066027792  0.302213668 -1.262899921
 [61]  0.101416574 -0.430023257  0.743649480  1.428285351 -0.288723909
 [66]  0.704892127 -0.742108809  1.417705120  0.782199387 -0.249226384
 [71]  2.459174804 -1.014203247 -1.146450778  0.006884204 -0.649600787
 [76] -0.975239401  1.781727743  1.164108781 -1.701929655  0.596257555
 [81] -0.042985186  0.732687407 -0.538698394 -0.728930578 -0.845158298
 [86]  0.719966334 -0.086203378  0.399675505  0.442269422  0.326523939
 [91]  1.476218302  0.362207302 -0.132078972 -1.319243394  0.208268589
 [96] -1.069972576  0.886751438  0.142304540  0.776330464 -1.091155684
> colMin(tmp)
  [1] -0.769311354 -0.491474023  1.345768490  0.517671242 -0.039568179
  [6] -0.479443000 -0.028805477  0.640414735 -0.473971425 -0.064108876
 [11]  0.996114497 -0.533626490  1.056777167 -1.321333952  0.410301245
 [16]  0.767444551 -0.095529476  0.588261059 -0.889299059  0.315291117
 [21]  0.087189511  1.475012505  0.220668229  0.821743287 -1.578969529
 [26] -1.550022184  0.448023666 -1.782599862  0.262399299  1.158478812
 [31]  0.625767232 -0.958235343  0.416292630  0.832385750 -0.496830126
 [36]  0.247964475  0.944951485 -2.657351985 -0.103134161 -0.652695845
 [41]  0.063099785  0.970235102  1.258432633 -0.193953390 -1.174451957
 [46] -0.633254811  0.433626632  1.235755998  1.772250023 -0.755933476
 [51] -0.157007713 -1.090952905  0.346109815  1.078331508 -1.078381163
 [56]  0.344258510 -0.375883584  0.066027792  0.302213668 -1.262899921
 [61]  0.101416574 -0.430023257  0.743649480  1.428285351 -0.288723909
 [66]  0.704892127 -0.742108809  1.417705120  0.782199387 -0.249226384
 [71]  2.459174804 -1.014203247 -1.146450778  0.006884204 -0.649600787
 [76] -0.975239401  1.781727743  1.164108781 -1.701929655  0.596257555
 [81] -0.042985186  0.732687407 -0.538698394 -0.728930578 -0.845158298
 [86]  0.719966334 -0.086203378  0.399675505  0.442269422  0.326523939
 [91]  1.476218302  0.362207302 -0.132078972 -1.319243394  0.208268589
 [96] -1.069972576  0.886751438  0.142304540  0.776330464 -1.091155684
> colMedians(tmp)
  [1] -0.769311354 -0.491474023  1.345768490  0.517671242 -0.039568179
  [6] -0.479443000 -0.028805477  0.640414735 -0.473971425 -0.064108876
 [11]  0.996114497 -0.533626490  1.056777167 -1.321333952  0.410301245
 [16]  0.767444551 -0.095529476  0.588261059 -0.889299059  0.315291117
 [21]  0.087189511  1.475012505  0.220668229  0.821743287 -1.578969529
 [26] -1.550022184  0.448023666 -1.782599862  0.262399299  1.158478812
 [31]  0.625767232 -0.958235343  0.416292630  0.832385750 -0.496830126
 [36]  0.247964475  0.944951485 -2.657351985 -0.103134161 -0.652695845
 [41]  0.063099785  0.970235102  1.258432633 -0.193953390 -1.174451957
 [46] -0.633254811  0.433626632  1.235755998  1.772250023 -0.755933476
 [51] -0.157007713 -1.090952905  0.346109815  1.078331508 -1.078381163
 [56]  0.344258510 -0.375883584  0.066027792  0.302213668 -1.262899921
 [61]  0.101416574 -0.430023257  0.743649480  1.428285351 -0.288723909
 [66]  0.704892127 -0.742108809  1.417705120  0.782199387 -0.249226384
 [71]  2.459174804 -1.014203247 -1.146450778  0.006884204 -0.649600787
 [76] -0.975239401  1.781727743  1.164108781 -1.701929655  0.596257555
 [81] -0.042985186  0.732687407 -0.538698394 -0.728930578 -0.845158298
 [86]  0.719966334 -0.086203378  0.399675505  0.442269422  0.326523939
 [91]  1.476218302  0.362207302 -0.132078972 -1.319243394  0.208268589
 [96] -1.069972576  0.886751438  0.142304540  0.776330464 -1.091155684
> colRanges(tmp)
           [,1]      [,2]     [,3]      [,4]        [,5]      [,6]        [,7]
[1,] -0.7693114 -0.491474 1.345768 0.5176712 -0.03956818 -0.479443 -0.02880548
[2,] -0.7693114 -0.491474 1.345768 0.5176712 -0.03956818 -0.479443 -0.02880548
          [,8]       [,9]       [,10]     [,11]      [,12]    [,13]     [,14]
[1,] 0.6404147 -0.4739714 -0.06410888 0.9961145 -0.5336265 1.056777 -1.321334
[2,] 0.6404147 -0.4739714 -0.06410888 0.9961145 -0.5336265 1.056777 -1.321334
         [,15]     [,16]       [,17]     [,18]      [,19]     [,20]      [,21]
[1,] 0.4103012 0.7674446 -0.09552948 0.5882611 -0.8892991 0.3152911 0.08718951
[2,] 0.4103012 0.7674446 -0.09552948 0.5882611 -0.8892991 0.3152911 0.08718951
        [,22]     [,23]     [,24]    [,25]     [,26]     [,27]   [,28]
[1,] 1.475013 0.2206682 0.8217433 -1.57897 -1.550022 0.4480237 -1.7826
[2,] 1.475013 0.2206682 0.8217433 -1.57897 -1.550022 0.4480237 -1.7826
         [,29]    [,30]     [,31]      [,32]     [,33]     [,34]      [,35]
[1,] 0.2623993 1.158479 0.6257672 -0.9582353 0.4162926 0.8323858 -0.4968301
[2,] 0.2623993 1.158479 0.6257672 -0.9582353 0.4162926 0.8323858 -0.4968301
         [,36]     [,37]     [,38]      [,39]      [,40]      [,41]     [,42]
[1,] 0.2479645 0.9449515 -2.657352 -0.1031342 -0.6526958 0.06309978 0.9702351
[2,] 0.2479645 0.9449515 -2.657352 -0.1031342 -0.6526958 0.06309978 0.9702351
        [,43]      [,44]     [,45]      [,46]     [,47]    [,48]   [,49]
[1,] 1.258433 -0.1939534 -1.174452 -0.6332548 0.4336266 1.235756 1.77225
[2,] 1.258433 -0.1939534 -1.174452 -0.6332548 0.4336266 1.235756 1.77225
          [,50]      [,51]     [,52]     [,53]    [,54]     [,55]     [,56]
[1,] -0.7559335 -0.1570077 -1.090953 0.3461098 1.078332 -1.078381 0.3442585
[2,] -0.7559335 -0.1570077 -1.090953 0.3461098 1.078332 -1.078381 0.3442585
          [,57]      [,58]     [,59]   [,60]     [,61]      [,62]     [,63]
[1,] -0.3758836 0.06602779 0.3022137 -1.2629 0.1014166 -0.4300233 0.7436495
[2,] -0.3758836 0.06602779 0.3022137 -1.2629 0.1014166 -0.4300233 0.7436495
        [,64]      [,65]     [,66]      [,67]    [,68]     [,69]      [,70]
[1,] 1.428285 -0.2887239 0.7048921 -0.7421088 1.417705 0.7821994 -0.2492264
[2,] 1.428285 -0.2887239 0.7048921 -0.7421088 1.417705 0.7821994 -0.2492264
        [,71]     [,72]     [,73]       [,74]      [,75]      [,76]    [,77]
[1,] 2.459175 -1.014203 -1.146451 0.006884204 -0.6496008 -0.9752394 1.781728
[2,] 2.459175 -1.014203 -1.146451 0.006884204 -0.6496008 -0.9752394 1.781728
        [,78]    [,79]     [,80]       [,81]     [,82]      [,83]      [,84]
[1,] 1.164109 -1.70193 0.5962576 -0.04298519 0.7326874 -0.5386984 -0.7289306
[2,] 1.164109 -1.70193 0.5962576 -0.04298519 0.7326874 -0.5386984 -0.7289306
          [,85]     [,86]       [,87]     [,88]     [,89]     [,90]    [,91]
[1,] -0.8451583 0.7199663 -0.08620338 0.3996755 0.4422694 0.3265239 1.476218
[2,] -0.8451583 0.7199663 -0.08620338 0.3996755 0.4422694 0.3265239 1.476218
         [,92]     [,93]     [,94]     [,95]     [,96]     [,97]     [,98]
[1,] 0.3622073 -0.132079 -1.319243 0.2082686 -1.069973 0.8867514 0.1423045
[2,] 0.3622073 -0.132079 -1.319243 0.2082686 -1.069973 0.8867514 0.1423045
         [,99]    [,100]
[1,] 0.7763305 -1.091156
[2,] 0.7763305 -1.091156
> 
> 
> Max(tmp2)
[1] 2.071716
> Min(tmp2)
[1] -2.551194
> mean(tmp2)
[1] -0.04288091
> Sum(tmp2)
[1] -4.288091
> Var(tmp2)
[1] 0.9941294
> 
> rowMeans(tmp2)
  [1] -0.864813102  1.492978463 -0.766774436  0.515594912  0.838879856
  [6]  0.830243189 -2.121105278  0.290026267 -0.003034921 -0.599253644
 [11] -0.496524253  0.882051048 -0.414246951 -0.270026266  0.527542761
 [16] -2.092879467  0.399028580  1.220222949 -1.220908691  0.555301935
 [21] -0.082651006  1.070771413  0.504237621 -1.737317173 -0.475607061
 [26]  0.531537803  0.385354373 -0.197291212 -0.998177891 -2.083722172
 [31] -0.700837491 -1.435493831 -0.648134828 -0.749915706  0.851410567
 [36]  1.147373238  2.071716172 -0.348569933  0.932882771 -1.541808091
 [41] -0.790753719 -0.500671576  2.023284476  0.715000589  1.156092889
 [46] -0.095182192 -0.632776100 -0.814207218  0.845710027  0.219183673
 [51] -1.827894100  0.079003623  0.202586799  0.006414274  0.057343449
 [56]  0.329181122 -1.016263313 -0.770056876 -0.109861960 -1.452763475
 [61] -0.748280221 -2.551194221 -0.105597854 -0.226774058 -0.266473403
 [66]  1.429589551  1.651870032  0.212645879 -1.257408902  0.582005623
 [71] -0.133038570  2.045871272 -0.112204365  0.152379221  1.059906426
 [76]  0.675320034  0.619023020 -0.080995038  0.667997508  0.175649676
 [81] -0.132558367  0.135351504 -0.319135472 -0.678616401  1.521987347
 [86]  0.575143133  0.176234072 -0.752745872 -1.234383140 -0.982191176
 [91]  0.720485390  0.821281212  1.773173550 -0.757479406  0.783012517
 [96] -0.192925705  1.413321228 -0.892557620 -1.515578701 -1.361631464
> rowSums(tmp2)
  [1] -0.864813102  1.492978463 -0.766774436  0.515594912  0.838879856
  [6]  0.830243189 -2.121105278  0.290026267 -0.003034921 -0.599253644
 [11] -0.496524253  0.882051048 -0.414246951 -0.270026266  0.527542761
 [16] -2.092879467  0.399028580  1.220222949 -1.220908691  0.555301935
 [21] -0.082651006  1.070771413  0.504237621 -1.737317173 -0.475607061
 [26]  0.531537803  0.385354373 -0.197291212 -0.998177891 -2.083722172
 [31] -0.700837491 -1.435493831 -0.648134828 -0.749915706  0.851410567
 [36]  1.147373238  2.071716172 -0.348569933  0.932882771 -1.541808091
 [41] -0.790753719 -0.500671576  2.023284476  0.715000589  1.156092889
 [46] -0.095182192 -0.632776100 -0.814207218  0.845710027  0.219183673
 [51] -1.827894100  0.079003623  0.202586799  0.006414274  0.057343449
 [56]  0.329181122 -1.016263313 -0.770056876 -0.109861960 -1.452763475
 [61] -0.748280221 -2.551194221 -0.105597854 -0.226774058 -0.266473403
 [66]  1.429589551  1.651870032  0.212645879 -1.257408902  0.582005623
 [71] -0.133038570  2.045871272 -0.112204365  0.152379221  1.059906426
 [76]  0.675320034  0.619023020 -0.080995038  0.667997508  0.175649676
 [81] -0.132558367  0.135351504 -0.319135472 -0.678616401  1.521987347
 [86]  0.575143133  0.176234072 -0.752745872 -1.234383140 -0.982191176
 [91]  0.720485390  0.821281212  1.773173550 -0.757479406  0.783012517
 [96] -0.192925705  1.413321228 -0.892557620 -1.515578701 -1.361631464
> 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.864813102  1.492978463 -0.766774436  0.515594912  0.838879856
  [6]  0.830243189 -2.121105278  0.290026267 -0.003034921 -0.599253644
 [11] -0.496524253  0.882051048 -0.414246951 -0.270026266  0.527542761
 [16] -2.092879467  0.399028580  1.220222949 -1.220908691  0.555301935
 [21] -0.082651006  1.070771413  0.504237621 -1.737317173 -0.475607061
 [26]  0.531537803  0.385354373 -0.197291212 -0.998177891 -2.083722172
 [31] -0.700837491 -1.435493831 -0.648134828 -0.749915706  0.851410567
 [36]  1.147373238  2.071716172 -0.348569933  0.932882771 -1.541808091
 [41] -0.790753719 -0.500671576  2.023284476  0.715000589  1.156092889
 [46] -0.095182192 -0.632776100 -0.814207218  0.845710027  0.219183673
 [51] -1.827894100  0.079003623  0.202586799  0.006414274  0.057343449
 [56]  0.329181122 -1.016263313 -0.770056876 -0.109861960 -1.452763475
 [61] -0.748280221 -2.551194221 -0.105597854 -0.226774058 -0.266473403
 [66]  1.429589551  1.651870032  0.212645879 -1.257408902  0.582005623
 [71] -0.133038570  2.045871272 -0.112204365  0.152379221  1.059906426
 [76]  0.675320034  0.619023020 -0.080995038  0.667997508  0.175649676
 [81] -0.132558367  0.135351504 -0.319135472 -0.678616401  1.521987347
 [86]  0.575143133  0.176234072 -0.752745872 -1.234383140 -0.982191176
 [91]  0.720485390  0.821281212  1.773173550 -0.757479406  0.783012517
 [96] -0.192925705  1.413321228 -0.892557620 -1.515578701 -1.361631464
> rowMin(tmp2)
  [1] -0.864813102  1.492978463 -0.766774436  0.515594912  0.838879856
  [6]  0.830243189 -2.121105278  0.290026267 -0.003034921 -0.599253644
 [11] -0.496524253  0.882051048 -0.414246951 -0.270026266  0.527542761
 [16] -2.092879467  0.399028580  1.220222949 -1.220908691  0.555301935
 [21] -0.082651006  1.070771413  0.504237621 -1.737317173 -0.475607061
 [26]  0.531537803  0.385354373 -0.197291212 -0.998177891 -2.083722172
 [31] -0.700837491 -1.435493831 -0.648134828 -0.749915706  0.851410567
 [36]  1.147373238  2.071716172 -0.348569933  0.932882771 -1.541808091
 [41] -0.790753719 -0.500671576  2.023284476  0.715000589  1.156092889
 [46] -0.095182192 -0.632776100 -0.814207218  0.845710027  0.219183673
 [51] -1.827894100  0.079003623  0.202586799  0.006414274  0.057343449
 [56]  0.329181122 -1.016263313 -0.770056876 -0.109861960 -1.452763475
 [61] -0.748280221 -2.551194221 -0.105597854 -0.226774058 -0.266473403
 [66]  1.429589551  1.651870032  0.212645879 -1.257408902  0.582005623
 [71] -0.133038570  2.045871272 -0.112204365  0.152379221  1.059906426
 [76]  0.675320034  0.619023020 -0.080995038  0.667997508  0.175649676
 [81] -0.132558367  0.135351504 -0.319135472 -0.678616401  1.521987347
 [86]  0.575143133  0.176234072 -0.752745872 -1.234383140 -0.982191176
 [91]  0.720485390  0.821281212  1.773173550 -0.757479406  0.783012517
 [96] -0.192925705  1.413321228 -0.892557620 -1.515578701 -1.361631464
> 
> colMeans(tmp2)
[1] -0.04288091
> colSums(tmp2)
[1] -4.288091
> colVars(tmp2)
[1] 0.9941294
> colSd(tmp2)
[1] 0.9970604
> colMax(tmp2)
[1] 2.071716
> colMin(tmp2)
[1] -2.551194
> colMedians(tmp2)
[1] -0.08182302
> colRanges(tmp2)
          [,1]
[1,] -2.551194
[2,]  2.071716
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.6890012  0.3255681  2.2630995 -2.1351842  2.6814538  5.0000462
 [7]  4.2315412 -3.3580288 -3.1680448 -2.9658309
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.7440082
[2,] -0.6158049
[3,] -0.2276883
[4,]  0.3372841
[5,]  1.0636072
> 
> rowApply(tmp,sum)
 [1] -3.6369497  1.5515664  1.8631461 -1.7034854  1.6775930 -0.4702468
 [7] -1.7695947 -2.4124809  4.8917122  2.1943589
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    3    5    5   10    4    4    4    3    8     8
 [2,]    7    4   10    1    1    2   10    6    3     5
 [3,]    4    8    1    8    9    6    5    9    4    10
 [4,]    1   10    7    2    7    5    3    2    5     7
 [5,]    9    9    6    9    6    9    7    4    9     1
 [6,]    6    6    4    6    2    8    9    8   10     9
 [7,]   10    7    9    5   10    3    6    7    6     4
 [8,]    8    1    8    3    3   10    1    1    2     3
 [9,]    5    2    3    4    5    7    2    5    1     6
[10,]    2    3    2    7    8    1    8   10    7     2
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.37523830  0.38235419 -0.10165849  1.23033910 -0.12713845  2.51122763
 [7] -0.42190189  1.61930002 -0.73637963  1.57573858  0.07207947 -1.24679404
[13]  1.65345979  0.09214519 -0.30654076  0.60405466 -1.06359361 -1.15876878
[19] -1.06797901  1.94326657
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.36947281
[2,] -1.28583099
[3,] -0.61496264
[4,]  0.06814603
[5,]  0.82688212
> 
> rowApply(tmp,sum)
[1]  4.725395 -1.938620  1.900066  1.485643 -3.094512
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    4   17   12    2    1
[2,]   14   10   10   11   13
[3,]   16    6   18    3    2
[4,]   20    8   16    7    8
[5,]   13    2    9    5   20
> 
> 
> as.matrix(tmp)
            [,1]        [,2]       [,3]       [,4]       [,5]      [,6]
[1,] -0.61496264  0.65181199  0.8210015  1.8292224  0.4825945 0.1744721
[2,]  0.82688212 -0.20954951 -0.6246498 -0.4616367 -0.9903468 1.1886606
[3,]  0.06814603 -0.03713619  1.5897423  0.7853890 -0.1313191 0.2253778
[4,] -1.28583099  0.02344792 -0.8301126 -0.5406081 -0.6258307 0.3815050
[5,] -1.36947281 -0.04622002 -1.0576400 -0.3820275  1.1377637 0.5412122
           [,7]        [,8]       [,9]       [,10]        [,11]      [,12]
[1,]  0.4391470  0.06302257  0.3346151 -0.91345298  0.009864485 -0.6496444
[2,]  0.3558171 -0.90970619 -0.1293973  0.14665297  1.309526132  0.5033951
[3,] -0.1933683  1.82865445 -0.7133965 -0.02202118 -0.478672686 -1.5708174
[4,] -0.4703587  0.66920949  0.1470743  3.02377769 -1.663322381  1.1570991
[5,] -0.5531390 -0.03188029 -0.3752752 -0.65921792  0.894683914 -0.6868264
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,]  0.9610779  0.6788924  0.2134058 -0.3225600  1.1619431  0.1441193
[2,]  1.5879060 -0.8989096 -0.5260348 -0.2225986 -2.0287469  0.1787976
[3,] -0.8891885  0.3077117  1.0519872  0.1946602 -0.4604671 -0.9524034
[4,] -0.4380632  0.5137646 -0.6944523  1.7697075  0.3742380 -0.3959549
[5,]  0.4317275 -0.5093140 -0.3514467 -0.8151545 -0.1105607 -0.1333273
          [,19]      [,20]
[1,] -1.6995537  0.9603790
[2,] -0.8619730 -0.1727080
[3,]  1.7363888 -0.4392014
[4,] -0.5915490  0.9619023
[5,]  0.3487079  0.6328947
> 
> 
> 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.17-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.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-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.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1      col2        col3      col4     col5      col6      col7
row1 0.1267369 -1.666132 -0.02416632 0.8458421 1.237305 0.1036904 -0.469205
          col8       col9    col10      col11     col12     col13      col14
row1 0.8105516 0.09336344 1.896439 -0.3029816 0.1974617 0.3411915 -0.2997915
         col15    col16     col17      col18      col19     col20
row1 -1.765083 0.505096 -2.329256 -0.2021545 -0.4866869 -0.882468
> tmp[,"col10"]
          col10
row1  1.8964392
row2  0.4928707
row3  2.4679602
row4 -0.5876467
row5 -1.4299772
> tmp[c("row1","row5"),]
          col1      col2        col3        col4     col5       col6      col7
row1 0.1267369 -1.666132 -0.02416632  0.84584209 1.237305  0.1036904 -0.469205
row5 0.4908508 -1.570360  1.42300378 -0.06968659 1.641508 -0.7107628 -1.897084
           col8       col9     col10      col11      col12     col13      col14
row1  0.8105516 0.09336344  1.896439 -0.3029816 0.19746168 0.3411915 -0.2997915
row5 -2.7718929 0.56296998 -1.429977 -0.3432896 0.01376006 0.2685719 -0.3864680
          col15      col16      col17      col18      col19     col20
row1 -1.7650834  0.5050960 -2.3292563 -0.2021545 -0.4866869 -0.882468
row5  0.2080208 -0.2294549 -0.1760887 -0.1711913 -0.8140016  0.207744
> tmp[,c("col6","col20")]
            col6      col20
row1  0.10369037 -0.8824680
row2  1.93564562  0.4950203
row3 -0.05170187 -1.4654741
row4  0.40145513  1.9106749
row5 -0.71076276  0.2077440
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1  0.1036904 -0.882468
row5 -0.7107628  0.207744
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3    col4     col5     col6     col7     col8
row1 49.88357 51.43671 49.63493 49.8251 49.87483 104.9871 51.76379 48.99155
        col9    col10    col11    col12    col13   col14    col15    col16
row1 48.7324 50.22699 50.00777 49.34644 48.24699 47.7636 50.43696 48.90321
        col17    col18    col19    col20
row1 49.16425 50.78493 48.83209 104.5576
> tmp[,"col10"]
        col10
row1 50.22699
row2 29.11807
row3 31.34354
row4 30.37841
row5 49.23338
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.88357 51.43671 49.63493 49.82510 49.87483 104.9871 51.76379 48.99155
row5 50.44768 50.61102 51.19016 50.49525 50.12847 104.1779 49.05793 50.84941
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.73240 50.22699 50.00777 49.34644 48.24699 47.76360 50.43696 48.90321
row5 52.12231 49.23338 51.25829 50.79322 49.66802 48.79925 49.60765 50.00155
        col17    col18    col19    col20
row1 49.16425 50.78493 48.83209 104.5576
row5 50.82425 50.53128 51.03325 105.8296
> tmp[,c("col6","col20")]
          col6     col20
row1 104.98713 104.55758
row2  74.17313  75.69678
row3  74.67480  73.84174
row4  74.16986  75.96093
row5 104.17794 105.82964
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.9871 104.5576
row5 104.1779 105.8296
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.9871 104.5576
row5 104.1779 105.8296
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  1.2784779
[2,] -0.9608031
[3,] -1.4742874
[4,] -0.4341712
[5,] -0.3490543
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.2474969  0.1693761
[2,] -1.0695876 -0.8736170
[3,]  1.1348023 -0.7971754
[4,] -1.6363915 -0.2041524
[5,] -1.4540104  0.7690288
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,] -0.4219959  0.45441086
[2,] -0.7405174 -0.06102231
[3,]  1.1220514  0.23239361
[4,]  0.9797580 -0.42767870
[5,]  1.7375731 -0.30726652
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.4219959
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.4219959
[2,] -0.7405174
> 
> 
> 
> 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 -1.5900744 1.41161300 0.1684774 -1.803888 -0.5219259 1.8828647 1.1044228
row1 -0.4561395 0.05442896 1.2281748 -1.083452 -1.0064592 0.3276643 0.9415699
          [,8]      [,9]     [,10]       [,11]      [,12]      [,13]      [,14]
row3 1.5724963 0.3249183 -1.461281  0.05006188  0.9096567  0.1918078 -1.1914066
row1 0.2136877 0.5741288  0.379571 -0.84622209 -0.4770666 -0.4000643  0.0344495
         [,15]     [,16]      [,17]      [,18]      [,19]     [,20]
row3 1.9360631 -1.593791 -0.5964349 0.31681227 -3.0365872 2.0221099
row1 0.6187347  0.696801 -0.6152484 0.03550626  0.8210302 0.1381213
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]     [,2]     [,3]      [,4]       [,5]      [,6]      [,7]
row2 1.140303 0.391009 1.437328 -1.675121 -0.4064952 0.5477955 -1.521992
          [,8]      [,9]     [,10]
row2 0.4116342 0.2512883 -1.189143
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]     [,3]       [,4]     [,5]      [,6]     [,7]
row5 -0.819588 0.5308054 1.429317 -0.5078615 1.956094 0.5012282 1.033644
         [,8]      [,9]      [,10]      [,11]      [,12]     [,13]      [,14]
row5 1.308531 0.2263995 -0.4740202 -0.2584417 -0.6923502 -1.030145 -0.5030282
          [,15]     [,16]     [,17]    [,18]     [,19]     [,20]
row5 -0.8699265 0.9846076 -0.310754 -1.04535 -1.035508 0.9568184
> 
> 
> 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: 0xaaaaf9ae7de0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b742163e984" 
 [2] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b7426f128fcd"
 [3] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b7421ed6a1bd"
 [4] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b7426a12e2d6"
 [5] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b7427a8f4edb"
 [6] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b742643a0c3b"
 [7] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b7421b9a2800"
 [8] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b7425f9919b0"
 [9] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b742614fc7f6"
[10] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b742153a5ab0"
[11] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b74220158e"  
[12] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b74249b7c42" 
[13] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b7422168cccc"
[14] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b7427ce7f5ec"
[15] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM29b74236bf8151"
> 
> 
> ### 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: 0xaaaaf972d480>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xaaaaf972d480>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xaaaaf972d480>
> rowMedians(tmp)
  [1]  0.038934496  0.244022675 -0.145464394 -0.158032485 -0.259065430
  [6] -0.614126156  0.023804322  0.076450493  0.153958469 -0.043390835
 [11]  0.171113674 -0.458955705  0.085932983 -0.319549784 -0.082068128
 [16]  0.044695298 -0.105158086 -0.551539153  0.569238933 -0.216151883
 [21] -0.361698329  0.243721912 -0.667349697  0.050724267 -0.098504260
 [26]  0.108223138  0.533891825 -0.074049487 -0.114408698 -0.584045297
 [31] -0.060475278 -0.540063400  0.352665725 -0.069281760 -0.029623215
 [36]  0.042763972  0.158010969  0.244738664 -0.011587327 -0.265901396
 [41]  0.099424579 -0.249105495  0.371755195 -0.623314117 -0.028332655
 [46]  0.015438496  0.565660009  0.187684684 -0.466777689  0.307496054
 [51] -0.105804820  0.125787500 -0.108033917  0.132119071 -0.253617815
 [56] -0.237873498 -0.162459790 -0.541944629  0.360286157 -0.038593861
 [61]  0.372376791  0.644775783 -0.106086266 -0.250352923  0.401322780
 [66] -0.005752572  0.113311624 -0.150375884 -0.022229381 -0.024775366
 [71] -0.073167308  0.139887666 -0.324269080 -0.003588909  0.072380354
 [76]  0.051446962 -0.805023411 -0.228958663  0.268436067 -0.530353542
 [81] -0.420085108  0.321382940 -0.061517450 -0.404295646  0.342504618
 [86]  0.022285858  0.270615202 -0.021719955  0.628654017 -0.415343327
 [91]  0.125884161  0.127731672 -0.118214699  0.293459316 -0.220854320
 [96]  0.454303601  0.216529342  0.236901677  0.241767658  0.160814300
[101]  0.153546429 -0.092028422  0.175657306 -0.304939844 -0.007710517
[106] -0.135997210 -0.168627756 -0.113705415 -0.518226549  0.537416156
[111] -0.007074585 -0.587490469  0.247646474 -0.420556861  0.049407148
[116]  0.105718291 -0.480678720 -0.026598186 -0.041942160  0.042677473
[121]  0.674317759  0.311086479  0.113228612 -0.583874897 -0.099327030
[126]  0.179390126  0.002292788 -0.993449473  0.533272814  0.490248438
[131]  0.175198801  0.382241871 -0.322555705  0.134257388  0.226147150
[136] -0.163661250 -0.404032433 -0.282785973  0.138125703  0.013055083
[141]  0.054093872  0.440335606  0.509264127  0.544431387  0.224389092
[146] -0.325923086  0.337055165  0.214820311 -0.074472769  0.410935133
[151]  0.285790493 -0.021370231 -0.696984698 -0.353484106 -0.132108868
[156] -0.290772109 -0.410454180 -0.085756411  0.121289344 -0.061415540
[161]  0.148808854 -0.059614537  0.227715796  0.439274376 -0.332572033
[166]  0.199670762  0.765663379 -0.105742273 -0.078479771 -0.098517677
[171] -0.118880111  0.189046949  0.149299368  0.143284977 -0.363080204
[176] -0.115059833  0.342872557  0.291486890 -0.273616545  0.590080416
[181]  0.376623392 -0.803026877  0.289388159 -0.320389642  0.291806678
[186] -0.098310283 -0.683345611  0.941961454  0.015028094 -0.023929896
[191] -0.341345851 -0.191727069  0.177268904  0.507219354  0.077126346
[196]  0.273038235 -0.044580605 -0.942878617  0.050616876  0.170709862
[201] -0.184721396 -0.531332412  0.301225300 -0.114348672  0.006988819
[206] -0.215003050  0.514190312  0.808127725 -0.302847295  0.625891836
[211] -0.433396519 -0.078000699  0.001958144 -0.276491963  0.319386419
[216] -0.775395913 -0.062380244  0.612243375 -0.256843474 -0.287157704
[221]  0.172449399 -0.464721465  0.442867351  0.110221256 -0.367419306
[226] -0.360119782 -0.201695087  0.084626631 -0.320538898 -0.110519520
> 
> proc.time()
   user  system elapsed 
  2.081   1.463   3.543 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-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: 0xaaaac3fe0900>
> .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: 0xaaaac3fe0900>
> .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: 0xaaaac3fe0900>
> .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: 0xaaaac3fe0900>
> 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: 0xaaaac47a1290>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac47a1290>
> .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: 0xaaaac47a1290>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac47a1290>
> .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: 0xaaaac47a1290>
> 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: 0xaaaac3f8ede0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac3f8ede0>
> .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: 0xaaaac3f8ede0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaaac3f8ede0>
> .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: 0xaaaac3f8ede0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0xaaaac3f8ede0>
> .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: 0xaaaac3f8ede0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0xaaaac3f8ede0>
> .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: 0xaaaac3f8ede0>
> 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: 0xaaaac480c390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0xaaaac480c390>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac480c390>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac480c390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile29b75a190bdbe0" "BufferedMatrixFile29b75a23617a2b"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile29b75a190bdbe0" "BufferedMatrixFile29b75a23617a2b"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac61459a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac61459a0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaaac61459a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaaac61459a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0xaaaac61459a0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0xaaaac61459a0>
> .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: 0xaaaac5c1c000>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac5c1c000>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaaac5c1c000>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0xaaaac5c1c000>
> 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: 0xaaaac6151520>
> .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: 0xaaaac6151520>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.355   0.043   0.380 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-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.361   0.074   0.417 

Example timings