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

This page was generated on 2025-01-20 12:16 -0500 (Mon, 20 Jan 2025).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 24.04.1 LTS)x86_644.4.2 (2024-10-31) -- "Pile of Leaves" 4746
palomino8Windows Server 2022 Datacenterx644.4.2 (2024-10-31 ucrt) -- "Pile of Leaves" 4493
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 251/2289HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.70.0  (landing page)
Ben Bolstad
Snapshot Date: 2025-01-19 12:27 -0500 (Sun, 19 Jan 2025)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_20
git_last_commit: 32b6f6a
git_last_commit_date: 2024-10-29 09:27:20 -0500 (Tue, 29 Oct 2024)
nebbiolo2Linux (Ubuntu 24.04.1 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


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.70.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.70.0.tar.gz
StartedAt: 2025-01-19 19:08:00 -0500 (Sun, 19 Jan 2025)
EndedAt: 2025-01-19 19:08:23 -0500 (Sun, 19 Jan 2025)
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.70.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.4.2 (2024-10-31)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
    gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
    GNU Fortran (Ubuntu 13.2.0-23ubuntu4) 13.2.0
* running under: Ubuntu 24.04.1 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.70.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... OK
* used C compiler: ‘gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
checkRd: (-1) BufferedMatrix-class.Rd:209: Lost braces; missing escapes or markup?
   209 |     $x^{power}$ elementwise of the matrix
       |        ^
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

Status: 2 NOTEs
See
  ‘/home/biocbuild/bbs-3.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 13.3.0-6ubuntu2~24.04) 13.3.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){
      |       ^~~~~~~~~~~~~~~~~~~
doubleBufferedMatrix.c: At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
gcc -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.2 (2024-10-31) -- "Pile of Leaves"
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.224   0.048   0.263 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.4.2 (2024-10-31) -- "Pile of Leaves"
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 471792 25.2    1026261 54.9   643431 34.4
Vcells 871947  6.7    8388608 64.0  2046621 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] "Sun Jan 19 19:08:14 2025"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sun Jan 19 19:08:15 2025"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x57e4d30c2b40>
> 
> 
> 
> 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] "Sun Jan 19 19:08:15 2025"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sun Jan 19 19:08:15 2025"
> 
> ColMode(tmp2)
<pointer: 0x57e4d30c2b40>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]        [,2]      [,3]        [,4]
[1,] 100.4766499 -0.08040873  0.593958  0.20734514
[2,]   1.9820054  0.42929980 -1.280783 -1.49132195
[3,]  -0.5982028  1.05709593  1.086920  0.07344434
[4,]  -1.6288009  1.26150405 -1.666604 -0.57205886
> 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 :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]       [,2]     [,3]       [,4]
[1,] 100.4766499 0.08040873 0.593958 0.20734514
[2,]   1.9820054 0.42929980 1.280783 1.49132195
[3,]   0.5982028 1.05709593 1.086920 0.07344434
[4,]   1.6288009 1.26150405 1.666604 0.57205886
> 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 :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0238042 0.2835643 0.7706867 0.4553517
[2,]  1.4078371 0.6552097 1.1317167 1.2211969
[3,]  0.7734357 1.0281517 1.0425546 0.2710062
[4,]  1.2762449 1.1231670 1.2909703 0.7563457
> 
> 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 :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.71469 27.91605 33.30083 29.76086
[2,]  41.06038 31.98140 37.59795 38.70329
[3,]  33.33256 36.33861 36.51247 27.78351
[4,]  39.39125 37.49317 39.57631 33.13552
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x57e4d1071470>
> exp(tmp5)
<pointer: 0x57e4d1071470>
> log(tmp5,2)
<pointer: 0x57e4d1071470>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.7956
> Min(tmp5)
[1] 53.16641
> mean(tmp5)
[1] 73.2677
> Sum(tmp5)
[1] 14653.54
> Var(tmp5)
[1] 856.8163
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.30775 74.67917 71.94926 71.29179 69.60318 71.96425 70.30608 73.62017
 [9] 69.10590 70.84943
> rowSums(tmp5)
 [1] 1786.155 1493.583 1438.985 1425.836 1392.064 1439.285 1406.122 1472.403
 [9] 1382.118 1416.989
> rowVars(tmp5)
 [1] 8075.80179   44.26936   67.26966   90.89630   56.05829   87.73532
 [7]   68.66042   37.49591   73.74053   43.55916
> rowSd(tmp5)
 [1] 89.865465  6.653522  8.201808  9.533955  7.487208  9.366714  8.286158
 [8]  6.123390  8.587231  6.599937
> rowMax(tmp5)
 [1] 469.79556  85.46179  87.99872  86.21629  84.16389  90.42422  82.46839
 [8]  87.45046  86.19655  84.07243
> rowMin(tmp5)
 [1] 54.69371 62.41912 57.82773 54.54913 55.73996 57.14907 53.16641 64.30890
 [9] 53.45999 60.60028
> 
> colMeans(tmp5)
 [1] 115.51772  73.30176  73.87093  67.66263  70.20211  74.63252  67.19663
 [8]  71.65690  74.92385  76.13605  67.40449  68.02475  74.39538  73.77194
[15]  67.72452  69.73288  67.14139  73.11256  69.27685  69.66811
> colSums(tmp5)
 [1] 1155.1772  733.0176  738.7093  676.6263  702.0211  746.3252  671.9663
 [8]  716.5690  749.2385  761.3605  674.0449  680.2475  743.9538  737.7194
[15]  677.2452  697.3288  671.4139  731.1256  692.7685  696.6811
> colVars(tmp5)
 [1] 15535.19425    56.54601    20.36521   111.25589    27.11519    68.75152
 [7]    83.69097    24.71565    49.97522    83.56499    51.61241    46.44428
[13]   125.55419    39.56023    35.00665    45.77853    64.00951    98.39484
[19]    58.35887    39.73022
> colSd(tmp5)
 [1] 124.640259   7.519708   4.512783  10.547791   5.207225   8.291653
 [7]   9.148277   4.971484   7.069315   9.141389   7.184178   6.815004
[13]  11.205097   6.289692   5.916642   6.765983   8.000594   9.919418
[19]   7.639298   6.303191
> colMax(tmp5)
 [1] 469.79556  86.19655  82.37290  83.36638  77.28670  86.21629  79.65224
 [8]  80.14045  84.95492  90.42422  78.41295  82.56917  87.45046  83.06026
[15]  78.93838  75.76530  76.78744  87.21387  84.16389  77.84880
> colMin(tmp5)
 [1] 65.83818 58.10360 68.38188 53.45999 60.60028 63.63552 54.54913 65.53805
 [9] 63.29681 64.60912 58.48051 59.51650 58.75161 63.22658 62.12002 57.27506
[17] 53.16641 57.14907 54.69371 58.30010
> 
> 
> ### 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]       NA 74.67917 71.94926 71.29179 69.60318 71.96425 70.30608 73.62017
 [9] 69.10590 70.84943
> rowSums(tmp5)
 [1]       NA 1493.583 1438.985 1425.836 1392.064 1439.285 1406.122 1472.403
 [9] 1382.118 1416.989
> rowVars(tmp5)
 [1] 8463.19821   44.26936   67.26966   90.89630   56.05829   87.73532
 [7]   68.66042   37.49591   73.74053   43.55916
> rowSd(tmp5)
 [1] 91.995642  6.653522  8.201808  9.533955  7.487208  9.366714  8.286158
 [8]  6.123390  8.587231  6.599937
> rowMax(tmp5)
 [1]       NA 85.46179 87.99872 86.21629 84.16389 90.42422 82.46839 87.45046
 [9] 86.19655 84.07243
> rowMin(tmp5)
 [1]       NA 62.41912 57.82773 54.54913 55.73996 57.14907 53.16641 64.30890
 [9] 53.45999 60.60028
> 
> colMeans(tmp5)
 [1] 115.51772  73.30176  73.87093  67.66263  70.20211  74.63252        NA
 [8]  71.65690  74.92385  76.13605  67.40449  68.02475  74.39538  73.77194
[15]  67.72452  69.73288  67.14139  73.11256  69.27685  69.66811
> colSums(tmp5)
 [1] 1155.1772  733.0176  738.7093  676.6263  702.0211  746.3252        NA
 [8]  716.5690  749.2385  761.3605  674.0449  680.2475  743.9538  737.7194
[15]  677.2452  697.3288  671.4139  731.1256  692.7685  696.6811
> colVars(tmp5)
 [1] 15535.19425    56.54601    20.36521   111.25589    27.11519    68.75152
 [7]          NA    24.71565    49.97522    83.56499    51.61241    46.44428
[13]   125.55419    39.56023    35.00665    45.77853    64.00951    98.39484
[19]    58.35887    39.73022
> colSd(tmp5)
 [1] 124.640259   7.519708   4.512783  10.547791   5.207225   8.291653
 [7]         NA   4.971484   7.069315   9.141389   7.184178   6.815004
[13]  11.205097   6.289692   5.916642   6.765983   8.000594   9.919418
[19]   7.639298   6.303191
> colMax(tmp5)
 [1] 469.79556  86.19655  82.37290  83.36638  77.28670  86.21629        NA
 [8]  80.14045  84.95492  90.42422  78.41295  82.56917  87.45046  83.06026
[15]  78.93838  75.76530  76.78744  87.21387  84.16389  77.84880
> colMin(tmp5)
 [1] 65.83818 58.10360 68.38188 53.45999 60.60028 63.63552       NA 65.53805
 [9] 63.29681 64.60912 58.48051 59.51650 58.75161 63.22658 62.12002 57.27506
[17] 53.16641 57.14907 54.69371 58.30010
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.7956
> Min(tmp5,na.rm=TRUE)
[1] 53.16641
> mean(tmp5,na.rm=TRUE)
[1] 73.34974
> Sum(tmp5,na.rm=TRUE)
[1] 14596.6
> Var(tmp5,na.rm=TRUE)
[1] 859.7908
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.01121 74.67917 71.94926 71.29179 69.60318 71.96425 70.30608 73.62017
 [9] 69.10590 70.84943
> rowSums(tmp5,na.rm=TRUE)
 [1] 1729.213 1493.583 1438.985 1425.836 1392.064 1439.285 1406.122 1472.403
 [9] 1382.118 1416.989
> rowVars(tmp5,na.rm=TRUE)
 [1] 8463.19821   44.26936   67.26966   90.89630   56.05829   87.73532
 [7]   68.66042   37.49591   73.74053   43.55916
> rowSd(tmp5,na.rm=TRUE)
 [1] 91.995642  6.653522  8.201808  9.533955  7.487208  9.366714  8.286158
 [8]  6.123390  8.587231  6.599937
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.79556  85.46179  87.99872  86.21629  84.16389  90.42422  82.46839
 [8]  87.45046  86.19655  84.07243
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.69371 62.41912 57.82773 54.54913 55.73996 57.14907 53.16641 64.30890
 [9] 53.45999 60.60028
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.51772  73.30176  73.87093  67.66263  70.20211  74.63252  68.33601
 [8]  71.65690  74.92385  76.13605  67.40449  68.02475  74.39538  73.77194
[15]  67.72452  69.73288  67.14139  73.11256  69.27685  69.66811
> colSums(tmp5,na.rm=TRUE)
 [1] 1155.1772  733.0176  738.7093  676.6263  702.0211  746.3252  615.0241
 [8]  716.5690  749.2385  761.3605  674.0449  680.2475  743.9538  737.7194
[15]  677.2452  697.3288  671.4139  731.1256  692.7685  696.6811
> colVars(tmp5,na.rm=TRUE)
 [1] 15535.19425    56.54601    20.36521   111.25589    27.11519    68.75152
 [7]    79.54756    24.71565    49.97522    83.56499    51.61241    46.44428
[13]   125.55419    39.56023    35.00665    45.77853    64.00951    98.39484
[19]    58.35887    39.73022
> colSd(tmp5,na.rm=TRUE)
 [1] 124.640259   7.519708   4.512783  10.547791   5.207225   8.291653
 [7]   8.918944   4.971484   7.069315   9.141389   7.184178   6.815004
[13]  11.205097   6.289692   5.916642   6.765983   8.000594   9.919418
[19]   7.639298   6.303191
> colMax(tmp5,na.rm=TRUE)
 [1] 469.79556  86.19655  82.37290  83.36638  77.28670  86.21629  79.65224
 [8]  80.14045  84.95492  90.42422  78.41295  82.56917  87.45046  83.06026
[15]  78.93838  75.76530  76.78744  87.21387  84.16389  77.84880
> colMin(tmp5,na.rm=TRUE)
 [1] 65.83818 58.10360 68.38188 53.45999 60.60028 63.63552 54.54913 65.53805
 [9] 63.29681 64.60912 58.48051 59.51650 58.75161 63.22658 62.12002 57.27506
[17] 53.16641 57.14907 54.69371 58.30010
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1]      NaN 74.67917 71.94926 71.29179 69.60318 71.96425 70.30608 73.62017
 [9] 69.10590 70.84943
> rowSums(tmp5,na.rm=TRUE)
 [1]    0.000 1493.583 1438.985 1425.836 1392.064 1439.285 1406.122 1472.403
 [9] 1382.118 1416.989
> rowVars(tmp5,na.rm=TRUE)
 [1]       NA 44.26936 67.26966 90.89630 56.05829 87.73532 68.66042 37.49591
 [9] 73.74053 43.55916
> rowSd(tmp5,na.rm=TRUE)
 [1]       NA 6.653522 8.201808 9.533955 7.487208 9.366714 8.286158 6.123390
 [9] 8.587231 6.599937
> rowMax(tmp5,na.rm=TRUE)
 [1]       NA 85.46179 87.99872 86.21629 84.16389 90.42422 82.46839 87.45046
 [9] 86.19655 84.07243
> rowMin(tmp5,na.rm=TRUE)
 [1]       NA 62.41912 57.82773 54.54913 55.73996 57.14907 53.16641 64.30890
 [9] 53.45999 60.60028
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 76.15351 74.99044 74.37756 68.29811 69.67911 73.75183      NaN 71.79919
 [9] 75.43587 77.12663 66.63869 67.91665 73.98117 73.37488 68.30027 69.33505
[17] 67.21575 72.98369 70.89720 69.11781
> colSums(tmp5,na.rm=TRUE)
 [1] 685.3816 674.9140 669.3980 614.6830 627.1120 663.7665   0.0000 646.1927
 [9] 678.9228 694.1396 599.7482 611.2498 665.8305 660.3739 614.7024 624.0154
[17] 604.9417 656.8532 638.0748 622.0603
> colVars(tmp5,na.rm=TRUE)
 [1]  44.76183  31.53317  20.02333 120.61978  27.42733  68.61978        NA
 [8]  27.57735  53.27275  82.97157  51.46642  52.11833 139.31829  42.73165
[15]  35.65327  49.72033  71.94850 110.50735  36.11651  41.28963
> colSd(tmp5,na.rm=TRUE)
 [1]  6.690428  5.615440  4.474744 10.982704  5.237111  8.283706        NA
 [8]  5.251414  7.298819  9.108873  7.174010  7.219303 11.803317  6.536945
[15]  5.971036  7.051264  8.482246 10.512248  6.009702  6.425701
> colMax(tmp5,na.rm=TRUE)
 [1] 85.46179 86.19655 82.37290 83.36638 77.28670 86.21629     -Inf 80.14045
 [9] 84.95492 90.42422 78.41295 82.56917 87.45046 83.06026 78.93838 75.76530
[17] 76.78744 87.21387 84.16389 77.84880
> colMin(tmp5,na.rm=TRUE)
 [1] 65.83818 66.56509 68.38188 53.45999 60.60028 63.63552      Inf 65.53805
 [9] 63.29681 64.60912 58.48051 59.51650 58.75161 63.22658 62.12002 57.27506
[17] 53.16641 57.14907 63.74287 58.30010
> 
> 
> 
> 
> 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] 201.7427 256.7451 277.1955 331.7834 277.0643 191.5999 137.6312 143.9669
 [9] 170.7602 266.0595
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 201.7427 256.7451 277.1955 331.7834 277.0643 191.5999 137.6312 143.9669
 [9] 170.7602 266.0595
> 
> 
> 
> 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]  1.989520e-13 -5.684342e-14  5.684342e-14  1.421085e-14  0.000000e+00
 [6]  2.842171e-14  5.684342e-14  5.684342e-14  2.842171e-14 -5.684342e-14
[11]  2.842171e-14  2.273737e-13  5.684342e-14  5.684342e-14  8.526513e-14
[16]  1.065814e-14 -1.705303e-13  8.526513e-14  1.847411e-13  1.421085e-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)
+ }
10   19 
7   18 
2   6 
6   1 
6   20 
3   9 
10   3 
4   19 
6   5 
7   11 
6   13 
10   4 
2   7 
9   9 
6   15 
7   4 
10   18 
9   16 
2   11 
10   9 
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] 1.486603
> Min(tmp)
[1] -1.9969
> mean(tmp)
[1] -0.163393
> Sum(tmp)
[1] -16.3393
> Var(tmp)
[1] 0.7146337
> 
> rowMeans(tmp)
[1] -0.163393
> rowSums(tmp)
[1] -16.3393
> rowVars(tmp)
[1] 0.7146337
> rowSd(tmp)
[1] 0.8453601
> rowMax(tmp)
[1] 1.486603
> rowMin(tmp)
[1] -1.9969
> 
> colMeans(tmp)
  [1]  0.338023088 -0.145905496 -1.996899748  0.039706473  0.487990489
  [6] -1.724282066  0.892959717  0.748945964 -1.400560262  1.486603182
 [11] -0.849851483  0.788445393 -1.697661396  0.404838329 -0.155753078
 [16] -1.197341647 -0.283789169 -0.975164275  0.514163144 -0.057824814
 [21] -0.516192935  0.458835197  0.025671859  0.148419956  1.150678149
 [26] -1.857151983  0.032288987  1.102861654  1.243473594 -0.834056768
 [31] -1.177722128 -0.350790740 -1.647608027  1.375000221 -1.280499228
 [36] -1.039995812 -0.420635191  0.777338969 -0.897351642  0.165656889
 [41]  0.202485377 -0.022787196 -1.523137307  1.169473639 -0.658054120
 [46] -0.189793055  1.364333974  0.631866810 -0.009386584  0.891801734
 [51] -0.586688657  0.045665928  0.298208718  0.207706088 -0.151653215
 [56] -0.175772419 -0.290252272 -1.218917279  0.781064519 -0.459216475
 [61]  1.227757806 -0.181092382  0.406974949 -1.785583852  0.171121499
 [66] -0.673413025 -0.306010728  0.411256357 -0.120556563  1.136804914
 [71] -0.790559896 -0.484051265  1.213755651 -0.775093792 -0.576948072
 [76] -0.565018273 -0.551267311  1.142787386 -1.057939522 -0.053766280
 [81] -1.044663742  0.033034545  0.614932837 -0.438546678 -1.714420932
 [86] -0.843933474 -0.878436836 -0.636802224 -0.014116320  0.363563965
 [91] -0.780166394  1.052183843  0.586955862 -0.965898667  0.038087900
 [96]  0.109910941 -0.133595271 -0.774298716  0.045203319 -0.729258707
> colSums(tmp)
  [1]  0.338023088 -0.145905496 -1.996899748  0.039706473  0.487990489
  [6] -1.724282066  0.892959717  0.748945964 -1.400560262  1.486603182
 [11] -0.849851483  0.788445393 -1.697661396  0.404838329 -0.155753078
 [16] -1.197341647 -0.283789169 -0.975164275  0.514163144 -0.057824814
 [21] -0.516192935  0.458835197  0.025671859  0.148419956  1.150678149
 [26] -1.857151983  0.032288987  1.102861654  1.243473594 -0.834056768
 [31] -1.177722128 -0.350790740 -1.647608027  1.375000221 -1.280499228
 [36] -1.039995812 -0.420635191  0.777338969 -0.897351642  0.165656889
 [41]  0.202485377 -0.022787196 -1.523137307  1.169473639 -0.658054120
 [46] -0.189793055  1.364333974  0.631866810 -0.009386584  0.891801734
 [51] -0.586688657  0.045665928  0.298208718  0.207706088 -0.151653215
 [56] -0.175772419 -0.290252272 -1.218917279  0.781064519 -0.459216475
 [61]  1.227757806 -0.181092382  0.406974949 -1.785583852  0.171121499
 [66] -0.673413025 -0.306010728  0.411256357 -0.120556563  1.136804914
 [71] -0.790559896 -0.484051265  1.213755651 -0.775093792 -0.576948072
 [76] -0.565018273 -0.551267311  1.142787386 -1.057939522 -0.053766280
 [81] -1.044663742  0.033034545  0.614932837 -0.438546678 -1.714420932
 [86] -0.843933474 -0.878436836 -0.636802224 -0.014116320  0.363563965
 [91] -0.780166394  1.052183843  0.586955862 -0.965898667  0.038087900
 [96]  0.109910941 -0.133595271 -0.774298716  0.045203319 -0.729258707
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.338023088 -0.145905496 -1.996899748  0.039706473  0.487990489
  [6] -1.724282066  0.892959717  0.748945964 -1.400560262  1.486603182
 [11] -0.849851483  0.788445393 -1.697661396  0.404838329 -0.155753078
 [16] -1.197341647 -0.283789169 -0.975164275  0.514163144 -0.057824814
 [21] -0.516192935  0.458835197  0.025671859  0.148419956  1.150678149
 [26] -1.857151983  0.032288987  1.102861654  1.243473594 -0.834056768
 [31] -1.177722128 -0.350790740 -1.647608027  1.375000221 -1.280499228
 [36] -1.039995812 -0.420635191  0.777338969 -0.897351642  0.165656889
 [41]  0.202485377 -0.022787196 -1.523137307  1.169473639 -0.658054120
 [46] -0.189793055  1.364333974  0.631866810 -0.009386584  0.891801734
 [51] -0.586688657  0.045665928  0.298208718  0.207706088 -0.151653215
 [56] -0.175772419 -0.290252272 -1.218917279  0.781064519 -0.459216475
 [61]  1.227757806 -0.181092382  0.406974949 -1.785583852  0.171121499
 [66] -0.673413025 -0.306010728  0.411256357 -0.120556563  1.136804914
 [71] -0.790559896 -0.484051265  1.213755651 -0.775093792 -0.576948072
 [76] -0.565018273 -0.551267311  1.142787386 -1.057939522 -0.053766280
 [81] -1.044663742  0.033034545  0.614932837 -0.438546678 -1.714420932
 [86] -0.843933474 -0.878436836 -0.636802224 -0.014116320  0.363563965
 [91] -0.780166394  1.052183843  0.586955862 -0.965898667  0.038087900
 [96]  0.109910941 -0.133595271 -0.774298716  0.045203319 -0.729258707
> colMin(tmp)
  [1]  0.338023088 -0.145905496 -1.996899748  0.039706473  0.487990489
  [6] -1.724282066  0.892959717  0.748945964 -1.400560262  1.486603182
 [11] -0.849851483  0.788445393 -1.697661396  0.404838329 -0.155753078
 [16] -1.197341647 -0.283789169 -0.975164275  0.514163144 -0.057824814
 [21] -0.516192935  0.458835197  0.025671859  0.148419956  1.150678149
 [26] -1.857151983  0.032288987  1.102861654  1.243473594 -0.834056768
 [31] -1.177722128 -0.350790740 -1.647608027  1.375000221 -1.280499228
 [36] -1.039995812 -0.420635191  0.777338969 -0.897351642  0.165656889
 [41]  0.202485377 -0.022787196 -1.523137307  1.169473639 -0.658054120
 [46] -0.189793055  1.364333974  0.631866810 -0.009386584  0.891801734
 [51] -0.586688657  0.045665928  0.298208718  0.207706088 -0.151653215
 [56] -0.175772419 -0.290252272 -1.218917279  0.781064519 -0.459216475
 [61]  1.227757806 -0.181092382  0.406974949 -1.785583852  0.171121499
 [66] -0.673413025 -0.306010728  0.411256357 -0.120556563  1.136804914
 [71] -0.790559896 -0.484051265  1.213755651 -0.775093792 -0.576948072
 [76] -0.565018273 -0.551267311  1.142787386 -1.057939522 -0.053766280
 [81] -1.044663742  0.033034545  0.614932837 -0.438546678 -1.714420932
 [86] -0.843933474 -0.878436836 -0.636802224 -0.014116320  0.363563965
 [91] -0.780166394  1.052183843  0.586955862 -0.965898667  0.038087900
 [96]  0.109910941 -0.133595271 -0.774298716  0.045203319 -0.729258707
> colMedians(tmp)
  [1]  0.338023088 -0.145905496 -1.996899748  0.039706473  0.487990489
  [6] -1.724282066  0.892959717  0.748945964 -1.400560262  1.486603182
 [11] -0.849851483  0.788445393 -1.697661396  0.404838329 -0.155753078
 [16] -1.197341647 -0.283789169 -0.975164275  0.514163144 -0.057824814
 [21] -0.516192935  0.458835197  0.025671859  0.148419956  1.150678149
 [26] -1.857151983  0.032288987  1.102861654  1.243473594 -0.834056768
 [31] -1.177722128 -0.350790740 -1.647608027  1.375000221 -1.280499228
 [36] -1.039995812 -0.420635191  0.777338969 -0.897351642  0.165656889
 [41]  0.202485377 -0.022787196 -1.523137307  1.169473639 -0.658054120
 [46] -0.189793055  1.364333974  0.631866810 -0.009386584  0.891801734
 [51] -0.586688657  0.045665928  0.298208718  0.207706088 -0.151653215
 [56] -0.175772419 -0.290252272 -1.218917279  0.781064519 -0.459216475
 [61]  1.227757806 -0.181092382  0.406974949 -1.785583852  0.171121499
 [66] -0.673413025 -0.306010728  0.411256357 -0.120556563  1.136804914
 [71] -0.790559896 -0.484051265  1.213755651 -0.775093792 -0.576948072
 [76] -0.565018273 -0.551267311  1.142787386 -1.057939522 -0.053766280
 [81] -1.044663742  0.033034545  0.614932837 -0.438546678 -1.714420932
 [86] -0.843933474 -0.878436836 -0.636802224 -0.014116320  0.363563965
 [91] -0.780166394  1.052183843  0.586955862 -0.965898667  0.038087900
 [96]  0.109910941 -0.133595271 -0.774298716  0.045203319 -0.729258707
> colRanges(tmp)
          [,1]       [,2]    [,3]       [,4]      [,5]      [,6]      [,7]
[1,] 0.3380231 -0.1459055 -1.9969 0.03970647 0.4879905 -1.724282 0.8929597
[2,] 0.3380231 -0.1459055 -1.9969 0.03970647 0.4879905 -1.724282 0.8929597
         [,8]     [,9]    [,10]      [,11]     [,12]     [,13]     [,14]
[1,] 0.748946 -1.40056 1.486603 -0.8498515 0.7884454 -1.697661 0.4048383
[2,] 0.748946 -1.40056 1.486603 -0.8498515 0.7884454 -1.697661 0.4048383
          [,15]     [,16]      [,17]      [,18]     [,19]       [,20]
[1,] -0.1557531 -1.197342 -0.2837892 -0.9751643 0.5141631 -0.05782481
[2,] -0.1557531 -1.197342 -0.2837892 -0.9751643 0.5141631 -0.05782481
          [,21]     [,22]      [,23]   [,24]    [,25]     [,26]      [,27]
[1,] -0.5161929 0.4588352 0.02567186 0.14842 1.150678 -1.857152 0.03228899
[2,] -0.5161929 0.4588352 0.02567186 0.14842 1.150678 -1.857152 0.03228899
        [,28]    [,29]      [,30]     [,31]      [,32]     [,33] [,34]
[1,] 1.102862 1.243474 -0.8340568 -1.177722 -0.3507907 -1.647608 1.375
[2,] 1.102862 1.243474 -0.8340568 -1.177722 -0.3507907 -1.647608 1.375
         [,35]     [,36]      [,37]    [,38]      [,39]     [,40]     [,41]
[1,] -1.280499 -1.039996 -0.4206352 0.777339 -0.8973516 0.1656569 0.2024854
[2,] -1.280499 -1.039996 -0.4206352 0.777339 -0.8973516 0.1656569 0.2024854
          [,42]     [,43]    [,44]      [,45]      [,46]    [,47]     [,48]
[1,] -0.0227872 -1.523137 1.169474 -0.6580541 -0.1897931 1.364334 0.6318668
[2,] -0.0227872 -1.523137 1.169474 -0.6580541 -0.1897931 1.364334 0.6318668
            [,49]     [,50]      [,51]      [,52]     [,53]     [,54]
[1,] -0.009386584 0.8918017 -0.5866887 0.04566593 0.2982087 0.2077061
[2,] -0.009386584 0.8918017 -0.5866887 0.04566593 0.2982087 0.2077061
          [,55]      [,56]      [,57]     [,58]     [,59]      [,60]    [,61]
[1,] -0.1516532 -0.1757724 -0.2902523 -1.218917 0.7810645 -0.4592165 1.227758
[2,] -0.1516532 -0.1757724 -0.2902523 -1.218917 0.7810645 -0.4592165 1.227758
          [,62]     [,63]     [,64]     [,65]     [,66]      [,67]     [,68]
[1,] -0.1810924 0.4069749 -1.785584 0.1711215 -0.673413 -0.3060107 0.4112564
[2,] -0.1810924 0.4069749 -1.785584 0.1711215 -0.673413 -0.3060107 0.4112564
          [,69]    [,70]      [,71]      [,72]    [,73]      [,74]      [,75]
[1,] -0.1205566 1.136805 -0.7905599 -0.4840513 1.213756 -0.7750938 -0.5769481
[2,] -0.1205566 1.136805 -0.7905599 -0.4840513 1.213756 -0.7750938 -0.5769481
          [,76]      [,77]    [,78]    [,79]       [,80]     [,81]      [,82]
[1,] -0.5650183 -0.5512673 1.142787 -1.05794 -0.05376628 -1.044664 0.03303455
[2,] -0.5650183 -0.5512673 1.142787 -1.05794 -0.05376628 -1.044664 0.03303455
         [,83]      [,84]     [,85]      [,86]      [,87]      [,88]
[1,] 0.6149328 -0.4385467 -1.714421 -0.8439335 -0.8784368 -0.6368022
[2,] 0.6149328 -0.4385467 -1.714421 -0.8439335 -0.8784368 -0.6368022
           [,89]    [,90]      [,91]    [,92]     [,93]      [,94]     [,95]
[1,] -0.01411632 0.363564 -0.7801664 1.052184 0.5869559 -0.9658987 0.0380879
[2,] -0.01411632 0.363564 -0.7801664 1.052184 0.5869559 -0.9658987 0.0380879
         [,96]      [,97]      [,98]      [,99]     [,100]
[1,] 0.1099109 -0.1335953 -0.7742987 0.04520332 -0.7292587
[2,] 0.1099109 -0.1335953 -0.7742987 0.04520332 -0.7292587
> 
> 
> Max(tmp2)
[1] 2.470368
> Min(tmp2)
[1] -3.29555
> mean(tmp2)
[1] -0.1339425
> Sum(tmp2)
[1] -13.39425
> Var(tmp2)
[1] 1.173081
> 
> rowMeans(tmp2)
  [1] -0.88924520 -0.13190794  0.44149267 -1.70745696  0.11326231  1.24258141
  [7] -0.94468940 -0.69177645 -0.17065836  0.16611733  1.22233640 -1.10491527
 [13]  2.47036793  0.16059794 -0.03301869 -0.60843981 -0.13721385 -1.18767081
 [19]  0.33849468 -0.28535689 -0.98832974 -0.68081871  1.06131517  0.38517308
 [25]  0.24879354 -0.81685090  0.16108263 -1.43868143  0.21897136  1.67659552
 [31]  0.35825535 -0.29458439 -1.58454518 -1.05139230 -1.61758146  0.47615484
 [37]  0.85573986 -0.90606926 -0.49721140  0.38005825  2.15401505 -0.01606624
 [43] -1.59459726  1.01033152  0.19837250  0.51695775 -0.05812470  0.40519215
 [49] -0.83936608  0.46283406  1.38086438 -0.08591919 -1.57306411  0.02476537
 [55] -0.72265245  1.06376613 -0.43625328  2.43187801  1.95307584 -0.99134358
 [61]  0.08114136 -1.74459474 -1.44039647 -1.44117581 -0.45529281 -1.62610743
 [67]  2.08106029 -0.86787729  1.37612686  0.38638189  0.40683347 -0.13689905
 [73]  0.61672825 -0.59565988 -0.91443742 -0.04191727 -0.31896365 -0.83089818
 [79]  1.56205020 -1.19320874 -0.10567676  1.11531160 -3.29554965 -0.12448661
 [85] -1.12648511 -1.83197789  0.47407301 -0.14742977 -1.23673228  0.93766488
 [91] -0.22409821 -0.23183399 -2.63873330  1.71645920 -0.09284041  0.12823944
 [97] -0.50687825  1.25968694 -0.85818498 -1.00131453
> rowSums(tmp2)
  [1] -0.88924520 -0.13190794  0.44149267 -1.70745696  0.11326231  1.24258141
  [7] -0.94468940 -0.69177645 -0.17065836  0.16611733  1.22233640 -1.10491527
 [13]  2.47036793  0.16059794 -0.03301869 -0.60843981 -0.13721385 -1.18767081
 [19]  0.33849468 -0.28535689 -0.98832974 -0.68081871  1.06131517  0.38517308
 [25]  0.24879354 -0.81685090  0.16108263 -1.43868143  0.21897136  1.67659552
 [31]  0.35825535 -0.29458439 -1.58454518 -1.05139230 -1.61758146  0.47615484
 [37]  0.85573986 -0.90606926 -0.49721140  0.38005825  2.15401505 -0.01606624
 [43] -1.59459726  1.01033152  0.19837250  0.51695775 -0.05812470  0.40519215
 [49] -0.83936608  0.46283406  1.38086438 -0.08591919 -1.57306411  0.02476537
 [55] -0.72265245  1.06376613 -0.43625328  2.43187801  1.95307584 -0.99134358
 [61]  0.08114136 -1.74459474 -1.44039647 -1.44117581 -0.45529281 -1.62610743
 [67]  2.08106029 -0.86787729  1.37612686  0.38638189  0.40683347 -0.13689905
 [73]  0.61672825 -0.59565988 -0.91443742 -0.04191727 -0.31896365 -0.83089818
 [79]  1.56205020 -1.19320874 -0.10567676  1.11531160 -3.29554965 -0.12448661
 [85] -1.12648511 -1.83197789  0.47407301 -0.14742977 -1.23673228  0.93766488
 [91] -0.22409821 -0.23183399 -2.63873330  1.71645920 -0.09284041  0.12823944
 [97] -0.50687825  1.25968694 -0.85818498 -1.00131453
> 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.88924520 -0.13190794  0.44149267 -1.70745696  0.11326231  1.24258141
  [7] -0.94468940 -0.69177645 -0.17065836  0.16611733  1.22233640 -1.10491527
 [13]  2.47036793  0.16059794 -0.03301869 -0.60843981 -0.13721385 -1.18767081
 [19]  0.33849468 -0.28535689 -0.98832974 -0.68081871  1.06131517  0.38517308
 [25]  0.24879354 -0.81685090  0.16108263 -1.43868143  0.21897136  1.67659552
 [31]  0.35825535 -0.29458439 -1.58454518 -1.05139230 -1.61758146  0.47615484
 [37]  0.85573986 -0.90606926 -0.49721140  0.38005825  2.15401505 -0.01606624
 [43] -1.59459726  1.01033152  0.19837250  0.51695775 -0.05812470  0.40519215
 [49] -0.83936608  0.46283406  1.38086438 -0.08591919 -1.57306411  0.02476537
 [55] -0.72265245  1.06376613 -0.43625328  2.43187801  1.95307584 -0.99134358
 [61]  0.08114136 -1.74459474 -1.44039647 -1.44117581 -0.45529281 -1.62610743
 [67]  2.08106029 -0.86787729  1.37612686  0.38638189  0.40683347 -0.13689905
 [73]  0.61672825 -0.59565988 -0.91443742 -0.04191727 -0.31896365 -0.83089818
 [79]  1.56205020 -1.19320874 -0.10567676  1.11531160 -3.29554965 -0.12448661
 [85] -1.12648511 -1.83197789  0.47407301 -0.14742977 -1.23673228  0.93766488
 [91] -0.22409821 -0.23183399 -2.63873330  1.71645920 -0.09284041  0.12823944
 [97] -0.50687825  1.25968694 -0.85818498 -1.00131453
> rowMin(tmp2)
  [1] -0.88924520 -0.13190794  0.44149267 -1.70745696  0.11326231  1.24258141
  [7] -0.94468940 -0.69177645 -0.17065836  0.16611733  1.22233640 -1.10491527
 [13]  2.47036793  0.16059794 -0.03301869 -0.60843981 -0.13721385 -1.18767081
 [19]  0.33849468 -0.28535689 -0.98832974 -0.68081871  1.06131517  0.38517308
 [25]  0.24879354 -0.81685090  0.16108263 -1.43868143  0.21897136  1.67659552
 [31]  0.35825535 -0.29458439 -1.58454518 -1.05139230 -1.61758146  0.47615484
 [37]  0.85573986 -0.90606926 -0.49721140  0.38005825  2.15401505 -0.01606624
 [43] -1.59459726  1.01033152  0.19837250  0.51695775 -0.05812470  0.40519215
 [49] -0.83936608  0.46283406  1.38086438 -0.08591919 -1.57306411  0.02476537
 [55] -0.72265245  1.06376613 -0.43625328  2.43187801  1.95307584 -0.99134358
 [61]  0.08114136 -1.74459474 -1.44039647 -1.44117581 -0.45529281 -1.62610743
 [67]  2.08106029 -0.86787729  1.37612686  0.38638189  0.40683347 -0.13689905
 [73]  0.61672825 -0.59565988 -0.91443742 -0.04191727 -0.31896365 -0.83089818
 [79]  1.56205020 -1.19320874 -0.10567676  1.11531160 -3.29554965 -0.12448661
 [85] -1.12648511 -1.83197789  0.47407301 -0.14742977 -1.23673228  0.93766488
 [91] -0.22409821 -0.23183399 -2.63873330  1.71645920 -0.09284041  0.12823944
 [97] -0.50687825  1.25968694 -0.85818498 -1.00131453
> 
> colMeans(tmp2)
[1] -0.1339425
> colSums(tmp2)
[1] -13.39425
> colVars(tmp2)
[1] 1.173081
> colSd(tmp2)
[1] 1.083089
> colMax(tmp2)
[1] 2.470368
> colMin(tmp2)
[1] -3.29555
> colMedians(tmp2)
[1] -0.1281973
> colRanges(tmp2)
          [,1]
[1,] -3.295550
[2,]  2.470368
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.0651240 -2.8679614 -1.5466388 -2.8005312  1.3856390  3.3616964
 [7]  3.8099210  0.8934075  2.0646438  3.9022445
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.6375851
[2,] -0.3306194
[3,]  0.1746129
[4,]  0.8313672
[5,]  1.9510633
> 
> rowApply(tmp,sum)
 [1] -0.6295937  1.6996362  0.7889152  0.9118791  6.1072928 -6.8365549
 [7]  5.4883090  2.0500846  1.3316029  0.3559737
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    5    4    3   10    1   10    3    3    9    10
 [2,]    9    1    6    1    3    4    5    2    5     4
 [3,]    3    7    4    6    6    1    4    8    3     5
 [4,]   10    3    1    8    4    3    2    4    1     6
 [5,]    2   10    2    5    5    7    9    5    8     9
 [6,]    8    6    7    2    2    5    8   10    4     8
 [7,]    6    5    8    9    9    2    6    7    7     2
 [8,]    4    8    5    7    7    8    1    1   10     7
 [9,]    1    2    9    4   10    9    7    6    6     3
[10,]    7    9   10    3    8    6   10    9    2     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -4.70529553 -0.71630877 -2.40880193  3.60005478 -1.49182743 -0.13253887
 [7] -0.24205470  1.49589655  0.40319597 -0.87170046 -0.15389551  3.09923157
[13] -3.04305862 -1.29091354  0.90692913  0.50616449  0.12056179 -1.10263529
[19] -0.05926507  1.54761885
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.40041648
[2,] -1.15521555
[3,] -0.80435879
[4,] -0.28578530
[5,] -0.05951941
> 
> rowApply(tmp,sum)
[1] -0.2776246  6.3033417 -4.4388490 -2.9911382 -3.1343725
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    3    5   12    1    4
[2,]    6   17   13    5    6
[3,]   15    1   14   12    3
[4,]   18    4   17   20   16
[5,]   20   15    2    2   10
> 
> 
> as.matrix(tmp)
            [,1]        [,2]        [,3]       [,4]       [,5]       [,6]
[1,] -1.15521555 -0.32295974  0.23202384  1.0714733  1.3009362 -0.6567953
[2,] -0.28578530  1.10380278 -2.06118408 -0.3291406  0.9129368 -0.2443168
[3,] -0.05951941  0.03038198  0.04993756  0.4341643 -1.4772512  0.2671303
[4,] -2.40041648 -0.79460246  0.19997629  1.7960217 -1.7578164 -0.3798263
[5,] -0.80435879 -0.73293132 -0.82955553  0.6275361 -0.4706328  0.8812692
           [,7]       [,8]       [,9]      [,10]         [,11]      [,12]
[1,]  0.9079730  0.1861443 -1.5483904 -1.4925868 -0.1464310499  0.6406767
[2,]  0.4637104 -1.0803340  1.6091076 -0.3628693 -0.0006370097  0.6881259
[3,] -0.6024274  1.7022005  0.6154105  0.3640731 -1.5077223463  0.7796064
[4,] -0.8572993  0.4523361  0.2526213  0.2308124  0.1136884078 -0.6993270
[5,] -0.1540115  0.2355497 -0.5255530  0.3888701  1.3872064913  1.6901496
          [,13]       [,14]      [,15]      [,16]        [,17]       [,18]
[1,] -0.1339611  0.08147258  0.1746822 -0.6046965  0.002637656 -0.07244810
[2,]  1.0355514 -0.01242052  1.4735863  0.1736705  0.355603834  0.17556604
[3,] -1.0691359 -0.29450463 -0.2729412 -0.2932893 -0.967311684 -0.38904997
[4,] -0.2436707  0.37989589  0.1704447  0.6163428  1.303766438 -0.72096321
[5,] -2.6318422 -1.44535686 -0.6388429  0.6141369 -0.574134452 -0.09574006
           [,19]      [,20]
[1,]  1.12247536  0.1353649
[2,] -0.08975751  2.7781253
[3,] -0.74304289 -1.0055578
[4,] -1.06734188  0.4142195
[5,]  0.71840183 -0.7745331
> 
> 
> 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 :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.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.3030159 0.5676589 -1.037923 0.46055 -1.927186 -0.9045943 -0.8449925
           col8     col9    col10     col11      col12    col13       col14
row1 -0.6852446 1.047286 1.421698 0.7808091 -0.9832801 1.952821 -0.02922087
        col15      col16    col17     col18     col19     col20
row1 1.010031 -0.2606965 1.232245 0.1193883 -0.570445 0.2579694
> tmp[,"col10"]
           col10
row1  1.42169818
row2  0.77578953
row3  0.37315148
row4 -0.03630348
row5 -0.32399074
> tmp[c("row1","row5"),]
           col1      col2       col3      col4      col5       col6       col7
row1 -0.3030159 0.5676589 -1.0379229 0.4605500 -1.927186 -0.9045943 -0.8449925
row5 -0.5942639 0.6429172  0.9876217 0.8604942  1.446425  0.5048538  1.9573297
           col8       col9      col10     col11      col12     col13
row1 -0.6852446  1.0472863  1.4216982 0.7808091 -0.9832801  1.952821
row5 -0.2720618 -0.4251808 -0.3239907 1.2535699 -0.7231406 -1.166938
           col14     col15      col16      col17     col18     col19      col20
row1 -0.02922087 1.0100307 -0.2606965  1.2322450 0.1193883 -0.570445  0.2579694
row5 -0.53083060 0.8068653 -0.8127013 -0.5624719 0.2501356  1.855268 -0.3887482
> tmp[,c("col6","col20")]
            col6      col20
row1 -0.90459434  0.2579694
row2  0.75730913 -1.2180476
row3 -0.03790207 -0.8527496
row4  0.45231215 -2.2591064
row5  0.50485383 -0.3887482
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.9045943  0.2579694
row5  0.5048538 -0.3887482
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.20108 48.98973 49.06701 48.42634 50.69285 103.8903 50.05574 50.13464
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.89642 49.99269 50.18678 49.89321 48.87872 51.06233 51.40418 48.50649
        col17    col18    col19    col20
row1 51.10657 49.58234 50.09946 105.8842
> tmp[,"col10"]
        col10
row1 49.99269
row2 32.21476
row3 29.31972
row4 32.21620
row5 49.48584
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.20108 48.98973 49.06701 48.42634 50.69285 103.8903 50.05574 50.13464
row5 50.25659 49.62880 51.36528 50.48748 50.09071 106.4854 50.05974 49.15487
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.89642 49.99269 50.18678 49.89321 48.87872 51.06233 51.40418 48.50649
row5 49.90726 49.48584 49.16393 47.90402 50.16522 50.35642 49.14996 49.42852
        col17    col18    col19    col20
row1 51.10657 49.58234 50.09946 105.8842
row5 49.52737 49.63326 49.75409 104.4752
> tmp[,c("col6","col20")]
          col6     col20
row1 103.89026 105.88424
row2  74.66956  75.06124
row3  75.11034  75.11501
row4  75.19377  73.66978
row5 106.48537 104.47523
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.8903 105.8842
row5 106.4854 104.4752
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.8903 105.8842
row5 106.4854 104.4752
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  1.1294179
[2,]  0.5407362
[3,]  0.2433932
[4,] -0.3291489
[5,] -0.2181839
> tmp[,c("col17","col7")]
          col17        col7
[1,] -1.8558680  0.59554467
[2,]  0.5015660  0.04763997
[3,]  0.6498010  1.35773017
[4,]  0.2267792 -1.80451896
[5,]  0.1427778 -1.33338447
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,]  0.94642923 -1.7536275
[2,] -0.68588470 -0.3779203
[3,]  0.05701403  0.7298190
[4,] -1.59554355  0.5716806
[5,]  1.71948484  1.0174170
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.9464292
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.9464292
[2,] -0.6858847
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]       [,3]       [,4]       [,5]      [,6]       [,7]
row3 -0.3140449  1.124244 -0.4513239 -0.6262551 -1.1282289 1.8666638 -0.5937188
row1  1.0919532 -1.054958  0.7698615  1.6397856  0.9799676 0.6551973 -1.1253110
           [,8]      [,9]      [,10]     [,11]     [,12]      [,13]      [,14]
row3 -0.7571461 1.1834917  0.4495315 -0.591220 0.1599226  0.9531427  0.5147969
row1  1.2441954 0.3451384 -1.1767132  0.644698 0.5576893 -0.8742774 -0.1116650
          [,15]     [,16]     [,17]       [,18]     [,19]      [,20]
row3 -0.9968331 0.8057347 0.5643403 -0.02583154 0.8661455 -1.8239085
row1 -0.5159629 1.0019816 0.3756967  0.79296286 0.2438605  0.4930374
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]       [,2]      [,3]       [,4]     [,5]       [,6]      [,7]
row2 1.455996 -0.9173072 -1.387125 -0.5187316 1.153918 -0.6372247 -1.932131
          [,8]      [,9]     [,10]
row2 0.5489811 -1.089409 -0.677143
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]        [,3]      [,4]      [,5]     [,6]      [,7]
row5 0.1897065 0.6549918 -0.05949589 -0.909977 0.3306417 1.105054 -1.464465
          [,8]      [,9]     [,10]     [,11]    [,12]    [,13]    [,14]
row5 -1.325281 -1.859322 -1.138624 -0.183469 0.339624 3.395436 1.186116
         [,15]     [,16]     [,17]      [,18]     [,19]     [,20]
row5 -1.349603 -2.580739 -0.235907 -0.2308043 -3.947825 -0.191597
> 
> 
> 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: 0x57e4d20ffcf0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc532e081c34"
 [2] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc5338bf5765"
 [3] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc5332c6499e"
 [4] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc5349d209ee"
 [5] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc5354a7958c"
 [6] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc534dc6b338"
 [7] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc53589262d9"
 [8] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc53462fb7c9"
 [9] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc534aea9bf1"
[10] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc537749829f"
[11] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc5339ef01e1"
[12] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc5352c59c7b"
[13] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc5325b30ba4"
[14] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc534fb737e3"
[15] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM24bc532f40d9e9"
> 
> 
> ### 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: 0x57e4d3120b70>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x57e4d3120b70>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x57e4d3120b70>
> rowMedians(tmp)
  [1]  0.066729964 -0.092635444  0.361481499 -0.155980002  0.465703214
  [6]  0.234078767 -0.264553961 -0.102993836  0.095777316  0.080750096
 [11]  0.274297916  0.037411093 -0.220309015 -0.516922012  0.022383647
 [16]  0.312228995  0.025063547 -0.061895043 -0.321371416  0.397641225
 [21]  0.309780654  0.040023945  0.139375335 -0.665947326  0.529284937
 [26]  0.316649950  0.103164253  0.990945122  0.098934770 -0.372574335
 [31] -0.217025380 -0.081090793 -0.002684823  0.627946162  0.020919247
 [36] -0.597341982 -0.095888509 -0.529182626 -0.155524580 -0.165864403
 [41]  0.331922223 -0.770166115 -0.115206967 -0.333039757 -0.195710499
 [46]  0.574028299 -0.651164791 -0.180417604  0.385146532 -0.648253748
 [51] -0.090578671  0.096027546  0.006581285 -0.863458026 -0.005997396
 [56] -1.096871082  0.181284700 -0.636870720  0.471805345 -0.310423607
 [61] -0.207591856 -0.033211975 -0.226227848  0.258330957 -0.002182659
 [66] -0.025573403 -0.492943862 -0.367511116  0.157651636 -0.413795972
 [71]  0.147101777  0.079958392 -0.238321241 -0.328465276  0.034907819
 [76] -0.514829238 -0.022125977  0.188081231 -0.091151757  0.129643644
 [81]  0.043104758  0.020546548 -0.122990870 -0.464848595 -0.071362307
 [86] -0.419228911 -0.042610910  0.226770179 -0.188685494 -0.375780529
 [91] -0.029858993  0.140031200 -0.261739913  0.253506331 -0.215474403
 [96]  0.325049002 -0.181706831 -0.483514435 -0.212078464  0.264536988
[101]  0.086888334 -0.166426530 -0.451131635  0.119910207 -0.214145731
[106]  0.212424082  0.363094590  0.154746166 -0.723947096  0.801548097
[111] -0.524157389  0.914049373 -0.267338952 -0.101773561 -0.218307258
[116]  0.624686120  0.103178858  0.427294389 -0.228773248  0.187241760
[121] -0.129005575  0.039304980 -0.191657889 -0.055154951  0.049041737
[126] -0.222052492  0.437654698  0.236637267 -0.121741943 -0.444945323
[131] -0.604023170 -0.050024321  0.493743765 -0.271489450  0.168757970
[136] -0.149466881  0.647346402  0.165252252  0.181083571 -0.265829531
[141]  0.128570329  0.624217941 -0.148429840 -0.500256837  0.070710417
[146] -0.034588661 -0.499521631  0.181336406 -0.049210532  0.149262926
[151]  0.691067805  0.018348820 -0.074240052 -0.167846466  0.180433548
[156] -0.420367409  0.019940500  0.108809536 -0.017124038  0.119844081
[161] -0.388997615 -0.644049569  0.034852597  0.184185649  0.057233909
[166] -0.139068772  0.683423038 -0.339286097  0.457540837  0.294384440
[171] -0.003265590  0.123617117 -0.270291173  0.357510571  0.002244853
[176] -0.043803213 -0.056688439  0.587946289  0.207035990 -0.061311836
[181]  0.116737278 -0.446888273  0.032981016  0.031878055 -0.197249182
[186]  0.123210090 -0.224631017  0.415415350 -0.364621017  0.147629731
[191]  0.048984081  0.521956507 -0.383976059  0.280257140  0.129188329
[196] -0.240681836 -0.355245044 -0.219002203 -0.047427434  0.101661278
[201]  0.034949207 -0.331861804 -0.137836645  0.143430222 -0.008840645
[206] -0.042433703 -0.183552093  0.321809377  0.212199573  0.357004270
[211] -0.057318962 -0.358239701 -0.375277025  0.148390258  0.024911615
[216] -0.030985360 -0.019751420 -0.678380358  0.899505545 -0.319518571
[221] -0.454228091  0.239172669  0.431061281  0.008131803 -0.180827915
[226]  0.311856035  0.056104311  0.307636728  0.045176264 -0.337678832
> 
> proc.time()
   user  system elapsed 
  1.169   0.706   1.863 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.4.2 (2024-10-31) -- "Pile of Leaves"
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: 0x5e6602a16b40>
> .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: 0x5e6602a16b40>
> .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: 0x5e6602a16b40>
> .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: 0x5e6602a16b40>
> 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: 0x5e6602a19320>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5e6602a19320>
> .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: 0x5e6602a19320>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5e6602a19320>
> .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: 0x5e6602a19320>
> 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: 0x5e66020909a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5e66020909a0>
> .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: 0x5e66020909a0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5e66020909a0>
> .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: 0x5e66020909a0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5e66020909a0>
> .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: 0x5e66020909a0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5e66020909a0>
> .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: 0x5e66020909a0>
> 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: 0x5e6602a1ee00>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5e6602a1ee00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5e6602a1ee00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5e6602a1ee00>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile24be5647346a77" "BufferedMatrixFile24be56a91a37e" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile24be5647346a77" "BufferedMatrixFile24be56a91a37e" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5e66031db0c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5e66031db0c0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5e66031db0c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5e66031db0c0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5e66031db0c0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5e66031db0c0>
> .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: 0x5e6602b7a250>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5e6602b7a250>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5e6602b7a250>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5e6602b7a250>
> 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: 0x5e6601797c20>
> .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: 0x5e6601797c20>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.245   0.048   0.281 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.4.2 (2024-10-31) -- "Pile of Leaves"
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.219   0.056   0.264 

Example timings