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

This page was generated on 2023-10-16 11:35:14 -0400 (Mon, 16 Oct 2023).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 22.04.2 LTS)x86_644.3.1 (2023-06-16) -- "Beagle Scouts" 4626
palomino3Windows Server 2022 Datacenterx644.3.1 (2023-06-16 ucrt) -- "Beagle Scouts" 4379
merida1macOS 12.6.4 Montereyx86_644.3.1 (2023-06-16) -- "Beagle Scouts" 4395
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 245/2230HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.64.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-10-15 14:00:13 -0400 (Sun, 15 Oct 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_17
git_last_commit: 3e3f8d6
git_last_commit_date: 2023-04-25 09:44:48 -0400 (Tue, 25 Apr 2023)
nebbiolo1Linux (Ubuntu 22.04.2 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino3Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
merida1macOS 12.6.4 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson2macOS 12.6.1 Monterey / arm64see weekly results here

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.64.0
Command: /home/biocbuild/bbs-3.17-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.17-bioc/R/site-library --timings BufferedMatrix_1.64.0.tar.gz
StartedAt: 2023-10-15 19:45:33 -0400 (Sun, 15 Oct 2023)
EndedAt: 2023-10-15 19:45:58 -0400 (Sun, 15 Oct 2023)
EllapsedTime: 25.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.3.1 (2023-06-16)
* using platform: x86_64-pc-linux-gnu (64-bit)
* R was compiled by
    gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
    GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
* running under: Ubuntu 22.04.3 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.64.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 R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking 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
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ...
  ‘BufferedMatrix.Rnw’... OK
 OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.17-bioc/R/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.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^~~~~~~~~~~~~~~~~~~
At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
gcc -I"/home/biocbuild/bbs-3.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/bbs-3.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/bbs-3.17-bioc/R/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/bbs-3.17-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.17-bioc/R/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.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

> library(BufferedMatrix);library.dynam("BufferedMatrix", "BufferedMatrix", .libPaths());.C("dbm_c_tester",integer(1))

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

Adding Additional Column
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 

Reassigning values
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 3
Buffer Cols: 3
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Activating Row Buffer
In row mode: 1
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Squaring Last Column
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 900.000000 

Square rooting Last Row, then turing off Row Buffer
In row mode: 0
Checking on value that should be not be in column buffer2.236068 
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
2.236068 3.162278 3.872983 4.472136 5.000000 30.000000 

Single Indexing. Assign each value its square
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Resizing Buffers Smaller
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Activating Row Mode.
Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
Activating ReadOnly Mode.
The results of assignment is: 0
Printing matrix reversed.
900.000000 625.000000 400.000000 225.000000 100.000000 25.000000 
841.000000 576.000000 361.000000 196.000000 81.000000 16.000000 
784.000000 529.000000 324.000000 169.000000 64.000000 9.000000 
729.000000 484.000000 289.000000 144.000000 49.000000 -30.000000 
676.000000 441.000000 256.000000 121.000000 -20.000000 -10.000000 

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.263   0.036   0.288 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 457528 24.5     981822 52.5   650800 34.8
Vcells 842801  6.5    8388608 64.0  2062520 15.8
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sun Oct 15 19:45:49 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sun Oct 15 19:45:49 2023"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x55fb857bc320>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Sun Oct 15 19:45:49 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Sun Oct 15 19:45:49 2023"
> 
> ColMode(tmp2)
<pointer: 0x55fb857bc320>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]       [,3]       [,4]
[1,] 101.4210604 -1.7611091 1.12699233  1.0491806
[2,]  -2.5988417 -1.5262708 0.74136169  0.3982037
[3,]   1.4034547  0.3984483 0.08853964 -0.6702742
[4,]  -0.6068191 -0.4560960 0.24476243 -0.8665909
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]       [,3]      [,4]
[1,] 101.4210604 1.7611091 1.12699233 1.0491806
[2,]   2.5988417 1.5262708 0.74136169 0.3982037
[3,]   1.4034547 0.3984483 0.08853964 0.6702742
[4,]   0.6068191 0.4560960 0.24476243 0.8665909
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0708024 1.3270679 1.0615989 1.0242952
[2,]  1.6120923 1.2354233 0.8610236 0.6310338
[3,]  1.1846749 0.6312276 0.2975561 0.8187028
[4,]  0.7789859 0.6753488 0.4947347 0.9309087
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 227.12908 40.03179 36.74298 36.29213
[2,]  43.71976 38.88050 34.35160 31.70854
[3,]  38.25020 31.71072 28.06410 33.85730
[4,]  33.39668 32.20958 30.19211 35.17568
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x55fb83b9a1d0>
> exp(tmp5)
<pointer: 0x55fb83b9a1d0>
> log(tmp5,2)
<pointer: 0x55fb83b9a1d0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 472.7394
> Min(tmp5)
[1] 53.65257
> mean(tmp5)
[1] 73.01688
> Sum(tmp5)
[1] 14603.38
> Var(tmp5)
[1] 869.1613
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.93410 72.54465 70.85725 70.04063 70.29458 73.97895 70.68711 69.07911
 [9] 68.40331 72.34909
> rowSums(tmp5)
 [1] 1838.682 1450.893 1417.145 1400.813 1405.892 1479.579 1413.742 1381.582
 [9] 1368.066 1446.982
> rowVars(tmp5)
 [1] 8077.30165   99.71966   67.43003   57.74199   59.52335   48.23248
 [7]   66.01853   73.81054   64.39361   44.29895
> rowSd(tmp5)
 [1] 89.873810  9.985973  8.211579  7.598815  7.715138  6.944961  8.125179
 [8]  8.591306  8.024563  6.655745
> rowMax(tmp5)
 [1] 472.73943  91.89115  88.29945  88.04994  81.38573  87.70743  88.13243
 [8]  82.56720  85.23547  83.39683
> rowMin(tmp5)
 [1] 60.38119 58.81706 56.93533 56.91898 55.81787 64.28776 57.60979 53.65257
 [9] 55.00833 57.50487
> 
> colMeans(tmp5)
 [1] 112.78058  73.69357  69.82569  68.92439  71.32029  70.49340  73.12050
 [8]  71.18477  71.16100  70.80991  72.58165  70.54517  69.90717  72.99511
[15]  73.62020  69.80197  64.73621  71.33720  70.93979  70.55899
> colSums(tmp5)
 [1] 1127.8058  736.9357  698.2569  689.2439  713.2029  704.9340  731.2050
 [8]  711.8477  711.6100  708.0991  725.8165  705.4517  699.0717  729.9511
[15]  736.2020  698.0197  647.3621  713.3720  709.3979  705.5899
> colVars(tmp5)
 [1] 16078.42129    79.51150    48.89647    51.56902    61.77293    45.63098
 [7]    25.52003    22.33867    58.59767   105.72272    84.38934    66.74678
[13]    75.93675    93.35100    27.72786    54.97526    24.54501    92.10527
[19]   114.14077    75.23778
> colSd(tmp5)
 [1] 126.800715   8.916922   6.992601   7.181158   7.859576   6.755071
 [7]   5.051735   4.726380   7.654912  10.282155   9.186367   8.169870
[13]   8.714170   9.661832   5.265725   7.414530   4.954292   9.597149
[19]  10.683668   8.673971
> colMax(tmp5)
 [1] 472.73943  83.32092  80.34800  80.38364  84.36832  80.55504  78.36647
 [8]  80.87439  85.23547  91.89115  88.29945  81.55530  79.80074  87.70743
[15]  79.68344  80.40189  71.91968  88.04994  86.56322  88.13243
> colMin(tmp5)
 [1] 62.53633 57.60979 58.41175 53.65257 60.69636 59.47122 60.05678 64.31505
 [9] 59.63542 55.22065 61.28517 57.50487 58.81706 57.50822 63.71781 56.91898
[17] 59.06851 55.00833 55.81787 58.64575
> 
> 
> ### 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.93410 72.54465 70.85725 70.04063       NA 73.97895 70.68711 69.07911
 [9] 68.40331 72.34909
> rowSums(tmp5)
 [1] 1838.682 1450.893 1417.145 1400.813       NA 1479.579 1413.742 1381.582
 [9] 1368.066 1446.982
> rowVars(tmp5)
 [1] 8077.30165   99.71966   67.43003   57.74199   56.12353   48.23248
 [7]   66.01853   73.81054   64.39361   44.29895
> rowSd(tmp5)
 [1] 89.873810  9.985973  8.211579  7.598815  7.491564  6.944961  8.125179
 [8]  8.591306  8.024563  6.655745
> rowMax(tmp5)
 [1] 472.73943  91.89115  88.29945  88.04994        NA  87.70743  88.13243
 [8]  82.56720  85.23547  83.39683
> rowMin(tmp5)
 [1] 60.38119 58.81706 56.93533 56.91898       NA 64.28776 57.60979 53.65257
 [9] 55.00833 57.50487
> 
> colMeans(tmp5)
 [1] 112.78058  73.69357  69.82569  68.92439  71.32029  70.49340  73.12050
 [8]  71.18477        NA  70.80991  72.58165  70.54517  69.90717  72.99511
[15]  73.62020  69.80197  64.73621  71.33720  70.93979  70.55899
> colSums(tmp5)
 [1] 1127.8058  736.9357  698.2569  689.2439  713.2029  704.9340  731.2050
 [8]  711.8477        NA  708.0991  725.8165  705.4517  699.0717  729.9511
[15]  736.2020  698.0197  647.3621  713.3720  709.3979  705.5899
> colVars(tmp5)
 [1] 16078.42129    79.51150    48.89647    51.56902    61.77293    45.63098
 [7]    25.52003    22.33867          NA   105.72272    84.38934    66.74678
[13]    75.93675    93.35100    27.72786    54.97526    24.54501    92.10527
[19]   114.14077    75.23778
> colSd(tmp5)
 [1] 126.800715   8.916922   6.992601   7.181158   7.859576   6.755071
 [7]   5.051735   4.726380         NA  10.282155   9.186367   8.169870
[13]   8.714170   9.661832   5.265725   7.414530   4.954292   9.597149
[19]  10.683668   8.673971
> colMax(tmp5)
 [1] 472.73943  83.32092  80.34800  80.38364  84.36832  80.55504  78.36647
 [8]  80.87439        NA  91.89115  88.29945  81.55530  79.80074  87.70743
[15]  79.68344  80.40189  71.91968  88.04994  86.56322  88.13243
> colMin(tmp5)
 [1] 62.53633 57.60979 58.41175 53.65257 60.69636 59.47122 60.05678 64.31505
 [9]       NA 55.22065 61.28517 57.50487 58.81706 57.50822 63.71781 56.91898
[17] 59.06851 55.00833 55.81787 58.64575
> 
> Max(tmp5,na.rm=TRUE)
[1] 472.7394
> Min(tmp5,na.rm=TRUE)
[1] 53.65257
> mean(tmp5,na.rm=TRUE)
[1] 72.97674
> Sum(tmp5,na.rm=TRUE)
[1] 14522.37
> Var(tmp5,na.rm=TRUE)
[1] 873.2272
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.93410 72.54465 70.85725 70.04063 69.73095 73.97895 70.68711 69.07911
 [9] 68.40331 72.34909
> rowSums(tmp5,na.rm=TRUE)
 [1] 1838.682 1450.893 1417.145 1400.813 1324.888 1479.579 1413.742 1381.582
 [9] 1368.066 1446.982
> rowVars(tmp5,na.rm=TRUE)
 [1] 8077.30165   99.71966   67.43003   57.74199   56.12353   48.23248
 [7]   66.01853   73.81054   64.39361   44.29895
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.873810  9.985973  8.211579  7.598815  7.491564  6.944961  8.125179
 [8]  8.591306  8.024563  6.655745
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.73943  91.89115  88.29945  88.04994  81.38573  87.70743  88.13243
 [8]  82.56720  85.23547  83.39683
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.38119 58.81706 56.93533 56.91898 55.81787 64.28776 57.60979 53.65257
 [9] 55.00833 57.50487
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.78058  73.69357  69.82569  68.92439  71.32029  70.49340  73.12050
 [8]  71.18477  70.06737  70.80991  72.58165  70.54517  69.90717  72.99511
[15]  73.62020  69.80197  64.73621  71.33720  70.93979  70.55899
> colSums(tmp5,na.rm=TRUE)
 [1] 1127.8058  736.9357  698.2569  689.2439  713.2029  704.9340  731.2050
 [8]  711.8477  630.6063  708.0991  725.8165  705.4517  699.0717  729.9511
[15]  736.2020  698.0197  647.3621  713.3720  709.3979  705.5899
> colVars(tmp5,na.rm=TRUE)
 [1] 16078.42129    79.51150    48.89647    51.56902    61.77293    45.63098
 [7]    25.52003    22.33867    52.46713   105.72272    84.38934    66.74678
[13]    75.93675    93.35100    27.72786    54.97526    24.54501    92.10527
[19]   114.14077    75.23778
> colSd(tmp5,na.rm=TRUE)
 [1] 126.800715   8.916922   6.992601   7.181158   7.859576   6.755071
 [7]   5.051735   4.726380   7.243420  10.282155   9.186367   8.169870
[13]   8.714170   9.661832   5.265725   7.414530   4.954292   9.597149
[19]  10.683668   8.673971
> colMax(tmp5,na.rm=TRUE)
 [1] 472.73943  83.32092  80.34800  80.38364  84.36832  80.55504  78.36647
 [8]  80.87439  85.23547  91.89115  88.29945  81.55530  79.80074  87.70743
[15]  79.68344  80.40189  71.91968  88.04994  86.56322  88.13243
> colMin(tmp5,na.rm=TRUE)
 [1] 62.53633 57.60979 58.41175 53.65257 60.69636 59.47122 60.05678 64.31505
 [9] 59.63542 55.22065 61.28517 57.50487 58.81706 57.50822 63.71781 56.91898
[17] 59.06851 55.00833 55.81787 58.64575
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.93410 72.54465 70.85725 70.04063      NaN 73.97895 70.68711 69.07911
 [9] 68.40331 72.34909
> rowSums(tmp5,na.rm=TRUE)
 [1] 1838.682 1450.893 1417.145 1400.813    0.000 1479.579 1413.742 1381.582
 [9] 1368.066 1446.982
> rowVars(tmp5,na.rm=TRUE)
 [1] 8077.30165   99.71966   67.43003   57.74199         NA   48.23248
 [7]   66.01853   73.81054   64.39361   44.29895
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.873810  9.985973  8.211579  7.598815        NA  6.944961  8.125179
 [8]  8.591306  8.024563  6.655745
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.73943  91.89115  88.29945  88.04994        NA  87.70743  88.13243
 [8]  82.56720  85.23547  83.39683
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.38119 58.81706 56.93533 56.91898       NA 64.28776 57.60979 53.65257
 [9] 55.00833 57.50487
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 118.31453  74.17128  70.05300  68.77264  70.84049  71.71808  74.57202
 [8]  71.94808       NaN  70.11749  72.65773  70.27497  69.49701  72.06282
[15]  73.05863  69.62981  65.28107  71.14918  72.62001  69.58088
> colSums(tmp5,na.rm=TRUE)
 [1] 1064.8308  667.5415  630.4770  618.9538  637.5644  645.4627  671.1482
 [8]  647.5327    0.0000  631.0574  653.9196  632.4748  625.4731  648.5654
[15]  657.5277  626.6683  587.5296  640.3426  653.5801  626.2279
> colVars(tmp5,na.rm=TRUE)
 [1] 17743.696676    86.883173    54.427264    57.756105    66.904734
 [6]    34.461468     5.007169    18.576404           NA   113.544285
[11]    94.872883    74.268796    83.536265    95.241763    27.646091
[16]    61.513711    24.273318   103.220740    96.648282    73.879735
> colSd(tmp5,na.rm=TRUE)
 [1] 133.205468   9.321114   7.377484   7.599744   8.179531   5.870389
 [7]   2.237670   4.310035         NA  10.655716   9.740271   8.617935
[13]   9.139818   9.759189   5.257955   7.843068   4.926796  10.159761
[19]   9.830986   8.595332
> colMax(tmp5,na.rm=TRUE)
 [1] 472.73943  83.32092  80.34800  80.38364  84.36832  80.55504  78.36647
 [8]  80.87439      -Inf  91.89115  88.29945  81.55530  79.80074  87.70743
[15]  79.68344  80.40189  71.91968  88.04994  86.56322  88.13243
> colMin(tmp5,na.rm=TRUE)
 [1] 62.53633 57.60979 58.41175 53.65257 60.69636 62.68662 71.59977 66.16122
 [9]      Inf 55.22065 61.28517 57.50487 58.81706 57.50822 63.71781 56.91898
[17] 59.06851 55.00833 56.93533 58.64575
> 
> 
> 
> 
> 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] 180.0959 136.4999 459.2311 203.6116 267.3199 128.1101 261.3169 251.5494
 [9] 245.8539 257.9470
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 180.0959 136.4999 459.2311 203.6116 267.3199 128.1101 261.3169 251.5494
 [9] 245.8539 257.9470
> 
> 
> 
> 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  2.842171e-14 -1.136868e-13 -1.421085e-13 -2.273737e-13
 [6]  8.526513e-14  5.684342e-14  5.684342e-14  0.000000e+00 -5.684342e-14
[11] -1.421085e-14  5.684342e-14  5.684342e-14  0.000000e+00 -2.273737e-13
[16] -9.947598e-14  1.136868e-13  0.000000e+00 -1.136868e-13 -8.526513e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
10   6 
10   1 
3   3 
2   17 
10   3 
10   1 
7   2 
8   14 
1   2 
3   15 
10   14 
4   19 
4   10 
9   6 
5   9 
9   20 
1   19 
1   15 
4   4 
7   19 
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.281523
> Min(tmp)
[1] -2.513104
> mean(tmp)
[1] 0.06012704
> Sum(tmp)
[1] 6.012704
> Var(tmp)
[1] 0.9360641
> 
> rowMeans(tmp)
[1] 0.06012704
> rowSums(tmp)
[1] 6.012704
> rowVars(tmp)
[1] 0.9360641
> rowSd(tmp)
[1] 0.9675041
> rowMax(tmp)
[1] 2.281523
> rowMin(tmp)
[1] -2.513104
> 
> colMeans(tmp)
  [1]  0.38163755 -1.89305710 -0.35956790  0.72302245  0.23330522 -1.95679314
  [7]  0.23048188  1.93613091 -0.58544038  0.53400332 -0.05137971  1.21365228
 [13] -1.50316250  0.34907020  2.02444155  0.67875424 -0.31990564 -1.68916677
 [19]  0.19825226  0.47708980  0.68135238 -1.21333073  0.28710637 -1.00651469
 [25]  0.96653415  0.41147567  0.73919727  0.36262847  0.73927107  1.82597156
 [31]  0.06903952  1.07246753 -0.72462189  1.45085492 -0.33634578  0.63815319
 [37] -0.44253756 -1.08089976  2.08238232 -0.47162202 -1.27647412  0.62274050
 [43]  0.35342496 -0.79190309  0.87477479 -0.95298607 -0.50295808  0.19514874
 [49]  0.08821131  0.30042913 -0.58252901 -0.20549733 -1.63469286  1.04866104
 [55]  1.86031420  0.06864195 -0.91813312  0.98664288  0.47223098  0.20444977
 [61]  0.37382007 -0.13063684 -1.19889254 -0.44431029  2.28152266  0.94980595
 [67]  1.05983516  1.06272371  0.42279232 -0.37172931 -1.13072187  1.63087430
 [73] -1.15653974 -0.78806532  1.00962004 -0.01616050  0.06252201  0.59512470
 [79]  0.40605480  0.31313258  0.18761311  0.10969709  0.64935259 -0.11324161
 [85] -1.09856944 -0.89445115  0.23679256  0.30023685  0.57988103 -0.82829408
 [91]  0.31321584 -1.34989190 -1.18746280  0.55209694  0.33754931 -1.42681688
 [97] -0.62703619 -0.06865092  1.04058824 -2.51310389
> colSums(tmp)
  [1]  0.38163755 -1.89305710 -0.35956790  0.72302245  0.23330522 -1.95679314
  [7]  0.23048188  1.93613091 -0.58544038  0.53400332 -0.05137971  1.21365228
 [13] -1.50316250  0.34907020  2.02444155  0.67875424 -0.31990564 -1.68916677
 [19]  0.19825226  0.47708980  0.68135238 -1.21333073  0.28710637 -1.00651469
 [25]  0.96653415  0.41147567  0.73919727  0.36262847  0.73927107  1.82597156
 [31]  0.06903952  1.07246753 -0.72462189  1.45085492 -0.33634578  0.63815319
 [37] -0.44253756 -1.08089976  2.08238232 -0.47162202 -1.27647412  0.62274050
 [43]  0.35342496 -0.79190309  0.87477479 -0.95298607 -0.50295808  0.19514874
 [49]  0.08821131  0.30042913 -0.58252901 -0.20549733 -1.63469286  1.04866104
 [55]  1.86031420  0.06864195 -0.91813312  0.98664288  0.47223098  0.20444977
 [61]  0.37382007 -0.13063684 -1.19889254 -0.44431029  2.28152266  0.94980595
 [67]  1.05983516  1.06272371  0.42279232 -0.37172931 -1.13072187  1.63087430
 [73] -1.15653974 -0.78806532  1.00962004 -0.01616050  0.06252201  0.59512470
 [79]  0.40605480  0.31313258  0.18761311  0.10969709  0.64935259 -0.11324161
 [85] -1.09856944 -0.89445115  0.23679256  0.30023685  0.57988103 -0.82829408
 [91]  0.31321584 -1.34989190 -1.18746280  0.55209694  0.33754931 -1.42681688
 [97] -0.62703619 -0.06865092  1.04058824 -2.51310389
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.38163755 -1.89305710 -0.35956790  0.72302245  0.23330522 -1.95679314
  [7]  0.23048188  1.93613091 -0.58544038  0.53400332 -0.05137971  1.21365228
 [13] -1.50316250  0.34907020  2.02444155  0.67875424 -0.31990564 -1.68916677
 [19]  0.19825226  0.47708980  0.68135238 -1.21333073  0.28710637 -1.00651469
 [25]  0.96653415  0.41147567  0.73919727  0.36262847  0.73927107  1.82597156
 [31]  0.06903952  1.07246753 -0.72462189  1.45085492 -0.33634578  0.63815319
 [37] -0.44253756 -1.08089976  2.08238232 -0.47162202 -1.27647412  0.62274050
 [43]  0.35342496 -0.79190309  0.87477479 -0.95298607 -0.50295808  0.19514874
 [49]  0.08821131  0.30042913 -0.58252901 -0.20549733 -1.63469286  1.04866104
 [55]  1.86031420  0.06864195 -0.91813312  0.98664288  0.47223098  0.20444977
 [61]  0.37382007 -0.13063684 -1.19889254 -0.44431029  2.28152266  0.94980595
 [67]  1.05983516  1.06272371  0.42279232 -0.37172931 -1.13072187  1.63087430
 [73] -1.15653974 -0.78806532  1.00962004 -0.01616050  0.06252201  0.59512470
 [79]  0.40605480  0.31313258  0.18761311  0.10969709  0.64935259 -0.11324161
 [85] -1.09856944 -0.89445115  0.23679256  0.30023685  0.57988103 -0.82829408
 [91]  0.31321584 -1.34989190 -1.18746280  0.55209694  0.33754931 -1.42681688
 [97] -0.62703619 -0.06865092  1.04058824 -2.51310389
> colMin(tmp)
  [1]  0.38163755 -1.89305710 -0.35956790  0.72302245  0.23330522 -1.95679314
  [7]  0.23048188  1.93613091 -0.58544038  0.53400332 -0.05137971  1.21365228
 [13] -1.50316250  0.34907020  2.02444155  0.67875424 -0.31990564 -1.68916677
 [19]  0.19825226  0.47708980  0.68135238 -1.21333073  0.28710637 -1.00651469
 [25]  0.96653415  0.41147567  0.73919727  0.36262847  0.73927107  1.82597156
 [31]  0.06903952  1.07246753 -0.72462189  1.45085492 -0.33634578  0.63815319
 [37] -0.44253756 -1.08089976  2.08238232 -0.47162202 -1.27647412  0.62274050
 [43]  0.35342496 -0.79190309  0.87477479 -0.95298607 -0.50295808  0.19514874
 [49]  0.08821131  0.30042913 -0.58252901 -0.20549733 -1.63469286  1.04866104
 [55]  1.86031420  0.06864195 -0.91813312  0.98664288  0.47223098  0.20444977
 [61]  0.37382007 -0.13063684 -1.19889254 -0.44431029  2.28152266  0.94980595
 [67]  1.05983516  1.06272371  0.42279232 -0.37172931 -1.13072187  1.63087430
 [73] -1.15653974 -0.78806532  1.00962004 -0.01616050  0.06252201  0.59512470
 [79]  0.40605480  0.31313258  0.18761311  0.10969709  0.64935259 -0.11324161
 [85] -1.09856944 -0.89445115  0.23679256  0.30023685  0.57988103 -0.82829408
 [91]  0.31321584 -1.34989190 -1.18746280  0.55209694  0.33754931 -1.42681688
 [97] -0.62703619 -0.06865092  1.04058824 -2.51310389
> colMedians(tmp)
  [1]  0.38163755 -1.89305710 -0.35956790  0.72302245  0.23330522 -1.95679314
  [7]  0.23048188  1.93613091 -0.58544038  0.53400332 -0.05137971  1.21365228
 [13] -1.50316250  0.34907020  2.02444155  0.67875424 -0.31990564 -1.68916677
 [19]  0.19825226  0.47708980  0.68135238 -1.21333073  0.28710637 -1.00651469
 [25]  0.96653415  0.41147567  0.73919727  0.36262847  0.73927107  1.82597156
 [31]  0.06903952  1.07246753 -0.72462189  1.45085492 -0.33634578  0.63815319
 [37] -0.44253756 -1.08089976  2.08238232 -0.47162202 -1.27647412  0.62274050
 [43]  0.35342496 -0.79190309  0.87477479 -0.95298607 -0.50295808  0.19514874
 [49]  0.08821131  0.30042913 -0.58252901 -0.20549733 -1.63469286  1.04866104
 [55]  1.86031420  0.06864195 -0.91813312  0.98664288  0.47223098  0.20444977
 [61]  0.37382007 -0.13063684 -1.19889254 -0.44431029  2.28152266  0.94980595
 [67]  1.05983516  1.06272371  0.42279232 -0.37172931 -1.13072187  1.63087430
 [73] -1.15653974 -0.78806532  1.00962004 -0.01616050  0.06252201  0.59512470
 [79]  0.40605480  0.31313258  0.18761311  0.10969709  0.64935259 -0.11324161
 [85] -1.09856944 -0.89445115  0.23679256  0.30023685  0.57988103 -0.82829408
 [91]  0.31321584 -1.34989190 -1.18746280  0.55209694  0.33754931 -1.42681688
 [97] -0.62703619 -0.06865092  1.04058824 -2.51310389
> colRanges(tmp)
          [,1]      [,2]       [,3]      [,4]      [,5]      [,6]      [,7]
[1,] 0.3816376 -1.893057 -0.3595679 0.7230225 0.2333052 -1.956793 0.2304819
[2,] 0.3816376 -1.893057 -0.3595679 0.7230225 0.2333052 -1.956793 0.2304819
         [,8]       [,9]     [,10]       [,11]    [,12]     [,13]     [,14]
[1,] 1.936131 -0.5854404 0.5340033 -0.05137971 1.213652 -1.503162 0.3490702
[2,] 1.936131 -0.5854404 0.5340033 -0.05137971 1.213652 -1.503162 0.3490702
        [,15]     [,16]      [,17]     [,18]     [,19]     [,20]     [,21]
[1,] 2.024442 0.6787542 -0.3199056 -1.689167 0.1982523 0.4770898 0.6813524
[2,] 2.024442 0.6787542 -0.3199056 -1.689167 0.1982523 0.4770898 0.6813524
         [,22]     [,23]     [,24]     [,25]     [,26]     [,27]     [,28]
[1,] -1.213331 0.2871064 -1.006515 0.9665341 0.4114757 0.7391973 0.3626285
[2,] -1.213331 0.2871064 -1.006515 0.9665341 0.4114757 0.7391973 0.3626285
         [,29]    [,30]      [,31]    [,32]      [,33]    [,34]      [,35]
[1,] 0.7392711 1.825972 0.06903952 1.072468 -0.7246219 1.450855 -0.3363458
[2,] 0.7392711 1.825972 0.06903952 1.072468 -0.7246219 1.450855 -0.3363458
         [,36]      [,37]   [,38]    [,39]     [,40]     [,41]     [,42]
[1,] 0.6381532 -0.4425376 -1.0809 2.082382 -0.471622 -1.276474 0.6227405
[2,] 0.6381532 -0.4425376 -1.0809 2.082382 -0.471622 -1.276474 0.6227405
        [,43]      [,44]     [,45]      [,46]      [,47]     [,48]      [,49]
[1,] 0.353425 -0.7919031 0.8747748 -0.9529861 -0.5029581 0.1951487 0.08821131
[2,] 0.353425 -0.7919031 0.8747748 -0.9529861 -0.5029581 0.1951487 0.08821131
         [,50]     [,51]      [,52]     [,53]    [,54]    [,55]      [,56]
[1,] 0.3004291 -0.582529 -0.2054973 -1.634693 1.048661 1.860314 0.06864195
[2,] 0.3004291 -0.582529 -0.2054973 -1.634693 1.048661 1.860314 0.06864195
          [,57]     [,58]    [,59]     [,60]     [,61]      [,62]     [,63]
[1,] -0.9181331 0.9866429 0.472231 0.2044498 0.3738201 -0.1306368 -1.198893
[2,] -0.9181331 0.9866429 0.472231 0.2044498 0.3738201 -0.1306368 -1.198893
          [,64]    [,65]     [,66]    [,67]    [,68]     [,69]      [,70]
[1,] -0.4443103 2.281523 0.9498059 1.059835 1.062724 0.4227923 -0.3717293
[2,] -0.4443103 2.281523 0.9498059 1.059835 1.062724 0.4227923 -0.3717293
         [,71]    [,72]    [,73]      [,74]   [,75]      [,76]      [,77]
[1,] -1.130722 1.630874 -1.15654 -0.7880653 1.00962 -0.0161605 0.06252201
[2,] -1.130722 1.630874 -1.15654 -0.7880653 1.00962 -0.0161605 0.06252201
         [,78]     [,79]     [,80]     [,81]     [,82]     [,83]      [,84]
[1,] 0.5951247 0.4060548 0.3131326 0.1876131 0.1096971 0.6493526 -0.1132416
[2,] 0.5951247 0.4060548 0.3131326 0.1876131 0.1096971 0.6493526 -0.1132416
         [,85]      [,86]     [,87]     [,88]    [,89]      [,90]     [,91]
[1,] -1.098569 -0.8944512 0.2367926 0.3002369 0.579881 -0.8282941 0.3132158
[2,] -1.098569 -0.8944512 0.2367926 0.3002369 0.579881 -0.8282941 0.3132158
         [,92]     [,93]     [,94]     [,95]     [,96]      [,97]       [,98]
[1,] -1.349892 -1.187463 0.5520969 0.3375493 -1.426817 -0.6270362 -0.06865092
[2,] -1.349892 -1.187463 0.5520969 0.3375493 -1.426817 -0.6270362 -0.06865092
        [,99]    [,100]
[1,] 1.040588 -2.513104
[2,] 1.040588 -2.513104
> 
> 
> Max(tmp2)
[1] 1.784649
> Min(tmp2)
[1] -2.112094
> mean(tmp2)
[1] 0.06799504
> Sum(tmp2)
[1] 6.799504
> Var(tmp2)
[1] 0.691152
> 
> rowMeans(tmp2)
  [1] -0.28934558 -0.56219758 -0.37625511 -0.61213302 -0.44432441  0.66266733
  [7]  0.04787504 -0.65477147  0.43994088 -2.11209415  0.38798405 -0.13869230
 [13] -0.16967823 -0.46672395  1.10507141 -0.02904520  0.45716536  1.60607397
 [19] -0.31396121 -0.27786876 -1.07337276  0.25031722  1.02837593  0.67195780
 [25] -0.05756825  0.53465293  0.21416319 -0.64219293 -0.38531833 -1.68685393
 [31] -1.41559104 -1.08481659 -1.12165879 -0.54596866  0.21788266  1.78464927
 [37]  0.31148772  0.48221569  0.30117839  1.43073420  0.17175690  1.72017540
 [43] -0.11566794 -1.43012362  1.64391474 -0.37138164 -0.56265097 -0.35240477
 [49]  0.26429388  1.07164501  0.79841538  0.60134835  0.56715157  0.05647751
 [55] -0.38008193 -0.42259844  1.01648779  0.75943358 -0.62634162  1.08005785
 [61] -0.70562684 -0.12164344 -0.98681116 -0.01504689 -0.02057443  1.62863782
 [67]  0.06312051  1.76501160  0.11654210  0.92657335  0.11645205  1.05011248
 [73] -0.69624322 -1.25645847  0.44937067  0.38169445 -2.08349590 -0.64938809
 [79]  0.11244870 -0.92745656 -0.21799631  0.94479965  1.12250900  0.65210040
 [85]  0.70054281  0.75986604 -0.28504450  1.41937641 -0.42759055 -0.04544125
 [91]  0.07178117 -0.09671957  0.09841293  0.77187221 -0.22405593 -0.82095297
 [97] -1.03378623  0.68979361  0.16474168  0.44420918
> rowSums(tmp2)
  [1] -0.28934558 -0.56219758 -0.37625511 -0.61213302 -0.44432441  0.66266733
  [7]  0.04787504 -0.65477147  0.43994088 -2.11209415  0.38798405 -0.13869230
 [13] -0.16967823 -0.46672395  1.10507141 -0.02904520  0.45716536  1.60607397
 [19] -0.31396121 -0.27786876 -1.07337276  0.25031722  1.02837593  0.67195780
 [25] -0.05756825  0.53465293  0.21416319 -0.64219293 -0.38531833 -1.68685393
 [31] -1.41559104 -1.08481659 -1.12165879 -0.54596866  0.21788266  1.78464927
 [37]  0.31148772  0.48221569  0.30117839  1.43073420  0.17175690  1.72017540
 [43] -0.11566794 -1.43012362  1.64391474 -0.37138164 -0.56265097 -0.35240477
 [49]  0.26429388  1.07164501  0.79841538  0.60134835  0.56715157  0.05647751
 [55] -0.38008193 -0.42259844  1.01648779  0.75943358 -0.62634162  1.08005785
 [61] -0.70562684 -0.12164344 -0.98681116 -0.01504689 -0.02057443  1.62863782
 [67]  0.06312051  1.76501160  0.11654210  0.92657335  0.11645205  1.05011248
 [73] -0.69624322 -1.25645847  0.44937067  0.38169445 -2.08349590 -0.64938809
 [79]  0.11244870 -0.92745656 -0.21799631  0.94479965  1.12250900  0.65210040
 [85]  0.70054281  0.75986604 -0.28504450  1.41937641 -0.42759055 -0.04544125
 [91]  0.07178117 -0.09671957  0.09841293  0.77187221 -0.22405593 -0.82095297
 [97] -1.03378623  0.68979361  0.16474168  0.44420918
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.28934558 -0.56219758 -0.37625511 -0.61213302 -0.44432441  0.66266733
  [7]  0.04787504 -0.65477147  0.43994088 -2.11209415  0.38798405 -0.13869230
 [13] -0.16967823 -0.46672395  1.10507141 -0.02904520  0.45716536  1.60607397
 [19] -0.31396121 -0.27786876 -1.07337276  0.25031722  1.02837593  0.67195780
 [25] -0.05756825  0.53465293  0.21416319 -0.64219293 -0.38531833 -1.68685393
 [31] -1.41559104 -1.08481659 -1.12165879 -0.54596866  0.21788266  1.78464927
 [37]  0.31148772  0.48221569  0.30117839  1.43073420  0.17175690  1.72017540
 [43] -0.11566794 -1.43012362  1.64391474 -0.37138164 -0.56265097 -0.35240477
 [49]  0.26429388  1.07164501  0.79841538  0.60134835  0.56715157  0.05647751
 [55] -0.38008193 -0.42259844  1.01648779  0.75943358 -0.62634162  1.08005785
 [61] -0.70562684 -0.12164344 -0.98681116 -0.01504689 -0.02057443  1.62863782
 [67]  0.06312051  1.76501160  0.11654210  0.92657335  0.11645205  1.05011248
 [73] -0.69624322 -1.25645847  0.44937067  0.38169445 -2.08349590 -0.64938809
 [79]  0.11244870 -0.92745656 -0.21799631  0.94479965  1.12250900  0.65210040
 [85]  0.70054281  0.75986604 -0.28504450  1.41937641 -0.42759055 -0.04544125
 [91]  0.07178117 -0.09671957  0.09841293  0.77187221 -0.22405593 -0.82095297
 [97] -1.03378623  0.68979361  0.16474168  0.44420918
> rowMin(tmp2)
  [1] -0.28934558 -0.56219758 -0.37625511 -0.61213302 -0.44432441  0.66266733
  [7]  0.04787504 -0.65477147  0.43994088 -2.11209415  0.38798405 -0.13869230
 [13] -0.16967823 -0.46672395  1.10507141 -0.02904520  0.45716536  1.60607397
 [19] -0.31396121 -0.27786876 -1.07337276  0.25031722  1.02837593  0.67195780
 [25] -0.05756825  0.53465293  0.21416319 -0.64219293 -0.38531833 -1.68685393
 [31] -1.41559104 -1.08481659 -1.12165879 -0.54596866  0.21788266  1.78464927
 [37]  0.31148772  0.48221569  0.30117839  1.43073420  0.17175690  1.72017540
 [43] -0.11566794 -1.43012362  1.64391474 -0.37138164 -0.56265097 -0.35240477
 [49]  0.26429388  1.07164501  0.79841538  0.60134835  0.56715157  0.05647751
 [55] -0.38008193 -0.42259844  1.01648779  0.75943358 -0.62634162  1.08005785
 [61] -0.70562684 -0.12164344 -0.98681116 -0.01504689 -0.02057443  1.62863782
 [67]  0.06312051  1.76501160  0.11654210  0.92657335  0.11645205  1.05011248
 [73] -0.69624322 -1.25645847  0.44937067  0.38169445 -2.08349590 -0.64938809
 [79]  0.11244870 -0.92745656 -0.21799631  0.94479965  1.12250900  0.65210040
 [85]  0.70054281  0.75986604 -0.28504450  1.41937641 -0.42759055 -0.04544125
 [91]  0.07178117 -0.09671957  0.09841293  0.77187221 -0.22405593 -0.82095297
 [97] -1.03378623  0.68979361  0.16474168  0.44420918
> 
> colMeans(tmp2)
[1] 0.06799504
> colSums(tmp2)
[1] 6.799504
> colVars(tmp2)
[1] 0.691152
> colSd(tmp2)
[1] 0.8313555
> colMax(tmp2)
[1] 1.784649
> colMin(tmp2)
[1] -2.112094
> colMedians(tmp2)
[1] 0.05979901
> colRanges(tmp2)
          [,1]
[1,] -2.112094
[2,]  1.784649
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -0.8151254  2.4529738 -4.0374779 -0.5527506  5.2024467 -0.6912827
 [7]  4.2060368 -0.1808097 -3.9451174  5.3289717
> colApply(tmp,quantile)[,1]
             [,1]
[1,] -1.254969501
[2,] -0.923838597
[3,]  0.004474975
[4,]  0.439364075
[5,]  1.303436675
> 
> rowApply(tmp,sum)
 [1] -1.8496992  1.5591725  0.2213933  2.7016786  4.0374460 -2.0237711
 [7] -0.5351482 -4.6470570  4.3848801  3.1189704
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    6    4    5    8    8    2    1    4    1     7
 [2,]    3    6    7    6   10    3    2    6    4     9
 [3,]    9    3    8    5    9    1    4    1    7     1
 [4,]    4   10    3    2    3    6    8    7    6     2
 [5,]    5    8    6   10    4    8    6    8    5     8
 [6,]    7    7    4    1    1    7   10    5    2    10
 [7,]   10    5   10    7    2   10    3    3   10     4
 [8,]    1    1    2    9    7    5    9   10    9     3
 [9,]    2    2    1    4    6    4    5    2    3     6
[10,]    8    9    9    3    5    9    7    9    8     5
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.7239684  2.0745638 -3.4428708  1.5637966 -1.5426586  3.0986974
 [7] -0.3267074  0.5639719  1.0692225 -0.9118338 -3.6558237  2.9728357
[13] -1.1786576  2.6106818 -1.2616367 -0.4159976 -0.7465305  2.5173863
[19] -1.4732479  0.1942102
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.7217820
[2,] -0.4952863
[3,]  0.2285506
[4,]  1.2959689
[5,]  1.4165171
> 
> rowApply(tmp,sum)
[1] -9.088285  6.489794  3.208476 -3.741285  5.564671
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   20    4   10    1   19
[2,]   18   18   20    4    6
[3,]   12    8    3    2    7
[4,]    9   12   12   12   18
[5,]   11    5   15    8    2
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]        [,4]       [,5]       [,6]
[1,]  1.4165171  0.3740812 -0.2883998 -0.65293633 -0.5241122 -0.7814729
[2,] -0.4952863  1.2562876  0.3078191  0.43350599 -0.2441207  0.3363411
[3,]  0.2285506  1.9678001 -1.5507445  0.46923519  0.8315480  1.6957607
[4,] -1.7217820 -1.2727210 -1.6655001  0.01891481 -0.6736950  0.8279540
[5,]  1.2959689 -0.2508840 -0.2460455  1.29507691 -0.9322788  1.0201145
           [,7]        [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -0.2754312 -0.62479384  0.4440017 -1.0565185 -0.1490794 -0.2875128
[2,]  0.8902823  0.41625447  0.4728899  0.7608527 -1.1424459  1.4066666
[3,] -1.6688101  1.00167422  0.5254286 -0.5082265  0.3120210 -0.2046118
[4,] -0.1920376 -0.31175529 -0.9758261  0.2243776 -0.8725282  1.6375429
[5,]  0.9192892  0.08259235  0.6027284 -0.3323191 -1.8037912  0.4207507
           [,13]      [,14]       [,15]      [,16]      [,17]      [,18]
[1,] -1.67089043 -0.7239356  0.07358687 -1.6516028 -0.9213401 -1.0480546
[2,] -1.13606547  1.8108056 -0.14303862  0.8817020 -0.0746163  0.4165129
[3,]  0.72877627  0.2235431 -0.34229583  0.9414656  1.0032668 -0.2680094
[4,]  0.95951959  0.5994853 -0.48101592 -1.4185518 -1.0471541  1.4520375
[5,] -0.05999752  0.7007834 -0.36887316  0.8309893  0.2933131  1.9648998
          [,19]      [,20]
[1,] -0.9233739  0.1829824
[2,]  1.0363775 -0.7009310
[3,] -1.7859256 -0.3919710
[4,]  0.4780895  0.6933603
[5,] -0.2784154  0.4107695
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  652  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  564  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1       col2       col3     col4     col5        col6     col7
row1 -0.7414691 -0.3657938 -0.2302828 1.100678 -1.41717 -0.08823351 0.776515
           col8      col9    col10      col11     col12     col13    col14
row1 -0.9604654 -1.785666 1.148775 -0.5213503 -0.280173 -1.657487 -1.32356
         col15      col16     col17      col18      col19      col20
row1 0.3246703 0.01819765 0.7177681 -0.8674265 -0.3022862 -0.6638837
> tmp[,"col10"]
           col10
row1  1.14877487
row2  0.30475074
row3 -1.62862950
row4 -0.07097863
row5 -0.37763039
> tmp[c("row1","row5"),]
           col1       col2       col3      col4       col5        col6
row1 -0.7414691 -0.3657938 -0.2302828  1.100678 -1.4171701 -0.08823351
row5  1.4310910 -1.0438559 -1.5963899 -1.476185  0.6449062  0.56738308
           col7       col8      col9      col10      col11      col12
row1  0.7765150 -0.9604654 -1.785666  1.1487749 -0.5213503 -0.2801730
row5 -0.5550359 -1.1199685  1.069073 -0.3776304  2.1827612 -0.6993839
          col13        col14       col15      col16      col17      col18
row1 -1.6574866 -1.323559902  0.32467033 0.01819765  0.7177681 -0.8674265
row5 -0.8375662  0.007600643 -0.03859187 0.81415265 -0.7411245  1.3938475
          col19      col20
row1 -0.3022862 -0.6638837
row5  0.6419264  1.3414397
> tmp[,c("col6","col20")]
            col6      col20
row1 -0.08823351 -0.6638837
row2 -0.77420678  0.1080168
row3  1.20565382  1.0064869
row4  1.44204865 -1.0216123
row5  0.56738308  1.3414397
> tmp[c("row1","row5"),c("col6","col20")]
            col6      col20
row1 -0.08823351 -0.6638837
row5  0.56738308  1.3414397
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.24484 50.70382 48.97001 50.11648 50.60298 103.8971 51.05026 49.55828
         col9    col10    col11    col12    col13    col14   col15    col16
row1 49.07281 49.64633 48.71206 50.66906 50.07751 51.24194 48.7012 50.87712
        col17    col18    col19    col20
row1 49.82139 50.56123 50.78529 104.1122
> tmp[,"col10"]
        col10
row1 49.64633
row2 28.86488
row3 28.69857
row4 32.17390
row5 48.82963
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.24484 50.70382 48.97001 50.11648 50.60298 103.8971 51.05026 49.55828
row5 50.24964 50.86908 49.02581 49.64050 51.30443 104.7424 50.71863 51.08539
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.07281 49.64633 48.71206 50.66906 50.07751 51.24194 48.70120 50.87712
row5 49.05347 48.82963 49.35721 50.35671 50.25847 49.52959 50.03544 50.63642
        col17    col18    col19    col20
row1 49.82139 50.56123 50.78529 104.1122
row5 52.28953 51.92547 49.28946 105.0072
> tmp[,c("col6","col20")]
          col6     col20
row1 103.89713 104.11223
row2  75.73350  74.25359
row3  74.52082  73.60406
row4  74.92461  74.28833
row5 104.74242 105.00721
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.8971 104.1122
row5 104.7424 105.0072
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.8971 104.1122
row5 104.7424 105.0072
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.2987354
[2,]  1.4918104
[3,] -2.3612210
[4,]  0.5604242
[5,] -0.7375347
> tmp[,c("col17","col7")]
          col17        col7
[1,] -0.7491030 -0.41520193
[2,] -1.0887354  0.13029554
[3,] -1.2506092  0.03341121
[4,] -1.6668789 -0.97622740
[5,] -0.3920587 -0.26629006
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
             col6      col20
[1,] -0.001063621 -0.2790076
[2,] -0.807193809 -0.4344681
[3,]  0.603929380  1.3777450
[4,]  0.639142192  1.5576519
[5,]  0.551880358 -1.2630345
> subBufferedMatrix(tmp,1,c("col6"))[,1]
             col1
[1,] -0.001063621
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
             col6
[1,] -0.001063621
[2,] -0.807193809
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]       [,4]       [,5]      [,6]       [,7]
row3 -1.0061454 -0.2912972 0.4444438 -0.7801667 -0.6752512 0.1447177 -0.2602785
row1 -0.6746347 -0.1551517 0.9370214 -0.4742250 -1.1608996 0.7800360  0.5114938
           [,8]       [,9]      [,10]     [,11]     [,12]      [,13]      [,14]
row3 -0.7527318 -0.8196707  1.2962193 0.5146761 0.8625402 -0.2379729  0.2091979
row1 -2.5401220 -0.7004739 -0.6540136 1.6203306 0.2098835 -1.4040716 -0.1228161
         [,15]      [,16]     [,17]    [,18]      [,19]     [,20]
row3 -1.881543 -0.5803100 0.3693078 1.499268 -0.3696925 -1.371220
row1  1.441305  0.4694894 0.6337575 1.259213 -0.7849072 -1.793417
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]       [,3]     [,4]      [,5]      [,6]     [,7]
row2 -2.020888 0.5915558 -0.6664236 1.343238 0.3826818 0.4198488 0.467582
         [,8]      [,9]    [,10]
row2 0.463626 -2.679671 0.504501
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]      [,2]      [,3]    [,4]       [,5]      [,6]       [,7]
row5 -0.2320461 0.2104604 -1.443834 -0.6423 -0.1311506 0.8913109 -0.4657504
           [,8]    [,9]   [,10]     [,11]     [,12]      [,13]    [,14]
row5 -0.3618019 1.13328 1.44776 0.2442518 0.1386196 0.05147564 1.519952
         [,15]     [,16]     [,17]     [,18]     [,19]    [,20]
row5 -1.290434 0.7870306 0.4841558 0.9054032 0.7998726 1.154784
> 
> 
> 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: 0x55fb83535490>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db86918d0ce8d"
 [2] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db869198a35b7"
 [3] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db869480d67f" 
 [4] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db869ce9f122" 
 [5] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db869607bb041"
 [6] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db86925551f7b"
 [7] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db8695340ff48"
 [8] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db86918ce9af" 
 [9] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db8693f83e6c2"
[10] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db8694ae0718" 
[11] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db86913680cf0"
[12] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db86963a28eb3"
[13] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db8692705afad"
[14] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db8695b844a8e"
[15] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM3db8694a0d24ea"
> 
> 
> ### 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: 0x55fb841bb220>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x55fb841bb220>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x55fb841bb220>
> rowMedians(tmp)
  [1]  0.383833691 -0.205867451 -0.048397838  0.044208029 -0.164468833
  [6] -0.100357700  0.258536817  0.072768031  0.110674159  0.677768519
 [11] -0.260401184 -0.296242972  0.079776102  0.466379015 -0.187572790
 [16] -0.653546142 -0.495854981  0.357411302 -0.029040879 -0.256961893
 [21]  0.345627529  0.722865877 -0.314010433 -0.399574510  0.475873389
 [26] -0.044881364 -0.019547117 -0.002785882 -0.238251453 -0.058221012
 [31] -0.483635176 -0.177880517 -0.570981498 -0.422102541  0.034683583
 [36] -0.045998976  0.487482883 -0.017217783  0.494670000  0.578940276
 [41] -0.270849702  0.168791073 -0.193599256 -0.185622228  0.315957544
 [46] -0.271853561 -0.136393395 -0.307980620  0.409755790  0.101783775
 [51]  0.176006667  0.314330067 -0.364801795 -0.221859356  0.050015336
 [56] -0.513778750 -0.469276812  0.231056189 -0.188516407  0.593686441
 [61]  0.173120126  0.134047724 -0.260338861  0.248805208 -0.111632170
 [66] -0.658564639  0.092907564  0.036365475 -0.348265880 -0.220025957
 [71]  0.468884185  0.383756909 -0.031921186  0.169002287 -0.368093172
 [76] -0.301076583  0.152882621 -0.372186767  0.114938567 -0.304841780
 [81] -0.627787799 -0.089005010 -0.612621735  0.185796770  0.246619093
 [86] -0.135622317  0.375416675 -0.087829453  0.461869509  0.608497531
 [91]  0.524066740  0.252955466 -0.367381877 -0.460825188 -0.051701630
 [96] -0.431594290 -0.045156731  0.247346785  0.775464223  0.152260191
[101]  0.342671314  0.110551766 -0.076574273  0.478698527 -0.361945322
[106]  0.023859732  0.063797575 -0.267208281  0.270876203 -0.204779696
[111] -0.023530972 -0.056235540 -0.564190326 -0.325832256  0.393367729
[116] -0.083235444  0.156283660 -0.179051030 -0.167323625 -0.096513225
[121] -0.201397162 -0.935031883 -0.392115861 -0.133775172  0.186882066
[126] -0.445589881 -0.297180151 -0.001305476 -0.042327345  0.274208740
[131] -0.124109554  0.146431586  0.089981203  0.366601493  0.001899127
[136] -0.268586197 -0.066384862  0.414784991  0.060430908  0.088272646
[141]  0.061788792 -0.547103152  0.030570165  0.438688235  0.250239336
[146] -0.957776460 -0.289683793  0.157963589 -0.077981223  0.720721800
[151] -0.486253035 -0.493931338  0.323984484  0.309705906  0.501452872
[156]  0.053507519  0.159809914  0.005267675 -0.649927699 -0.637208248
[161]  0.440378488  0.689606340 -0.490017706  0.739530072  0.206961529
[166] -0.167919480  0.692287632  0.310409913 -0.183122140 -0.611487883
[171] -0.179419694  0.224436619  0.042390497 -0.170208366 -0.166718155
[176] -0.566027910  0.187859998  0.269730371 -0.173363019 -0.664787783
[181]  0.269419062 -0.029438492 -0.019805494 -0.253065054  0.222067568
[186]  0.013351950  0.066035430  0.312568919  0.179575406 -0.161081366
[191] -0.486813520 -0.386165110  0.189543004  0.216736809  0.212586825
[196]  0.481678977  0.149001542 -0.084207844  0.268389711  0.230044858
[201] -0.085126658  0.309516248 -0.104454596 -0.083728661 -0.234559099
[206] -0.187110590 -0.280518190  0.112288461 -0.025096759 -0.201831599
[211]  0.435166743 -0.109133556  0.153127039 -0.006279363  0.505144468
[216] -0.317030940  0.224982238 -0.255990367  0.159076123  0.167267295
[221] -0.093365316  0.189240874  0.081071376 -0.267178897 -0.196530110
[226]  0.306076878  0.443461926 -0.125357894  0.177770961  0.740603605
> 
> proc.time()
   user  system elapsed 
  1.363   1.640   3.015 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> prefix <- "dbmtest"
> directory <- getwd()
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x5573624f0310>
> .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: 0x5573624f0310>
> .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: 0x5573624f0310>
> .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: 0x5573624f0310>
> 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: 0x557360a785c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x557360a785c0>
> .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: 0x557360a785c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x557360a785c0>
> .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: 0x557360a785c0>
> 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: 0x5573600b7a80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5573600b7a80>
> .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: 0x5573600b7a80>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5573600b7a80>
> .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: 0x5573600b7a80>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5573600b7a80>
> .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: 0x5573600b7a80>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5573600b7a80>
> .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: 0x5573600b7a80>
> 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: 0x557360cff230>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x557360cff230>
> .Call("R_bm_AddColumn",P)
<pointer: 0x557360cff230>
> .Call("R_bm_AddColumn",P)
<pointer: 0x557360cff230>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3dc72f697ab83d" "BufferedMatrixFile3dc72f7f55a184"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3dc72f697ab83d" "BufferedMatrixFile3dc72f7f55a184"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x557361b3d8f0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x557361b3d8f0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x557361b3d8f0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x557361b3d8f0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x557361b3d8f0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x557361b3d8f0>
> .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: 0x5573608cd530>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5573608cd530>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5573608cd530>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5573608cd530>
> 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: 0x557360d4f8b0>
> .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: 0x557360d4f8b0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.264   0.043   0.297 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.253   0.037   0.280 

Example timings