Back to Multiple platform build/check report for BioC 3.22:   simplified   long
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

This page was generated on 2025-12-04 12:00 -0500 (Thu, 04 Dec 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.3 LTS)x86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4878
merida1macOS 12.7.6 Montereyx86_644.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 4624
taishanLinux (openEuler 24.03 LTS)aarch644.5.0 (2025-04-11) -- "How About a Twenty-Six" 4669
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

Package 257/2361HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.74.0  (landing page)
Ben Bolstad
Snapshot Date: 2025-12-01 13:45 -0500 (Mon, 01 Dec 2025)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_22
git_last_commit: d2ce144
git_last_commit_date: 2025-10-29 09:58:55 -0500 (Wed, 29 Oct 2025)
nebbiolo2Linux (Ubuntu 24.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
merida1macOS 12.7.6 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
taishanLinux (openEuler 24.03 LTS) / aarch64  OK    OK    OK  


CHECK results for BufferedMatrix on nebbiolo2

To the developers/maintainers of the BufferedMatrix package:
- 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 Troubleshooting Build Report for more information.
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.

raw results


Summary

Package: BufferedMatrix
Version: 1.74.0
Command: /home/biocbuild/bbs-3.22-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.22-bioc/R/site-library --timings BufferedMatrix_1.74.0.tar.gz
StartedAt: 2025-12-01 22:04:43 -0500 (Mon, 01 Dec 2025)
EndedAt: 2025-12-01 22:05:07 -0500 (Mon, 01 Dec 2025)
EllapsedTime: 24.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.5.2 (2025-10-31)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
    gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
    GNU Fortran (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
* running under: Ubuntu 24.04.3 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.74.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 13.3.0-6ubuntu2~24.04) 13.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 code 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 loading without being on the library search path ... 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
checkRd: (-1) BufferedMatrix-class.Rd:209: Lost braces; missing escapes or markup?
   209 |     $x^{power}$ elementwise of the matrix
       |        ^
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 ... OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.22-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** this is package ‘BufferedMatrix’ version ‘1.74.0’
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0’
gcc -std=gnu2x -I"/home/biocbuild/bbs-3.22-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -Werror=format-security -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -std=gnu2x -I"/home/biocbuild/bbs-3.22-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -Werror=format-security -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){
      |       ^~~~~~~~~~~~~~~~~~~
doubleBufferedMatrix.c: 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 -std=gnu2x -I"/home/biocbuild/bbs-3.22-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -Werror=format-security -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -std=gnu2x -I"/home/biocbuild/bbs-3.22-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -Werror=format-security -c init_package.c -o init_package.o
gcc -std=gnu2x -shared -L/home/biocbuild/bbs-3.22-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.22-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.22-bioc/R/site-library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.246   0.047   0.284 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.22-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 478284 25.6    1046725   56   639600 34.2
Vcells 884773  6.8    8388608   64  2081613 15.9
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Dec  1 22:04:58 2025"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon Dec  1 22:04:58 2025"
> 
> 
> 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: 0x563928391370>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Dec  1 22:04:58 2025"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon Dec  1 22:04:58 2025"
> 
> ColMode(tmp2)
<pointer: 0x563928391370>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]        [,2]       [,3]        [,4]
[1,] 99.56208800  0.19173021 -1.0210309  0.22856890
[2,] -2.22371348  0.06333479  0.3203122 -0.03601754
[3,] -0.09619041 -0.82570525 -0.2554332 -1.51807163
[4,]  1.23477706  0.48271881  0.6223589 -0.64967798
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]       [,2]      [,3]       [,4]
[1,] 99.56208800 0.19173021 1.0210309 0.22856890
[2,]  2.22371348 0.06333479 0.3203122 0.03601754
[3,]  0.09619041 0.82570525 0.2554332 1.51807163
[4,]  1.23477706 0.48271881 0.6223589 0.64967798
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9780804 0.4378701 1.0104607 0.4780888
[2,] 1.4912121 0.2516641 0.5659613 0.1897829
[3,] 0.3101458 0.9086832 0.5054040 1.2321005
[4,] 1.1112052 0.6947797 0.7888972 0.8060260
> 
> 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.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.34289 29.57043 36.12564 30.00946
[2,]  42.13583 27.57998 30.97992 26.93385
[3,]  28.19765 34.91254 30.30947 38.83908
[4,]  37.34683 32.43052 33.51133 33.70994
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x56392938d9b0>
> exp(tmp5)
<pointer: 0x56392938d9b0>
> log(tmp5,2)
<pointer: 0x56392938d9b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.9403
> Min(tmp5)
[1] 53.42225
> mean(tmp5)
[1] 72.6787
> Sum(tmp5)
[1] 14535.74
> Var(tmp5)
[1] 866.067
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.93272 67.19050 71.70408 71.11149 72.67111 67.30663 71.68989 71.87894
 [9] 68.15833 73.14335
> rowSums(tmp5)
 [1] 1838.654 1343.810 1434.082 1422.230 1453.422 1346.133 1433.798 1437.579
 [9] 1363.167 1462.867
> rowVars(tmp5)
 [1] 7840.86733   94.90580   74.25497   52.83077  102.06110   64.98614
 [7]   75.90291   80.66120   71.72793  133.37783
> rowSd(tmp5)
 [1] 88.548672  9.741961  8.617132  7.268478 10.102529  8.061398  8.712227
 [8]  8.981158  8.469234 11.548932
> rowMax(tmp5)
 [1] 466.94034  87.70022  85.86089  86.62420  90.32120  85.47230  92.19530
 [8]  91.41037  84.24387  97.25526
> rowMin(tmp5)
 [1] 61.54698 53.86364 53.62314 58.78933 53.43713 55.66040 56.20680 54.72003
 [9] 53.42225 53.96832
> 
> colMeans(tmp5)
 [1] 112.48485  67.91996  70.21375  67.61173  71.74676  73.09994  72.45191
 [8]  68.63108  69.45795  77.12795  68.16976  69.75234  71.94869  69.52211
[15]  74.32836  71.72906  71.83401  71.63546  66.45595  67.45247
> colSums(tmp5)
 [1] 1124.8485  679.1996  702.1375  676.1173  717.4676  730.9994  724.5191
 [8]  686.3108  694.5795  771.2795  681.6976  697.5234  719.4869  695.2211
[15]  743.2836  717.2906  718.3401  716.3546  664.5595  674.5247
> colVars(tmp5)
 [1] 15590.15976    60.46782    40.05539   105.78793   106.17705   170.04042
 [7]    54.35467    63.05105    86.11577    72.26171   107.79203    33.50085
[13]   104.25085    72.84953    94.28507    50.96460    93.91933    68.56359
[19]   142.96441    35.00180
> colSd(tmp5)
 [1] 124.860561   7.776106   6.328933  10.285326  10.304225  13.039955
 [7]   7.372562   7.940469   9.279858   8.500689  10.382294   5.787992
[13]  10.210331   8.535194   9.710050   7.138949   9.691199   8.280314
[19]  11.956773   5.916232
> colMax(tmp5)
 [1] 466.94034  79.21696  85.16910  84.70787  97.25526  92.19530  84.81885
 [8]  78.61658  82.37102  85.86089  83.97268  83.03620  91.41037  84.32645
[15]  89.95476  85.47230  86.62420  81.21513  86.37017  79.48383
> colMin(tmp5)
 [1] 58.68971 57.16405 63.08520 56.05927 59.35169 54.72003 61.84723 56.66585
 [9] 55.66040 61.85775 53.43713 62.37999 58.78933 53.86364 58.04232 63.10707
[17] 53.96832 59.61798 53.42225 59.61687
> 
> 
> ### 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] 91.93272 67.19050 71.70408 71.11149 72.67111 67.30663 71.68989       NA
 [9] 68.15833 73.14335
> rowSums(tmp5)
 [1] 1838.654 1343.810 1434.082 1422.230 1453.422 1346.133 1433.798       NA
 [9] 1363.167 1462.867
> rowVars(tmp5)
 [1] 7840.86733   94.90580   74.25497   52.83077  102.06110   64.98614
 [7]   75.90291   83.94743   71.72793  133.37783
> rowSd(tmp5)
 [1] 88.548672  9.741961  8.617132  7.268478 10.102529  8.061398  8.712227
 [8]  9.162283  8.469234 11.548932
> rowMax(tmp5)
 [1] 466.94034  87.70022  85.86089  86.62420  90.32120  85.47230  92.19530
 [8]        NA  84.24387  97.25526
> rowMin(tmp5)
 [1] 61.54698 53.86364 53.62314 58.78933 53.43713 55.66040 56.20680       NA
 [9] 53.42225 53.96832
> 
> colMeans(tmp5)
 [1] 112.48485  67.91996  70.21375  67.61173  71.74676  73.09994  72.45191
 [8]  68.63108  69.45795  77.12795  68.16976  69.75234  71.94869  69.52211
[15]  74.32836  71.72906  71.83401        NA  66.45595  67.45247
> colSums(tmp5)
 [1] 1124.8485  679.1996  702.1375  676.1173  717.4676  730.9994  724.5191
 [8]  686.3108  694.5795  771.2795  681.6976  697.5234  719.4869  695.2211
[15]  743.2836  717.2906  718.3401        NA  664.5595  674.5247
> colVars(tmp5)
 [1] 15590.15976    60.46782    40.05539   105.78793   106.17705   170.04042
 [7]    54.35467    63.05105    86.11577    72.26171   107.79203    33.50085
[13]   104.25085    72.84953    94.28507    50.96460    93.91933          NA
[19]   142.96441    35.00180
> colSd(tmp5)
 [1] 124.860561   7.776106   6.328933  10.285326  10.304225  13.039955
 [7]   7.372562   7.940469   9.279858   8.500689  10.382294   5.787992
[13]  10.210331   8.535194   9.710050   7.138949   9.691199         NA
[19]  11.956773   5.916232
> colMax(tmp5)
 [1] 466.94034  79.21696  85.16910  84.70787  97.25526  92.19530  84.81885
 [8]  78.61658  82.37102  85.86089  83.97268  83.03620  91.41037  84.32645
[15]  89.95476  85.47230  86.62420        NA  86.37017  79.48383
> colMin(tmp5)
 [1] 58.68971 57.16405 63.08520 56.05927 59.35169 54.72003 61.84723 56.66585
 [9] 55.66040 61.85775 53.43713 62.37999 58.78933 53.86364 58.04232 63.10707
[17] 53.96832       NA 53.42225 59.61687
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.9403
> Min(tmp5,na.rm=TRUE)
[1] 53.42225
> mean(tmp5,na.rm=TRUE)
[1] 72.66001
> Sum(tmp5,na.rm=TRUE)
[1] 14459.34
> Var(tmp5,na.rm=TRUE)
[1] 870.3709
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.93272 67.19050 71.70408 71.11149 72.67111 67.30663 71.68989 71.64103
 [9] 68.15833 73.14335
> rowSums(tmp5,na.rm=TRUE)
 [1] 1838.654 1343.810 1434.082 1422.230 1453.422 1346.133 1433.798 1361.180
 [9] 1363.167 1462.867
> rowVars(tmp5,na.rm=TRUE)
 [1] 7840.86733   94.90580   74.25497   52.83077  102.06110   64.98614
 [7]   75.90291   83.94743   71.72793  133.37783
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.548672  9.741961  8.617132  7.268478 10.102529  8.061398  8.712227
 [8]  9.162283  8.469234 11.548932
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.94034  87.70022  85.86089  86.62420  90.32120  85.47230  92.19530
 [8]  91.41037  84.24387  97.25526
> rowMin(tmp5,na.rm=TRUE)
 [1] 61.54698 53.86364 53.62314 58.78933 53.43713 55.66040 56.20680 54.72003
 [9] 53.42225 53.96832
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.48485  67.91996  70.21375  67.61173  71.74676  73.09994  72.45191
 [8]  68.63108  69.45795  77.12795  68.16976  69.75234  71.94869  69.52211
[15]  74.32836  71.72906  71.83401  71.10615  66.45595  67.45247
> colSums(tmp5,na.rm=TRUE)
 [1] 1124.8485  679.1996  702.1375  676.1173  717.4676  730.9994  724.5191
 [8]  686.3108  694.5795  771.2795  681.6976  697.5234  719.4869  695.2211
[15]  743.2836  717.2906  718.3401  639.9553  664.5595  674.5247
> colVars(tmp5,na.rm=TRUE)
 [1] 15590.15976    60.46782    40.05539   105.78793   106.17705   170.04042
 [7]    54.35467    63.05105    86.11577    72.26171   107.79203    33.50085
[13]   104.25085    72.84953    94.28507    50.96460    93.91933    73.98209
[19]   142.96441    35.00180
> colSd(tmp5,na.rm=TRUE)
 [1] 124.860561   7.776106   6.328933  10.285326  10.304225  13.039955
 [7]   7.372562   7.940469   9.279858   8.500689  10.382294   5.787992
[13]  10.210331   8.535194   9.710050   7.138949   9.691199   8.601284
[19]  11.956773   5.916232
> colMax(tmp5,na.rm=TRUE)
 [1] 466.94034  79.21696  85.16910  84.70787  97.25526  92.19530  84.81885
 [8]  78.61658  82.37102  85.86089  83.97268  83.03620  91.41037  84.32645
[15]  89.95476  85.47230  86.62420  81.21513  86.37017  79.48383
> colMin(tmp5,na.rm=TRUE)
 [1] 58.68971 57.16405 63.08520 56.05927 59.35169 54.72003 61.84723 56.66585
 [9] 55.66040 61.85775 53.43713 62.37999 58.78933 53.86364 58.04232 63.10707
[17] 53.96832 59.61798 53.42225 59.61687
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.93272 67.19050 71.70408 71.11149 72.67111 67.30663 71.68989      NaN
 [9] 68.15833 73.14335
> rowSums(tmp5,na.rm=TRUE)
 [1] 1838.654 1343.810 1434.082 1422.230 1453.422 1346.133 1433.798    0.000
 [9] 1363.167 1462.867
> rowVars(tmp5,na.rm=TRUE)
 [1] 7840.86733   94.90580   74.25497   52.83077  102.06110   64.98614
 [7]   75.90291         NA   71.72793  133.37783
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.548672  9.741961  8.617132  7.268478 10.102529  8.061398  8.712227
 [8]        NA  8.469234 11.548932
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.94034  87.70022  85.86089  86.62420  90.32120  85.47230  92.19530
 [8]        NA  84.24387  97.25526
> rowMin(tmp5,na.rm=TRUE)
 [1] 61.54698 53.86364 53.62314 58.78933 53.43713 55.66040 56.20680       NA
 [9] 53.42225 53.96832
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 117.53785  67.65609  70.77700  66.69265  71.49800  75.14216  71.07781
 [8]  67.91097  68.85235  77.93214  66.41388  70.57149  69.78628  70.92651
[15]  74.89618  72.01760  71.19475       NaN  65.67991  67.68159
> colSums(tmp5,na.rm=TRUE)
 [1] 1057.8406  608.9048  636.9930  600.2338  643.4820  676.2794  639.7003
 [8]  611.1987  619.6711  701.3893  597.7249  635.1434  628.0765  638.3386
[15]  674.0656  648.1584  640.7528    0.0000  591.1192  609.1343
> colVars(tmp5,na.rm=TRUE)
 [1] 17251.68547    67.24298    41.49328   109.50834   118.75300   144.37586
 [7]    39.90716    65.09859    92.75427    74.01883    86.58099    30.13961
[13]    64.67708    59.76666   102.44352    56.39851   101.06196          NA
[19]   154.05983    38.78647
> colSd(tmp5,na.rm=TRUE)
 [1] 131.345672   8.200181   6.441528  10.464623  10.897385  12.015651
 [7]   6.317211   8.068369   9.630902   8.603420   9.304891   5.489956
[13]   8.042206   7.730890  10.121439   7.509894  10.052958         NA
[19]  12.412084   6.227879
> colMax(tmp5,na.rm=TRUE)
 [1] 466.94034  79.21696  85.16910  84.70787  97.25526  92.19530  77.39495
 [8]  78.61658  82.37102  85.86089  82.46143  83.03620  83.25769  84.32645
[15]  89.95476  85.47230  86.62420      -Inf  86.37017  79.48383
> colMin(tmp5,na.rm=TRUE)
 [1] 58.68971 57.16405 63.08520 56.05927 59.35169 56.34914 61.84723 56.66585
 [9] 55.66040 61.85775 53.43713 65.14702 58.78933 53.86364 58.04232 63.10707
[17] 53.96832      Inf 53.42225 59.61687
> 
> 
> 
> 
> 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] 187.95541 253.48742 159.21872 221.07274 258.11645 272.17099  79.59553
 [8] 154.76527 185.15680 346.90482
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 187.95541 253.48742 159.21872 221.07274 258.11645 272.17099  79.59553
 [8] 154.76527 185.15680 346.90482
> 
> 
> 
> 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] -8.526513e-14 -1.421085e-14  1.136868e-13  4.263256e-14  7.105427e-14
 [6] -5.684342e-14  5.684342e-14 -5.684342e-14  0.000000e+00  2.842171e-14
[11] -8.526513e-14  2.842171e-14  0.000000e+00 -2.842171e-14  1.136868e-13
[16]  4.547474e-13  1.421085e-13 -5.684342e-14 -2.842171e-14  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
7   10 
9   1 
2   2 
1   1 
4   1 
10   4 
9   19 
9   2 
2   6 
1   7 
4   9 
6   2 
4   2 
9   12 
10   3 
6   4 
1   5 
10   2 
9   13 
2   11 
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.854718
> Min(tmp)
[1] -1.729279
> mean(tmp)
[1] 0.01847505
> Sum(tmp)
[1] 1.847505
> Var(tmp)
[1] 0.9051547
> 
> rowMeans(tmp)
[1] 0.01847505
> rowSums(tmp)
[1] 1.847505
> rowVars(tmp)
[1] 0.9051547
> rowSd(tmp)
[1] 0.9513962
> rowMax(tmp)
[1] 2.854718
> rowMin(tmp)
[1] -1.729279
> 
> colMeans(tmp)
  [1] -0.15905637  0.26502212  0.11951455 -0.79159126 -0.41630846  1.22064282
  [7] -0.41795823 -0.65877255 -0.06683307 -0.29831197 -0.79474155 -0.20335520
 [13] -0.42769315 -1.15365771 -0.03320953  1.00252282  0.63033768 -0.32211581
 [19]  0.28629932 -0.17176951 -0.32997092 -0.25457787 -0.29765489  0.66770672
 [25] -0.07852845  0.33217759  0.68561061  1.18737390  1.05874643 -1.72927860
 [31]  0.48898411  1.20416834 -0.78275567 -1.08144301  0.35956983  0.63026993
 [37]  1.45352562 -0.52584536  0.19427974  0.79903991  0.17398942  1.48561641
 [43]  0.09315980  0.62315875 -0.94559252 -0.59335848  0.16079982 -0.27021624
 [49] -0.73744928  1.59733519  0.80095817  0.09929621 -1.68293743  0.32115155
 [55] -1.57635239 -1.10255037  1.73940725 -0.49409891 -0.46533941 -1.13640454
 [61] -0.37795186  0.35078537 -1.41695270  0.62052545  1.98188785  1.01742681
 [67] -1.63375894 -1.17487638 -0.68721007  0.30574675  1.44550564  2.25043515
 [73]  0.26007454  2.85471842 -1.24924337 -1.69028533  0.01853858 -1.14226676
 [79] -1.65057055  1.40522795  1.04440680 -0.89599696  0.46041808 -0.94379327
 [85] -0.21279723  0.82816505 -0.28086520 -0.63850897  0.64220760  0.47924063
 [91] -0.89547474  0.61445995  1.53821575  1.03133238 -0.93355483  0.28461859
 [97] -0.64771612 -0.04459671  0.15696276 -0.90791113
> colSums(tmp)
  [1] -0.15905637  0.26502212  0.11951455 -0.79159126 -0.41630846  1.22064282
  [7] -0.41795823 -0.65877255 -0.06683307 -0.29831197 -0.79474155 -0.20335520
 [13] -0.42769315 -1.15365771 -0.03320953  1.00252282  0.63033768 -0.32211581
 [19]  0.28629932 -0.17176951 -0.32997092 -0.25457787 -0.29765489  0.66770672
 [25] -0.07852845  0.33217759  0.68561061  1.18737390  1.05874643 -1.72927860
 [31]  0.48898411  1.20416834 -0.78275567 -1.08144301  0.35956983  0.63026993
 [37]  1.45352562 -0.52584536  0.19427974  0.79903991  0.17398942  1.48561641
 [43]  0.09315980  0.62315875 -0.94559252 -0.59335848  0.16079982 -0.27021624
 [49] -0.73744928  1.59733519  0.80095817  0.09929621 -1.68293743  0.32115155
 [55] -1.57635239 -1.10255037  1.73940725 -0.49409891 -0.46533941 -1.13640454
 [61] -0.37795186  0.35078537 -1.41695270  0.62052545  1.98188785  1.01742681
 [67] -1.63375894 -1.17487638 -0.68721007  0.30574675  1.44550564  2.25043515
 [73]  0.26007454  2.85471842 -1.24924337 -1.69028533  0.01853858 -1.14226676
 [79] -1.65057055  1.40522795  1.04440680 -0.89599696  0.46041808 -0.94379327
 [85] -0.21279723  0.82816505 -0.28086520 -0.63850897  0.64220760  0.47924063
 [91] -0.89547474  0.61445995  1.53821575  1.03133238 -0.93355483  0.28461859
 [97] -0.64771612 -0.04459671  0.15696276 -0.90791113
> 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.15905637  0.26502212  0.11951455 -0.79159126 -0.41630846  1.22064282
  [7] -0.41795823 -0.65877255 -0.06683307 -0.29831197 -0.79474155 -0.20335520
 [13] -0.42769315 -1.15365771 -0.03320953  1.00252282  0.63033768 -0.32211581
 [19]  0.28629932 -0.17176951 -0.32997092 -0.25457787 -0.29765489  0.66770672
 [25] -0.07852845  0.33217759  0.68561061  1.18737390  1.05874643 -1.72927860
 [31]  0.48898411  1.20416834 -0.78275567 -1.08144301  0.35956983  0.63026993
 [37]  1.45352562 -0.52584536  0.19427974  0.79903991  0.17398942  1.48561641
 [43]  0.09315980  0.62315875 -0.94559252 -0.59335848  0.16079982 -0.27021624
 [49] -0.73744928  1.59733519  0.80095817  0.09929621 -1.68293743  0.32115155
 [55] -1.57635239 -1.10255037  1.73940725 -0.49409891 -0.46533941 -1.13640454
 [61] -0.37795186  0.35078537 -1.41695270  0.62052545  1.98188785  1.01742681
 [67] -1.63375894 -1.17487638 -0.68721007  0.30574675  1.44550564  2.25043515
 [73]  0.26007454  2.85471842 -1.24924337 -1.69028533  0.01853858 -1.14226676
 [79] -1.65057055  1.40522795  1.04440680 -0.89599696  0.46041808 -0.94379327
 [85] -0.21279723  0.82816505 -0.28086520 -0.63850897  0.64220760  0.47924063
 [91] -0.89547474  0.61445995  1.53821575  1.03133238 -0.93355483  0.28461859
 [97] -0.64771612 -0.04459671  0.15696276 -0.90791113
> colMin(tmp)
  [1] -0.15905637  0.26502212  0.11951455 -0.79159126 -0.41630846  1.22064282
  [7] -0.41795823 -0.65877255 -0.06683307 -0.29831197 -0.79474155 -0.20335520
 [13] -0.42769315 -1.15365771 -0.03320953  1.00252282  0.63033768 -0.32211581
 [19]  0.28629932 -0.17176951 -0.32997092 -0.25457787 -0.29765489  0.66770672
 [25] -0.07852845  0.33217759  0.68561061  1.18737390  1.05874643 -1.72927860
 [31]  0.48898411  1.20416834 -0.78275567 -1.08144301  0.35956983  0.63026993
 [37]  1.45352562 -0.52584536  0.19427974  0.79903991  0.17398942  1.48561641
 [43]  0.09315980  0.62315875 -0.94559252 -0.59335848  0.16079982 -0.27021624
 [49] -0.73744928  1.59733519  0.80095817  0.09929621 -1.68293743  0.32115155
 [55] -1.57635239 -1.10255037  1.73940725 -0.49409891 -0.46533941 -1.13640454
 [61] -0.37795186  0.35078537 -1.41695270  0.62052545  1.98188785  1.01742681
 [67] -1.63375894 -1.17487638 -0.68721007  0.30574675  1.44550564  2.25043515
 [73]  0.26007454  2.85471842 -1.24924337 -1.69028533  0.01853858 -1.14226676
 [79] -1.65057055  1.40522795  1.04440680 -0.89599696  0.46041808 -0.94379327
 [85] -0.21279723  0.82816505 -0.28086520 -0.63850897  0.64220760  0.47924063
 [91] -0.89547474  0.61445995  1.53821575  1.03133238 -0.93355483  0.28461859
 [97] -0.64771612 -0.04459671  0.15696276 -0.90791113
> colMedians(tmp)
  [1] -0.15905637  0.26502212  0.11951455 -0.79159126 -0.41630846  1.22064282
  [7] -0.41795823 -0.65877255 -0.06683307 -0.29831197 -0.79474155 -0.20335520
 [13] -0.42769315 -1.15365771 -0.03320953  1.00252282  0.63033768 -0.32211581
 [19]  0.28629932 -0.17176951 -0.32997092 -0.25457787 -0.29765489  0.66770672
 [25] -0.07852845  0.33217759  0.68561061  1.18737390  1.05874643 -1.72927860
 [31]  0.48898411  1.20416834 -0.78275567 -1.08144301  0.35956983  0.63026993
 [37]  1.45352562 -0.52584536  0.19427974  0.79903991  0.17398942  1.48561641
 [43]  0.09315980  0.62315875 -0.94559252 -0.59335848  0.16079982 -0.27021624
 [49] -0.73744928  1.59733519  0.80095817  0.09929621 -1.68293743  0.32115155
 [55] -1.57635239 -1.10255037  1.73940725 -0.49409891 -0.46533941 -1.13640454
 [61] -0.37795186  0.35078537 -1.41695270  0.62052545  1.98188785  1.01742681
 [67] -1.63375894 -1.17487638 -0.68721007  0.30574675  1.44550564  2.25043515
 [73]  0.26007454  2.85471842 -1.24924337 -1.69028533  0.01853858 -1.14226676
 [79] -1.65057055  1.40522795  1.04440680 -0.89599696  0.46041808 -0.94379327
 [85] -0.21279723  0.82816505 -0.28086520 -0.63850897  0.64220760  0.47924063
 [91] -0.89547474  0.61445995  1.53821575  1.03133238 -0.93355483  0.28461859
 [97] -0.64771612 -0.04459671  0.15696276 -0.90791113
> colRanges(tmp)
           [,1]      [,2]      [,3]       [,4]       [,5]     [,6]       [,7]
[1,] -0.1590564 0.2650221 0.1195145 -0.7915913 -0.4163085 1.220643 -0.4179582
[2,] -0.1590564 0.2650221 0.1195145 -0.7915913 -0.4163085 1.220643 -0.4179582
           [,8]        [,9]     [,10]      [,11]      [,12]      [,13]
[1,] -0.6587726 -0.06683307 -0.298312 -0.7947415 -0.2033552 -0.4276932
[2,] -0.6587726 -0.06683307 -0.298312 -0.7947415 -0.2033552 -0.4276932
         [,14]       [,15]    [,16]     [,17]      [,18]     [,19]      [,20]
[1,] -1.153658 -0.03320953 1.002523 0.6303377 -0.3221158 0.2862993 -0.1717695
[2,] -1.153658 -0.03320953 1.002523 0.6303377 -0.3221158 0.2862993 -0.1717695
          [,21]      [,22]      [,23]     [,24]       [,25]     [,26]     [,27]
[1,] -0.3299709 -0.2545779 -0.2976549 0.6677067 -0.07852845 0.3321776 0.6856106
[2,] -0.3299709 -0.2545779 -0.2976549 0.6677067 -0.07852845 0.3321776 0.6856106
        [,28]    [,29]     [,30]     [,31]    [,32]      [,33]     [,34]
[1,] 1.187374 1.058746 -1.729279 0.4889841 1.204168 -0.7827557 -1.081443
[2,] 1.187374 1.058746 -1.729279 0.4889841 1.204168 -0.7827557 -1.081443
         [,35]     [,36]    [,37]      [,38]     [,39]     [,40]     [,41]
[1,] 0.3595698 0.6302699 1.453526 -0.5258454 0.1942797 0.7990399 0.1739894
[2,] 0.3595698 0.6302699 1.453526 -0.5258454 0.1942797 0.7990399 0.1739894
        [,42]     [,43]     [,44]      [,45]      [,46]     [,47]      [,48]
[1,] 1.485616 0.0931598 0.6231588 -0.9455925 -0.5933585 0.1607998 -0.2702162
[2,] 1.485616 0.0931598 0.6231588 -0.9455925 -0.5933585 0.1607998 -0.2702162
          [,49]    [,50]     [,51]      [,52]     [,53]     [,54]     [,55]
[1,] -0.7374493 1.597335 0.8009582 0.09929621 -1.682937 0.3211515 -1.576352
[2,] -0.7374493 1.597335 0.8009582 0.09929621 -1.682937 0.3211515 -1.576352
        [,56]    [,57]      [,58]      [,59]     [,60]      [,61]     [,62]
[1,] -1.10255 1.739407 -0.4940989 -0.4653394 -1.136405 -0.3779519 0.3507854
[2,] -1.10255 1.739407 -0.4940989 -0.4653394 -1.136405 -0.3779519 0.3507854
         [,63]     [,64]    [,65]    [,66]     [,67]     [,68]      [,69]
[1,] -1.416953 0.6205254 1.981888 1.017427 -1.633759 -1.174876 -0.6872101
[2,] -1.416953 0.6205254 1.981888 1.017427 -1.633759 -1.174876 -0.6872101
         [,70]    [,71]    [,72]     [,73]    [,74]     [,75]     [,76]
[1,] 0.3057468 1.445506 2.250435 0.2600745 2.854718 -1.249243 -1.690285
[2,] 0.3057468 1.445506 2.250435 0.2600745 2.854718 -1.249243 -1.690285
          [,77]     [,78]     [,79]    [,80]    [,81]     [,82]     [,83]
[1,] 0.01853858 -1.142267 -1.650571 1.405228 1.044407 -0.895997 0.4604181
[2,] 0.01853858 -1.142267 -1.650571 1.405228 1.044407 -0.895997 0.4604181
          [,84]      [,85]    [,86]      [,87]     [,88]     [,89]     [,90]
[1,] -0.9437933 -0.2127972 0.828165 -0.2808652 -0.638509 0.6422076 0.4792406
[2,] -0.9437933 -0.2127972 0.828165 -0.2808652 -0.638509 0.6422076 0.4792406
          [,91]     [,92]    [,93]    [,94]      [,95]     [,96]      [,97]
[1,] -0.8954747 0.6144599 1.538216 1.031332 -0.9335548 0.2846186 -0.6477161
[2,] -0.8954747 0.6144599 1.538216 1.031332 -0.9335548 0.2846186 -0.6477161
           [,98]     [,99]     [,100]
[1,] -0.04459671 0.1569628 -0.9079111
[2,] -0.04459671 0.1569628 -0.9079111
> 
> 
> Max(tmp2)
[1] 2.678467
> Min(tmp2)
[1] -2.265665
> mean(tmp2)
[1] 0.002614417
> Sum(tmp2)
[1] 0.2614417
> Var(tmp2)
[1] 1.167887
> 
> rowMeans(tmp2)
  [1]  0.23035091 -0.06402257 -1.25846877 -0.61423355 -0.57408879  0.72725964
  [7]  0.13784373  0.87412300 -0.40497264 -0.67428073  0.91995510 -0.57770597
 [13] -0.21495502  0.21963041 -1.44158379  0.71550539 -1.04835543  1.26668839
 [19] -0.46225745 -1.44603703  0.39956643  0.09735128  2.67846694 -1.20432614
 [25]  0.25179393  0.31155750 -0.38159040  0.06881937  0.51682968 -0.86151997
 [31]  0.62519127  1.43654972  0.46452124  1.19586654  0.76378735  0.77494525
 [37] -0.54065242  1.39864612 -0.61202102  1.28405590 -0.24842419 -0.57188786
 [43]  0.27695139 -2.17242920 -0.69029404  1.15201601  2.50189670  0.24810447
 [49] -0.02243976  1.02046502 -0.04158084  1.36346384  1.49328911 -1.85077698
 [55] -1.90411276 -1.24873620 -0.38303874  1.51229647  0.56562026 -0.54132085
 [61]  0.18395725 -1.60863588 -1.75176488 -0.78111737  0.51486665  1.37671283
 [67] -1.31519998 -2.26566509 -0.20732865 -1.73024627  1.91198681  0.29957151
 [73] -0.42519166 -1.04144270  1.65119396  0.65637476 -1.33710549  0.39569491
 [79] -0.37351322 -0.04428053  0.89299970  0.27419102  0.05257417 -1.25940590
 [85]  1.19945244  0.56696023 -0.20912215  0.55506359  0.96207193 -2.16896357
 [91] -1.75800108  0.70418372  0.97972546  0.54162286  1.32989556  0.65162019
 [97] -1.31051080 -0.34739114 -1.98223456  1.04054784
> rowSums(tmp2)
  [1]  0.23035091 -0.06402257 -1.25846877 -0.61423355 -0.57408879  0.72725964
  [7]  0.13784373  0.87412300 -0.40497264 -0.67428073  0.91995510 -0.57770597
 [13] -0.21495502  0.21963041 -1.44158379  0.71550539 -1.04835543  1.26668839
 [19] -0.46225745 -1.44603703  0.39956643  0.09735128  2.67846694 -1.20432614
 [25]  0.25179393  0.31155750 -0.38159040  0.06881937  0.51682968 -0.86151997
 [31]  0.62519127  1.43654972  0.46452124  1.19586654  0.76378735  0.77494525
 [37] -0.54065242  1.39864612 -0.61202102  1.28405590 -0.24842419 -0.57188786
 [43]  0.27695139 -2.17242920 -0.69029404  1.15201601  2.50189670  0.24810447
 [49] -0.02243976  1.02046502 -0.04158084  1.36346384  1.49328911 -1.85077698
 [55] -1.90411276 -1.24873620 -0.38303874  1.51229647  0.56562026 -0.54132085
 [61]  0.18395725 -1.60863588 -1.75176488 -0.78111737  0.51486665  1.37671283
 [67] -1.31519998 -2.26566509 -0.20732865 -1.73024627  1.91198681  0.29957151
 [73] -0.42519166 -1.04144270  1.65119396  0.65637476 -1.33710549  0.39569491
 [79] -0.37351322 -0.04428053  0.89299970  0.27419102  0.05257417 -1.25940590
 [85]  1.19945244  0.56696023 -0.20912215  0.55506359  0.96207193 -2.16896357
 [91] -1.75800108  0.70418372  0.97972546  0.54162286  1.32989556  0.65162019
 [97] -1.31051080 -0.34739114 -1.98223456  1.04054784
> 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.23035091 -0.06402257 -1.25846877 -0.61423355 -0.57408879  0.72725964
  [7]  0.13784373  0.87412300 -0.40497264 -0.67428073  0.91995510 -0.57770597
 [13] -0.21495502  0.21963041 -1.44158379  0.71550539 -1.04835543  1.26668839
 [19] -0.46225745 -1.44603703  0.39956643  0.09735128  2.67846694 -1.20432614
 [25]  0.25179393  0.31155750 -0.38159040  0.06881937  0.51682968 -0.86151997
 [31]  0.62519127  1.43654972  0.46452124  1.19586654  0.76378735  0.77494525
 [37] -0.54065242  1.39864612 -0.61202102  1.28405590 -0.24842419 -0.57188786
 [43]  0.27695139 -2.17242920 -0.69029404  1.15201601  2.50189670  0.24810447
 [49] -0.02243976  1.02046502 -0.04158084  1.36346384  1.49328911 -1.85077698
 [55] -1.90411276 -1.24873620 -0.38303874  1.51229647  0.56562026 -0.54132085
 [61]  0.18395725 -1.60863588 -1.75176488 -0.78111737  0.51486665  1.37671283
 [67] -1.31519998 -2.26566509 -0.20732865 -1.73024627  1.91198681  0.29957151
 [73] -0.42519166 -1.04144270  1.65119396  0.65637476 -1.33710549  0.39569491
 [79] -0.37351322 -0.04428053  0.89299970  0.27419102  0.05257417 -1.25940590
 [85]  1.19945244  0.56696023 -0.20912215  0.55506359  0.96207193 -2.16896357
 [91] -1.75800108  0.70418372  0.97972546  0.54162286  1.32989556  0.65162019
 [97] -1.31051080 -0.34739114 -1.98223456  1.04054784
> rowMin(tmp2)
  [1]  0.23035091 -0.06402257 -1.25846877 -0.61423355 -0.57408879  0.72725964
  [7]  0.13784373  0.87412300 -0.40497264 -0.67428073  0.91995510 -0.57770597
 [13] -0.21495502  0.21963041 -1.44158379  0.71550539 -1.04835543  1.26668839
 [19] -0.46225745 -1.44603703  0.39956643  0.09735128  2.67846694 -1.20432614
 [25]  0.25179393  0.31155750 -0.38159040  0.06881937  0.51682968 -0.86151997
 [31]  0.62519127  1.43654972  0.46452124  1.19586654  0.76378735  0.77494525
 [37] -0.54065242  1.39864612 -0.61202102  1.28405590 -0.24842419 -0.57188786
 [43]  0.27695139 -2.17242920 -0.69029404  1.15201601  2.50189670  0.24810447
 [49] -0.02243976  1.02046502 -0.04158084  1.36346384  1.49328911 -1.85077698
 [55] -1.90411276 -1.24873620 -0.38303874  1.51229647  0.56562026 -0.54132085
 [61]  0.18395725 -1.60863588 -1.75176488 -0.78111737  0.51486665  1.37671283
 [67] -1.31519998 -2.26566509 -0.20732865 -1.73024627  1.91198681  0.29957151
 [73] -0.42519166 -1.04144270  1.65119396  0.65637476 -1.33710549  0.39569491
 [79] -0.37351322 -0.04428053  0.89299970  0.27419102  0.05257417 -1.25940590
 [85]  1.19945244  0.56696023 -0.20912215  0.55506359  0.96207193 -2.16896357
 [91] -1.75800108  0.70418372  0.97972546  0.54162286  1.32989556  0.65162019
 [97] -1.31051080 -0.34739114 -1.98223456  1.04054784
> 
> colMeans(tmp2)
[1] 0.002614417
> colSums(tmp2)
[1] 0.2614417
> colVars(tmp2)
[1] 1.167887
> colSd(tmp2)
[1] 1.080688
> colMax(tmp2)
[1] 2.678467
> colMin(tmp2)
[1] -2.265665
> colMedians(tmp2)
[1] 0.1175975
> colRanges(tmp2)
          [,1]
[1,] -2.265665
[2,]  2.678467
> 
> 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] -2.2799041 -3.3097878 -0.8012412  1.2463992  0.4170415  1.3605951
 [7]  4.0682081 -5.3960406  1.1880793 -0.5646853
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.1500057
[2,] -0.9826718
[3,] -0.1514872
[4,]  0.1728165
[5,]  2.6750163
> 
> rowApply(tmp,sum)
 [1] -6.3380591 -1.5690317 -0.8234809  4.8451629  1.8140573 -2.8472984
 [7] -2.1182531  1.1136738  2.1089984 -0.2571049
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    2    6    4   10    6    2    7    5    1     5
 [2,]    6    9    5    2    3    5    4    9    2     1
 [3,]    5    3    9    1   10    1   10    2    7     8
 [4,]    1    2    8    9    1    9    8    7    5    10
 [5,]    4   10    2    5    9    3    6   10    4     3
 [6,]    8    7   10    4    4   10    3    3    6     2
 [7,]    9    8    6    8    2    8    9    8    3     7
 [8,]    7    1    1    6    7    6    1    4    8     4
 [9,]   10    5    3    3    8    7    2    6   10     6
[10,]    3    4    7    7    5    4    5    1    9     9
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.0232855 -1.3396683 -3.4908536 -0.4300454  0.8385368 -4.7085967
 [7]  4.6084504 -2.7706976 -1.4242978  0.1690770  1.3820152  0.8900509
[13] -1.0106592 -2.0809672  0.9176927  0.2514231 -3.6515010  1.5752638
[19]  0.1769017 -1.0278502
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.6812903
[2,] -0.5470590
[3,]  1.1183857
[4,]  1.2985336
[5,]  1.8347154
> 
> rowApply(tmp,sum)
[1] -4.244454  3.281822 -5.282311 -3.000595  1.143099
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   18    6   20    6   18
[2,]    3   17   14   10    3
[3,]    8    2    9   11    2
[4,]   12    5   18   13    7
[5,]   19   13   17    3    8
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]       [,5]       [,6]
[1,]  1.1183857 -1.1818669 -0.4316619 -0.16442222  1.1279177 -1.5937100
[2,] -0.5470590  0.8758636 -0.8378174 -0.56192187  0.5792622 -1.1184522
[3,]  1.8347154  0.1681476 -0.5317361  0.78078874  0.6539802 -0.7173207
[4,] -0.6812903 -0.3207223 -0.2374749  0.09518991 -1.1186747 -1.5694422
[5,]  1.2985336 -0.8810903 -1.4521633 -0.57967992 -0.4039485  0.2903284
           [,7]       [,8]        [,9]      [,10]      [,11]       [,12]
[1,]  1.4100063 -1.5016410  0.31963482 -1.0222487  1.0389567  0.80617354
[2,]  0.8046909  0.9298830  0.05695761  0.6569261  1.5178472  0.16353312
[3,]  1.4960171 -2.5711940 -0.29802430  0.3965589 -0.1943122  0.20710536
[4,] -0.3284937  0.2461322 -0.71807734 -1.2744378  1.0286947 -0.33328290
[5,]  1.2262299  0.1261221 -0.78478856  1.4122785 -2.0091711  0.04652176
          [,13]      [,14]        [,15]      [,16]      [,17]       [,18]
[1,] -0.4226958 -0.7749351 -1.102986885 -1.0760691 -0.1412744 -0.02235955
[2,]  0.2170090  0.7512503  0.378412390 -0.4994442 -0.5742774  0.88485778
[3,] -0.6584324 -1.1842095  0.001361884 -0.5511691 -1.2906748 -1.23889203
[4,]  0.7071807 -0.6118109  0.421742785  1.6213169 -0.8591842  0.13713051
[5,] -0.8537207 -0.2612620  1.219162481  0.7567887 -0.7860902  1.81452706
          [,19]       [,20]
[1,] -0.3580318 -0.27162524
[2,] -0.6428923  0.24719280
[3,] -0.5205967 -1.06442447
[4,]  0.7620687  0.03283936
[5,]  0.9363538  0.02816736
> 
> 
> 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.22-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.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1      col2      col3      col4       col5      col6     col7
row1 -1.862171 -2.066061 0.4141304 0.2466556 -0.7139864 -0.296387 2.480434
           col8       col9       col10      col11    col12    col13      col14
row1 -0.3751746 -0.1410131 -0.05769665 0.07505623 1.420736 1.499347 -0.6825858
         col15      col16      col17      col18      col19      col20
row1 0.9973362 -0.6110202 -0.4034463 -0.7432983 -0.6073838 -0.5628212
> tmp[,"col10"]
           col10
row1 -0.05769665
row2 -0.98147494
row3  0.68535152
row4  0.53017838
row5 -0.43103251
> tmp[c("row1","row5"),]
          col1      col2       col3      col4       col5       col6     col7
row1 -1.862171 -2.066061  0.4141304 0.2466556 -0.7139864 -0.2963870 2.480434
row5 -1.408136 -1.334449 -0.2529986 1.5624941  0.1208563  0.8721172 2.850867
           col8       col9       col10       col11      col12      col13
row1 -0.3751746 -0.1410131 -0.05769665  0.07505623  1.4207358  1.4993465
row5 -0.7123346 -0.3981545 -0.43103251 -0.97800263 -0.1587215 -0.5301181
          col14     col15      col16      col17      col18      col19
row1 -0.6825858 0.9973362 -0.6110202 -0.4034463 -0.7432983 -0.6073838
row5 -1.0384323 0.7701307  1.3885157  1.2992563  0.6720105 -0.6206506
          col20
row1 -0.5628212
row5  2.2038613
> tmp[,c("col6","col20")]
            col6      col20
row1 -0.29638698 -0.5628212
row2  0.09199817 -1.6359361
row3 -0.88874299 -0.5911503
row4 -1.34894239  0.3558560
row5  0.87211716  2.2038613
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.2963870 -0.5628212
row5  0.8721172  2.2038613
> 
> 
> 
> 
> 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.54582 48.53681 50.15118 48.12866 50.69408 104.7609 49.82289 48.8656
         col9    col10   col11    col12    col13    col14    col15  col16
row1 49.20309 50.17187 50.7998 48.03415 48.45602 51.35675 50.25066 48.836
        col17    col18    col19    col20
row1 49.62286 50.04055 52.09136 104.1296
> tmp[,"col10"]
        col10
row1 50.17187
row2 31.24134
row3 28.70257
row4 29.23521
row5 49.76808
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.54582 48.53681 50.15118 48.12866 50.69408 104.7609 49.82289 48.86560
row5 50.86515 50.80533 51.37674 52.56739 49.41632 104.7806 51.03312 51.16921
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.20309 50.17187 50.79980 48.03415 48.45602 51.35675 50.25066 48.83600
row5 48.68843 49.76808 49.05289 49.90220 50.27830 49.92919 49.32571 50.84484
        col17    col18    col19    col20
row1 49.62286 50.04055 52.09136 104.1296
row5 50.13539 49.70492 48.74909 106.4491
> tmp[,c("col6","col20")]
          col6     col20
row1 104.76089 104.12963
row2  75.38750  75.14987
row3  73.47350  75.65228
row4  73.99042  74.94183
row5 104.78059 106.44908
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.7609 104.1296
row5 104.7806 106.4491
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.7609 104.1296
row5 104.7806 106.4491
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  0.36118848
[2,] -0.02820572
[3,]  1.75086066
[4,]  0.25993807
[5,] -1.14241695
> tmp[,c("col17","col7")]
          col17       col7
[1,] -2.0263057  2.0790671
[2,]  0.6821734  0.6018805
[3,] -0.7890662 -2.4496967
[4,]  1.5181875 -1.2588530
[5,] -0.9072778  0.5306074
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -2.0721538 -0.8388668
[2,] -0.0159332  1.9326072
[3,]  0.1338602 -1.1956190
[4,]  0.1988933  0.9094994
[5,]  1.4533822  2.0333994
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -2.072154
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -2.0721538
[2,] -0.0159332
> 
> 
> 
> 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.3379940  0.01043756 1.359817  0.3037827 -1.529373 -0.7939523 -0.4927879
row1 0.1696683 -0.48370107 1.060707 -0.0709972  0.805883 -0.7663159 -0.1698374
          [,8]       [,9]     [,10]      [,11]      [,12]      [,13]      [,14]
row3 0.1840363 -1.0328779 0.5979568  0.5342957 -0.4406757 -1.1728301 -0.3071391
row1 1.9106186  0.2623691 0.3620428 -0.2073530  0.6412628  0.4002036  1.3831151
        [,15]      [,16]     [,17]     [,18]     [,19]        [,20]
row3 1.403973  0.2713096 -1.069386 0.7932499 0.5409879 -0.001423782
row1 1.421430 -0.8195503  1.121704 0.6834322 0.8094598 -0.483855408
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]      [,3]      [,4]       [,5]      [,6]      [,7]
row2 -1.308697 -0.5581171 0.8313412 -1.729388 -0.1080287 -0.322672 -1.388168
          [,8]      [,9]     [,10]
row2 0.3250956 0.3295698 -1.767139
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]       [,3]      [,4]     [,5]     [,6]       [,7]
row5 0.9729621 -0.7288396 -0.2882252 0.9360572 0.331428 1.221795 -0.1633918
           [,8]      [,9]     [,10]     [,11]     [,12]    [,13]      [,14]
row5 -0.7125445 0.8901328 -1.199096 0.4037848 -1.297397 1.167793 0.05412856
       [,15]     [,16]      [,17]      [,18]     [,19]     [,20]
row5 -0.1566 0.5838397 -0.1503491 -0.7990362 -1.963049 0.7975775
> 
> 
> 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: 0x563927093570>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d90066a81bcc"
 [2] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d90072069dd4"
 [3] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d90029b78603"
 [4] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d900561e997f"
 [5] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d90057942c71"
 [6] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d9002f6b467a"
 [7] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d9002124bed7"
 [8] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d90070973b3e"
 [9] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d9001cd701bb"
[10] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d90060c6c18f"
[11] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d90073b663d" 
[12] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d900ee82d64" 
[13] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d900727f7023"
[14] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d9006f8fde64"
[15] "/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests/BM25d9003d678607"
> 
> 
> ### 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: 0x563927c50b60>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x563927c50b60>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.22-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x563927c50b60>
> rowMedians(tmp)
  [1] -0.032000016 -0.063399757  0.132645182  0.095377927  0.257256570
  [6] -0.194951473  0.697541003 -0.276392334  0.376986188  0.097718548
 [11] -0.277729854 -0.341426834  0.463467337  0.237844116  0.792315410
 [16]  0.139009836 -0.201012119 -0.311007466  0.326161046  0.057145514
 [21] -0.297208560  0.153364533  0.043434537 -0.018158414 -0.214094582
 [26] -0.244618529  0.210299720  0.039351169 -0.262530347  0.395894267
 [31] -0.237787417  0.394342256 -0.127772180  0.386787233  0.231964563
 [36]  0.257526942 -0.198895004 -0.123596742 -0.110037398 -0.111194920
 [41]  0.275866092  0.267800868  0.166765118 -0.347855659  0.709114828
 [46] -0.289226053 -0.231720663  0.417546292  0.366600484 -0.028746656
 [51]  0.268566591 -0.251580511  0.130107360 -0.174612090  0.096456991
 [56] -0.498463407  0.480217638  0.070117102 -0.060289426  0.386341938
 [61] -0.265591193  0.195975473 -0.200087043 -0.048588460  0.497095126
 [66] -0.324036753  0.237970384 -0.093681078  0.066038184 -0.317691586
 [71] -0.121150877 -0.008821940 -0.208993243 -0.131866453  0.067956735
 [76] -0.090242795 -0.332915641 -0.388219911 -0.049079585 -1.192632506
 [81] -0.326903366 -0.101798026 -0.041220514 -0.359112057 -0.022407356
 [86]  0.294197818  0.012589960  0.599060621  0.207885861 -0.142657904
 [91] -0.210064615  0.240138324 -0.309544885  0.107710295  0.052799490
 [96]  0.340311100  0.254513000  0.096290726  0.105154846 -0.645393841
[101] -0.061670602 -0.369458260 -0.294889659  0.283149069  0.136184753
[106]  0.003428363 -0.025395247 -0.423556196  0.448256744 -0.072592454
[111] -0.267046843 -0.179941124  0.230646976  0.169739764 -0.029518510
[116]  0.565744762 -0.321719995 -0.190137856 -0.739006998 -0.058355093
[121] -0.195838854 -0.552707830 -0.188605830  0.077866110 -0.243434981
[126] -0.131332455 -0.521404075 -0.148140409  0.262500121  0.395502443
[131]  0.768817780  0.238969536  0.378114131 -0.509491755  0.107330584
[136] -0.360390899 -0.002947246  0.848370599 -0.019463207 -0.036755793
[141]  0.506455007  0.816748625 -0.137576956  0.366330176  0.208145742
[146]  0.358179664 -0.068487277  0.237662942 -0.155242695  0.621690280
[151]  0.513835050  0.434660168 -0.093007941  0.115837050 -0.085627914
[156]  0.207387118 -0.060331181 -0.221302719  0.009948933  0.313641886
[161]  0.026238250  0.193606054 -0.623141647 -0.219704340  0.052413940
[166] -0.425469760 -0.585246402  0.107893421  0.246119957 -0.142303761
[171]  0.260703782 -0.002542344 -0.278006428  0.515400705  0.303130606
[176] -0.303299307  0.323385709  0.276105173 -0.738770093  0.507262132
[181] -0.154300121  0.155084048 -0.176523822 -0.160504548 -0.117663566
[186] -0.139814634 -0.227392359  0.341380214 -0.159661637 -0.176836810
[191]  0.206029833  0.270858896  0.355420592  0.325424583  0.035421059
[196]  0.026211359 -0.105985807  0.082173966  0.071172170 -0.226436277
[201]  0.966721408 -0.327495461  0.067952819  0.492940871  0.165725219
[206] -0.174780331  0.376889295 -0.205065413  0.514759769 -0.132108933
[211] -0.263636470 -0.225610498  0.189360577  0.057142790 -0.238778559
[216]  0.156474654  0.201176912  0.085428957 -0.355867049 -0.496184326
[221] -0.096946272  0.151849125  0.004321072  0.107117250  0.194631654
[226]  0.122559616 -0.175703914 -0.419480026  0.452655212  0.352733044
> 
> proc.time()
   user  system elapsed 
  1.248   0.654   1.891 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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: 0x5b56ad761370>
> .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: 0x5b56ad761370>
> .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: 0x5b56ad761370>
> .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: 0x5b56ad761370>
> 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: 0x5b56ad7491c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b56ad7491c0>
> .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: 0x5b56ad7491c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b56ad7491c0>
> .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: 0x5b56ad7491c0>
> 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: 0x5b56ada2c120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b56ada2c120>
> .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: 0x5b56ada2c120>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5b56ada2c120>
> .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: 0x5b56ada2c120>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5b56ada2c120>
> .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: 0x5b56ada2c120>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5b56ada2c120>
> .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: 0x5b56ada2c120>
> 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: 0x5b56ac77c390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5b56ac77c390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b56ac77c390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b56ac77c390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile25d9ba1baad762" "BufferedMatrixFile25d9ba2e4e0a68"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile25d9ba1baad762" "BufferedMatrixFile25d9ba2e4e0a68"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b56ac6733d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b56ac6733d0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5b56ac6733d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5b56ac6733d0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5b56ac6733d0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5b56ac6733d0>
> .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: 0x5b56ae1a8fa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5b56ae1a8fa0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5b56ae1a8fa0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5b56ae1a8fa0>
> 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: 0x5b56ac980ff0>
> .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: 0x5b56ac980ff0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.239   0.045   0.273 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.231   0.054   0.274 

Example timings