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

This page was generated on 2024-07-24 11:38 -0400 (Wed, 24 Jul 2024).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 22.04.3 LTS)x86_644.4.1 (2024-06-14) -- "Race for Your Life" 4688
palomino8Windows Server 2022 Datacenterx644.4.1 (2024-06-14 ucrt) -- "Race for Your Life" 4284
lconwaymacOS 12.7.1 Montereyx86_644.4.1 (2024-06-14) -- "Race for Your Life" 4455
kjohnson3macOS 13.6.5 Venturaarm644.4.1 (2024-06-14) -- "Race for Your Life" 4404
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 249/2248HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.69.0  (landing page)
Ben Bolstad
Snapshot Date: 2024-07-23 14:00 -0400 (Tue, 23 Jul 2024)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: d422a05
git_last_commit_date: 2024-04-30 10:16:21 -0400 (Tue, 30 Apr 2024)
nebbiolo2Linux (Ubuntu 22.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino8Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
lconwaymacOS 12.7.1 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.6.5 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published


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.69.0
Command: /home/biocbuild/bbs-3.20-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.20-bioc/R/site-library --timings BufferedMatrix_1.69.0.tar.gz
StartedAt: 2024-07-23 21:40:20 -0400 (Tue, 23 Jul 2024)
EndedAt: 2024-07-23 21:40:43 -0400 (Tue, 23 Jul 2024)
EllapsedTime: 23.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.4.1 (2024-06-14)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
    gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
    GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
* running under: Ubuntu 22.04.4 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.69.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... OK
* used C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.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.20-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.


Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.20-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
gcc -I"/home/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^~~~~~~~~~~~~~~~~~~
At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
gcc -I"/home/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/bbs-3.20-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.20-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.20-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.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 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.267   0.036   0.292 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 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.20-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 471777 25.2    1026220 54.9   643428 34.4
Vcells 871900  6.7    8388608 64.0  2046605 15.7
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue Jul 23 21:40:35 2024"
> 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] "Tue Jul 23 21:40:35 2024"
> 
> 
> 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: 0x55ccc6485950>
> 
> 
> 
> 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] "Tue Jul 23 21:40:36 2024"
> 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] "Tue Jul 23 21:40:36 2024"
> 
> ColMode(tmp2)
<pointer: 0x55ccc6485950>
> 
> 
> 
> ### 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,] 98.8530191  0.3600860  2.3963401 1.7358329
[2,]  1.3982922  1.6787899  0.3708756 0.6372400
[3,]  0.9086362 -0.1385156 -0.2495464 0.3075734
[4,] -0.9946254  0.6772771  0.4392134 1.4282214
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 98.8530191 0.3600860 2.3963401 1.7358329
[2,]  1.3982922 1.6787899 0.3708756 0.6372400
[3,]  0.9086362 0.1385156 0.2495464 0.3075734
[4,]  0.9946254 0.6772771 0.4392134 1.4282214
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9424856 0.6000717 1.5480117 1.3175101
[2,] 1.1824941 1.2956812 0.6089956 0.7982732
[3,] 0.9532241 0.3721769 0.4995462 0.5545930
[4,] 0.9973091 0.8229685 0.6627318 1.1950822
> 
> 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.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 223.27787 31.36080 42.87646 39.91093
[2,]  38.22323 39.63560 31.46083 33.61997
[3,]  35.44088 28.86028 30.24501 30.85350
[4,]  35.96772 33.90696 32.06653 38.37904
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x55ccc6244a80>
> exp(tmp5)
<pointer: 0x55ccc6244a80>
> log(tmp5,2)
<pointer: 0x55ccc6244a80>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 464.7236
> Min(tmp5)
[1] 52.6174
> mean(tmp5)
[1] 71.79483
> Sum(tmp5)
[1] 14358.97
> Var(tmp5)
[1] 849.8712
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.88497 70.42712 66.80960 69.85283 69.07419 75.14177 70.03763 69.22552
 [9] 66.42941 71.06528
> rowSums(tmp5)
 [1] 1797.699 1408.542 1336.192 1397.057 1381.484 1502.835 1400.753 1384.510
 [9] 1328.588 1421.306
> rowVars(tmp5)
 [1] 7872.78835   60.93974   81.35307   47.23754   79.87452   78.37503
 [7]   77.05299   62.76688   40.63940   63.03305
> rowSd(tmp5)
 [1] 88.728735  7.806391  9.019594  6.872957  8.937255  8.852968  8.777983
 [8]  7.922555  6.374904  7.939335
> rowMax(tmp5)
 [1] 464.72364  82.49631  87.39946  80.76140  89.02067  94.57419  87.80031
 [8]  83.75477  82.71531  91.03857
> rowMin(tmp5)
 [1] 56.97971 57.31727 52.61740 57.25219 53.93710 59.75255 56.95493 57.17138
 [9] 54.82017 56.12810
> 
> colMeans(tmp5)
 [1] 112.42789  68.05148  68.81386  76.35838  68.68345  67.07115  72.07602
 [8]  65.80292  68.73672  68.87609  67.87257  71.50847  69.85203  69.54757
[15]  72.16761  67.49513  71.29316  67.69939  69.37774  72.18501
> colSums(tmp5)
 [1] 1124.2789  680.5148  688.1386  763.5838  686.8345  670.7115  720.7602
 [8]  658.0292  687.3672  688.7609  678.7257  715.0847  698.5203  695.4757
[15]  721.6761  674.9513  712.9316  676.9939  693.7774  721.8501
> colVars(tmp5)
 [1] 15345.02689   130.42544    83.79884   102.02073    58.92681   126.84205
 [7]    58.35208    51.07853    53.38938    77.46141   109.35596    70.02356
[13]    36.01166    74.50323    64.04032    49.23523    66.82370    84.94399
[19]    45.12417    52.48569
> colSd(tmp5)
 [1] 123.875045  11.420396   9.154171  10.100531   7.676380  11.262418
 [7]   7.638853   7.146925   7.306804   8.801216  10.457340   8.368008
[13]   6.000972   8.631526   8.002520   7.016782   8.174576   9.216506
[19]   6.717452   7.244701
> colMax(tmp5)
 [1] 464.72364  91.65331  89.24173  94.57419  79.17231  91.03857  86.98742
 [8]  77.82014  80.52176  87.39946  88.65805  81.85452  81.33481  84.63584
[15]  87.80031  83.75477  87.34352  80.06691  81.73238  83.98742
> colMin(tmp5)
 [1] 64.23306 56.12810 53.93710 64.21753 57.73976 55.30094 65.21858 56.95493
 [9] 58.11599 57.15662 52.61740 60.45935 64.16124 54.82017 63.27017 56.97971
[17] 61.09383 56.23241 61.12879 60.00047
> 
> 
> ### 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] 89.88497 70.42712 66.80960 69.85283       NA 75.14177 70.03763 69.22552
 [9] 66.42941 71.06528
> rowSums(tmp5)
 [1] 1797.699 1408.542 1336.192 1397.057       NA 1502.835 1400.753 1384.510
 [9] 1328.588 1421.306
> rowVars(tmp5)
 [1] 7872.78835   60.93974   81.35307   47.23754   84.31093   78.37503
 [7]   77.05299   62.76688   40.63940   63.03305
> rowSd(tmp5)
 [1] 88.728735  7.806391  9.019594  6.872957  9.182099  8.852968  8.777983
 [8]  7.922555  6.374904  7.939335
> rowMax(tmp5)
 [1] 464.72364  82.49631  87.39946  80.76140        NA  94.57419  87.80031
 [8]  83.75477  82.71531  91.03857
> rowMin(tmp5)
 [1] 56.97971 57.31727 52.61740 57.25219       NA 59.75255 56.95493 57.17138
 [9] 54.82017 56.12810
> 
> colMeans(tmp5)
 [1] 112.42789  68.05148  68.81386  76.35838  68.68345  67.07115  72.07602
 [8]  65.80292  68.73672  68.87609  67.87257        NA  69.85203  69.54757
[15]  72.16761  67.49513  71.29316  67.69939  69.37774  72.18501
> colSums(tmp5)
 [1] 1124.2789  680.5148  688.1386  763.5838  686.8345  670.7115  720.7602
 [8]  658.0292  687.3672  688.7609  678.7257        NA  698.5203  695.4757
[15]  721.6761  674.9513  712.9316  676.9939  693.7774  721.8501
> colVars(tmp5)
 [1] 15345.02689   130.42544    83.79884   102.02073    58.92681   126.84205
 [7]    58.35208    51.07853    53.38938    77.46141   109.35596          NA
[13]    36.01166    74.50323    64.04032    49.23523    66.82370    84.94399
[19]    45.12417    52.48569
> colSd(tmp5)
 [1] 123.875045  11.420396   9.154171  10.100531   7.676380  11.262418
 [7]   7.638853   7.146925   7.306804   8.801216  10.457340         NA
[13]   6.000972   8.631526   8.002520   7.016782   8.174576   9.216506
[19]   6.717452   7.244701
> colMax(tmp5)
 [1] 464.72364  91.65331  89.24173  94.57419  79.17231  91.03857  86.98742
 [8]  77.82014  80.52176  87.39946  88.65805        NA  81.33481  84.63584
[15]  87.80031  83.75477  87.34352  80.06691  81.73238  83.98742
> colMin(tmp5)
 [1] 64.23306 56.12810 53.93710 64.21753 57.73976 55.30094 65.21858 56.95493
 [9] 58.11599 57.15662 52.61740       NA 64.16124 54.82017 63.27017 56.97971
[17] 61.09383 56.23241 61.12879 60.00047
> 
> Max(tmp5,na.rm=TRUE)
[1] 464.7236
> Min(tmp5,na.rm=TRUE)
[1] 52.6174
> mean(tmp5,na.rm=TRUE)
[1] 71.80918
> Sum(tmp5,na.rm=TRUE)
[1] 14290.03
> Var(tmp5,na.rm=TRUE)
[1] 854.1221
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.88497 70.42712 66.80960 69.85283 69.08128 75.14177 70.03763 69.22552
 [9] 66.42941 71.06528
> rowSums(tmp5,na.rm=TRUE)
 [1] 1797.699 1408.542 1336.192 1397.057 1312.544 1502.835 1400.753 1384.510
 [9] 1328.588 1421.306
> rowVars(tmp5,na.rm=TRUE)
 [1] 7872.78835   60.93974   81.35307   47.23754   84.31093   78.37503
 [7]   77.05299   62.76688   40.63940   63.03305
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.728735  7.806391  9.019594  6.872957  9.182099  8.852968  8.777983
 [8]  7.922555  6.374904  7.939335
> rowMax(tmp5,na.rm=TRUE)
 [1] 464.72364  82.49631  87.39946  80.76140  89.02067  94.57419  87.80031
 [8]  83.75477  82.71531  91.03857
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.97971 57.31727 52.61740 57.25219 53.93710 59.75255 56.95493 57.17138
 [9] 54.82017 56.12810
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.42789  68.05148  68.81386  76.35838  68.68345  67.07115  72.07602
 [8]  65.80292  68.73672  68.87609  67.87257  71.79391  69.85203  69.54757
[15]  72.16761  67.49513  71.29316  67.69939  69.37774  72.18501
> colSums(tmp5,na.rm=TRUE)
 [1] 1124.2789  680.5148  688.1386  763.5838  686.8345  670.7115  720.7602
 [8]  658.0292  687.3672  688.7609  678.7257  646.1452  698.5203  695.4757
[15]  721.6761  674.9513  712.9316  676.9939  693.7774  721.8501
> colVars(tmp5,na.rm=TRUE)
 [1] 15345.02689   130.42544    83.79884   102.02073    58.92681   126.84205
 [7]    58.35208    51.07853    53.38938    77.46141   109.35596    77.85992
[13]    36.01166    74.50323    64.04032    49.23523    66.82370    84.94399
[19]    45.12417    52.48569
> colSd(tmp5,na.rm=TRUE)
 [1] 123.875045  11.420396   9.154171  10.100531   7.676380  11.262418
 [7]   7.638853   7.146925   7.306804   8.801216  10.457340   8.823827
[13]   6.000972   8.631526   8.002520   7.016782   8.174576   9.216506
[19]   6.717452   7.244701
> colMax(tmp5,na.rm=TRUE)
 [1] 464.72364  91.65331  89.24173  94.57419  79.17231  91.03857  86.98742
 [8]  77.82014  80.52176  87.39946  88.65805  81.85452  81.33481  84.63584
[15]  87.80031  83.75477  87.34352  80.06691  81.73238  83.98742
> colMin(tmp5,na.rm=TRUE)
 [1] 64.23306 56.12810 53.93710 64.21753 57.73976 55.30094 65.21858 56.95493
 [9] 58.11599 57.15662 52.61740 60.45935 64.16124 54.82017 63.27017 56.97971
[17] 61.09383 56.23241 61.12879 60.00047
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.88497 70.42712 66.80960 69.85283      NaN 75.14177 70.03763 69.22552
 [9] 66.42941 71.06528
> rowSums(tmp5,na.rm=TRUE)
 [1] 1797.699 1408.542 1336.192 1397.057    0.000 1502.835 1400.753 1384.510
 [9] 1328.588 1421.306
> rowVars(tmp5,na.rm=TRUE)
 [1] 7872.78835   60.93974   81.35307   47.23754         NA   78.37503
 [7]   77.05299   62.76688   40.63940   63.03305
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.728735  7.806391  9.019594  6.872957        NA  8.852968  8.777983
 [8]  7.922555  6.374904  7.939335
> rowMax(tmp5,na.rm=TRUE)
 [1] 464.72364  82.49631  87.39946  80.76140        NA  94.57419  87.80031
 [8]  83.75477  82.71531  91.03857
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.97971 57.31727 52.61740 57.25219       NA 59.75255 56.95493 57.17138
 [9] 54.82017 56.12810
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.75283  67.57622  70.46683  74.95145  69.25602  67.49268  70.41920
 [8]  65.23362  69.91680  68.28490  68.19173       NaN  69.87414  68.70245
[15]  71.58938  67.74684  71.93985  68.13112  70.08371  73.53885
> colSums(tmp5,na.rm=TRUE)
 [1] 1050.7755  608.1860  634.2015  674.5631  623.3041  607.4341  633.7728
 [8]  587.1026  629.2512  614.5641  613.7256    0.0000  628.8672  618.3220
[15]  644.3044  609.7215  647.4586  613.1801  630.7534  661.8497
> colVars(tmp5,na.rm=TRUE)
 [1] 17052.72315   144.18758    63.53512    92.50474    62.60459   140.69833
 [7]    34.76416    53.81715    44.39638    83.21208   121.87951          NA
[13]    40.50762    75.78105    68.28389    54.67690    70.47177    93.46505
[19]    45.15774    38.42652
> colSd(tmp5,na.rm=TRUE)
 [1] 130.586076  12.007813   7.970892   9.617938   7.912306  11.861633
 [7]   5.896114   7.336017   6.663061   9.122065  11.039905         NA
[13]   6.364560   8.705231   8.263407   7.394383   8.394746   9.667732
[19]   6.719951   6.198913
> colMax(tmp5,na.rm=TRUE)
 [1] 464.72364  91.65331  89.24173  94.57419  79.17231  91.03857  81.83205
 [8]  77.82014  80.52176  87.39946  88.65805      -Inf  81.33481  84.63584
[15]  87.80031  83.75477  87.34352  80.06691  81.73238  83.98742
> colMin(tmp5,na.rm=TRUE)
 [1] 64.23306 56.12810 62.95102 64.21753 57.73976 55.30094 65.21858 56.95493
 [9] 59.75255 57.15662 52.61740      Inf 64.16124 54.82017 63.27017 56.97971
[17] 61.09383 56.23241 61.12879 67.22317
> 
> 
> 
> 
> 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] 230.0722 211.9102 186.6564 122.9709 176.5092 205.5269 269.7991 132.7169
 [9] 155.2684 164.3520
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 230.0722 211.9102 186.6564 122.9709 176.5092 205.5269 269.7991 132.7169
 [9] 155.2684 164.3520
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14 -8.526513e-14  2.842171e-13  2.842171e-14  0.000000e+00
 [6]  8.526513e-14 -1.421085e-14  0.000000e+00  5.684342e-14  0.000000e+00
[11] -5.684342e-14  1.421085e-14  5.684342e-14 -5.684342e-14  0.000000e+00
[16] -5.684342e-14 -3.552714e-14  0.000000e+00 -1.136868e-13 -2.557954e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
8   9 
7   4 
3   10 
10   20 
10   17 
9   19 
4   8 
3   7 
1   13 
5   19 
1   10 
2   20 
4   8 
7   3 
1   4 
1   5 
6   15 
8   4 
8   15 
7   5 
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.82747
> Min(tmp)
[1] -2.255158
> mean(tmp)
[1] 0.006883071
> Sum(tmp)
[1] 0.6883071
> Var(tmp)
[1] 1.169892
> 
> rowMeans(tmp)
[1] 0.006883071
> rowSums(tmp)
[1] 0.6883071
> rowVars(tmp)
[1] 1.169892
> rowSd(tmp)
[1] 1.081616
> rowMax(tmp)
[1] 2.82747
> rowMin(tmp)
[1] -2.255158
> 
> colMeans(tmp)
  [1] -1.94945213  0.39189703  1.43780627 -1.39626751  1.06871468  2.82747025
  [7] -0.42119140  0.49503923 -0.56440230 -0.17147989 -0.11332199 -0.62873957
 [13] -1.12240925  0.85190337 -0.46593677 -0.50190095 -0.68429250  0.18244308
 [19]  1.82695041 -0.98754554 -1.27708141  1.10908105 -2.23301063  0.48208871
 [25]  1.08557090  1.11424241 -1.14235775 -1.10408440  0.50914517  0.11892653
 [31]  1.91689287 -0.94200355 -0.90732974 -0.57611867 -0.14554280 -0.26670855
 [37]  0.38202752  0.44268340  2.36244220 -1.10606461 -0.82754724  0.53687027
 [43]  0.49085452  2.02500472 -1.74969477  1.07301452 -1.30481524  0.47916396
 [49]  1.13579349  0.64956406 -0.72498938 -1.55217473  0.63470977  0.03457418
 [55]  1.84255503  1.15279288  1.59471087  0.73980085  0.77321098 -1.59011095
 [61] -0.01789707  0.63965088 -1.53225932  0.37377099  0.49848342 -0.02194668
 [67]  0.29797176  1.05719650 -1.15344750  0.28478297 -1.12421311 -0.28208028
 [73]  0.40379367  0.37033394 -0.60166487 -0.54092969 -2.25515780 -0.30601571
 [79] -0.41863331 -0.57324437 -1.29704473 -0.83641222  1.15809000 -0.21795129
 [85]  0.95223121  1.81369230 -0.53749841 -0.95614538  0.53187531 -1.36887333
 [91] -0.01900419  1.49081994  0.92274164  1.29143577  0.67171575 -1.48892996
 [97] -1.07823643 -0.76084336 -1.07852304  1.08530214
> colSums(tmp)
  [1] -1.94945213  0.39189703  1.43780627 -1.39626751  1.06871468  2.82747025
  [7] -0.42119140  0.49503923 -0.56440230 -0.17147989 -0.11332199 -0.62873957
 [13] -1.12240925  0.85190337 -0.46593677 -0.50190095 -0.68429250  0.18244308
 [19]  1.82695041 -0.98754554 -1.27708141  1.10908105 -2.23301063  0.48208871
 [25]  1.08557090  1.11424241 -1.14235775 -1.10408440  0.50914517  0.11892653
 [31]  1.91689287 -0.94200355 -0.90732974 -0.57611867 -0.14554280 -0.26670855
 [37]  0.38202752  0.44268340  2.36244220 -1.10606461 -0.82754724  0.53687027
 [43]  0.49085452  2.02500472 -1.74969477  1.07301452 -1.30481524  0.47916396
 [49]  1.13579349  0.64956406 -0.72498938 -1.55217473  0.63470977  0.03457418
 [55]  1.84255503  1.15279288  1.59471087  0.73980085  0.77321098 -1.59011095
 [61] -0.01789707  0.63965088 -1.53225932  0.37377099  0.49848342 -0.02194668
 [67]  0.29797176  1.05719650 -1.15344750  0.28478297 -1.12421311 -0.28208028
 [73]  0.40379367  0.37033394 -0.60166487 -0.54092969 -2.25515780 -0.30601571
 [79] -0.41863331 -0.57324437 -1.29704473 -0.83641222  1.15809000 -0.21795129
 [85]  0.95223121  1.81369230 -0.53749841 -0.95614538  0.53187531 -1.36887333
 [91] -0.01900419  1.49081994  0.92274164  1.29143577  0.67171575 -1.48892996
 [97] -1.07823643 -0.76084336 -1.07852304  1.08530214
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -1.94945213  0.39189703  1.43780627 -1.39626751  1.06871468  2.82747025
  [7] -0.42119140  0.49503923 -0.56440230 -0.17147989 -0.11332199 -0.62873957
 [13] -1.12240925  0.85190337 -0.46593677 -0.50190095 -0.68429250  0.18244308
 [19]  1.82695041 -0.98754554 -1.27708141  1.10908105 -2.23301063  0.48208871
 [25]  1.08557090  1.11424241 -1.14235775 -1.10408440  0.50914517  0.11892653
 [31]  1.91689287 -0.94200355 -0.90732974 -0.57611867 -0.14554280 -0.26670855
 [37]  0.38202752  0.44268340  2.36244220 -1.10606461 -0.82754724  0.53687027
 [43]  0.49085452  2.02500472 -1.74969477  1.07301452 -1.30481524  0.47916396
 [49]  1.13579349  0.64956406 -0.72498938 -1.55217473  0.63470977  0.03457418
 [55]  1.84255503  1.15279288  1.59471087  0.73980085  0.77321098 -1.59011095
 [61] -0.01789707  0.63965088 -1.53225932  0.37377099  0.49848342 -0.02194668
 [67]  0.29797176  1.05719650 -1.15344750  0.28478297 -1.12421311 -0.28208028
 [73]  0.40379367  0.37033394 -0.60166487 -0.54092969 -2.25515780 -0.30601571
 [79] -0.41863331 -0.57324437 -1.29704473 -0.83641222  1.15809000 -0.21795129
 [85]  0.95223121  1.81369230 -0.53749841 -0.95614538  0.53187531 -1.36887333
 [91] -0.01900419  1.49081994  0.92274164  1.29143577  0.67171575 -1.48892996
 [97] -1.07823643 -0.76084336 -1.07852304  1.08530214
> colMin(tmp)
  [1] -1.94945213  0.39189703  1.43780627 -1.39626751  1.06871468  2.82747025
  [7] -0.42119140  0.49503923 -0.56440230 -0.17147989 -0.11332199 -0.62873957
 [13] -1.12240925  0.85190337 -0.46593677 -0.50190095 -0.68429250  0.18244308
 [19]  1.82695041 -0.98754554 -1.27708141  1.10908105 -2.23301063  0.48208871
 [25]  1.08557090  1.11424241 -1.14235775 -1.10408440  0.50914517  0.11892653
 [31]  1.91689287 -0.94200355 -0.90732974 -0.57611867 -0.14554280 -0.26670855
 [37]  0.38202752  0.44268340  2.36244220 -1.10606461 -0.82754724  0.53687027
 [43]  0.49085452  2.02500472 -1.74969477  1.07301452 -1.30481524  0.47916396
 [49]  1.13579349  0.64956406 -0.72498938 -1.55217473  0.63470977  0.03457418
 [55]  1.84255503  1.15279288  1.59471087  0.73980085  0.77321098 -1.59011095
 [61] -0.01789707  0.63965088 -1.53225932  0.37377099  0.49848342 -0.02194668
 [67]  0.29797176  1.05719650 -1.15344750  0.28478297 -1.12421311 -0.28208028
 [73]  0.40379367  0.37033394 -0.60166487 -0.54092969 -2.25515780 -0.30601571
 [79] -0.41863331 -0.57324437 -1.29704473 -0.83641222  1.15809000 -0.21795129
 [85]  0.95223121  1.81369230 -0.53749841 -0.95614538  0.53187531 -1.36887333
 [91] -0.01900419  1.49081994  0.92274164  1.29143577  0.67171575 -1.48892996
 [97] -1.07823643 -0.76084336 -1.07852304  1.08530214
> colMedians(tmp)
  [1] -1.94945213  0.39189703  1.43780627 -1.39626751  1.06871468  2.82747025
  [7] -0.42119140  0.49503923 -0.56440230 -0.17147989 -0.11332199 -0.62873957
 [13] -1.12240925  0.85190337 -0.46593677 -0.50190095 -0.68429250  0.18244308
 [19]  1.82695041 -0.98754554 -1.27708141  1.10908105 -2.23301063  0.48208871
 [25]  1.08557090  1.11424241 -1.14235775 -1.10408440  0.50914517  0.11892653
 [31]  1.91689287 -0.94200355 -0.90732974 -0.57611867 -0.14554280 -0.26670855
 [37]  0.38202752  0.44268340  2.36244220 -1.10606461 -0.82754724  0.53687027
 [43]  0.49085452  2.02500472 -1.74969477  1.07301452 -1.30481524  0.47916396
 [49]  1.13579349  0.64956406 -0.72498938 -1.55217473  0.63470977  0.03457418
 [55]  1.84255503  1.15279288  1.59471087  0.73980085  0.77321098 -1.59011095
 [61] -0.01789707  0.63965088 -1.53225932  0.37377099  0.49848342 -0.02194668
 [67]  0.29797176  1.05719650 -1.15344750  0.28478297 -1.12421311 -0.28208028
 [73]  0.40379367  0.37033394 -0.60166487 -0.54092969 -2.25515780 -0.30601571
 [79] -0.41863331 -0.57324437 -1.29704473 -0.83641222  1.15809000 -0.21795129
 [85]  0.95223121  1.81369230 -0.53749841 -0.95614538  0.53187531 -1.36887333
 [91] -0.01900419  1.49081994  0.92274164  1.29143577  0.67171575 -1.48892996
 [97] -1.07823643 -0.76084336 -1.07852304  1.08530214
> colRanges(tmp)
          [,1]     [,2]     [,3]      [,4]     [,5]    [,6]       [,7]
[1,] -1.949452 0.391897 1.437806 -1.396268 1.068715 2.82747 -0.4211914
[2,] -1.949452 0.391897 1.437806 -1.396268 1.068715 2.82747 -0.4211914
          [,8]       [,9]      [,10]     [,11]      [,12]     [,13]     [,14]
[1,] 0.4950392 -0.5644023 -0.1714799 -0.113322 -0.6287396 -1.122409 0.8519034
[2,] 0.4950392 -0.5644023 -0.1714799 -0.113322 -0.6287396 -1.122409 0.8519034
          [,15]      [,16]      [,17]     [,18]   [,19]      [,20]     [,21]
[1,] -0.4659368 -0.5019009 -0.6842925 0.1824431 1.82695 -0.9875455 -1.277081
[2,] -0.4659368 -0.5019009 -0.6842925 0.1824431 1.82695 -0.9875455 -1.277081
        [,22]     [,23]     [,24]    [,25]    [,26]     [,27]     [,28]
[1,] 1.109081 -2.233011 0.4820887 1.085571 1.114242 -1.142358 -1.104084
[2,] 1.109081 -2.233011 0.4820887 1.085571 1.114242 -1.142358 -1.104084
         [,29]     [,30]    [,31]      [,32]      [,33]      [,34]      [,35]
[1,] 0.5091452 0.1189265 1.916893 -0.9420036 -0.9073297 -0.5761187 -0.1455428
[2,] 0.5091452 0.1189265 1.916893 -0.9420036 -0.9073297 -0.5761187 -0.1455428
          [,36]     [,37]     [,38]    [,39]     [,40]      [,41]     [,42]
[1,] -0.2667085 0.3820275 0.4426834 2.362442 -1.106065 -0.8275472 0.5368703
[2,] -0.2667085 0.3820275 0.4426834 2.362442 -1.106065 -0.8275472 0.5368703
         [,43]    [,44]     [,45]    [,46]     [,47]    [,48]    [,49]
[1,] 0.4908545 2.025005 -1.749695 1.073015 -1.304815 0.479164 1.135793
[2,] 0.4908545 2.025005 -1.749695 1.073015 -1.304815 0.479164 1.135793
         [,50]      [,51]     [,52]     [,53]      [,54]    [,55]    [,56]
[1,] 0.6495641 -0.7249894 -1.552175 0.6347098 0.03457418 1.842555 1.152793
[2,] 0.6495641 -0.7249894 -1.552175 0.6347098 0.03457418 1.842555 1.152793
        [,57]     [,58]    [,59]     [,60]       [,61]     [,62]     [,63]
[1,] 1.594711 0.7398008 0.773211 -1.590111 -0.01789707 0.6396509 -1.532259
[2,] 1.594711 0.7398008 0.773211 -1.590111 -0.01789707 0.6396509 -1.532259
        [,64]     [,65]       [,66]     [,67]    [,68]     [,69]    [,70]
[1,] 0.373771 0.4984834 -0.02194668 0.2979718 1.057197 -1.153447 0.284783
[2,] 0.373771 0.4984834 -0.02194668 0.2979718 1.057197 -1.153447 0.284783
         [,71]      [,72]     [,73]     [,74]      [,75]      [,76]     [,77]
[1,] -1.124213 -0.2820803 0.4037937 0.3703339 -0.6016649 -0.5409297 -2.255158
[2,] -1.124213 -0.2820803 0.4037937 0.3703339 -0.6016649 -0.5409297 -2.255158
          [,78]      [,79]      [,80]     [,81]      [,82]   [,83]      [,84]
[1,] -0.3060157 -0.4186333 -0.5732444 -1.297045 -0.8364122 1.15809 -0.2179513
[2,] -0.3060157 -0.4186333 -0.5732444 -1.297045 -0.8364122 1.15809 -0.2179513
         [,85]    [,86]      [,87]      [,88]     [,89]     [,90]       [,91]
[1,] 0.9522312 1.813692 -0.5374984 -0.9561454 0.5318753 -1.368873 -0.01900419
[2,] 0.9522312 1.813692 -0.5374984 -0.9561454 0.5318753 -1.368873 -0.01900419
       [,92]     [,93]    [,94]     [,95]    [,96]     [,97]      [,98]
[1,] 1.49082 0.9227416 1.291436 0.6717157 -1.48893 -1.078236 -0.7608434
[2,] 1.49082 0.9227416 1.291436 0.6717157 -1.48893 -1.078236 -0.7608434
         [,99]   [,100]
[1,] -1.078523 1.085302
[2,] -1.078523 1.085302
> 
> 
> Max(tmp2)
[1] 2.873335
> Min(tmp2)
[1] -2.673227
> mean(tmp2)
[1] 0.02648764
> Sum(tmp2)
[1] 2.648764
> Var(tmp2)
[1] 1.107718
> 
> rowMeans(tmp2)
  [1] -0.48778733 -1.07059943 -1.46187613  0.99855418  0.75626820  0.64827292
  [7] -2.67322728 -0.49003942 -0.72781691  0.56081168  1.72618049  0.70257503
 [13] -0.09329040 -0.20119651  0.31081632  0.92318112 -1.08141669  1.42753090
 [19]  0.46632796 -0.06844092  1.04970722  0.01221888  0.08854149 -1.26209900
 [25] -0.59015581  0.52485441 -0.44015257  1.51268811 -0.02933179  0.47137754
 [31] -0.18156410  0.11285693  0.51953953 -0.47242805 -0.96632758 -0.38263215
 [37]  1.01117296  1.44661354  0.10600716 -0.53779466 -1.84242899 -1.45544390
 [43]  0.71553891  0.43792743 -1.60047690 -0.67176954  0.07128058 -0.45788257
 [49] -1.38010875  0.12472266  1.82857972 -1.74835855 -0.42060888 -0.90533210
 [55]  1.88743192 -0.00382344  0.99583742  0.21862174  1.31057055  0.82968167
 [61] -1.28209200  0.25894345  0.80491703  1.57132306  1.48127989  1.24538955
 [67] -0.19107665 -1.50021512 -0.47228148 -1.80553361 -0.87125295  2.87333497
 [73]  0.74417099 -0.32427505  0.39596796 -0.92525444  0.85196571  0.87483847
 [79]  0.16630607 -1.35918740  0.19284782  1.02834502 -0.50438516  2.07445112
 [85] -1.01612545 -0.18450088 -1.61525510 -0.48896284 -0.88343661 -1.01320283
 [91]  1.46283816  0.49680562 -0.41104045  1.19139230 -0.08508945  0.89890064
 [97] -0.58588873 -1.77980703 -0.47780521  1.71953621
> rowSums(tmp2)
  [1] -0.48778733 -1.07059943 -1.46187613  0.99855418  0.75626820  0.64827292
  [7] -2.67322728 -0.49003942 -0.72781691  0.56081168  1.72618049  0.70257503
 [13] -0.09329040 -0.20119651  0.31081632  0.92318112 -1.08141669  1.42753090
 [19]  0.46632796 -0.06844092  1.04970722  0.01221888  0.08854149 -1.26209900
 [25] -0.59015581  0.52485441 -0.44015257  1.51268811 -0.02933179  0.47137754
 [31] -0.18156410  0.11285693  0.51953953 -0.47242805 -0.96632758 -0.38263215
 [37]  1.01117296  1.44661354  0.10600716 -0.53779466 -1.84242899 -1.45544390
 [43]  0.71553891  0.43792743 -1.60047690 -0.67176954  0.07128058 -0.45788257
 [49] -1.38010875  0.12472266  1.82857972 -1.74835855 -0.42060888 -0.90533210
 [55]  1.88743192 -0.00382344  0.99583742  0.21862174  1.31057055  0.82968167
 [61] -1.28209200  0.25894345  0.80491703  1.57132306  1.48127989  1.24538955
 [67] -0.19107665 -1.50021512 -0.47228148 -1.80553361 -0.87125295  2.87333497
 [73]  0.74417099 -0.32427505  0.39596796 -0.92525444  0.85196571  0.87483847
 [79]  0.16630607 -1.35918740  0.19284782  1.02834502 -0.50438516  2.07445112
 [85] -1.01612545 -0.18450088 -1.61525510 -0.48896284 -0.88343661 -1.01320283
 [91]  1.46283816  0.49680562 -0.41104045  1.19139230 -0.08508945  0.89890064
 [97] -0.58588873 -1.77980703 -0.47780521  1.71953621
> 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.48778733 -1.07059943 -1.46187613  0.99855418  0.75626820  0.64827292
  [7] -2.67322728 -0.49003942 -0.72781691  0.56081168  1.72618049  0.70257503
 [13] -0.09329040 -0.20119651  0.31081632  0.92318112 -1.08141669  1.42753090
 [19]  0.46632796 -0.06844092  1.04970722  0.01221888  0.08854149 -1.26209900
 [25] -0.59015581  0.52485441 -0.44015257  1.51268811 -0.02933179  0.47137754
 [31] -0.18156410  0.11285693  0.51953953 -0.47242805 -0.96632758 -0.38263215
 [37]  1.01117296  1.44661354  0.10600716 -0.53779466 -1.84242899 -1.45544390
 [43]  0.71553891  0.43792743 -1.60047690 -0.67176954  0.07128058 -0.45788257
 [49] -1.38010875  0.12472266  1.82857972 -1.74835855 -0.42060888 -0.90533210
 [55]  1.88743192 -0.00382344  0.99583742  0.21862174  1.31057055  0.82968167
 [61] -1.28209200  0.25894345  0.80491703  1.57132306  1.48127989  1.24538955
 [67] -0.19107665 -1.50021512 -0.47228148 -1.80553361 -0.87125295  2.87333497
 [73]  0.74417099 -0.32427505  0.39596796 -0.92525444  0.85196571  0.87483847
 [79]  0.16630607 -1.35918740  0.19284782  1.02834502 -0.50438516  2.07445112
 [85] -1.01612545 -0.18450088 -1.61525510 -0.48896284 -0.88343661 -1.01320283
 [91]  1.46283816  0.49680562 -0.41104045  1.19139230 -0.08508945  0.89890064
 [97] -0.58588873 -1.77980703 -0.47780521  1.71953621
> rowMin(tmp2)
  [1] -0.48778733 -1.07059943 -1.46187613  0.99855418  0.75626820  0.64827292
  [7] -2.67322728 -0.49003942 -0.72781691  0.56081168  1.72618049  0.70257503
 [13] -0.09329040 -0.20119651  0.31081632  0.92318112 -1.08141669  1.42753090
 [19]  0.46632796 -0.06844092  1.04970722  0.01221888  0.08854149 -1.26209900
 [25] -0.59015581  0.52485441 -0.44015257  1.51268811 -0.02933179  0.47137754
 [31] -0.18156410  0.11285693  0.51953953 -0.47242805 -0.96632758 -0.38263215
 [37]  1.01117296  1.44661354  0.10600716 -0.53779466 -1.84242899 -1.45544390
 [43]  0.71553891  0.43792743 -1.60047690 -0.67176954  0.07128058 -0.45788257
 [49] -1.38010875  0.12472266  1.82857972 -1.74835855 -0.42060888 -0.90533210
 [55]  1.88743192 -0.00382344  0.99583742  0.21862174  1.31057055  0.82968167
 [61] -1.28209200  0.25894345  0.80491703  1.57132306  1.48127989  1.24538955
 [67] -0.19107665 -1.50021512 -0.47228148 -1.80553361 -0.87125295  2.87333497
 [73]  0.74417099 -0.32427505  0.39596796 -0.92525444  0.85196571  0.87483847
 [79]  0.16630607 -1.35918740  0.19284782  1.02834502 -0.50438516  2.07445112
 [85] -1.01612545 -0.18450088 -1.61525510 -0.48896284 -0.88343661 -1.01320283
 [91]  1.46283816  0.49680562 -0.41104045  1.19139230 -0.08508945  0.89890064
 [97] -0.58588873 -1.77980703 -0.47780521  1.71953621
> 
> colMeans(tmp2)
[1] 0.02648764
> colSums(tmp2)
[1] 2.648764
> colVars(tmp2)
[1] 1.107718
> colSd(tmp2)
[1] 1.052482
> colMax(tmp2)
[1] 2.873335
> colMin(tmp2)
[1] -2.673227
> colMedians(tmp2)
[1] 0.004197721
> colRanges(tmp2)
          [,1]
[1,] -2.673227
[2,]  2.873335
> 
> 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.0599348  1.5000061 -3.0529192  1.7831581  1.5827076 -2.0601493
 [7] -2.4301214 -0.6395158 -2.4118026 -2.3505189
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8797482
[2,] -0.7590189
[3,]  0.2861200
[4,]  0.9489606
[5,]  2.9936920
> 
> rowApply(tmp,sum)
 [1] -4.2717088 -1.8248483  1.2291287 -2.3140896 -1.7416583 -1.5849911
 [7]  0.9236107  1.1456920 -0.3057775  2.7254216
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1   10    6   10    3    8    3    6    2    10
 [2,]   10    6    5    7    7   10    1    8    5     6
 [3,]    6    4    7    1    2    3    4    7    8     5
 [4,]    4    1    8    6    8    9   10   10    6     2
 [5,]    9    7    1    5    6    5    6    3    9     9
 [6,]    5    3    4    8    1    7    2    9    7     4
 [7,]    7    5   10    4    4    4    5    4    4     1
 [8,]    3    2    3    9   10    6    8    1   10     7
 [9,]    8    9    2    2    5    1    9    2    3     8
[10,]    2    8    9    3    9    2    7    5    1     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.3056614 -2.2970784  0.4121411 -0.7385228  2.2703971 -0.3338151
 [7] -2.0245229  1.0942885 -0.4173805  3.3339587  4.1849694  0.3201329
[13]  0.2223674 -2.4772706 -1.9090436  2.7180831 -4.6801567  3.7710313
[19]  0.8975202 -0.9590502
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.4914683
[2,]  0.2051142
[3,]  0.4337570
[4,]  0.5728652
[5,]  1.5853932
> 
> rowApply(tmp,sum)
[1]  5.932974 -2.461393 -4.034372 -2.042500  8.299002
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   13    7   16   19    7
[2,]    5   15    7   15    1
[3,]    6   12   12   18    6
[4,]   20   13    1    3   14
[5,]   10   10   13   13   19
> 
> 
> as.matrix(tmp)
           [,1]       [,2]        [,3]       [,4]        [,5]       [,6]
[1,]  0.5728652 -0.5368757 -0.46821280  1.7656009  0.16464174 -0.8911637
[2,] -0.4914683  0.2911762  0.01250859  0.1544560 -0.20527365  1.0624735
[3,]  0.4337570 -0.6019905  0.06174264 -1.8165356  0.06716027 -0.3528946
[4,]  1.5853932  0.6311371  0.82629706 -1.6306857  0.33927642 -0.5033809
[5,]  0.2051142 -2.0805256 -0.02019437  0.7886416  1.90459235  0.3511506
           [,7]       [,8]        [,9]      [,10]     [,11]       [,12]
[1,]  1.2755369  1.4156051 -0.14039519  1.6091240  0.882231  1.25776607
[2,] -0.8735744  1.1358432 -0.88742446  0.8800240 -1.644250 -0.72381678
[3,] -0.0891465 -0.8852116  0.25638065 -1.2599980  1.234365 -0.58440664
[4,] -1.0924616  0.5528552 -0.05372724  0.6388917  2.007771  0.08478652
[5,] -1.2448773 -1.1248034  0.40778578  1.4659170  1.704853  0.28580369
          [,13]      [,14]      [,15]      [,16]      [,17]     [,18]
[1,]  0.5294543 -0.7159784 -1.5879436  0.6348232 -0.5415037 0.4103649
[2,]  1.2010132 -1.2269641 -0.4241270 -0.3440021 -1.6045513 1.1844516
[3,] -1.6099601 -0.1719363 -0.8197638  1.0628990 -1.0081270 0.3695489
[4,] -0.3152101 -0.8949010 -0.5819239 -1.6761206 -1.7671016 0.7946594
[5,]  0.4170701  0.5325093  1.5047146  3.0404835  0.2411268 1.0120065
          [,19]      [,20]
[1,]  0.1479276  0.1491060
[2,] -0.1770910  0.2192045
[3,]  0.9207930  0.7589522
[4,]  0.3099817 -1.2980366
[5,] -0.3040911 -0.7882764
> 
> 
> 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.20-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.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  649  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  561  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1        col2      col3      col4     col5      col6       col7
row1 0.8312135 -0.07068187 0.6755393 0.1590313 1.351373 0.8828289 -0.6926102
          col8       col9      col10     col11     col12      col13      col14
row1 -1.999212 -0.1782008 -0.1813827 0.2094689 0.2403724 -0.6980598 -0.4759757
         col15     col16     col17     col18     col19    col20
row1 -1.017623 -1.288185 -1.672947 0.1911784 -0.532479 1.124954
> tmp[,"col10"]
           col10
row1 -0.18138269
row2  0.07319198
row3  0.61328315
row4  0.88599034
row5 -0.37880066
> tmp[c("row1","row5"),]
           col1        col2      col3       col4     col5       col6       col7
row1  0.8312135 -0.07068187 0.6755393  0.1590313 1.351373  0.8828289 -0.6926102
row5 -0.3562806 -0.19814684 0.4814312 -0.2724620 1.180771 -0.8744125  0.8259779
           col8       col9      col10      col11      col12      col13
row1 -1.9992125 -0.1782008 -0.1813827  0.2094689  0.2403724 -0.6980598
row5  0.6051086  0.9219119 -0.3788007 -0.8803247 -0.5955106  0.6871898
          col14      col15     col16       col17     col18      col19
row1 -0.4759757 -1.0176233 -1.288185 -1.67294696 0.1911784 -0.5324790
row5 -0.4907195  0.7180016 -1.529672 -0.05645163 0.9390966 -0.5791561
          col20
row1  1.1249535
row5 -0.8726197
> tmp[,c("col6","col20")]
           col6      col20
row1  0.8828289  1.1249535
row2 -1.2311543 -0.4335212
row3  2.6317581 -0.4424526
row4 -1.1126207  0.5375096
row5 -0.8744125 -0.8726197
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  0.8828289  1.1249535
row5 -0.8744125 -0.8726197
> 
> 
> 
> 
> 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 51.00215 48.59817 50.44004 52.38356 50.34235 103.3047 48.4664 50.61115
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.64164 47.40382 49.75011 49.70037 49.66066 49.07567 50.30263 51.39337
        col17   col18    col19    col20
row1 49.88699 48.7362 48.98531 106.7634
> tmp[,"col10"]
        col10
row1 47.40382
row2 29.06104
row3 30.66389
row4 29.68919
row5 50.24670
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.00215 48.59817 50.44004 52.38356 50.34235 103.3047 48.46640 50.61115
row5 50.61569 50.65240 49.99100 50.21722 51.10328 103.6416 48.45517 51.03277
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.64164 47.40382 49.75011 49.70037 49.66066 49.07567 50.30263 51.39337
row5 49.03946 50.24670 49.83387 48.69681 50.85654 49.59817 50.44922 50.37607
        col17    col18    col19    col20
row1 49.88699 48.73620 48.98531 106.7634
row5 51.17218 48.90495 49.12192 106.2432
> tmp[,c("col6","col20")]
          col6     col20
row1 103.30468 106.76335
row2  73.54356  77.80416
row3  74.12910  75.13502
row4  76.09612  73.53386
row5 103.64159 106.24322
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.3047 106.7634
row5 103.6416 106.2432
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.3047 106.7634
row5 103.6416 106.2432
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
         col13
[1,] 1.1892939
[2,] 0.5545592
[3,] 1.4421278
[4,] 1.8285989
[5,] 0.9561708
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.4696735  0.5749698
[2,] -0.1622457  1.2090365
[3,]  0.6977663 -1.4754588
[4,]  1.5855189  1.1353875
[5,] -1.0117198 -0.1407486
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.7908005  0.7356725
[2,]  1.7079232  1.0557264
[3,] -0.2663416 -0.9649334
[4,]  1.0570027  1.5387384
[5,] -1.7295355 -0.0344728
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.7908005
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.7908005
[2,]  1.7079232
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]       [,4]       [,5]        [,6]
row3 -0.8270696  0.3657214 -0.1091410  1.0233053  0.2931130  0.04841397
row1  0.4682141 -0.5320078  0.8482256 -0.7921137 -0.6695953 -1.12537018
          [,7]       [,8]      [,9]      [,10]      [,11]      [,12]     [,13]
row3 -1.114009 -1.9195844 0.1577085 -0.2454850  0.7086237 -0.2872479 1.0407163
row1  0.448327  0.8519202 0.5124673 -0.6823471 -0.2239177  0.8365691 0.2917202
         [,14]     [,15]      [,16]     [,17]      [,18]      [,19]      [,20]
row3 0.6622571  3.021412 0.31641522 0.2024441 0.07426058 1.11448603  1.0108481
row1 0.2193202 -1.878897 0.06842748 1.0533282 0.91098783 0.09892874 -0.3379332
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]      [,3]       [,4]      [,5]      [,6]     [,7]
row2 0.7244148 0.549797 0.8882308 -0.1563576 -1.306235 0.3485954 2.346983
           [,8]       [,9]     [,10]
row2 -0.5518763 -0.7486733 0.3114526
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]      [,2]      [,3]       [,4]     [,5]      [,6]       [,7]
row5 -0.3662374 -1.500959 -1.350679 -0.8912966 1.084677 0.1486823 -0.8886288
          [,8]      [,9]    [,10]     [,11]     [,12]      [,13]     [,14]
row5 -1.207939 0.7950598 0.871042 0.4108884 0.6531807 -0.5394376 0.2212647
         [,15]       [,16]    [,17]     [,18]    [,19]    [,20]
row5 -0.516201 -0.04988961 0.760881 -1.296944 0.995656 1.351576
> 
> 
> 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: 0x55ccc7682060>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e7ae29030"
 [2] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e542650d3"
 [3] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e1d166e0e"
 [4] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e7c3c6c61"
 [5] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e5da02"   
 [6] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e504ae04f"
 [7] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e6188fc22"
 [8] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e1067f8a6"
 [9] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e10300943"
[10] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e485171a1"
[11] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e68025e71"
[12] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e7842e579"
[13] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e589201"  
[14] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e4407dd41"
[15] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BMbcf3e60e41f4b"
> 
> 
> ### 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: 0x55ccc7dad6f0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x55ccc7dad6f0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x55ccc7dad6f0>
> rowMedians(tmp)
  [1]  0.51456060  0.55328824  0.43694586 -0.05860133 -0.22900526 -0.18399516
  [7] -0.10690837  0.14189496  0.32063310 -0.06201356  0.11139092  0.02441274
 [13] -0.70868484  0.13481658  0.13028588  0.21833049 -0.14742724  0.05330837
 [19] -0.22161310  0.30038449 -0.73291125 -0.01034324  0.40506447  0.17341935
 [25] -0.09601898  0.18551876  0.02912421  0.10571620 -0.37956880  0.38841439
 [31] -0.39112164  0.19909390 -0.17021091  0.12540505  0.30947660 -0.08981412
 [37] -0.03612705 -0.49427307 -0.67097450 -0.03891503  0.21680232  0.13135004
 [43]  0.20612374  0.34754656  0.40338952  0.52567048 -0.32258657  0.05511528
 [49]  0.13182001 -0.71309075 -0.03384432  0.24526421  0.33427372 -0.34371359
 [55] -0.04400573  0.30148040 -0.02243392  0.16324873  0.18045321 -0.13885310
 [61] -0.29423173 -0.21626298  0.31586647  0.20735421 -0.08743854 -0.02693569
 [67]  0.18101307  0.32635224 -0.46760597  0.20722083  0.02482587  0.80478517
 [73]  0.06659961  0.32899597  0.01372791  0.06740623 -0.24106777  0.59208497
 [79]  0.47749901 -0.02401340  0.04374445  0.60586878  0.14437191  0.35586522
 [85]  0.49865286  0.10144478  0.46416154 -0.17238568 -0.54322408 -0.24592388
 [91] -0.07878857 -0.77213729 -0.23636377 -0.50479602  0.75874308 -0.28544363
 [97]  0.34041449  0.12281895 -0.29604203  0.26716243 -0.22781487  0.20099156
[103] -0.83052526  0.10746092  0.27311974  0.55640621 -0.61174512 -0.28905624
[109] -0.33436350 -0.29768437  0.13931253  0.12845283  0.36558102 -0.17061436
[115]  0.06870926  0.09405734  0.10285456 -0.43551482 -0.17698373  0.41109776
[121]  0.12590321 -0.46211825 -0.20016587  0.07913554  0.24330983  0.03316553
[127] -0.45375672  0.47479849  0.72609881 -0.01968566  0.77414681  0.05486442
[133] -0.38610940 -0.20620451 -0.05917728 -0.43105216 -0.19033078  0.21590704
[139] -0.33349000 -0.03390713 -0.11666089  0.01992092  0.63727345 -0.08626713
[145] -0.13590698  0.22451454 -0.07894727  0.08365073 -0.46138854  0.35428889
[151]  0.29240797 -0.04635330 -0.49084455 -0.20376182 -0.01393536 -0.78326614
[157] -0.07812564 -0.50550524 -0.24819015  0.19973431  0.05446264  0.10106078
[163]  0.41379172 -0.10443815 -0.07313573 -0.18688564  0.04845054 -0.50066695
[169] -0.30223973  0.34454341  0.19937416  0.38340272  0.41597181 -0.19116424
[175]  0.64291449 -0.02167023 -0.28044670 -0.14044366  0.25996991 -0.42962792
[181] -0.20468677 -0.16246186 -0.15975485  0.36444249 -0.04125946 -0.06699975
[187]  0.56335825 -0.06246400  0.16731531  0.01875570 -0.24708560 -0.46907952
[193]  0.15732379  0.13330620  0.43660924 -0.37982546 -0.92200643 -0.09762303
[199] -0.29122325 -0.26915655  0.19396497 -0.11391654 -0.05411825 -0.30133097
[205]  0.02579954 -0.30726001  0.14563834 -0.26863188 -0.31084271  0.69163190
[211]  0.29030528  0.52527581  0.35251798  0.38822179  0.46191653  0.32943058
[217]  0.38027237  0.05040715  0.57342753 -0.13031360 -0.43081511  0.17161348
[223] -0.14223724 -0.51184088 -0.42325922 -0.30642342 -0.13412669  0.26835493
[229]  0.05115640 -0.12537024
> 
> proc.time()
   user  system elapsed 
  1.241   0.673   1.910 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 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: 0x55e694308950>
> .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: 0x55e694308950>
> .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: 0x55e694308950>
> .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: 0x55e694308950>
> 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: 0x55e695b88860>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55e695b88860>
> .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: 0x55e695b88860>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55e695b88860>
> .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: 0x55e695b88860>
> 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: 0x55e695bd3c10>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55e695bd3c10>
> .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: 0x55e695bd3c10>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55e695bd3c10>
> .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: 0x55e695bd3c10>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x55e695bd3c10>
> .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: 0x55e695bd3c10>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x55e695bd3c10>
> .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: 0x55e695bd3c10>
> 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: 0x55e695571230>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x55e695571230>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55e695571230>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55e695571230>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilebd0cc3544a1a1" "BufferedMatrixFilebd0cc36e87a04"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilebd0cc3544a1a1" "BufferedMatrixFilebd0cc36e87a04"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x55e694889700>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55e694889700>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55e694889700>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55e694889700>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x55e694889700>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x55e694889700>
> .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: 0x55e6948c9050>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55e6948c9050>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55e6948c9050>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x55e6948c9050>
> 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: 0x55e694a4aa30>
> .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: 0x55e694a4aa30>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.276   0.045   0.310 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 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.263   0.041   0.290 

Example timings