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

This page was generated on 2024-05-31 17:02:51 -0400 (Fri, 31 May 2024).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 22.04.3 LTS)x86_644.4.0 (2024-04-24) -- "Puppy Cup" 4753
kjohnson3macOS 13.6.5 Venturaarm644.4.0 (2024-04-24) -- "Puppy Cup" 4464
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

Package 249/2300HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.68.0  (landing page)
Ben Bolstad
Snapshot Date: 2024-05-30 18:28:32 -0400 (Thu, 30 May 2024)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_19
git_last_commit: af6c73d
git_last_commit_date: 2024-04-30 10:16:21 -0400 (Tue, 30 Apr 2024)
nebbiolo1Linux (Ubuntu 22.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
kjohnson3macOS 13.6.5 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published

CHECK results for BufferedMatrix on nebbiolo1


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.68.0
Command: /home/biocbuild/bbs-3.19-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.19-bioc/R/site-library --timings BufferedMatrix_1.68.0.tar.gz
StartedAt: 2024-05-31 01:51:33 -0400 (Fri, 31 May 2024)
EndedAt: 2024-05-31 01:51:58 -0400 (Fri, 31 May 2024)
EllapsedTime: 24.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.19-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
gcc -I"/home/biocbuild/bbs-3.19-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.19-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^~~~~~~~~~~~~~~~~~~
At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
gcc -I"/home/biocbuild/bbs-3.19-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.19-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.19-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.19-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.19-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.0 (2024-04-24) -- "Puppy Cup"
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.263   0.045   0.297 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
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.19-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 471778 25.2    1026221 54.9   643431 34.4
Vcells 871899  6.7    8388608 64.0  2046580 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] "Fri May 31 01:51:49 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Fri May 31 01:51:49 2024"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x55b343c73210>
> 
> 
> 
> 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] "Fri May 31 01:51:50 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Fri May 31 01:51:50 2024"
> 
> ColMode(tmp2)
<pointer: 0x55b343c73210>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]       [,2]       [,3]        [,4]
[1,] 99.3470469  1.1464719  2.4196793  0.05387797
[2,] -0.2557478  0.6902386  0.1607653 -0.10353112
[3,] -0.5311733  0.6384974 -0.8700559 -0.10563874
[4,]  1.1869947 -1.9023386  0.5314897 -0.24382303
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]       [,4]
[1,] 99.3470469 1.1464719 2.4196793 0.05387797
[2,]  0.2557478 0.6902386 0.1607653 0.10353112
[3,]  0.5311733 0.6384974 0.8700559 0.10563874
[4,]  1.1869947 1.9023386 0.5314897 0.24382303
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9672989 1.0707343 1.5555318 0.2321163
[2,] 0.5057151 0.8308060 0.4009555 0.3217625
[3,] 0.7288164 0.7990603 0.9327679 0.3250211
[4,] 1.0894929 1.3792529 0.7290334 0.4937844
> 
> 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.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.02004 36.85381 42.97500 27.37504
[2,]  30.31290 33.99830 29.17032 28.32116
[3,]  32.81934 33.62910 35.19773 28.35585
[4,]  37.08192 40.69487 32.82182 30.18167
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x55b3431e1350>
> exp(tmp5)
<pointer: 0x55b3431e1350>
> log(tmp5,2)
<pointer: 0x55b3431e1350>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.2684
> Min(tmp5)
[1] 53.46313
> mean(tmp5)
[1] 73.45867
> Sum(tmp5)
[1] 14691.73
> Var(tmp5)
[1] 851.384
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.01838 69.85421 69.09276 69.64417 73.80120 72.56890 72.46938 70.41246
 [9] 73.03001 72.69519
> rowSums(tmp5)
 [1] 1820.368 1397.084 1381.855 1392.883 1476.024 1451.378 1449.388 1408.249
 [9] 1460.600 1453.904
> rowVars(tmp5)
 [1] 7883.02971   64.07940   90.37037   53.81104   75.13097   68.42142
 [7]   39.14144   54.19272  120.10046   82.65878
> rowSd(tmp5)
 [1] 88.786427  8.004961  9.506333  7.335601  8.667812  8.271724  6.256312
 [8]  7.361571 10.959036  9.091688
> rowMax(tmp5)
 [1] 466.26835  83.90197  83.54917  84.70104  87.16612  84.00794  85.65827
 [8]  83.89023  93.21701  97.79473
> rowMin(tmp5)
 [1] 56.97756 58.94678 54.61155 60.03457 57.50159 53.46313 64.86567 54.96779
 [9] 55.08039 55.45155
> 
> colMeans(tmp5)
 [1] 113.19992  75.09226  74.05872  70.75533  73.77088  69.16623  72.62261
 [8]  69.04969  72.33099  69.76935  65.95853  73.10397  75.03251  66.14934
[15]  72.34969  71.26536  68.60981  67.46926  78.54557  70.87335
> colSums(tmp5)
 [1] 1131.9992  750.9226  740.5872  707.5533  737.7088  691.6623  726.2261
 [8]  690.4969  723.3099  697.6935  659.5853  731.0397  750.3251  661.4934
[15]  723.4969  712.6536  686.0981  674.6926  785.4557  708.7335
> colVars(tmp5)
 [1] 15439.60589    28.05284   103.11891   174.41629    67.86424    28.45831
 [7]   110.45095   103.06873    74.43536    34.79744   100.14307    30.66873
[13]    42.68562    70.52654    16.48578    47.20947    77.76341    69.01181
[19]    73.22340    73.59913
> colSd(tmp5)
 [1] 124.256211   5.296493  10.154748  13.206676   8.237976   5.334633
 [7]  10.509565  10.152277   8.627593   5.898935  10.007151   5.537936
[13]   6.533423   8.398008   4.060269   6.870915   8.818356   8.307334
[19]   8.557067   8.578993
> colMax(tmp5)
 [1] 466.26835  84.70104  90.59960  93.21701  82.32518  76.58687  85.65827
 [8]  86.30382  83.59022  79.52417  83.90197  83.03834  83.24729  79.81750
[15]  79.90257  81.62387  81.58894  85.29741  97.79473  82.80501
> colMin(tmp5)
 [1] 63.09233 69.99457 60.18463 56.97756 59.44431 60.90670 54.61155 53.46313
 [9] 57.37762 61.03084 54.96779 64.94540 61.30007 55.08039 65.93149 59.84889
[17] 55.45155 57.39781 66.18754 59.17937
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 91.01838       NA 69.09276 69.64417 73.80120 72.56890 72.46938 70.41246
 [9] 73.03001 72.69519
> rowSums(tmp5)
 [1] 1820.368       NA 1381.855 1392.883 1476.024 1451.378 1449.388 1408.249
 [9] 1460.600 1453.904
> rowVars(tmp5)
 [1] 7883.02971   67.59107   90.37037   53.81104   75.13097   68.42142
 [7]   39.14144   54.19272  120.10046   82.65878
> rowSd(tmp5)
 [1] 88.786427  8.221379  9.506333  7.335601  8.667812  8.271724  6.256312
 [8]  7.361571 10.959036  9.091688
> rowMax(tmp5)
 [1] 466.26835        NA  83.54917  84.70104  87.16612  84.00794  85.65827
 [8]  83.89023  93.21701  97.79473
> rowMin(tmp5)
 [1] 56.97756       NA 54.61155 60.03457 57.50159 53.46313 64.86567 54.96779
 [9] 55.08039 55.45155
> 
> colMeans(tmp5)
 [1] 113.19992        NA  74.05872  70.75533  73.77088  69.16623  72.62261
 [8]  69.04969  72.33099  69.76935  65.95853  73.10397  75.03251  66.14934
[15]  72.34969  71.26536  68.60981  67.46926  78.54557  70.87335
> colSums(tmp5)
 [1] 1131.9992        NA  740.5872  707.5533  737.7088  691.6623  726.2261
 [8]  690.4969  723.3099  697.6935  659.5853  731.0397  750.3251  661.4934
[15]  723.4969  712.6536  686.0981  674.6926  785.4557  708.7335
> colVars(tmp5)
 [1] 15439.60589          NA   103.11891   174.41629    67.86424    28.45831
 [7]   110.45095   103.06873    74.43536    34.79744   100.14307    30.66873
[13]    42.68562    70.52654    16.48578    47.20947    77.76341    69.01181
[19]    73.22340    73.59913
> colSd(tmp5)
 [1] 124.256211         NA  10.154748  13.206676   8.237976   5.334633
 [7]  10.509565  10.152277   8.627593   5.898935  10.007151   5.537936
[13]   6.533423   8.398008   4.060269   6.870915   8.818356   8.307334
[19]   8.557067   8.578993
> colMax(tmp5)
 [1] 466.26835        NA  90.59960  93.21701  82.32518  76.58687  85.65827
 [8]  86.30382  83.59022  79.52417  83.90197  83.03834  83.24729  79.81750
[15]  79.90257  81.62387  81.58894  85.29741  97.79473  82.80501
> colMin(tmp5)
 [1] 63.09233       NA 60.18463 56.97756 59.44431 60.90670 54.61155 53.46313
 [9] 57.37762 61.03084 54.96779 64.94540 61.30007 55.08039 65.93149 59.84889
[17] 55.45155 57.39781 66.18754 59.17937
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.2684
> Min(tmp5,na.rm=TRUE)
[1] 53.46313
> mean(tmp5,na.rm=TRUE)
[1] 73.47221
> Sum(tmp5,na.rm=TRUE)
[1] 14620.97
> Var(tmp5,na.rm=TRUE)
[1] 855.647
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.01838 69.80638 69.09276 69.64417 73.80120 72.56890 72.46938 70.41246
 [9] 73.03001 72.69519
> rowSums(tmp5,na.rm=TRUE)
 [1] 1820.368 1326.321 1381.855 1392.883 1476.024 1451.378 1449.388 1408.249
 [9] 1460.600 1453.904
> rowVars(tmp5,na.rm=TRUE)
 [1] 7883.02971   67.59107   90.37037   53.81104   75.13097   68.42142
 [7]   39.14144   54.19272  120.10046   82.65878
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.786427  8.221379  9.506333  7.335601  8.667812  8.271724  6.256312
 [8]  7.361571 10.959036  9.091688
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.26835  83.90197  83.54917  84.70104  87.16612  84.00794  85.65827
 [8]  83.89023  93.21701  97.79473
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.97756 58.94678 54.61155 60.03457 57.50159 53.46313 64.86567 54.96779
 [9] 55.08039 55.45155
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.19992  75.57329  74.05872  70.75533  73.77088  69.16623  72.62261
 [8]  69.04969  72.33099  69.76935  65.95853  73.10397  75.03251  66.14934
[15]  72.34969  71.26536  68.60981  67.46926  78.54557  70.87335
> colSums(tmp5,na.rm=TRUE)
 [1] 1131.9992  680.1596  740.5872  707.5533  737.7088  691.6623  726.2261
 [8]  690.4969  723.3099  697.6935  659.5853  731.0397  750.3251  661.4934
[15]  723.4969  712.6536  686.0981  674.6926  785.4557  708.7335
> colVars(tmp5,na.rm=TRUE)
 [1] 15439.60589    28.95633   103.11891   174.41629    67.86424    28.45831
 [7]   110.45095   103.06873    74.43536    34.79744   100.14307    30.66873
[13]    42.68562    70.52654    16.48578    47.20947    77.76341    69.01181
[19]    73.22340    73.59913
> colSd(tmp5,na.rm=TRUE)
 [1] 124.256211   5.381108  10.154748  13.206676   8.237976   5.334633
 [7]  10.509565  10.152277   8.627593   5.898935  10.007151   5.537936
[13]   6.533423   8.398008   4.060269   6.870915   8.818356   8.307334
[19]   8.557067   8.578993
> colMax(tmp5,na.rm=TRUE)
 [1] 466.26835  84.70104  90.59960  93.21701  82.32518  76.58687  85.65827
 [8]  86.30382  83.59022  79.52417  83.90197  83.03834  83.24729  79.81750
[15]  79.90257  81.62387  81.58894  85.29741  97.79473  82.80501
> colMin(tmp5,na.rm=TRUE)
 [1] 63.09233 69.99457 60.18463 56.97756 59.44431 60.90670 54.61155 53.46313
 [9] 57.37762 61.03084 54.96779 64.94540 61.30007 55.08039 65.93149 59.84889
[17] 55.45155 57.39781 66.18754 59.17937
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.01838      NaN 69.09276 69.64417 73.80120 72.56890 72.46938 70.41246
 [9] 73.03001 72.69519
> rowSums(tmp5,na.rm=TRUE)
 [1] 1820.368    0.000 1381.855 1392.883 1476.024 1451.378 1449.388 1408.249
 [9] 1460.600 1453.904
> rowVars(tmp5,na.rm=TRUE)
 [1] 7883.02971         NA   90.37037   53.81104   75.13097   68.42142
 [7]   39.14144   54.19272  120.10046   82.65878
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.786427        NA  9.506333  7.335601  8.667812  8.271724  6.256312
 [8]  7.361571 10.959036  9.091688
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.26835        NA  83.54917  84.70104  87.16612  84.00794  85.65827
 [8]  83.89023  93.21701  97.79473
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.97756       NA 54.61155 60.03457 57.50159 53.46313 64.86567 54.96779
 [9] 55.08039 55.45155
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 118.76743       NaN  75.54144  72.06739  72.82040  69.61521  71.49185
 [8]  70.03467  72.56835  70.55091  63.96481  73.77849  74.68766  66.36557
[15]  72.30187  72.21159  67.94892  67.63312  78.59044  70.66983
> colSums(tmp5,na.rm=TRUE)
 [1] 1068.9069    0.0000  679.8730  648.6065  655.3836  626.5369  643.4267
 [8]  630.3121  653.1152  634.9582  575.6833  664.0064  672.1889  597.2901
[15]  650.7168  649.9043  611.5403  608.6980  707.3140  636.0284
> colVars(tmp5,na.rm=TRUE)
 [1] 17020.83845          NA    91.27598   176.85140    66.18393    29.74779
 [7]   109.87303   105.03757    83.10593    32.27519    67.94326    29.38384
[13]    46.68346    78.81639    18.52078    43.03790    82.57023    77.33624
[19]    82.35368    82.33304
> colSd(tmp5,na.rm=TRUE)
 [1] 130.463935         NA   9.553846  13.298549   8.135351   5.454153
 [7]  10.482033  10.248784   9.116245   5.681126   8.242770   5.420686
[13]   6.832529   8.877860   4.303578   6.560328   9.086816   8.794102
[19]   9.074893   9.073755
> colMax(tmp5,na.rm=TRUE)
 [1] 466.26835      -Inf  90.59960  93.21701  82.02568  76.58687  85.65827
 [8]  86.30382  83.59022  79.52417  79.92556  83.03834  83.24729  79.81750
[15]  79.90257  81.62387  81.58894  85.29741  97.79473  82.80501
> colMin(tmp5,na.rm=TRUE)
 [1] 68.04558      Inf 60.18463 56.97756 59.44431 60.90670 54.61155 53.46313
 [9] 57.37762 61.03084 54.96779 64.94540 61.30007 55.08039 65.93149 59.84889
[17] 55.45155 57.39781 66.18754 59.17937
> 
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 3
> which.col  <- 1
> cat(which.row," ",which.col,"\n")
3   1 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> rowVars(tmp5,na.rm=TRUE)
 [1] 132.2298 261.8379 186.9958 499.8591 358.1450 335.7775 205.6439 226.4381
 [9] 142.4934 233.6725
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 132.2298 261.8379 186.9958 499.8591 358.1450 335.7775 205.6439 226.4381
 [9] 142.4934 233.6725
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14  0.000000e+00 -2.842171e-14 -1.421085e-14 -8.526513e-14
 [6]  5.684342e-14 -3.197442e-14  1.705303e-13  4.263256e-14  8.526513e-14
[11] -1.421085e-13 -2.842171e-14  0.000000e+00 -1.705303e-13  8.526513e-14
[16]  0.000000e+00 -8.526513e-14  1.136868e-13 -2.842171e-14 -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)
+ }
9   5 
1   1 
5   7 
9   20 
3   12 
3   20 
5   1 
2   8 
2   7 
5   7 
8   14 
8   1 
2   19 
8   17 
5   5 
2   10 
1   8 
7   12 
5   3 
8   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] 2.394164
> Min(tmp)
[1] -1.926865
> mean(tmp)
[1] 0.04644184
> Sum(tmp)
[1] 4.644184
> Var(tmp)
[1] 0.7799264
> 
> rowMeans(tmp)
[1] 0.04644184
> rowSums(tmp)
[1] 4.644184
> rowVars(tmp)
[1] 0.7799264
> rowSd(tmp)
[1] 0.8831344
> rowMax(tmp)
[1] 2.394164
> rowMin(tmp)
[1] -1.926865
> 
> colMeans(tmp)
  [1] -1.56359827  0.05491150 -0.55202524 -0.02361119 -1.03728783 -0.23704382
  [7]  1.70425364  0.77166750  0.50547432 -0.93695100  0.72266682  0.59584563
 [13] -0.57231756 -0.61462880 -0.30399246  0.48396819  0.14187552 -0.08087577
 [19] -0.18527367 -0.57782313  0.25060956 -0.77882972 -0.17228990 -0.95369271
 [25] -0.47877250 -0.37811051  1.31643218 -0.35220667  0.39219384  0.51854917
 [31]  0.10774675 -0.33719182 -0.89220818  1.03245973  0.93058265  1.30223766
 [37] -1.32244586 -0.68484639  1.48616832  0.70521693 -0.11028946 -1.78428703
 [43] -0.63052661  1.13893307 -1.05359198  1.05772636  0.93508936  1.30456232
 [49]  0.23003682  0.36222945 -0.23728682  0.68905417  0.16538713 -0.73441071
 [55]  1.43068300 -1.92686510  0.80563494  1.05758107  2.15559975 -0.61737769
 [61] -1.02896095  0.22574572 -0.55269918 -0.31264609 -0.90449877 -1.44492956
 [67]  0.87958836  0.14838054  0.11278551  0.59257933  0.85950591  0.31603500
 [73]  0.51973387 -0.18870006 -0.29118658 -0.78834078 -0.83456382 -1.35864680
 [79]  0.43022649  1.19745548 -0.81039533  0.54513400 -0.32286212 -0.50422629
 [85] -0.25563343 -1.10869119  2.39416353 -0.46837911 -0.89311766  2.09392467
 [91]  0.66032079  0.67732389  0.55984504 -1.10145428  0.64317799 -0.19299131
 [97] -0.10489223 -0.09622737  0.07380417  1.05377810
> colSums(tmp)
  [1] -1.56359827  0.05491150 -0.55202524 -0.02361119 -1.03728783 -0.23704382
  [7]  1.70425364  0.77166750  0.50547432 -0.93695100  0.72266682  0.59584563
 [13] -0.57231756 -0.61462880 -0.30399246  0.48396819  0.14187552 -0.08087577
 [19] -0.18527367 -0.57782313  0.25060956 -0.77882972 -0.17228990 -0.95369271
 [25] -0.47877250 -0.37811051  1.31643218 -0.35220667  0.39219384  0.51854917
 [31]  0.10774675 -0.33719182 -0.89220818  1.03245973  0.93058265  1.30223766
 [37] -1.32244586 -0.68484639  1.48616832  0.70521693 -0.11028946 -1.78428703
 [43] -0.63052661  1.13893307 -1.05359198  1.05772636  0.93508936  1.30456232
 [49]  0.23003682  0.36222945 -0.23728682  0.68905417  0.16538713 -0.73441071
 [55]  1.43068300 -1.92686510  0.80563494  1.05758107  2.15559975 -0.61737769
 [61] -1.02896095  0.22574572 -0.55269918 -0.31264609 -0.90449877 -1.44492956
 [67]  0.87958836  0.14838054  0.11278551  0.59257933  0.85950591  0.31603500
 [73]  0.51973387 -0.18870006 -0.29118658 -0.78834078 -0.83456382 -1.35864680
 [79]  0.43022649  1.19745548 -0.81039533  0.54513400 -0.32286212 -0.50422629
 [85] -0.25563343 -1.10869119  2.39416353 -0.46837911 -0.89311766  2.09392467
 [91]  0.66032079  0.67732389  0.55984504 -1.10145428  0.64317799 -0.19299131
 [97] -0.10489223 -0.09622737  0.07380417  1.05377810
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -1.56359827  0.05491150 -0.55202524 -0.02361119 -1.03728783 -0.23704382
  [7]  1.70425364  0.77166750  0.50547432 -0.93695100  0.72266682  0.59584563
 [13] -0.57231756 -0.61462880 -0.30399246  0.48396819  0.14187552 -0.08087577
 [19] -0.18527367 -0.57782313  0.25060956 -0.77882972 -0.17228990 -0.95369271
 [25] -0.47877250 -0.37811051  1.31643218 -0.35220667  0.39219384  0.51854917
 [31]  0.10774675 -0.33719182 -0.89220818  1.03245973  0.93058265  1.30223766
 [37] -1.32244586 -0.68484639  1.48616832  0.70521693 -0.11028946 -1.78428703
 [43] -0.63052661  1.13893307 -1.05359198  1.05772636  0.93508936  1.30456232
 [49]  0.23003682  0.36222945 -0.23728682  0.68905417  0.16538713 -0.73441071
 [55]  1.43068300 -1.92686510  0.80563494  1.05758107  2.15559975 -0.61737769
 [61] -1.02896095  0.22574572 -0.55269918 -0.31264609 -0.90449877 -1.44492956
 [67]  0.87958836  0.14838054  0.11278551  0.59257933  0.85950591  0.31603500
 [73]  0.51973387 -0.18870006 -0.29118658 -0.78834078 -0.83456382 -1.35864680
 [79]  0.43022649  1.19745548 -0.81039533  0.54513400 -0.32286212 -0.50422629
 [85] -0.25563343 -1.10869119  2.39416353 -0.46837911 -0.89311766  2.09392467
 [91]  0.66032079  0.67732389  0.55984504 -1.10145428  0.64317799 -0.19299131
 [97] -0.10489223 -0.09622737  0.07380417  1.05377810
> colMin(tmp)
  [1] -1.56359827  0.05491150 -0.55202524 -0.02361119 -1.03728783 -0.23704382
  [7]  1.70425364  0.77166750  0.50547432 -0.93695100  0.72266682  0.59584563
 [13] -0.57231756 -0.61462880 -0.30399246  0.48396819  0.14187552 -0.08087577
 [19] -0.18527367 -0.57782313  0.25060956 -0.77882972 -0.17228990 -0.95369271
 [25] -0.47877250 -0.37811051  1.31643218 -0.35220667  0.39219384  0.51854917
 [31]  0.10774675 -0.33719182 -0.89220818  1.03245973  0.93058265  1.30223766
 [37] -1.32244586 -0.68484639  1.48616832  0.70521693 -0.11028946 -1.78428703
 [43] -0.63052661  1.13893307 -1.05359198  1.05772636  0.93508936  1.30456232
 [49]  0.23003682  0.36222945 -0.23728682  0.68905417  0.16538713 -0.73441071
 [55]  1.43068300 -1.92686510  0.80563494  1.05758107  2.15559975 -0.61737769
 [61] -1.02896095  0.22574572 -0.55269918 -0.31264609 -0.90449877 -1.44492956
 [67]  0.87958836  0.14838054  0.11278551  0.59257933  0.85950591  0.31603500
 [73]  0.51973387 -0.18870006 -0.29118658 -0.78834078 -0.83456382 -1.35864680
 [79]  0.43022649  1.19745548 -0.81039533  0.54513400 -0.32286212 -0.50422629
 [85] -0.25563343 -1.10869119  2.39416353 -0.46837911 -0.89311766  2.09392467
 [91]  0.66032079  0.67732389  0.55984504 -1.10145428  0.64317799 -0.19299131
 [97] -0.10489223 -0.09622737  0.07380417  1.05377810
> colMedians(tmp)
  [1] -1.56359827  0.05491150 -0.55202524 -0.02361119 -1.03728783 -0.23704382
  [7]  1.70425364  0.77166750  0.50547432 -0.93695100  0.72266682  0.59584563
 [13] -0.57231756 -0.61462880 -0.30399246  0.48396819  0.14187552 -0.08087577
 [19] -0.18527367 -0.57782313  0.25060956 -0.77882972 -0.17228990 -0.95369271
 [25] -0.47877250 -0.37811051  1.31643218 -0.35220667  0.39219384  0.51854917
 [31]  0.10774675 -0.33719182 -0.89220818  1.03245973  0.93058265  1.30223766
 [37] -1.32244586 -0.68484639  1.48616832  0.70521693 -0.11028946 -1.78428703
 [43] -0.63052661  1.13893307 -1.05359198  1.05772636  0.93508936  1.30456232
 [49]  0.23003682  0.36222945 -0.23728682  0.68905417  0.16538713 -0.73441071
 [55]  1.43068300 -1.92686510  0.80563494  1.05758107  2.15559975 -0.61737769
 [61] -1.02896095  0.22574572 -0.55269918 -0.31264609 -0.90449877 -1.44492956
 [67]  0.87958836  0.14838054  0.11278551  0.59257933  0.85950591  0.31603500
 [73]  0.51973387 -0.18870006 -0.29118658 -0.78834078 -0.83456382 -1.35864680
 [79]  0.43022649  1.19745548 -0.81039533  0.54513400 -0.32286212 -0.50422629
 [85] -0.25563343 -1.10869119  2.39416353 -0.46837911 -0.89311766  2.09392467
 [91]  0.66032079  0.67732389  0.55984504 -1.10145428  0.64317799 -0.19299131
 [97] -0.10489223 -0.09622737  0.07380417  1.05377810
> colRanges(tmp)
          [,1]      [,2]       [,3]        [,4]      [,5]       [,6]     [,7]
[1,] -1.563598 0.0549115 -0.5520252 -0.02361119 -1.037288 -0.2370438 1.704254
[2,] -1.563598 0.0549115 -0.5520252 -0.02361119 -1.037288 -0.2370438 1.704254
          [,8]      [,9]     [,10]     [,11]     [,12]      [,13]      [,14]
[1,] 0.7716675 0.5054743 -0.936951 0.7226668 0.5958456 -0.5723176 -0.6146288
[2,] 0.7716675 0.5054743 -0.936951 0.7226668 0.5958456 -0.5723176 -0.6146288
          [,15]     [,16]     [,17]       [,18]      [,19]      [,20]     [,21]
[1,] -0.3039925 0.4839682 0.1418755 -0.08087577 -0.1852737 -0.5778231 0.2506096
[2,] -0.3039925 0.4839682 0.1418755 -0.08087577 -0.1852737 -0.5778231 0.2506096
          [,22]      [,23]      [,24]      [,25]      [,26]    [,27]      [,28]
[1,] -0.7788297 -0.1722899 -0.9536927 -0.4787725 -0.3781105 1.316432 -0.3522067
[2,] -0.7788297 -0.1722899 -0.9536927 -0.4787725 -0.3781105 1.316432 -0.3522067
         [,29]     [,30]     [,31]      [,32]      [,33]   [,34]     [,35]
[1,] 0.3921938 0.5185492 0.1077467 -0.3371918 -0.8922082 1.03246 0.9305827
[2,] 0.3921938 0.5185492 0.1077467 -0.3371918 -0.8922082 1.03246 0.9305827
        [,36]     [,37]      [,38]    [,39]     [,40]      [,41]     [,42]
[1,] 1.302238 -1.322446 -0.6848464 1.486168 0.7052169 -0.1102895 -1.784287
[2,] 1.302238 -1.322446 -0.6848464 1.486168 0.7052169 -0.1102895 -1.784287
          [,43]    [,44]     [,45]    [,46]     [,47]    [,48]     [,49]
[1,] -0.6305266 1.138933 -1.053592 1.057726 0.9350894 1.304562 0.2300368
[2,] -0.6305266 1.138933 -1.053592 1.057726 0.9350894 1.304562 0.2300368
         [,50]      [,51]     [,52]     [,53]      [,54]    [,55]     [,56]
[1,] 0.3622295 -0.2372868 0.6890542 0.1653871 -0.7344107 1.430683 -1.926865
[2,] 0.3622295 -0.2372868 0.6890542 0.1653871 -0.7344107 1.430683 -1.926865
         [,57]    [,58]  [,59]      [,60]     [,61]     [,62]      [,63]
[1,] 0.8056349 1.057581 2.1556 -0.6173777 -1.028961 0.2257457 -0.5526992
[2,] 0.8056349 1.057581 2.1556 -0.6173777 -1.028961 0.2257457 -0.5526992
          [,64]      [,65]    [,66]     [,67]     [,68]     [,69]     [,70]
[1,] -0.3126461 -0.9044988 -1.44493 0.8795884 0.1483805 0.1127855 0.5925793
[2,] -0.3126461 -0.9044988 -1.44493 0.8795884 0.1483805 0.1127855 0.5925793
         [,71]    [,72]     [,73]      [,74]      [,75]      [,76]      [,77]
[1,] 0.8595059 0.316035 0.5197339 -0.1887001 -0.2911866 -0.7883408 -0.8345638
[2,] 0.8595059 0.316035 0.5197339 -0.1887001 -0.2911866 -0.7883408 -0.8345638
         [,78]     [,79]    [,80]      [,81]    [,82]      [,83]      [,84]
[1,] -1.358647 0.4302265 1.197455 -0.8103953 0.545134 -0.3228621 -0.5042263
[2,] -1.358647 0.4302265 1.197455 -0.8103953 0.545134 -0.3228621 -0.5042263
          [,85]     [,86]    [,87]      [,88]      [,89]    [,90]     [,91]
[1,] -0.2556334 -1.108691 2.394164 -0.4683791 -0.8931177 2.093925 0.6603208
[2,] -0.2556334 -1.108691 2.394164 -0.4683791 -0.8931177 2.093925 0.6603208
         [,92]    [,93]     [,94]    [,95]      [,96]      [,97]       [,98]
[1,] 0.6773239 0.559845 -1.101454 0.643178 -0.1929913 -0.1048922 -0.09622737
[2,] 0.6773239 0.559845 -1.101454 0.643178 -0.1929913 -0.1048922 -0.09622737
          [,99]   [,100]
[1,] 0.07380417 1.053778
[2,] 0.07380417 1.053778
> 
> 
> Max(tmp2)
[1] 2.730212
> Min(tmp2)
[1] -2.466818
> mean(tmp2)
[1] 0.008134281
> Sum(tmp2)
[1] 0.8134281
> Var(tmp2)
[1] 0.9721496
> 
> rowMeans(tmp2)
  [1] -1.01111850 -0.55697320 -0.15552885 -1.93918387 -0.19059300 -0.33791147
  [7] -0.72658681 -0.06678857  0.17463856  1.04662535 -0.07299987  0.12551146
 [13]  1.01821369  0.01713461 -0.45072595  0.77795841  1.19765240  1.18381617
 [19]  0.18730259 -2.46681814 -1.39360509  1.62363754  0.06505744 -0.08433185
 [25]  0.50029571 -1.99596891  0.79348809  1.29085229 -0.22588779  0.51784148
 [31]  0.29023549  0.02880819 -0.98945595  0.04781142 -0.42429347  1.01277128
 [37]  0.55156764 -0.61731827 -0.41112305 -1.85650233 -0.42691079 -0.20274932
 [43]  0.42205351 -1.09437743 -0.06649912 -0.31487434  1.25616533  1.15645284
 [49]  0.39633498 -1.13589143 -0.69795091 -0.28125907 -0.32098924 -0.88012538
 [55] -2.07588099  0.69001327 -0.28321150 -0.75059213 -0.11362526  1.03200846
 [61]  0.43445337  0.45030876 -0.65791231  1.21610595  1.63641621 -0.02352070
 [67]  0.76219157  0.69777907 -0.08665161  2.73021193 -1.00773446  1.09183054
 [73]  0.74999842 -0.04669692  0.25232234 -0.50829266  2.54722767 -0.99342542
 [79]  0.61200509 -0.68966603  0.86943529 -1.61681695  0.49473186  0.22304660
 [85] -1.44619171  1.16696926 -0.08148290 -0.15047317 -1.34602958  0.03509051
 [91]  0.62750536 -1.62351610  1.84503497  0.96064259 -1.39652431  0.76670477
 [97]  0.67017626 -0.52185214  0.63454887 -1.25011855
> rowSums(tmp2)
  [1] -1.01111850 -0.55697320 -0.15552885 -1.93918387 -0.19059300 -0.33791147
  [7] -0.72658681 -0.06678857  0.17463856  1.04662535 -0.07299987  0.12551146
 [13]  1.01821369  0.01713461 -0.45072595  0.77795841  1.19765240  1.18381617
 [19]  0.18730259 -2.46681814 -1.39360509  1.62363754  0.06505744 -0.08433185
 [25]  0.50029571 -1.99596891  0.79348809  1.29085229 -0.22588779  0.51784148
 [31]  0.29023549  0.02880819 -0.98945595  0.04781142 -0.42429347  1.01277128
 [37]  0.55156764 -0.61731827 -0.41112305 -1.85650233 -0.42691079 -0.20274932
 [43]  0.42205351 -1.09437743 -0.06649912 -0.31487434  1.25616533  1.15645284
 [49]  0.39633498 -1.13589143 -0.69795091 -0.28125907 -0.32098924 -0.88012538
 [55] -2.07588099  0.69001327 -0.28321150 -0.75059213 -0.11362526  1.03200846
 [61]  0.43445337  0.45030876 -0.65791231  1.21610595  1.63641621 -0.02352070
 [67]  0.76219157  0.69777907 -0.08665161  2.73021193 -1.00773446  1.09183054
 [73]  0.74999842 -0.04669692  0.25232234 -0.50829266  2.54722767 -0.99342542
 [79]  0.61200509 -0.68966603  0.86943529 -1.61681695  0.49473186  0.22304660
 [85] -1.44619171  1.16696926 -0.08148290 -0.15047317 -1.34602958  0.03509051
 [91]  0.62750536 -1.62351610  1.84503497  0.96064259 -1.39652431  0.76670477
 [97]  0.67017626 -0.52185214  0.63454887 -1.25011855
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -1.01111850 -0.55697320 -0.15552885 -1.93918387 -0.19059300 -0.33791147
  [7] -0.72658681 -0.06678857  0.17463856  1.04662535 -0.07299987  0.12551146
 [13]  1.01821369  0.01713461 -0.45072595  0.77795841  1.19765240  1.18381617
 [19]  0.18730259 -2.46681814 -1.39360509  1.62363754  0.06505744 -0.08433185
 [25]  0.50029571 -1.99596891  0.79348809  1.29085229 -0.22588779  0.51784148
 [31]  0.29023549  0.02880819 -0.98945595  0.04781142 -0.42429347  1.01277128
 [37]  0.55156764 -0.61731827 -0.41112305 -1.85650233 -0.42691079 -0.20274932
 [43]  0.42205351 -1.09437743 -0.06649912 -0.31487434  1.25616533  1.15645284
 [49]  0.39633498 -1.13589143 -0.69795091 -0.28125907 -0.32098924 -0.88012538
 [55] -2.07588099  0.69001327 -0.28321150 -0.75059213 -0.11362526  1.03200846
 [61]  0.43445337  0.45030876 -0.65791231  1.21610595  1.63641621 -0.02352070
 [67]  0.76219157  0.69777907 -0.08665161  2.73021193 -1.00773446  1.09183054
 [73]  0.74999842 -0.04669692  0.25232234 -0.50829266  2.54722767 -0.99342542
 [79]  0.61200509 -0.68966603  0.86943529 -1.61681695  0.49473186  0.22304660
 [85] -1.44619171  1.16696926 -0.08148290 -0.15047317 -1.34602958  0.03509051
 [91]  0.62750536 -1.62351610  1.84503497  0.96064259 -1.39652431  0.76670477
 [97]  0.67017626 -0.52185214  0.63454887 -1.25011855
> rowMin(tmp2)
  [1] -1.01111850 -0.55697320 -0.15552885 -1.93918387 -0.19059300 -0.33791147
  [7] -0.72658681 -0.06678857  0.17463856  1.04662535 -0.07299987  0.12551146
 [13]  1.01821369  0.01713461 -0.45072595  0.77795841  1.19765240  1.18381617
 [19]  0.18730259 -2.46681814 -1.39360509  1.62363754  0.06505744 -0.08433185
 [25]  0.50029571 -1.99596891  0.79348809  1.29085229 -0.22588779  0.51784148
 [31]  0.29023549  0.02880819 -0.98945595  0.04781142 -0.42429347  1.01277128
 [37]  0.55156764 -0.61731827 -0.41112305 -1.85650233 -0.42691079 -0.20274932
 [43]  0.42205351 -1.09437743 -0.06649912 -0.31487434  1.25616533  1.15645284
 [49]  0.39633498 -1.13589143 -0.69795091 -0.28125907 -0.32098924 -0.88012538
 [55] -2.07588099  0.69001327 -0.28321150 -0.75059213 -0.11362526  1.03200846
 [61]  0.43445337  0.45030876 -0.65791231  1.21610595  1.63641621 -0.02352070
 [67]  0.76219157  0.69777907 -0.08665161  2.73021193 -1.00773446  1.09183054
 [73]  0.74999842 -0.04669692  0.25232234 -0.50829266  2.54722767 -0.99342542
 [79]  0.61200509 -0.68966603  0.86943529 -1.61681695  0.49473186  0.22304660
 [85] -1.44619171  1.16696926 -0.08148290 -0.15047317 -1.34602958  0.03509051
 [91]  0.62750536 -1.62351610  1.84503497  0.96064259 -1.39652431  0.76670477
 [97]  0.67017626 -0.52185214  0.63454887 -1.25011855
> 
> colMeans(tmp2)
[1] 0.008134281
> colSums(tmp2)
[1] 0.8134281
> colVars(tmp2)
[1] 0.9721496
> colSd(tmp2)
[1] 0.9859765
> colMax(tmp2)
[1] 2.730212
> colMin(tmp2)
[1] -2.466818
> colMedians(tmp2)
[1] -0.03510881
> colRanges(tmp2)
          [,1]
[1,] -2.466818
[2,]  2.730212
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.3210549  4.0166164  0.1267087 -0.4750805 -4.3492604  0.3705803
 [7] -6.4458902  1.2207390  2.9124530  0.4921429
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.1213103
[2,] -1.0494689
[3,] -0.3961251
[4,]  0.1607948
[5,]  2.0973977
> 
> rowApply(tmp,sum)
 [1] -0.365557  1.210785  3.814417  2.409198 -3.024447 -6.538181 -1.085294
 [8] -1.669896  0.311345  0.485585
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    7    1   10    9    2    9    3    4    1     4
 [2,]    9    7    9    1   10    7    5    8    5     5
 [3,]   10    5    3    5    8    8   10    3    4     7
 [4,]    8    8    1    8    4    1    6    5    8     6
 [5,]    1    3    5    4    5    2    4    6    9     3
 [6,]    5    4    6    6    7    4    8   10    3     8
 [7,]    3    2    2   10    3    5    1    1    2     2
 [8,]    2    9    7    2    9    6    7    2    7     9
 [9,]    4    6    4    7    6    3    9    7   10    10
[10,]    6   10    8    3    1   10    2    9    6     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.3545756 -2.2848959  1.1831662  2.3633473 -0.8965437  1.1073550
 [7]  2.3127740  2.4185936  0.3778802 -0.2502381 -2.1243083  2.3701803
[13] -4.1665925  0.4217876 -0.5674651  1.2080392 -2.2405897 -2.9819135
[19]  3.6042417 -0.8951412
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1224066
[2,] -0.5261097
[3,] -0.1568176
[4,]  0.7219035
[5,]  1.4380061
> 
> rowApply(tmp,sum)
[1] -2.2508943 -0.6758540 -0.2571857  3.4482949  1.0498919
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   20    3   11   16    4
[2,]    1    8   19    2    7
[3,]   18   13   12   10    3
[4,]   17   18   18    5    6
[5,]   11    1   15    3   18
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]       [,4]        [,5]        [,6]
[1,]  1.4380061 -2.19400981  1.1978403  0.6080102  0.03898809  0.28100805
[2,] -1.1224066 -0.32052535  0.2372580  1.1125570 -1.74204120  1.71811130
[3,] -0.1568176  1.26981199  0.1156315  1.1201902  0.80670085 -1.44995984
[4,]  0.7219035 -1.00592336  0.3644238 -0.3031553 -0.80571108  0.57129704
[5,] -0.5261097 -0.03424933 -0.7319874 -0.1742548  0.80551967 -0.01310156
          [,7]       [,8]       [,9]       [,10]      [,11]      [,12]
[1,] 0.2264420  1.2563437  0.1843303 -1.82736119 -1.4916568 -0.4140968
[2,] 0.8412537 -0.1514789  0.1431835 -0.02158902 -1.0161070  1.8944151
[3,] 0.2159423  0.9302620 -0.8984960  1.06361668 -0.5841813 -0.4256348
[4,] 0.9134608 -0.1896045 -0.2184719  0.33577877  0.7546098  0.6493339
[5,] 0.1156752  0.5730713  1.1673344  0.19931663  0.2130270  0.6661630
          [,13]       [,14]      [,15]       [,16]       [,17]      [,18]
[1,] -0.9731780  0.02752846 -0.5550476  0.22080119  0.02926961 -0.3426811
[2,] -1.7183649  0.23739323 -0.4760009 -0.05312031 -0.66496257  0.5785672
[3,] -0.4829662 -0.67705778 -0.6524465 -0.67419194  0.47530092 -1.5198790
[4,] -1.9292999  0.70586487  0.4215184  1.47402654 -0.62602482 -0.2085128
[5,]  0.9372165  0.12805887  0.6945116  0.24052369 -1.45417284 -1.4894078
           [,19]       [,20]
[1,] -0.02896569  0.06753474
[2,]  0.56712636 -0.71912275
[3,]  1.68738659 -0.42039761
[4,]  1.14338383  0.67939746
[5,]  0.23531062 -0.50255302
> 
> 
> 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.19-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.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  645  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  559  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
         col1      col2       col3        col4      col5     col6       col7
row1 1.711948 -0.959949 -0.4264526 -0.08548261 -1.246337 0.759464 -0.5756586
           col8       col9      col10    col11      col12 col13      col14
row1 -0.9543638 -0.8520401 -0.4905851 1.281778 -0.4232354 1.262 -0.2820225
         col15      col16     col17    col18    col19     col20
row1 0.7404247 -0.9981066 0.4974124 0.392093 1.400905 -1.719788
> tmp[,"col10"]
          col10
row1 -0.4905851
row2  0.4331531
row3 -1.5452509
row4 -1.1713477
row5 -0.3028487
> tmp[c("row1","row5"),]
          col1         col2       col3        col4       col5       col6
row1 1.7119484 -0.959948992 -0.4264526 -0.08548261 -1.2463373  0.7594640
row5 0.9930151  0.003394664 -1.7359099 -0.32618221  0.3325111 -0.4367148
           col7       col8       col9      col10       col11      col12
row1 -0.5756586 -0.9543638 -0.8520401 -0.4905851  1.28177835 -0.4232354
row5 -0.8416358  1.9982251  1.2879911 -0.3028487 -0.03957866 -1.0943504
        col13      col14      col15      col16     col17      col18      col19
row1 1.262000 -0.2820225  0.7404247 -0.9981066 0.4974124  0.3920930  1.4009051
row5 2.249778 -1.0413108 -0.4362416 -0.1690046 0.4791213 -0.5444236 -0.8961575
          col20
row1 -1.7197881
row5  0.2153449
> tmp[,c("col6","col20")]
           col6        col20
row1  0.7594640 -1.719788078
row2  0.5119852 -0.582527926
row3  0.5626579  0.003900029
row4  0.2850949  0.204122709
row5 -0.4367148  0.215344895
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  0.7594640 -1.7197881
row5 -0.4367148  0.2153449
> 
> 
> 
> 
> 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 48.52784 49.87883 50.29584 50.49232 48.57438 105.1959 48.51612 49.75043
         col9    col10    col11    col12   col13    col14    col15    col16
row1 50.11055 50.10316 50.36262 49.19778 49.7971 50.00539 50.34326 49.40939
        col17    col18    col19    col20
row1 49.44578 50.08295 49.57835 105.9673
> tmp[,"col10"]
        col10
row1 50.10316
row2 31.85884
row3 30.53592
row4 31.88655
row5 50.04863
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.52784 49.87883 50.29584 50.49232 48.57438 105.1959 48.51612 49.75043
row5 49.81626 49.40687 51.32752 50.23772 51.98614 103.4672 51.84969 49.35608
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.11055 50.10316 50.36262 49.19778 49.79710 50.00539 50.34326 49.40939
row5 49.55005 50.04863 48.97053 51.64753 50.92492 52.51087 49.89216 49.70921
        col17    col18    col19    col20
row1 49.44578 50.08295 49.57835 105.9673
row5 49.86270 50.06246 49.68483 105.3301
> tmp[,c("col6","col20")]
          col6     col20
row1 105.19586 105.96734
row2  75.01846  75.19418
row3  74.01405  75.41170
row4  74.51947  74.31630
row5 103.46722 105.33007
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.1959 105.9673
row5 103.4672 105.3301
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.1959 105.9673
row5 103.4672 105.3301
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.7792765
[2,]  1.3457156
[3,]  0.2752048
[4,] -0.4798530
[5,] -0.6040869
> tmp[,c("col17","col7")]
          col17        col7
[1,] -0.1564493  1.36443115
[2,] -0.5813661 -0.04014445
[3,] -0.5362591 -0.16634969
[4,]  1.2525729  1.09277923
[5,]  0.6488432 -1.18549956
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  1.2099377  1.8005400
[2,]  1.4002461 -1.3108956
[3,]  1.4823887 -0.8237070
[4,] -0.6754015  0.2398302
[5,]  0.9182802 -0.1361080
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.209938
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
         col6
[1,] 1.209938
[2,] 1.400246
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
         [,1]       [,2]       [,3]       [,4]        [,5]       [,6]
row3 1.051917  1.6177428 -0.8813233 0.08314417 -0.04693943 0.06668868
row1 1.475749 -0.8569985 -0.3630112 0.37424166 -2.15180500 0.95822472
           [,7]      [,8]       [,9]     [,10]      [,11]     [,12]      [,13]
row3 -1.9163555 2.3933078 -0.4388965 0.2665989  1.4355042 0.8298994 1.99761581
row1  0.7960961 0.3321575  0.8514749 0.6302310 -0.2212047 0.3280170 0.09833081
          [,14]      [,15]      [,16]      [,17]      [,18]    [,19]      [,20]
row3  0.2318782  0.4137170 -1.8133675 -1.4336345 -0.2985351 1.487952 0.08530958
row1 -1.4994081 -0.8484571  0.2359821  0.8945034 -0.7625974 1.176100 0.29130053
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
        [,1]      [,2]     [,3]   [,4]     [,5]      [,6]       [,7]       [,8]
row2 1.20875 -2.195828 2.271064 1.2572 1.146364 -1.043267 -0.7277871 -0.2600524
          [,9]      [,10]
row2 0.8039734 -0.3825327
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]       [,2]     [,3]       [,4]     [,5]     [,6]       [,7]
row5 -1.58687 -0.5654451 1.563343 -0.7741684 2.367736 1.241679 -0.3779457
          [,8]       [,9]     [,10]    [,11]    [,12]     [,13]    [,14]
row5 0.5516336 -0.1273606 0.4388466 1.238965 1.262067 -1.714848 -2.65744
         [,15]    [,16]     [,17]     [,18]     [,19]      [,20]
row5 0.9455962 1.367341 0.9261052 -2.755254 -1.167124 0.07595868
> 
> 
> 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: 0x55b3452ec9f0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e4664ca86"
 [2] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e7624ec95"
 [3] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e446c413b"
 [4] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e288e601a"
 [5] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e7df0b75b"
 [6] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e563e49e2"
 [7] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e7e08a7f3"
 [8] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e5176eb40"
 [9] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e583a3a6a"
[10] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e5bb26b79"
[11] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e1682c3d5"
[12] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e68dab593"
[13] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e2330cc07"
[14] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e2fe942db"
[15] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4566e7d0c1781"
> 
> 
> ### 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: 0x55b34382c890>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x55b34382c890>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x55b34382c890>
> rowMedians(tmp)
  [1]  0.0205249616  0.3036630990 -0.3360361771  0.0115479170  0.0951042251
  [6] -0.0271463518 -0.2229319175  0.2072970377 -0.0848920264  0.0324263345
 [11]  0.4178059390  0.1424150562 -0.4515634182 -0.0646724065  0.0902211693
 [16]  0.3190189435  0.1785496788  0.2528944628  0.3048280772 -0.4606571334
 [21]  0.4037819128 -1.0240122064  0.2533087957  0.3399603819  0.5995838176
 [26]  0.2760221363  0.1843841536 -0.1967655040  0.0908400586  0.2099043268
 [31] -0.5039168129 -0.3673553336 -0.1760523386 -0.6904055425 -0.3564349192
 [36]  0.1766703166 -0.0928378910 -0.0533858870  0.3445008511 -0.2456061441
 [41]  0.5513879394 -0.5101457926  0.6681628666  0.2357599377 -0.2359198573
 [46] -0.1787785615  0.1285331684  0.4483387944 -0.3233111716 -0.1320394579
 [51] -0.2623130234 -0.2605880604  0.2446028545  0.3146520325 -0.1880559637
 [56]  0.0453360208 -0.1441176674  0.5994202962  0.2747912790 -0.3342798239
 [61] -0.0937620745 -0.0329325341 -0.1011991516 -0.2370335205  0.4457304726
 [66] -0.2448547467 -0.6126553827  0.0368250604 -0.5876387939 -0.0451845398
 [71] -0.0911740040  0.0156398934  0.1469920846 -0.2749174921 -0.1460397289
 [76] -0.0042092666  0.4892412464  0.1458127435 -0.5218256862 -0.4094880605
 [81]  0.1145717549 -0.0250423573  0.6799663631 -0.1827186516  0.1037621600
 [86] -0.0299995164 -0.2723789429  0.0006108964  0.1742667634  0.0058062955
 [91] -0.0656828511 -1.2441543095 -0.2733558298 -0.2906877011 -0.1808444874
 [96]  0.0723349968 -0.0576561254 -0.3949840888 -0.0400777581 -0.1391241153
[101] -0.5689611977 -0.0264133629 -0.9827460681 -0.0214298202 -0.1870611138
[106] -0.0191542839  0.5240394298  0.4306413650 -0.0085759010  0.2160428037
[111] -0.2964852047 -0.5849509344 -0.3191868309 -0.1241122226 -0.0632938969
[116] -0.8287146913  0.5627527181  0.0154564013  0.2245338396  0.4252129390
[121]  0.0087767698  0.2550589369  0.1249207202  0.4590112609  0.0219875598
[126] -0.3565894288 -0.1644273304  0.2658687596  0.1743346416  0.2834354029
[131]  0.3033410139 -0.1601587791  0.6604413963 -0.3100230190 -0.0920628827
[136]  0.0226469364 -0.1455967602 -0.0555520920 -0.0765118340 -0.1454120929
[141] -0.5043724149  0.0773777175  0.0523278876  0.0515366525  0.0141925107
[146]  0.0354644715  0.2324165290 -0.5406679790  0.2337435320 -0.3156065081
[151] -0.2441028647  0.1563042664 -0.2144368073  0.1096567490 -0.0068120685
[156] -0.4739100381  0.0948271999 -0.0455378655  0.7624817834  0.0603221690
[161]  0.0281306745  0.5099855792  0.0399362937 -0.1125321264  0.2940794108
[166]  0.1171271270  0.4121053319  0.5028934952 -0.3373542586 -0.0491978162
[171]  0.0789001403 -0.1936670628 -0.4886489316  0.1412306720  0.1783777176
[176]  0.0930050149 -0.1344002219  0.1416174092 -0.3284059947  0.0166410742
[181]  0.2087677239 -0.5084407902  0.0350618385 -0.0111009902 -0.3191879772
[186]  0.1721239021 -0.3486944267 -0.0420358706 -0.5570358463  0.2194373293
[191]  0.1290865848 -0.5075456008  0.3494662526  0.1849394788  0.0339136273
[196] -0.4415853570 -0.0619158323  0.3457566044 -0.0222381460  0.2954301683
[201]  0.1364984892 -0.4804104313  0.1742687150  0.2136699110  0.7323547043
[206] -0.4342195917  0.0406723218  0.2044610724  0.0329435174 -0.1282635391
[211] -0.2052727924  0.4138209791  0.1183834892  0.0884612070 -0.1366950813
[216]  0.0649359592  0.6403483432 -0.0355809296 -0.4060745266  0.1494400190
[221]  0.0268452326  0.3774152709 -0.9678441219 -0.7406947786 -0.0738225694
[226] -0.2288181549  0.1320735906 -0.0366308514  0.2223732889  0.2045846812
> 
> proc.time()
   user  system elapsed 
  1.502   1.575   3.088 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
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: 0x5609e69314b0>
> .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: 0x5609e69314b0>
> .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: 0x5609e69314b0>
> .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: 0x5609e69314b0>
> 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: 0x5609e6d6b6e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5609e6d6b6e0>
> .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: 0x5609e6d6b6e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5609e6d6b6e0>
> .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: 0x5609e6d6b6e0>
> 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: 0x5609e8418d70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5609e8418d70>
> .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: 0x5609e8418d70>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5609e8418d70>
> .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: 0x5609e8418d70>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5609e8418d70>
> .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: 0x5609e8418d70>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5609e8418d70>
> .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: 0x5609e8418d70>
> 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: 0x5609e8464120>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5609e8464120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5609e8464120>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5609e8464120>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile4574f274c9695" "BufferedMatrixFile4574f7b8c57ff"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile4574f274c9695" "BufferedMatrixFile4574f7b8c57ff"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5609e7cbc010>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5609e7cbc010>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5609e7cbc010>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5609e7cbc010>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5609e7cbc010>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5609e7cbc010>
> .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: 0x5609e7cc3a40>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5609e7cc3a40>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5609e7cc3a40>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5609e7cc3a40>
> 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: 0x5609e7cc8c90>
> .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: 0x5609e7cc8c90>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.264   0.047   0.301 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.263   0.040   0.291 

Example timings