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

This page was generated on 2024-05-17 11:36:28 -0400 (Fri, 17 May 2024).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 22.04.3 LTS)x86_644.4.0 RC (2024-04-16 r86468) -- "Puppy Cup" 4663
palomino4Windows Server 2022 Datacenterx644.4.0 RC (2024-04-16 r86468 ucrt) -- "Puppy Cup" 4398
merida1macOS 12.7.4 Montereyx86_644.4.0 Patched (2024-04-24 r86482) -- "Puppy Cup" 4425
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 244/2230HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.69.0  (landing page)
Ben Bolstad
Snapshot Date: 2024-05-15 14:05:05 -0400 (Wed, 15 May 2024)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: d422a05
git_last_commit_date: 2024-04-30 10:16:21 -0400 (Tue, 30 Apr 2024)
nebbiolo2Linux (Ubuntu 22.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino4Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
merida1macOS 12.7.4 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson1macOS 13.6.6 Ventura / arm64see weekly results here

CHECK results for BufferedMatrix on nebbiolo2


To the developers/maintainers of the BufferedMatrix package:
- Allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to reflect on this report. See Troubleshooting Build Report for more information.
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.

raw results


Summary

Package: BufferedMatrix
Version: 1.69.0
Command: /home/biocbuild/bbs-3.20-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.20-bioc/R/site-library --timings BufferedMatrix_1.69.0.tar.gz
StartedAt: 2024-05-15 20:41:51 -0400 (Wed, 15 May 2024)
EndedAt: 2024-05-15 20:42:14 -0400 (Wed, 15 May 2024)
EllapsedTime: 23.3 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.20-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
gcc -I"/home/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^~~~~~~~~~~~~~~~~~~
At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
gcc -I"/home/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/bbs-3.20-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/bbs-3.20-bioc/R/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/bbs-3.20-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.20-bioc/R/site-library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.264   0.037   0.290 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 471778 25.2    1026220 54.9   643434 34.4
Vcells 871903  6.7    8388608 64.0  2046581 15.7
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed May 15 20:42:06 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed May 15 20:42:06 2024"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x55f88d88c690>
> 
> 
> 
> 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] "Wed May 15 20:42:06 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed May 15 20:42:06 2024"
> 
> ColMode(tmp2)
<pointer: 0x55f88d88c690>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]       [,3]       [,4]
[1,] 100.6223916 -0.9502607 -0.6830584 -1.4868336
[2,]   0.5470559 -0.4397309 -2.5739250 -1.1558477
[3,]  -1.7493433  3.1953412 -1.2391172  0.1433266
[4,]  -1.5496997 -0.1178632  1.5126003 -0.6857526
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 100.6223916 0.9502607 0.6830584 1.4868336
[2,]   0.5470559 0.4397309 2.5739250 1.1558477
[3,]   1.7493433 3.1953412 1.2391172 0.1433266
[4,]   1.5496997 0.1178632 1.5126003 0.6857526
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0310713 0.9748131 0.8264735 1.2193579
[2,]  0.7396323 0.6631221 1.6043457 1.0751036
[3,]  1.3226274 1.7875517 1.1131564 0.3785849
[4,]  1.2448693 0.3433122 1.2298782 0.8281018
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.93310 35.69839 33.94779 38.68041
[2,]  32.94338 32.07095 43.61738 36.90688
[3,]  39.97562 46.07086 37.37068 28.92918
[4,]  38.99839 28.55098 38.81138 33.96677
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x55f88c73d510>
> exp(tmp5)
<pointer: 0x55f88c73d510>
> log(tmp5,2)
<pointer: 0x55f88c73d510>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.2502
> Min(tmp5)
[1] 52.63975
> mean(tmp5)
[1] 72.88722
> Sum(tmp5)
[1] 14577.44
> Var(tmp5)
[1] 874.7743
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 93.04989 72.31041 72.83926 70.84649 66.74196 69.73207 69.97597 69.31840
 [9] 72.00447 72.05330
> rowSums(tmp5)
 [1] 1860.998 1446.208 1456.785 1416.930 1334.839 1394.641 1399.519 1386.368
 [9] 1440.089 1441.066
> rowVars(tmp5)
 [1] 7972.80992   61.06270  116.93307   67.48329   47.54183   35.77782
 [7]   71.75210  102.82334  105.06066   74.08804
> rowSd(tmp5)
 [1] 89.290593  7.814263 10.813560  8.214821  6.895059  5.981456  8.470661
 [8] 10.140184 10.249910  8.607441
> rowMax(tmp5)
 [1] 470.25016  90.78386  95.89046  81.17005  80.18601  81.96283  85.40193
 [8]  90.57400  95.70774  89.49544
> rowMin(tmp5)
 [1] 52.63975 56.98527 58.91495 53.55262 55.60415 61.53611 54.01001 55.45131
 [9] 55.28719 58.78354
> 
> colMeans(tmp5)
 [1] 117.90106  71.80567  70.95510  72.14833  73.88769  68.68459  70.38541
 [8]  69.69628  70.40580  68.07525  66.53967  72.80623  67.59434  70.21091
[15]  70.33072  74.52693  70.26160  72.21781  68.91725  70.39380
> colSums(tmp5)
 [1] 1179.0106  718.0567  709.5510  721.4833  738.8769  686.8459  703.8541
 [8]  696.9628  704.0580  680.7525  665.3967  728.0623  675.9434  702.1091
[15]  703.3072  745.2693  702.6160  722.1781  689.1725  703.9380
> colVars(tmp5)
 [1] 15411.97065   142.95844    93.03035    51.00238   118.35148    44.94939
 [7]    62.66716    55.27757    84.44979    79.47944    41.41872    69.10198
[13]    89.69032    65.64516    92.92491    75.08466   103.86442    34.12211
[19]    46.24808   124.29520
> colSd(tmp5)
 [1] 124.144958  11.956523   9.645224   7.141595  10.878946   6.704430
 [7]   7.916259   7.434889   9.189657   8.915124   6.435737   8.312760
[13]   9.470497   8.102170   9.639756   8.665140  10.191390   5.841413
[19]   6.800594  11.148776
> colMax(tmp5)
 [1] 470.25016  95.89046  90.78386  80.50821  88.60588  81.96283  81.42115
 [8]  81.92677  82.52761  84.49690  79.47763  85.95393  85.40193  88.07557
[15]  90.57400  85.42332  91.52242  81.44345  78.16455  89.49544
> colMin(tmp5)
 [1] 62.12096 59.35478 58.29312 59.45009 57.56274 60.91704 56.98527 55.60415
 [9] 57.91336 55.45131 52.63975 58.91495 57.43883 62.08651 58.61984 58.78354
[17] 53.55262 64.90063 55.28719 54.01001
> 
> 
> ### 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] 93.04989 72.31041 72.83926 70.84649 66.74196 69.73207       NA 69.31840
 [9] 72.00447 72.05330
> rowSums(tmp5)
 [1] 1860.998 1446.208 1456.785 1416.930 1334.839 1394.641       NA 1386.368
 [9] 1440.089 1441.066
> rowVars(tmp5)
 [1] 7972.80992   61.06270  116.93307   67.48329   47.54183   35.77782
 [7]   66.52524  102.82334  105.06066   74.08804
> rowSd(tmp5)
 [1] 89.290593  7.814263 10.813560  8.214821  6.895059  5.981456  8.156301
 [8] 10.140184 10.249910  8.607441
> rowMax(tmp5)
 [1] 470.25016  90.78386  95.89046  81.17005  80.18601  81.96283        NA
 [8]  90.57400  95.70774  89.49544
> rowMin(tmp5)
 [1] 52.63975 56.98527 58.91495 53.55262 55.60415 61.53611       NA 55.45131
 [9] 55.28719 58.78354
> 
> colMeans(tmp5)
 [1] 117.90106  71.80567  70.95510  72.14833  73.88769  68.68459  70.38541
 [8]  69.69628        NA  68.07525  66.53967  72.80623  67.59434  70.21091
[15]  70.33072  74.52693  70.26160  72.21781  68.91725  70.39380
> colSums(tmp5)
 [1] 1179.0106  718.0567  709.5510  721.4833  738.8769  686.8459  703.8541
 [8]  696.9628        NA  680.7525  665.3967  728.0623  675.9434  702.1091
[15]  703.3072  745.2693  702.6160  722.1781  689.1725  703.9380
> colVars(tmp5)
 [1] 15411.97065   142.95844    93.03035    51.00238   118.35148    44.94939
 [7]    62.66716    55.27757          NA    79.47944    41.41872    69.10198
[13]    89.69032    65.64516    92.92491    75.08466   103.86442    34.12211
[19]    46.24808   124.29520
> colSd(tmp5)
 [1] 124.144958  11.956523   9.645224   7.141595  10.878946   6.704430
 [7]   7.916259   7.434889         NA   8.915124   6.435737   8.312760
[13]   9.470497   8.102170   9.639756   8.665140  10.191390   5.841413
[19]   6.800594  11.148776
> colMax(tmp5)
 [1] 470.25016  95.89046  90.78386  80.50821  88.60588  81.96283  81.42115
 [8]  81.92677        NA  84.49690  79.47763  85.95393  85.40193  88.07557
[15]  90.57400  85.42332  91.52242  81.44345  78.16455  89.49544
> colMin(tmp5)
 [1] 62.12096 59.35478 58.29312 59.45009 57.56274 60.91704 56.98527 55.60415
 [9]       NA 55.45131 52.63975 58.91495 57.43883 62.08651 58.61984 58.78354
[17] 53.55262 64.90063 55.28719 54.01001
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.2502
> Min(tmp5,na.rm=TRUE)
[1] 52.63975
> mean(tmp5,na.rm=TRUE)
[1] 72.83878
> Sum(tmp5,na.rm=TRUE)
[1] 14494.92
> Var(tmp5,na.rm=TRUE)
[1] 878.7207
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.04989 72.31041 72.83926 70.84649 66.74196 69.73207 69.31536 69.31840
 [9] 72.00447 72.05330
> rowSums(tmp5,na.rm=TRUE)
 [1] 1860.998 1446.208 1456.785 1416.930 1334.839 1394.641 1316.992 1386.368
 [9] 1440.089 1441.066
> rowVars(tmp5,na.rm=TRUE)
 [1] 7972.80992   61.06270  116.93307   67.48329   47.54183   35.77782
 [7]   66.52524  102.82334  105.06066   74.08804
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.290593  7.814263 10.813560  8.214821  6.895059  5.981456  8.156301
 [8] 10.140184 10.249910  8.607441
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.25016  90.78386  95.89046  81.17005  80.18601  81.96283  85.40193
 [8]  90.57400  95.70774  89.49544
> rowMin(tmp5,na.rm=TRUE)
 [1] 52.63975 56.98527 58.91495 53.55262 55.60415 61.53611 54.01001 55.45131
 [9] 55.28719 58.78354
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 117.90106  71.80567  70.95510  72.14833  73.88769  68.68459  70.38541
 [8]  69.69628  69.05893  68.07525  66.53967  72.80623  67.59434  70.21091
[15]  70.33072  74.52693  70.26160  72.21781  68.91725  70.39380
> colSums(tmp5,na.rm=TRUE)
 [1] 1179.0106  718.0567  709.5510  721.4833  738.8769  686.8459  703.8541
 [8]  696.9628  621.5304  680.7525  665.3967  728.0623  675.9434  702.1091
[15]  703.3072  745.2693  702.6160  722.1781  689.1725  703.9380
> colVars(tmp5,na.rm=TRUE)
 [1] 15411.97065   142.95844    93.03035    51.00238   118.35148    44.94939
 [7]    62.66716    55.27757    74.59790    79.47944    41.41872    69.10198
[13]    89.69032    65.64516    92.92491    75.08466   103.86442    34.12211
[19]    46.24808   124.29520
> colSd(tmp5,na.rm=TRUE)
 [1] 124.144958  11.956523   9.645224   7.141595  10.878946   6.704430
 [7]   7.916259   7.434889   8.637008   8.915124   6.435737   8.312760
[13]   9.470497   8.102170   9.639756   8.665140  10.191390   5.841413
[19]   6.800594  11.148776
> colMax(tmp5,na.rm=TRUE)
 [1] 470.25016  95.89046  90.78386  80.50821  88.60588  81.96283  81.42115
 [8]  81.92677  81.83757  84.49690  79.47763  85.95393  85.40193  88.07557
[15]  90.57400  85.42332  91.52242  81.44345  78.16455  89.49544
> colMin(tmp5,na.rm=TRUE)
 [1] 62.12096 59.35478 58.29312 59.45009 57.56274 60.91704 56.98527 55.60415
 [9] 57.91336 55.45131 52.63975 58.91495 57.43883 62.08651 58.61984 58.78354
[17] 53.55262 64.90063 55.28719 54.01001
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.04989 72.31041 72.83926 70.84649 66.74196 69.73207      NaN 69.31840
 [9] 72.00447 72.05330
> rowSums(tmp5,na.rm=TRUE)
 [1] 1860.998 1446.208 1456.785 1416.930 1334.839 1394.641    0.000 1386.368
 [9] 1440.089 1441.066
> rowVars(tmp5,na.rm=TRUE)
 [1] 7972.80992   61.06270  116.93307   67.48329   47.54183   35.77782
 [7]         NA  102.82334  105.06066   74.08804
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.290593  7.814263 10.813560  8.214821  6.895059  5.981456        NA
 [8] 10.140184 10.249910  8.607441
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.25016  90.78386  95.89046  81.17005  80.18601  81.96283        NA
 [8]  90.57400  95.70774  89.49544
> rowMin(tmp5,na.rm=TRUE)
 [1] 52.63975 56.98527 58.91495 53.55262 55.60415 61.53611       NA 55.45131
 [9] 55.28719 58.78354
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 124.09885  73.18911  72.36198  73.55925  73.35842  68.44023  69.77847
 [8]  68.78011       NaN  67.42416  66.75436  72.52160  65.61572  69.77600
[15]  70.40200  75.55812  70.32931  72.39562  68.59742  72.21422
> colSums(tmp5,na.rm=TRUE)
 [1] 1116.8896  658.7020  651.2578  662.0332  660.2257  615.9621  628.0062
 [8]  619.0210    0.0000  606.8175  600.7893  652.6944  590.5415  627.9840
[15]  633.6180  680.0231  632.9638  651.5606  617.3768  649.9280
> colVars(tmp5,na.rm=TRUE)
 [1] 16906.32538   139.29703    82.39168    34.98249   129.99398    49.89632
 [7]    66.35633    52.74444          NA    84.64529    46.07750    76.82831
[13]    56.85851    71.72293   104.48336    72.50761   116.79589    38.03168
[19]    50.87831   102.55034
> colSd(tmp5,na.rm=TRUE)
 [1] 130.024326  11.802416   9.076986   5.914600  11.401490   7.063733
 [7]   8.145940   7.262537         NA   9.200288   6.788041   8.765176
[13]   7.540458   8.468939  10.221710   8.515140  10.807215   6.166983
[19]   7.132903  10.126714
> colMax(tmp5,na.rm=TRUE)
 [1] 470.25016  95.89046  90.78386  80.50821  88.60588  81.96283  81.42115
 [8]  81.92677      -Inf  84.49690  79.47763  85.95393  83.51060  88.07557
[15]  90.57400  85.42332  91.52242  81.44345  78.16455  89.49544
> colMin(tmp5,na.rm=TRUE)
 [1] 68.56733 59.42513 62.24201 60.21229 57.56274 60.91704 56.98527 55.60415
 [9]      Inf 55.45131 52.63975 58.91495 57.43883 62.08651 58.61984 58.78354
[17] 53.55262 64.90063 55.28719 58.62973
> 
> 
> 
> 
> 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] 111.62526 280.87311 181.57826 149.35110 236.91937 189.54860 267.35056
 [8]  99.11847 119.99042 341.03691
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 111.62526 280.87311 181.57826 149.35110 236.91937 189.54860 267.35056
 [8]  99.11847 119.99042 341.03691
> 
> 
> 
> 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 -7.105427e-14 -1.705303e-13  5.684342e-14
 [6] -2.842171e-14  1.421085e-13  1.421085e-14  2.842171e-14 -8.526513e-14
[11] -1.136868e-13  0.000000e+00  5.684342e-14 -5.684342e-14 -5.684342e-14
[16] -2.842171e-14  5.684342e-14  5.684342e-14  8.526513e-14  1.136868e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
1   4 
7   2 
5   14 
1   18 
9   11 
10   15 
4   10 
6   17 
8   10 
10   8 
7   20 
3   14 
2   4 
7   5 
1   9 
7   3 
4   18 
10   13 
10   1 
9   3 
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.223243
> Min(tmp)
[1] -2.713536
> mean(tmp)
[1] -0.0762582
> Sum(tmp)
[1] -7.62582
> Var(tmp)
[1] 0.9484081
> 
> rowMeans(tmp)
[1] -0.0762582
> rowSums(tmp)
[1] -7.62582
> rowVars(tmp)
[1] 0.9484081
> rowSd(tmp)
[1] 0.9738625
> rowMax(tmp)
[1] 2.223243
> rowMin(tmp)
[1] -2.713536
> 
> colMeans(tmp)
  [1]  1.276676905 -1.007414905  0.914211266 -0.286569259 -0.577570536
  [6]  0.005245672 -1.201210235 -1.417402147 -0.931724251 -1.624224393
 [11] -0.751274899  0.358356461 -0.626507541 -0.037389362 -0.410609296
 [16] -0.027654376  0.281884173 -0.149431580 -1.559156669 -0.309539802
 [21] -0.657822617 -2.713535507  1.068880300 -0.181126211  0.070564760
 [26]  0.599866873  0.340923868  1.891358579 -1.318473877 -2.022807644
 [31]  0.062932022 -0.233388774 -0.221757375 -1.391751401 -0.160292809
 [36] -0.688916360  0.737743235 -1.093365634  1.109785781  2.223243236
 [41] -0.492735313  1.726525237 -0.694495961  0.822325493 -0.309648948
 [46]  0.077550594 -0.095895357  0.743463955 -0.497529215  0.494459396
 [51] -0.282292930  0.690867096 -1.738243902  1.485786889 -1.822481710
 [56]  1.489351162 -1.266498744  0.671936540 -1.019544189  0.989151320
 [61] -0.568461733  0.750498344  0.044757840  0.632748662  0.425046998
 [66]  0.367765179  0.370811701  0.371255431  0.720243985  1.361731989
 [71] -0.887092749  1.412826180 -1.039328485 -0.780458008 -0.338551855
 [76]  0.076801027 -0.089777478  1.351390227  1.172353883 -0.207229238
 [81] -0.720659591  0.044954579 -0.093435617  0.779505389 -0.551146868
 [86] -0.345994341 -2.080130881 -1.143590627 -0.420897813 -1.111506664
 [91]  0.810554330 -0.064056677 -0.258108074  0.655169972  1.336807814
 [96] -1.362042758 -0.946067554  0.199463276  1.663197616  0.522025449
> colSums(tmp)
  [1]  1.276676905 -1.007414905  0.914211266 -0.286569259 -0.577570536
  [6]  0.005245672 -1.201210235 -1.417402147 -0.931724251 -1.624224393
 [11] -0.751274899  0.358356461 -0.626507541 -0.037389362 -0.410609296
 [16] -0.027654376  0.281884173 -0.149431580 -1.559156669 -0.309539802
 [21] -0.657822617 -2.713535507  1.068880300 -0.181126211  0.070564760
 [26]  0.599866873  0.340923868  1.891358579 -1.318473877 -2.022807644
 [31]  0.062932022 -0.233388774 -0.221757375 -1.391751401 -0.160292809
 [36] -0.688916360  0.737743235 -1.093365634  1.109785781  2.223243236
 [41] -0.492735313  1.726525237 -0.694495961  0.822325493 -0.309648948
 [46]  0.077550594 -0.095895357  0.743463955 -0.497529215  0.494459396
 [51] -0.282292930  0.690867096 -1.738243902  1.485786889 -1.822481710
 [56]  1.489351162 -1.266498744  0.671936540 -1.019544189  0.989151320
 [61] -0.568461733  0.750498344  0.044757840  0.632748662  0.425046998
 [66]  0.367765179  0.370811701  0.371255431  0.720243985  1.361731989
 [71] -0.887092749  1.412826180 -1.039328485 -0.780458008 -0.338551855
 [76]  0.076801027 -0.089777478  1.351390227  1.172353883 -0.207229238
 [81] -0.720659591  0.044954579 -0.093435617  0.779505389 -0.551146868
 [86] -0.345994341 -2.080130881 -1.143590627 -0.420897813 -1.111506664
 [91]  0.810554330 -0.064056677 -0.258108074  0.655169972  1.336807814
 [96] -1.362042758 -0.946067554  0.199463276  1.663197616  0.522025449
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  1.276676905 -1.007414905  0.914211266 -0.286569259 -0.577570536
  [6]  0.005245672 -1.201210235 -1.417402147 -0.931724251 -1.624224393
 [11] -0.751274899  0.358356461 -0.626507541 -0.037389362 -0.410609296
 [16] -0.027654376  0.281884173 -0.149431580 -1.559156669 -0.309539802
 [21] -0.657822617 -2.713535507  1.068880300 -0.181126211  0.070564760
 [26]  0.599866873  0.340923868  1.891358579 -1.318473877 -2.022807644
 [31]  0.062932022 -0.233388774 -0.221757375 -1.391751401 -0.160292809
 [36] -0.688916360  0.737743235 -1.093365634  1.109785781  2.223243236
 [41] -0.492735313  1.726525237 -0.694495961  0.822325493 -0.309648948
 [46]  0.077550594 -0.095895357  0.743463955 -0.497529215  0.494459396
 [51] -0.282292930  0.690867096 -1.738243902  1.485786889 -1.822481710
 [56]  1.489351162 -1.266498744  0.671936540 -1.019544189  0.989151320
 [61] -0.568461733  0.750498344  0.044757840  0.632748662  0.425046998
 [66]  0.367765179  0.370811701  0.371255431  0.720243985  1.361731989
 [71] -0.887092749  1.412826180 -1.039328485 -0.780458008 -0.338551855
 [76]  0.076801027 -0.089777478  1.351390227  1.172353883 -0.207229238
 [81] -0.720659591  0.044954579 -0.093435617  0.779505389 -0.551146868
 [86] -0.345994341 -2.080130881 -1.143590627 -0.420897813 -1.111506664
 [91]  0.810554330 -0.064056677 -0.258108074  0.655169972  1.336807814
 [96] -1.362042758 -0.946067554  0.199463276  1.663197616  0.522025449
> colMin(tmp)
  [1]  1.276676905 -1.007414905  0.914211266 -0.286569259 -0.577570536
  [6]  0.005245672 -1.201210235 -1.417402147 -0.931724251 -1.624224393
 [11] -0.751274899  0.358356461 -0.626507541 -0.037389362 -0.410609296
 [16] -0.027654376  0.281884173 -0.149431580 -1.559156669 -0.309539802
 [21] -0.657822617 -2.713535507  1.068880300 -0.181126211  0.070564760
 [26]  0.599866873  0.340923868  1.891358579 -1.318473877 -2.022807644
 [31]  0.062932022 -0.233388774 -0.221757375 -1.391751401 -0.160292809
 [36] -0.688916360  0.737743235 -1.093365634  1.109785781  2.223243236
 [41] -0.492735313  1.726525237 -0.694495961  0.822325493 -0.309648948
 [46]  0.077550594 -0.095895357  0.743463955 -0.497529215  0.494459396
 [51] -0.282292930  0.690867096 -1.738243902  1.485786889 -1.822481710
 [56]  1.489351162 -1.266498744  0.671936540 -1.019544189  0.989151320
 [61] -0.568461733  0.750498344  0.044757840  0.632748662  0.425046998
 [66]  0.367765179  0.370811701  0.371255431  0.720243985  1.361731989
 [71] -0.887092749  1.412826180 -1.039328485 -0.780458008 -0.338551855
 [76]  0.076801027 -0.089777478  1.351390227  1.172353883 -0.207229238
 [81] -0.720659591  0.044954579 -0.093435617  0.779505389 -0.551146868
 [86] -0.345994341 -2.080130881 -1.143590627 -0.420897813 -1.111506664
 [91]  0.810554330 -0.064056677 -0.258108074  0.655169972  1.336807814
 [96] -1.362042758 -0.946067554  0.199463276  1.663197616  0.522025449
> colMedians(tmp)
  [1]  1.276676905 -1.007414905  0.914211266 -0.286569259 -0.577570536
  [6]  0.005245672 -1.201210235 -1.417402147 -0.931724251 -1.624224393
 [11] -0.751274899  0.358356461 -0.626507541 -0.037389362 -0.410609296
 [16] -0.027654376  0.281884173 -0.149431580 -1.559156669 -0.309539802
 [21] -0.657822617 -2.713535507  1.068880300 -0.181126211  0.070564760
 [26]  0.599866873  0.340923868  1.891358579 -1.318473877 -2.022807644
 [31]  0.062932022 -0.233388774 -0.221757375 -1.391751401 -0.160292809
 [36] -0.688916360  0.737743235 -1.093365634  1.109785781  2.223243236
 [41] -0.492735313  1.726525237 -0.694495961  0.822325493 -0.309648948
 [46]  0.077550594 -0.095895357  0.743463955 -0.497529215  0.494459396
 [51] -0.282292930  0.690867096 -1.738243902  1.485786889 -1.822481710
 [56]  1.489351162 -1.266498744  0.671936540 -1.019544189  0.989151320
 [61] -0.568461733  0.750498344  0.044757840  0.632748662  0.425046998
 [66]  0.367765179  0.370811701  0.371255431  0.720243985  1.361731989
 [71] -0.887092749  1.412826180 -1.039328485 -0.780458008 -0.338551855
 [76]  0.076801027 -0.089777478  1.351390227  1.172353883 -0.207229238
 [81] -0.720659591  0.044954579 -0.093435617  0.779505389 -0.551146868
 [86] -0.345994341 -2.080130881 -1.143590627 -0.420897813 -1.111506664
 [91]  0.810554330 -0.064056677 -0.258108074  0.655169972  1.336807814
 [96] -1.362042758 -0.946067554  0.199463276  1.663197616  0.522025449
> colRanges(tmp)
         [,1]      [,2]      [,3]       [,4]       [,5]        [,6]     [,7]
[1,] 1.276677 -1.007415 0.9142113 -0.2865693 -0.5775705 0.005245672 -1.20121
[2,] 1.276677 -1.007415 0.9142113 -0.2865693 -0.5775705 0.005245672 -1.20121
          [,8]       [,9]     [,10]      [,11]     [,12]      [,13]       [,14]
[1,] -1.417402 -0.9317243 -1.624224 -0.7512749 0.3583565 -0.6265075 -0.03738936
[2,] -1.417402 -0.9317243 -1.624224 -0.7512749 0.3583565 -0.6265075 -0.03738936
          [,15]       [,16]     [,17]      [,18]     [,19]      [,20]
[1,] -0.4106093 -0.02765438 0.2818842 -0.1494316 -1.559157 -0.3095398
[2,] -0.4106093 -0.02765438 0.2818842 -0.1494316 -1.559157 -0.3095398
          [,21]     [,22]   [,23]      [,24]      [,25]     [,26]     [,27]
[1,] -0.6578226 -2.713536 1.06888 -0.1811262 0.07056476 0.5998669 0.3409239
[2,] -0.6578226 -2.713536 1.06888 -0.1811262 0.07056476 0.5998669 0.3409239
        [,28]     [,29]     [,30]      [,31]      [,32]      [,33]     [,34]
[1,] 1.891359 -1.318474 -2.022808 0.06293202 -0.2333888 -0.2217574 -1.391751
[2,] 1.891359 -1.318474 -2.022808 0.06293202 -0.2333888 -0.2217574 -1.391751
          [,35]      [,36]     [,37]     [,38]    [,39]    [,40]      [,41]
[1,] -0.1602928 -0.6889164 0.7377432 -1.093366 1.109786 2.223243 -0.4927353
[2,] -0.1602928 -0.6889164 0.7377432 -1.093366 1.109786 2.223243 -0.4927353
        [,42]     [,43]     [,44]      [,45]      [,46]       [,47]    [,48]
[1,] 1.726525 -0.694496 0.8223255 -0.3096489 0.07755059 -0.09589536 0.743464
[2,] 1.726525 -0.694496 0.8223255 -0.3096489 0.07755059 -0.09589536 0.743464
          [,49]     [,50]      [,51]     [,52]     [,53]    [,54]     [,55]
[1,] -0.4975292 0.4944594 -0.2822929 0.6908671 -1.738244 1.485787 -1.822482
[2,] -0.4975292 0.4944594 -0.2822929 0.6908671 -1.738244 1.485787 -1.822482
        [,56]     [,57]     [,58]     [,59]     [,60]      [,61]     [,62]
[1,] 1.489351 -1.266499 0.6719365 -1.019544 0.9891513 -0.5684617 0.7504983
[2,] 1.489351 -1.266499 0.6719365 -1.019544 0.9891513 -0.5684617 0.7504983
          [,63]     [,64]    [,65]     [,66]     [,67]     [,68]    [,69]
[1,] 0.04475784 0.6327487 0.425047 0.3677652 0.3708117 0.3712554 0.720244
[2,] 0.04475784 0.6327487 0.425047 0.3677652 0.3708117 0.3712554 0.720244
        [,70]      [,71]    [,72]     [,73]     [,74]      [,75]      [,76]
[1,] 1.361732 -0.8870927 1.412826 -1.039328 -0.780458 -0.3385519 0.07680103
[2,] 1.361732 -0.8870927 1.412826 -1.039328 -0.780458 -0.3385519 0.07680103
           [,77]   [,78]    [,79]      [,80]      [,81]      [,82]       [,83]
[1,] -0.08977748 1.35139 1.172354 -0.2072292 -0.7206596 0.04495458 -0.09343562
[2,] -0.08977748 1.35139 1.172354 -0.2072292 -0.7206596 0.04495458 -0.09343562
         [,84]      [,85]      [,86]     [,87]     [,88]      [,89]     [,90]
[1,] 0.7795054 -0.5511469 -0.3459943 -2.080131 -1.143591 -0.4208978 -1.111507
[2,] 0.7795054 -0.5511469 -0.3459943 -2.080131 -1.143591 -0.4208978 -1.111507
         [,91]       [,92]      [,93]   [,94]    [,95]     [,96]      [,97]
[1,] 0.8105543 -0.06405668 -0.2581081 0.65517 1.336808 -1.362043 -0.9460676
[2,] 0.8105543 -0.06405668 -0.2581081 0.65517 1.336808 -1.362043 -0.9460676
         [,98]    [,99]    [,100]
[1,] 0.1994633 1.663198 0.5220254
[2,] 0.1994633 1.663198 0.5220254
> 
> 
> Max(tmp2)
[1] 2.392418
> Min(tmp2)
[1] -2.070121
> mean(tmp2)
[1] 0.03416256
> Sum(tmp2)
[1] 3.416256
> Var(tmp2)
[1] 0.9088548
> 
> rowMeans(tmp2)
  [1] -0.555729122  0.559385241  0.137413065  0.402110326  1.463568546
  [6] -1.385346911 -0.510086909  0.052397555  0.422100949 -0.441526340
 [11]  0.112901567 -0.516258091 -0.646667819  0.418432560  0.323324067
 [16]  0.809913648 -0.771098227  0.071607905  0.280870771 -2.070121293
 [21]  0.243058011  1.041182727  0.549544183 -0.242156910 -1.084564717
 [26] -0.274909883  1.188497674 -1.555768383  0.082594752 -0.356575984
 [31] -0.893868728 -0.780089661  0.559111439 -0.204609153  0.132101553
 [36]  1.641980463  0.543122856  1.255560187 -0.835549104  2.392417923
 [41] -0.184652883 -1.625961176  0.167418418  1.842858525  0.851089290
 [46]  0.792471449 -0.986084925  1.400675418 -1.532914440 -1.490585615
 [51]  1.075023927  1.119369113 -0.109500815  0.651336721 -0.236977960
 [56]  1.263101374 -0.665233856 -0.791503598  0.406285031  0.300669075
 [61]  1.556745388  0.004486575 -1.574963666 -0.706304938 -1.771463334
 [66]  0.535367165  0.612879505  1.475968615  0.999093693  1.048932249
 [71] -1.031016025  0.023130170 -1.134323108  0.875989029  0.913395303
 [76] -0.532987108 -0.894947766  1.443567211  0.106666671 -0.869991894
 [81]  0.882399771 -1.720931905 -0.064388119 -0.446285642 -0.135408413
 [86] -0.572029087  0.228763720  0.715152895  0.484296760 -1.889520924
 [91] -0.152039955 -1.409389422  0.880101236  1.519057838  0.581959032
 [96] -0.455128944 -0.412042544 -0.895532130  0.451508101  0.940335827
> rowSums(tmp2)
  [1] -0.555729122  0.559385241  0.137413065  0.402110326  1.463568546
  [6] -1.385346911 -0.510086909  0.052397555  0.422100949 -0.441526340
 [11]  0.112901567 -0.516258091 -0.646667819  0.418432560  0.323324067
 [16]  0.809913648 -0.771098227  0.071607905  0.280870771 -2.070121293
 [21]  0.243058011  1.041182727  0.549544183 -0.242156910 -1.084564717
 [26] -0.274909883  1.188497674 -1.555768383  0.082594752 -0.356575984
 [31] -0.893868728 -0.780089661  0.559111439 -0.204609153  0.132101553
 [36]  1.641980463  0.543122856  1.255560187 -0.835549104  2.392417923
 [41] -0.184652883 -1.625961176  0.167418418  1.842858525  0.851089290
 [46]  0.792471449 -0.986084925  1.400675418 -1.532914440 -1.490585615
 [51]  1.075023927  1.119369113 -0.109500815  0.651336721 -0.236977960
 [56]  1.263101374 -0.665233856 -0.791503598  0.406285031  0.300669075
 [61]  1.556745388  0.004486575 -1.574963666 -0.706304938 -1.771463334
 [66]  0.535367165  0.612879505  1.475968615  0.999093693  1.048932249
 [71] -1.031016025  0.023130170 -1.134323108  0.875989029  0.913395303
 [76] -0.532987108 -0.894947766  1.443567211  0.106666671 -0.869991894
 [81]  0.882399771 -1.720931905 -0.064388119 -0.446285642 -0.135408413
 [86] -0.572029087  0.228763720  0.715152895  0.484296760 -1.889520924
 [91] -0.152039955 -1.409389422  0.880101236  1.519057838  0.581959032
 [96] -0.455128944 -0.412042544 -0.895532130  0.451508101  0.940335827
> 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.555729122  0.559385241  0.137413065  0.402110326  1.463568546
  [6] -1.385346911 -0.510086909  0.052397555  0.422100949 -0.441526340
 [11]  0.112901567 -0.516258091 -0.646667819  0.418432560  0.323324067
 [16]  0.809913648 -0.771098227  0.071607905  0.280870771 -2.070121293
 [21]  0.243058011  1.041182727  0.549544183 -0.242156910 -1.084564717
 [26] -0.274909883  1.188497674 -1.555768383  0.082594752 -0.356575984
 [31] -0.893868728 -0.780089661  0.559111439 -0.204609153  0.132101553
 [36]  1.641980463  0.543122856  1.255560187 -0.835549104  2.392417923
 [41] -0.184652883 -1.625961176  0.167418418  1.842858525  0.851089290
 [46]  0.792471449 -0.986084925  1.400675418 -1.532914440 -1.490585615
 [51]  1.075023927  1.119369113 -0.109500815  0.651336721 -0.236977960
 [56]  1.263101374 -0.665233856 -0.791503598  0.406285031  0.300669075
 [61]  1.556745388  0.004486575 -1.574963666 -0.706304938 -1.771463334
 [66]  0.535367165  0.612879505  1.475968615  0.999093693  1.048932249
 [71] -1.031016025  0.023130170 -1.134323108  0.875989029  0.913395303
 [76] -0.532987108 -0.894947766  1.443567211  0.106666671 -0.869991894
 [81]  0.882399771 -1.720931905 -0.064388119 -0.446285642 -0.135408413
 [86] -0.572029087  0.228763720  0.715152895  0.484296760 -1.889520924
 [91] -0.152039955 -1.409389422  0.880101236  1.519057838  0.581959032
 [96] -0.455128944 -0.412042544 -0.895532130  0.451508101  0.940335827
> rowMin(tmp2)
  [1] -0.555729122  0.559385241  0.137413065  0.402110326  1.463568546
  [6] -1.385346911 -0.510086909  0.052397555  0.422100949 -0.441526340
 [11]  0.112901567 -0.516258091 -0.646667819  0.418432560  0.323324067
 [16]  0.809913648 -0.771098227  0.071607905  0.280870771 -2.070121293
 [21]  0.243058011  1.041182727  0.549544183 -0.242156910 -1.084564717
 [26] -0.274909883  1.188497674 -1.555768383  0.082594752 -0.356575984
 [31] -0.893868728 -0.780089661  0.559111439 -0.204609153  0.132101553
 [36]  1.641980463  0.543122856  1.255560187 -0.835549104  2.392417923
 [41] -0.184652883 -1.625961176  0.167418418  1.842858525  0.851089290
 [46]  0.792471449 -0.986084925  1.400675418 -1.532914440 -1.490585615
 [51]  1.075023927  1.119369113 -0.109500815  0.651336721 -0.236977960
 [56]  1.263101374 -0.665233856 -0.791503598  0.406285031  0.300669075
 [61]  1.556745388  0.004486575 -1.574963666 -0.706304938 -1.771463334
 [66]  0.535367165  0.612879505  1.475968615  0.999093693  1.048932249
 [71] -1.031016025  0.023130170 -1.134323108  0.875989029  0.913395303
 [76] -0.532987108 -0.894947766  1.443567211  0.106666671 -0.869991894
 [81]  0.882399771 -1.720931905 -0.064388119 -0.446285642 -0.135408413
 [86] -0.572029087  0.228763720  0.715152895  0.484296760 -1.889520924
 [91] -0.152039955 -1.409389422  0.880101236  1.519057838  0.581959032
 [96] -0.455128944 -0.412042544 -0.895532130  0.451508101  0.940335827
> 
> colMeans(tmp2)
[1] 0.03416256
> colSums(tmp2)
[1] 3.416256
> colVars(tmp2)
[1] 0.9088548
> colSd(tmp2)
[1] 0.9533388
> colMax(tmp2)
[1] 2.392418
> colMin(tmp2)
[1] -2.070121
> colMedians(tmp2)
[1] 0.09463071
> colRanges(tmp2)
          [,1]
[1,] -2.070121
[2,]  2.392418
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.2899376446  0.0005610424 -4.2034175091 -3.8182597734  3.1699930820
 [6] -0.1440385513  2.9387050574 -1.8596634001 -1.7131986845  0.2590709940
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.4265316
[2,] -0.3585372
[3,]  0.1937979
[4,]  0.8512989
[5,]  1.9975651
> 
> rowApply(tmp,sum)
 [1] -0.2321467  2.4008187 -5.0296683 -3.4563260  3.4511458 -3.7907227
 [7] -0.6675703  2.3359477  2.1752919 -0.2670802
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   10    4    5    2    6    2    8    4    9     8
 [2,]    8    1    8   10    9    7    3    8    2     4
 [3,]    4    2    1    6    1    1    6    9    5     5
 [4,]    1   10    3    1    4    3    5    7    8     6
 [5,]    6    9    2    9    7    9   10   10    3     3
 [6,]    2    8    6    5    8   10    1    1    1     9
 [7,]    3    3    9    8   10    4    9    5    7     2
 [8,]    5    6    7    7    5    8    4    2   10     1
 [9,]    7    7    4    4    2    5    7    3    4     7
[10,]    9    5   10    3    3    6    2    6    6    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.7450685  2.5848167 -2.8358914  1.9487531  1.2618497 -3.1820828
 [7]  1.5098460  1.0045434  2.6175675 -1.7347206  1.9346774 -1.0390357
[13]  0.1695960  1.4023975 -1.0371904  1.7574139 -0.9303101  0.3623290
[19]  0.1202426 -0.7061711
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.83679821
[2,] -0.20773274
[3,] -0.01887637
[4,]  0.79621195
[5,]  1.01226392
> 
> rowApply(tmp,sum)
[1]  4.588790 -2.765540  4.734048 -0.420224 -0.183375
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   16   17    4    9    8
[2,]   20    5   10   14   15
[3,]    1    3   12   11    2
[4,]   17   10   16    6   13
[5,]    4   14   20    4   17
> 
> 
> as.matrix(tmp)
            [,1]       [,2]       [,3]       [,4]        [,5]       [,6]
[1,]  1.01226392  1.6252796 -1.0317889  1.0279890 -0.67785380 -0.0391296
[2,]  0.79621195 -0.6689758 -0.7100299 -0.2409253  0.08206707  0.3042923
[3,] -0.83679821  0.3965921  0.5766769  0.9607173  1.82811719 -0.3805286
[4,] -0.01887637  0.3899827  0.1605615 -0.2889479 -0.87086244 -1.8902737
[5,] -0.20773274  0.8419380 -1.8313108  0.4899199  0.90038165 -1.1764432
           [,7]       [,8]       [,9]      [,10]       [,11]       [,12]
[1,]  0.6692782  0.4225049  1.1096228 -1.0167254 -0.95827231  0.76322926
[2,]  1.0290070 -0.3565210 -0.4364815 -0.2107621  1.57526411 -3.26143621
[3,]  1.2273453  0.9233974 -1.0864240  0.2519048  1.07871567 -0.05893041
[4,] -0.8928660  0.2345699  0.8765296 -0.8637150  0.19563254  0.71031648
[5,] -0.5229184 -0.2194078  2.1543206  0.1045772  0.04333735  0.80778521
           [,13]       [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -0.35575632  0.10030790  0.3173589 -0.2912398  0.2930850  1.3611771
[2,] -0.27927147 -0.02678396 -0.6760612  1.2658463 -0.1898435 -0.8707064
[3,] -0.10906561  0.68469336 -2.4970463 -0.9765241  0.5169197  0.8429760
[4,]  0.02784714  0.85520092  0.8208136  0.6151459 -0.1320803 -1.1422923
[5,]  0.88584226 -0.21102074  0.9977445  1.1441855 -1.4183910  0.1711746
           [,19]       [,20]
[1,]  0.22985351  0.02760561
[2,] -0.33769178  0.44726188
[3,]  0.39261227  0.99869728
[4,] -0.26394420  1.05703385
[5,]  0.09941278 -3.23676970
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  563  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1       col2       col3      col4       col5     col6      col7
row1 -1.167689 -0.2225264 -0.8830447 -1.597256 -0.1777088 1.789549 -1.187021
           col8       col9    col10      col11    col12     col13     col14
row1 -0.2753883 -0.2819729 0.234625 -0.3107185 2.101304 0.3835766 -1.539423
         col15       col16     col17      col18     col19    col20
row1 -1.013134 -0.08768371 0.6707714 -0.6813063 0.4067745 1.464821
> tmp[,"col10"]
          col10
row1  0.2346250
row2 -0.5972472
row3 -1.7675427
row4 -0.1027053
row5 -0.7357542
> tmp[c("row1","row5"),]
           col1       col2       col3       col4       col5      col6
row1 -1.1676894 -0.2225264 -0.8830447 -1.5972559 -0.1777088 1.7895491
row5 -0.8418087  0.9713935  0.4611865  0.9556793  1.1802372 0.4877435
           col7       col8       col9      col10      col11      col12
row1 -1.1870211 -0.2753883 -0.2819729  0.2346250 -0.3107185  2.1013038
row5 -0.5074651 -0.3118476 -1.5302810 -0.7357542  1.2222239 -0.6794742
         col13     col14      col15       col16      col17      col18     col19
row1 0.3835766 -1.539423 -1.0131342 -0.08768371  0.6707714 -0.6813063 0.4067745
row5 0.3406983 -1.095047  0.1730393 -0.85457096 -0.3671256 -0.5471160 0.8677523
          col20
row1  1.4648209
row5 -0.2785008
> tmp[,c("col6","col20")]
            col6      col20
row1  1.78954912  1.4648209
row2 -0.25798459  0.3513862
row3 -1.87298897 -0.5768196
row4  0.04284994  0.4387431
row5  0.48774350 -0.2785008
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 1.7895491  1.4648209
row5 0.4877435 -0.2785008
> 
> 
> 
> 
> 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.39136 49.57584 50.28022 49.68471 50.65676 104.7974 49.42113 49.13351
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.66426 50.11616 51.41928 49.40118 50.45747 50.41461 49.28745 50.14128
        col17    col18    col19    col20
row1 51.07242 48.18802 49.50779 105.8931
> tmp[,"col10"]
        col10
row1 50.11616
row2 30.17185
row3 31.26645
row4 30.84491
row5 50.31986
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.39136 49.57584 50.28022 49.68471 50.65676 104.7974 49.42113 49.13351
row5 50.07384 50.97974 50.07635 49.64153 49.65119 104.9794 47.66184 50.97199
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.66426 50.11616 51.41928 49.40118 50.45747 50.41461 49.28745 50.14128
row5 52.35545 50.31986 49.77376 52.11868 48.74666 48.28436 50.62076 50.80967
        col17    col18    col19    col20
row1 51.07242 48.18802 49.50779 105.8931
row5 49.38307 49.73763 48.70794 104.8886
> tmp[,c("col6","col20")]
          col6     col20
row1 104.79737 105.89315
row2  76.21756  74.18269
row3  75.33466  75.26357
row4  75.41206  73.36477
row5 104.97940 104.88858
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.7974 105.8931
row5 104.9794 104.8886
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.7974 105.8931
row5 104.9794 104.8886
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -0.44663690
[2,] -0.41400250
[3,] -0.02989759
[4,] -2.11211948
[5,] -1.33783826
> tmp[,c("col17","col7")]
          col17        col7
[1,] -1.9061432 -0.06544822
[2,] -0.9282807  0.37800587
[3,]  0.4916085 -1.84796730
[4,]  0.9116356  0.82761335
[5,]  1.0911720  0.35433972
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,]  2.7855387 -0.46814774
[2,]  0.4025407  0.12832190
[3,] -1.1263194 -0.74527937
[4,] -0.1529646 -0.26452908
[5,] -0.7564990  0.01094947
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 2.785539
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 2.7855387
[2,] 0.4025407
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]     [,3]       [,4]       [,5]      [,6]       [,7]
row3 -0.7450685 -0.8154758 1.192335 -0.3608045 -1.7822000 -1.384490 -0.2046563
row1 -0.8718982 -1.3863991 1.208605 -0.1346908 -0.2199181  0.128945  0.4055929
           [,8]       [,9]       [,10]     [,11]      [,12]        [,13]
row3  0.5872875  1.3159764  0.08724421 0.3261764 -1.1559753 -0.026832464
row1 -0.8389400 -0.6417707 -0.04016658 0.3365121  0.8698108  0.008467798
          [,14]     [,15]     [,16]     [,17]     [,18]      [,19]     [,20]
row3 -0.1310540 0.1515411 0.6158469 0.8191017 -1.053999 -1.9545660 -1.017298
row1 -0.5115994 1.5395695 2.5767992 0.9417013  1.429096  0.2335413 -0.597544
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]        [,3]      [,4]     [,5]     [,6]       [,7]
row2 0.4246095 -0.6689012 0.000855011 -1.103653 1.555051 -0.38511 -0.1724407
          [,8]     [,9]      [,10]
row2 0.7278725 2.033925 -0.1537424
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]       [,4]        [,5]       [,6]
row5 0.8040575 0.09865817 0.5519886 0.02058308 -0.07504176 -0.9375011
           [,7]      [,8]       [,9]      [,10]    [,11]     [,12]    [,13]
row5 -0.3183197 -0.210534 -0.5377373 -0.5315732 2.002255 0.3215938 -1.20506
         [,14]    [,15]     [,16]      [,17]      [,18]     [,19]      [,20]
row5 0.2446055 1.185969 -1.182674 -0.8037931 -0.1240106 0.2669447 -0.2813004
> 
> 
> 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: 0x55f88ea11cb0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b61cd7d392"
 [2] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b624f7fb19"
 [3] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b674745988"
 [4] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b612f14f14"
 [5] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b625acb4ff"
 [6] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b655635651"
 [7] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b6659a977e"
 [8] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b677e67331"
 [9] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b64855d4f4"
[10] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b63762f591"
[11] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b643cc8ab3"
[12] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b66646f5ae"
[13] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b621b467c9"
[14] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b674ab6449"
[15] "/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1732b626d3c962"
> 
> 
> ### 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: 0x55f88cb00510>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x55f88cb00510>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x55f88cb00510>
> rowMedians(tmp)
  [1] -0.048046520 -0.169963783 -0.610877182  0.203852800 -0.202772696
  [6] -0.878581732 -0.252561463 -0.229499618 -0.486934137  0.222111491
 [11]  0.428516220 -0.622493695  0.094535991 -0.042190784 -0.292640054
 [16]  0.469744088 -0.262164958  0.430293136  0.116749845  0.264677751
 [21] -0.152130161 -0.382330973 -0.119601770  0.486873184  0.261910202
 [26] -0.019764840  0.038374919 -0.221547058 -0.226525042 -0.003723618
 [31]  0.008800785  0.200169729 -0.055967447  0.408224332  0.093873304
 [36] -0.023748897 -0.258464124  0.306365164  0.172971170  0.412989583
 [41] -0.259838487 -0.321860646  0.345990692  0.757960506  0.209966014
 [46]  0.251095417 -0.541377738  0.173449561  0.150956321 -0.075265067
 [51] -0.351015465  0.240715163 -0.081904619 -0.068533546 -0.506518714
 [56] -0.249427953 -0.043160032 -0.052500338 -0.376636602 -0.522964226
 [61]  0.342823173  0.419943641  0.410203623  0.045103287  0.235133572
 [66] -0.057574247  0.133635425  0.262630299  0.658736033  0.159776647
 [71]  0.593044311  0.113160977 -0.142621854 -0.117262930 -0.137225095
 [76]  0.533395159  0.270497355  0.370778951  0.360095339  0.669434545
 [81]  0.073984846 -0.077409796  0.214375027  0.045662310 -0.074448532
 [86] -0.024393471 -0.004436607  0.060265914  0.132800884  0.060636334
 [91]  0.294032944 -0.057142952 -0.021741910 -0.206950004 -0.239129150
 [96]  0.303019700 -0.385687700 -0.060472995  0.081340839  0.059935525
[101]  0.265926600 -0.155918644 -0.206545256  0.153044721 -0.665883992
[106]  0.341353512 -0.123637824 -0.172183893 -0.409055128 -0.376141514
[111] -0.583164642 -0.307894638  0.055319462 -0.111663962 -0.255006073
[116] -0.366166101  0.428866829  0.340183702  0.460040768 -0.270105372
[121]  0.179979053  0.207845438 -0.106937517  0.566213859  0.056899613
[126]  0.660147940 -0.124668359  0.408582597  0.185001920 -0.009888225
[131] -0.734499056 -0.375270561  0.181999358  0.502356035 -0.151240465
[136] -0.473694004 -0.424396951 -0.486006943  0.060149983  0.266687642
[141] -0.320463701 -0.291328620 -0.134832521 -0.331306343 -0.232777731
[146]  0.276205152 -0.204373234 -0.186764965 -0.262306663  0.034028528
[151]  0.523900637 -0.387632694  0.179896328  0.140709035  0.299768036
[156]  0.603599753  0.127508282  0.330479217 -0.034216106  0.191008221
[161]  0.517792465 -0.196620441 -0.092263020 -0.228615023 -0.222262437
[166] -0.194903610  0.184399785 -0.126370033  0.123972342  0.276949667
[171] -0.108271987  0.003285643 -0.299977844 -0.181842548  0.766324871
[176]  0.438268604  0.069538165 -0.327880392  0.097645878  0.070689253
[181]  0.583233328 -0.527112684  0.247315811  0.016418929 -0.041864543
[186] -0.238799175  0.052024597 -0.031372423  0.456983789  0.464604567
[191] -0.348334136  0.011587784  0.582573699  0.072296375 -0.299620179
[196]  0.603457785  0.449954047 -0.254990645 -0.361555577  0.121227451
[201]  0.188115909  0.359447414  0.282768525  0.226914295 -0.173227521
[206] -0.637231791 -0.186916575  0.018236153  0.039219150 -0.424291412
[211]  0.235047525  0.402681651 -0.160666230 -0.265323127 -0.136742115
[216]  0.230339288 -0.433888176  0.146055272 -0.066488737 -0.129313790
[221]  0.312941250  0.040913819 -0.229532617 -0.393155910  0.124664930
[226] -0.006356814 -0.323306602 -0.364055936 -0.235807360  0.163867013
> 
> proc.time()
   user  system elapsed 
  1.337   0.583   1.923 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x55f365b86690>
> .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: 0x55f365b86690>
> .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: 0x55f365b86690>
> .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: 0x55f365b86690>
> 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: 0x55f365c72970>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f365c72970>
> .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: 0x55f365c72970>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f365c72970>
> .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: 0x55f365c72970>
> 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: 0x55f365b7af00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f365b7af00>
> .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: 0x55f365b7af00>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55f365b7af00>
> .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: 0x55f365b7af00>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x55f365b7af00>
> .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: 0x55f365b7af00>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x55f365b7af00>
> .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: 0x55f365b7af00>
> 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: 0x55f364535650>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x55f364535650>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f364535650>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f364535650>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1733953715951d" "BufferedMatrixFile1733955f96ebe1"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1733953715951d" "BufferedMatrixFile1733955f96ebe1"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f364919060>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f364919060>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55f364919060>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55f364919060>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x55f364919060>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x55f364919060>
> .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: 0x55f3655789c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f3655789c0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55f3655789c0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x55f3655789c0>
> 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: 0x55f3655bcca0>
> .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: 0x55f3655bcca0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.286   0.019   0.296 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

Example timings