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

This page was generated on 2023-04-12 10:55:34 -0400 (Wed, 12 Apr 2023).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 22.04.1 LTS)x86_644.3.0 alpha (2023-04-03 r84154) 4547
nebbiolo2Linux (Ubuntu 20.04.5 LTS)x86_64R Under development (unstable) (2023-02-14 r83833) -- "Unsuffered Consequences" 4333
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

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.

Note: If "R CMD check" recently failed on the Linux builder over a missing dependency, add the missing dependency to "Suggests" in your DESCRIPTION file. See the Renviron.bioc for details.

raw results

Package 244/2207HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.63.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-04-11 14:00:16 -0400 (Tue, 11 Apr 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: e95ad0a
git_last_commit_date: 2022-11-01 10:42:48 -0400 (Tue, 01 Nov 2022)
nebbiolo1Linux (Ubuntu 22.04.1 LTS) / x86_64  OK    OK    OK  
nebbiolo2Linux (Ubuntu 20.04.5 LTS) / x86_64  OK    OK    OK  

Summary

Package: BufferedMatrix
Version: 1.63.0
Command: /home/biocbuild/bbs-3.17-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.17-bioc/R/site-library --timings BufferedMatrix_1.63.0.tar.gz
StartedAt: 2023-04-12 05:04:13 -0400 (Wed, 12 Apr 2023)
EndedAt: 2023-04-12 05:04:37 -0400 (Wed, 12 Apr 2023)
EllapsedTime: 24.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2023-02-14 r83833)
* using platform: x86_64-pc-linux-gnu (64-bit)
* R was compiled by
    gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
    GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
* running under: Ubuntu 20.04.6 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.63.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 9.4.0-1ubuntu1~20.04.1) 9.4.0’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ...
  ‘BufferedMatrix.Rnw’... OK
 OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


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

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R Under development (unstable) (2023-02-14 r83833) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.273   0.043   0.300 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2023-02-14 r83833) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 457293 24.5     980737 52.4   651628 34.9
Vcells 842606  6.5    8388608 64.0  2045623 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 Apr 12 05:04:29 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Apr 12 05:04:29 2023"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x561d1f5b1880>
> 
> 
> 
> 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 Apr 12 05:04:29 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Apr 12 05:04:29 2023"
> 
> ColMode(tmp2)
<pointer: 0x561d1f5b1880>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]        [,2]       [,3]        [,4]
[1,] 99.7374793 -0.07161363 -1.1488624 -0.14529234
[2,] -0.4532767 -1.77889036  0.7463050  2.19155751
[3,] -0.3411601 -0.84162679 -1.1390014 -0.08146317
[4,]  0.5002311 -0.76200456 -0.8906446  0.12538671
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]       [,2]      [,3]       [,4]
[1,] 99.7374793 0.07161363 1.1488624 0.14529234
[2,]  0.4532767 1.77889036 0.7463050 2.19155751
[3,]  0.3411601 0.84162679 1.1390014 0.08146317
[4,]  0.5002311 0.76200456 0.8906446 0.12538671
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9868653 0.2676072 1.0718500 0.3811723
[2,] 0.6732583 1.3337505 0.8638895 1.4803910
[3,] 0.5840891 0.9174022 1.0672401 0.2854175
[4,] 0.7072702 0.8729287 0.9437397 0.3540999
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.60613 27.74769 36.86736 28.95702
[2,]  32.18586 40.11640 34.38520 41.99547
[3,]  31.18205 35.01565 36.81140 27.93564
[4,]  32.57293 34.49129 35.32804 28.66639
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x561d1d9e03a0>
> exp(tmp5)
<pointer: 0x561d1d9e03a0>
> log(tmp5,2)
<pointer: 0x561d1d9e03a0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.4882
> Min(tmp5)
[1] 52.85728
> mean(tmp5)
[1] 73.52567
> Sum(tmp5)
[1] 14705.13
> Var(tmp5)
[1] 858.8118
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 88.49944 72.53693 70.11251 73.04583 71.69762 73.73889 69.59039 72.81183
 [9] 71.07211 72.15113
> rowSums(tmp5)
 [1] 1769.989 1450.739 1402.250 1460.917 1433.952 1474.778 1391.808 1456.237
 [9] 1421.442 1443.023
> rowVars(tmp5)
 [1] 8020.73621   53.65181   64.76250   67.47473   72.29581   94.04044
 [7]   81.11224   70.43885  100.02570   92.10791
> rowSd(tmp5)
 [1] 89.558563  7.324740  8.047515  8.214301  8.502694  9.697445  9.006233
 [8]  8.392786 10.001285  9.597287
> rowMax(tmp5)
 [1] 467.48824  87.40806  84.03098  86.21482  87.85226  90.37819  83.10318
 [8]  88.14667  83.75637  89.06885
> rowMin(tmp5)
 [1] 56.26920 60.45296 58.14437 57.95304 56.72632 58.12104 55.08766 58.12970
 [9] 52.85728 55.33076
> 
> colMeans(tmp5)
 [1] 109.82342  75.12913  72.01313  67.36109  72.81578  72.53821  74.89934
 [8]  69.44174  71.68096  70.15518  73.01227  73.39150  72.66029  73.47965
[15]  72.67800  69.24890  67.73173  67.87119  69.05405  75.52779
> colSums(tmp5)
 [1] 1098.2342  751.2913  720.1313  673.6109  728.1578  725.3821  748.9934
 [8]  694.4174  716.8096  701.5518  730.1227  733.9150  726.6029  734.7965
[15]  726.7800  692.4890  677.3173  678.7119  690.5405  755.2779
> colVars(tmp5)
 [1] 15841.96770   138.60562    36.73965    99.50488    90.92999    51.46735
 [7]    96.44932    66.85964   100.00688    48.20568    48.61299    24.87376
[13]    97.21867    92.24004    67.93792   120.34498   101.68189    78.03488
[19]    81.41419    34.20586
> colSd(tmp5)
 [1] 125.864879  11.773089   6.061324   9.975213   9.535722   7.174075
 [7]   9.820861   8.176774  10.000344   6.943031   6.972302   4.987360
[13]   9.859953   9.604168   8.242446  10.970186  10.083744   8.833735
[19]   9.022981   5.848577
> colMax(tmp5)
 [1] 467.48824  90.37819  78.91496  87.40806  85.82517  84.03098  86.43764
 [8]  82.26440  82.29448  81.23274  83.52620  81.48709  87.85226  88.14667
[15]  80.60569  89.06885  85.48025  79.71187  83.59866  86.21482
> colMin(tmp5)
 [1] 60.47552 57.75317 59.77976 55.15480 58.12970 61.93596 62.35414 56.92809
 [9] 52.85728 59.55827 60.06254 65.93303 61.19225 55.64550 57.66855 55.40926
[17] 55.08766 57.95304 58.20614 67.70486
> 
> 
> ### 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] 88.49944 72.53693 70.11251       NA 71.69762 73.73889 69.59039 72.81183
 [9] 71.07211 72.15113
> rowSums(tmp5)
 [1] 1769.989 1450.739 1402.250       NA 1433.952 1474.778 1391.808 1456.237
 [9] 1421.442 1443.023
> rowVars(tmp5)
 [1] 8020.73621   53.65181   64.76250   71.13097   72.29581   94.04044
 [7]   81.11224   70.43885  100.02570   92.10791
> rowSd(tmp5)
 [1] 89.558563  7.324740  8.047515  8.433918  8.502694  9.697445  9.006233
 [8]  8.392786 10.001285  9.597287
> rowMax(tmp5)
 [1] 467.48824  87.40806  84.03098        NA  87.85226  90.37819  83.10318
 [8]  88.14667  83.75637  89.06885
> rowMin(tmp5)
 [1] 56.26920 60.45296 58.14437       NA 56.72632 58.12104 55.08766 58.12970
 [9] 52.85728 55.33076
> 
> colMeans(tmp5)
 [1] 109.82342        NA  72.01313  67.36109  72.81578  72.53821  74.89934
 [8]  69.44174  71.68096  70.15518  73.01227  73.39150  72.66029  73.47965
[15]  72.67800  69.24890  67.73173  67.87119  69.05405  75.52779
> colSums(tmp5)
 [1] 1098.2342        NA  720.1313  673.6109  728.1578  725.3821  748.9934
 [8]  694.4174  716.8096  701.5518  730.1227  733.9150  726.6029  734.7965
[15]  726.7800  692.4890  677.3173  678.7119  690.5405  755.2779
> colVars(tmp5)
 [1] 15841.96770          NA    36.73965    99.50488    90.92999    51.46735
 [7]    96.44932    66.85964   100.00688    48.20568    48.61299    24.87376
[13]    97.21867    92.24004    67.93792   120.34498   101.68189    78.03488
[19]    81.41419    34.20586
> colSd(tmp5)
 [1] 125.864879         NA   6.061324   9.975213   9.535722   7.174075
 [7]   9.820861   8.176774  10.000344   6.943031   6.972302   4.987360
[13]   9.859953   9.604168   8.242446  10.970186  10.083744   8.833735
[19]   9.022981   5.848577
> colMax(tmp5)
 [1] 467.48824        NA  78.91496  87.40806  85.82517  84.03098  86.43764
 [8]  82.26440  82.29448  81.23274  83.52620  81.48709  87.85226  88.14667
[15]  80.60569  89.06885  85.48025  79.71187  83.59866  86.21482
> colMin(tmp5)
 [1] 60.47552       NA 59.77976 55.15480 58.12970 61.93596 62.35414 56.92809
 [9] 52.85728 59.55827 60.06254 65.93303 61.19225 55.64550 57.66855 55.40926
[17] 55.08766 57.95304 58.20614 67.70486
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.4882
> Min(tmp5,na.rm=TRUE)
[1] 52.85728
> mean(tmp5,na.rm=TRUE)
[1] 73.53439
> Sum(tmp5,na.rm=TRUE)
[1] 14633.34
> Var(tmp5,na.rm=TRUE)
[1] 863.134
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.49944 72.53693 70.11251 73.11198 71.69762 73.73889 69.59039 72.81183
 [9] 71.07211 72.15113
> rowSums(tmp5,na.rm=TRUE)
 [1] 1769.989 1450.739 1402.250 1389.128 1433.952 1474.778 1391.808 1456.237
 [9] 1421.442 1443.023
> rowVars(tmp5,na.rm=TRUE)
 [1] 8020.73621   53.65181   64.76250   71.13097   72.29581   94.04044
 [7]   81.11224   70.43885  100.02570   92.10791
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.558563  7.324740  8.047515  8.433918  8.502694  9.697445  9.006233
 [8]  8.392786 10.001285  9.597287
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.48824  87.40806  84.03098  86.21482  87.85226  90.37819  83.10318
 [8]  88.14667  83.75637  89.06885
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.26920 60.45296 58.14437 57.95304 56.72632 58.12104 55.08766 58.12970
 [9] 52.85728 55.33076
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.82342  75.50024  72.01313  67.36109  72.81578  72.53821  74.89934
 [8]  69.44174  71.68096  70.15518  73.01227  73.39150  72.66029  73.47965
[15]  72.67800  69.24890  67.73173  67.87119  69.05405  75.52779
> colSums(tmp5,na.rm=TRUE)
 [1] 1098.2342  679.5022  720.1313  673.6109  728.1578  725.3821  748.9934
 [8]  694.4174  716.8096  701.5518  730.1227  733.9150  726.6029  734.7965
[15]  726.7800  692.4890  677.3173  678.7119  690.5405  755.2779
> colVars(tmp5,na.rm=TRUE)
 [1] 15841.96770   154.38191    36.73965    99.50488    90.92999    51.46735
 [7]    96.44932    66.85964   100.00688    48.20568    48.61299    24.87376
[13]    97.21867    92.24004    67.93792   120.34498   101.68189    78.03488
[19]    81.41419    34.20586
> colSd(tmp5,na.rm=TRUE)
 [1] 125.864879  12.425052   6.061324   9.975213   9.535722   7.174075
 [7]   9.820861   8.176774  10.000344   6.943031   6.972302   4.987360
[13]   9.859953   9.604168   8.242446  10.970186  10.083744   8.833735
[19]   9.022981   5.848577
> colMax(tmp5,na.rm=TRUE)
 [1] 467.48824  90.37819  78.91496  87.40806  85.82517  84.03098  86.43764
 [8]  82.26440  82.29448  81.23274  83.52620  81.48709  87.85226  88.14667
[15]  80.60569  89.06885  85.48025  79.71187  83.59866  86.21482
> colMin(tmp5,na.rm=TRUE)
 [1] 60.47552 57.75317 59.77976 55.15480 58.12970 61.93596 62.35414 56.92809
 [9] 52.85728 59.55827 60.06254 65.93303 61.19225 55.64550 57.66855 55.40926
[17] 55.08766 57.95304 58.20614 67.70486
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.49944 72.53693 70.11251      NaN 71.69762 73.73889 69.59039 72.81183
 [9] 71.07211 72.15113
> rowSums(tmp5,na.rm=TRUE)
 [1] 1769.989 1450.739 1402.250    0.000 1433.952 1474.778 1391.808 1456.237
 [9] 1421.442 1443.023
> rowVars(tmp5,na.rm=TRUE)
 [1] 8020.73621   53.65181   64.76250         NA   72.29581   94.04044
 [7]   81.11224   70.43885  100.02570   92.10791
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.558563  7.324740  8.047515        NA  8.502694  9.697445  9.006233
 [8]  8.392786 10.001285  9.597287
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.48824  87.40806  84.03098        NA  87.85226  90.37819  83.10318
 [8]  88.14667  83.75637  89.06885
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.26920 60.45296 58.14437       NA 56.72632 58.12104 55.08766 58.12970
 [9] 52.85728 55.33076
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.49310       NaN  71.84451  68.21618  71.56983  71.84352  75.86387
 [8]  69.04660  70.94133  69.06064  72.34065  74.22022  73.47769  73.71031
[15]  72.10532  69.74497  65.75967  68.97321  68.52745  74.34034
> colSums(tmp5,na.rm=TRUE)
 [1] 1030.4379    0.0000  646.6006  613.9456  644.1285  646.5917  682.7748
 [8]  621.4194  638.4720  621.5458  651.0659  667.9820  661.2992  663.3928
[15]  648.9479  627.7048  591.8370  620.7589  616.7470  669.0631
> colVars(tmp5,na.rm=TRUE)
 [1] 17576.89704          NA    41.01225   103.71732    84.83191    52.47168
 [7]    98.03934    73.46055   106.35342    40.75370    49.61505    20.25674
[13]   101.85448   103.17152    72.74055   132.61961    70.64072    74.12678
[19]    88.47117    22.61871
> colSd(tmp5,na.rm=TRUE)
 [1] 132.577890         NA   6.404081  10.184170   9.210424   7.243734
 [7]   9.901482   8.570913  10.312779   6.383862   7.043795   4.500749
[13]  10.092298  10.157338   8.528807  11.516059   8.404804   8.609691
[19]   9.405911   4.755914
> colMax(tmp5,na.rm=TRUE)
 [1] 467.48824      -Inf  78.91496  87.40806  85.82517  84.03098  86.43764
 [8]  82.26440  82.29448  81.23274  83.52620  81.48709  87.85226  88.14667
[15]  80.60569  89.06885  81.01779  79.71187  83.59866  80.64668
> colMin(tmp5,na.rm=TRUE)
 [1] 60.47552      Inf 59.77976 55.15480 58.12970 61.93596 62.35414 56.92809
 [9] 52.85728 59.55827 60.06254 67.19368 61.19225 55.64550 57.66855 55.40926
[17] 55.08766 58.12104 58.20614 67.70486
> 
> 
> 
> 
> 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] 453.3067 257.1329 183.9046 114.0317 236.8666 245.5217 165.4758 175.7394
 [9] 137.5179 262.1105
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 453.3067 257.1329 183.9046 114.0317 236.8666 245.5217 165.4758 175.7394
 [9] 137.5179 262.1105
> 
> 
> 
> 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] -2.273737e-13  0.000000e+00  8.526513e-14  8.526513e-14  2.842171e-14
 [6]  0.000000e+00 -8.526513e-14  5.684342e-14  8.526513e-14 -9.947598e-14
[11]  3.126388e-13 -5.684342e-14  8.526513e-14  8.526513e-14 -2.842171e-14
[16] -2.842171e-14 -2.842171e-14  0.000000e+00 -2.842171e-14  5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
2   12 
10   3 
4   16 
10   15 
10   15 
2   5 
3   19 
3   9 
9   20 
5   20 
8   20 
1   15 
10   6 
3   17 
3   13 
1   8 
2   15 
6   11 
8   12 
5   17 
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.781252
> Min(tmp)
[1] -2.133833
> mean(tmp)
[1] 0.003786894
> Sum(tmp)
[1] 0.3786894
> Var(tmp)
[1] 0.911379
> 
> rowMeans(tmp)
[1] 0.003786894
> rowSums(tmp)
[1] 0.3786894
> rowVars(tmp)
[1] 0.911379
> rowSd(tmp)
[1] 0.9546617
> rowMax(tmp)
[1] 2.781252
> rowMin(tmp)
[1] -2.133833
> 
> colMeans(tmp)
  [1]  1.105706289 -0.148350851 -1.341915112  2.199985818 -0.173379148
  [6] -0.027788553 -0.449748352 -0.142840336  1.184991923 -0.032298196
 [11]  1.470979330  0.090724414  1.067726760 -0.040739571 -0.636851201
 [16]  0.884643748  1.356068250 -0.578057158 -1.430800297  0.778742689
 [21] -0.240862303 -2.133833115 -1.441945494 -0.981008150  0.348614527
 [26]  0.249099220  0.052264252  0.537495922 -0.434539924 -0.062122045
 [31] -0.661105819 -0.123873785 -0.664375623 -0.536020597 -0.093565083
 [36]  1.460520717 -0.534493324 -1.115186989  1.543084228  1.629716959
 [41]  0.765184781  0.164585914  0.745613960  2.395467268 -0.859795891
 [46]  1.427017831  0.972462689  1.685933741 -0.004467749  0.170594784
 [51] -1.500742615  0.491407967 -0.410589722 -1.097760322 -0.161054062
 [56] -0.312386406  0.359159907  0.650032089 -0.833251595  0.965469255
 [61] -0.890421150 -1.251817495  0.584758431 -0.447493535  2.781252154
 [66] -1.651023873 -0.259473459  0.135979884 -0.796211555 -0.409120672
 [71] -0.242959829  1.041931084 -0.601591707  0.720674299  0.909534308
 [76]  0.521926057  0.205253627 -1.408373341 -0.461074063  1.004756162
 [81] -0.295059770 -0.451907946  0.839331282 -1.126268826 -0.019881382
 [86]  0.079810632 -0.727167884  1.495161351 -1.242226140  0.524652032
 [91] -0.494165412 -0.389166257 -1.473715215  0.210747929 -1.227294430
 [96]  0.031621431 -0.512115225 -0.111595673 -1.034288861 -0.731833375
> colSums(tmp)
  [1]  1.105706289 -0.148350851 -1.341915112  2.199985818 -0.173379148
  [6] -0.027788553 -0.449748352 -0.142840336  1.184991923 -0.032298196
 [11]  1.470979330  0.090724414  1.067726760 -0.040739571 -0.636851201
 [16]  0.884643748  1.356068250 -0.578057158 -1.430800297  0.778742689
 [21] -0.240862303 -2.133833115 -1.441945494 -0.981008150  0.348614527
 [26]  0.249099220  0.052264252  0.537495922 -0.434539924 -0.062122045
 [31] -0.661105819 -0.123873785 -0.664375623 -0.536020597 -0.093565083
 [36]  1.460520717 -0.534493324 -1.115186989  1.543084228  1.629716959
 [41]  0.765184781  0.164585914  0.745613960  2.395467268 -0.859795891
 [46]  1.427017831  0.972462689  1.685933741 -0.004467749  0.170594784
 [51] -1.500742615  0.491407967 -0.410589722 -1.097760322 -0.161054062
 [56] -0.312386406  0.359159907  0.650032089 -0.833251595  0.965469255
 [61] -0.890421150 -1.251817495  0.584758431 -0.447493535  2.781252154
 [66] -1.651023873 -0.259473459  0.135979884 -0.796211555 -0.409120672
 [71] -0.242959829  1.041931084 -0.601591707  0.720674299  0.909534308
 [76]  0.521926057  0.205253627 -1.408373341 -0.461074063  1.004756162
 [81] -0.295059770 -0.451907946  0.839331282 -1.126268826 -0.019881382
 [86]  0.079810632 -0.727167884  1.495161351 -1.242226140  0.524652032
 [91] -0.494165412 -0.389166257 -1.473715215  0.210747929 -1.227294430
 [96]  0.031621431 -0.512115225 -0.111595673 -1.034288861 -0.731833375
> 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.105706289 -0.148350851 -1.341915112  2.199985818 -0.173379148
  [6] -0.027788553 -0.449748352 -0.142840336  1.184991923 -0.032298196
 [11]  1.470979330  0.090724414  1.067726760 -0.040739571 -0.636851201
 [16]  0.884643748  1.356068250 -0.578057158 -1.430800297  0.778742689
 [21] -0.240862303 -2.133833115 -1.441945494 -0.981008150  0.348614527
 [26]  0.249099220  0.052264252  0.537495922 -0.434539924 -0.062122045
 [31] -0.661105819 -0.123873785 -0.664375623 -0.536020597 -0.093565083
 [36]  1.460520717 -0.534493324 -1.115186989  1.543084228  1.629716959
 [41]  0.765184781  0.164585914  0.745613960  2.395467268 -0.859795891
 [46]  1.427017831  0.972462689  1.685933741 -0.004467749  0.170594784
 [51] -1.500742615  0.491407967 -0.410589722 -1.097760322 -0.161054062
 [56] -0.312386406  0.359159907  0.650032089 -0.833251595  0.965469255
 [61] -0.890421150 -1.251817495  0.584758431 -0.447493535  2.781252154
 [66] -1.651023873 -0.259473459  0.135979884 -0.796211555 -0.409120672
 [71] -0.242959829  1.041931084 -0.601591707  0.720674299  0.909534308
 [76]  0.521926057  0.205253627 -1.408373341 -0.461074063  1.004756162
 [81] -0.295059770 -0.451907946  0.839331282 -1.126268826 -0.019881382
 [86]  0.079810632 -0.727167884  1.495161351 -1.242226140  0.524652032
 [91] -0.494165412 -0.389166257 -1.473715215  0.210747929 -1.227294430
 [96]  0.031621431 -0.512115225 -0.111595673 -1.034288861 -0.731833375
> colMin(tmp)
  [1]  1.105706289 -0.148350851 -1.341915112  2.199985818 -0.173379148
  [6] -0.027788553 -0.449748352 -0.142840336  1.184991923 -0.032298196
 [11]  1.470979330  0.090724414  1.067726760 -0.040739571 -0.636851201
 [16]  0.884643748  1.356068250 -0.578057158 -1.430800297  0.778742689
 [21] -0.240862303 -2.133833115 -1.441945494 -0.981008150  0.348614527
 [26]  0.249099220  0.052264252  0.537495922 -0.434539924 -0.062122045
 [31] -0.661105819 -0.123873785 -0.664375623 -0.536020597 -0.093565083
 [36]  1.460520717 -0.534493324 -1.115186989  1.543084228  1.629716959
 [41]  0.765184781  0.164585914  0.745613960  2.395467268 -0.859795891
 [46]  1.427017831  0.972462689  1.685933741 -0.004467749  0.170594784
 [51] -1.500742615  0.491407967 -0.410589722 -1.097760322 -0.161054062
 [56] -0.312386406  0.359159907  0.650032089 -0.833251595  0.965469255
 [61] -0.890421150 -1.251817495  0.584758431 -0.447493535  2.781252154
 [66] -1.651023873 -0.259473459  0.135979884 -0.796211555 -0.409120672
 [71] -0.242959829  1.041931084 -0.601591707  0.720674299  0.909534308
 [76]  0.521926057  0.205253627 -1.408373341 -0.461074063  1.004756162
 [81] -0.295059770 -0.451907946  0.839331282 -1.126268826 -0.019881382
 [86]  0.079810632 -0.727167884  1.495161351 -1.242226140  0.524652032
 [91] -0.494165412 -0.389166257 -1.473715215  0.210747929 -1.227294430
 [96]  0.031621431 -0.512115225 -0.111595673 -1.034288861 -0.731833375
> colMedians(tmp)
  [1]  1.105706289 -0.148350851 -1.341915112  2.199985818 -0.173379148
  [6] -0.027788553 -0.449748352 -0.142840336  1.184991923 -0.032298196
 [11]  1.470979330  0.090724414  1.067726760 -0.040739571 -0.636851201
 [16]  0.884643748  1.356068250 -0.578057158 -1.430800297  0.778742689
 [21] -0.240862303 -2.133833115 -1.441945494 -0.981008150  0.348614527
 [26]  0.249099220  0.052264252  0.537495922 -0.434539924 -0.062122045
 [31] -0.661105819 -0.123873785 -0.664375623 -0.536020597 -0.093565083
 [36]  1.460520717 -0.534493324 -1.115186989  1.543084228  1.629716959
 [41]  0.765184781  0.164585914  0.745613960  2.395467268 -0.859795891
 [46]  1.427017831  0.972462689  1.685933741 -0.004467749  0.170594784
 [51] -1.500742615  0.491407967 -0.410589722 -1.097760322 -0.161054062
 [56] -0.312386406  0.359159907  0.650032089 -0.833251595  0.965469255
 [61] -0.890421150 -1.251817495  0.584758431 -0.447493535  2.781252154
 [66] -1.651023873 -0.259473459  0.135979884 -0.796211555 -0.409120672
 [71] -0.242959829  1.041931084 -0.601591707  0.720674299  0.909534308
 [76]  0.521926057  0.205253627 -1.408373341 -0.461074063  1.004756162
 [81] -0.295059770 -0.451907946  0.839331282 -1.126268826 -0.019881382
 [86]  0.079810632 -0.727167884  1.495161351 -1.242226140  0.524652032
 [91] -0.494165412 -0.389166257 -1.473715215  0.210747929 -1.227294430
 [96]  0.031621431 -0.512115225 -0.111595673 -1.034288861 -0.731833375
> colRanges(tmp)
         [,1]       [,2]      [,3]     [,4]       [,5]        [,6]       [,7]
[1,] 1.105706 -0.1483509 -1.341915 2.199986 -0.1733791 -0.02778855 -0.4497484
[2,] 1.105706 -0.1483509 -1.341915 2.199986 -0.1733791 -0.02778855 -0.4497484
           [,8]     [,9]      [,10]    [,11]      [,12]    [,13]       [,14]
[1,] -0.1428403 1.184992 -0.0322982 1.470979 0.09072441 1.067727 -0.04073957
[2,] -0.1428403 1.184992 -0.0322982 1.470979 0.09072441 1.067727 -0.04073957
          [,15]     [,16]    [,17]      [,18]   [,19]     [,20]      [,21]
[1,] -0.6368512 0.8846437 1.356068 -0.5780572 -1.4308 0.7787427 -0.2408623
[2,] -0.6368512 0.8846437 1.356068 -0.5780572 -1.4308 0.7787427 -0.2408623
         [,22]     [,23]      [,24]     [,25]     [,26]      [,27]     [,28]
[1,] -2.133833 -1.441945 -0.9810082 0.3486145 0.2490992 0.05226425 0.5374959
[2,] -2.133833 -1.441945 -0.9810082 0.3486145 0.2490992 0.05226425 0.5374959
          [,29]       [,30]      [,31]      [,32]      [,33]      [,34]
[1,] -0.4345399 -0.06212205 -0.6611058 -0.1238738 -0.6643756 -0.5360206
[2,] -0.4345399 -0.06212205 -0.6611058 -0.1238738 -0.6643756 -0.5360206
           [,35]    [,36]      [,37]     [,38]    [,39]    [,40]     [,41]
[1,] -0.09356508 1.460521 -0.5344933 -1.115187 1.543084 1.629717 0.7651848
[2,] -0.09356508 1.460521 -0.5344933 -1.115187 1.543084 1.629717 0.7651848
         [,42]    [,43]    [,44]      [,45]    [,46]     [,47]    [,48]
[1,] 0.1645859 0.745614 2.395467 -0.8597959 1.427018 0.9724627 1.685934
[2,] 0.1645859 0.745614 2.395467 -0.8597959 1.427018 0.9724627 1.685934
            [,49]     [,50]     [,51]    [,52]      [,53]    [,54]      [,55]
[1,] -0.004467749 0.1705948 -1.500743 0.491408 -0.4105897 -1.09776 -0.1610541
[2,] -0.004467749 0.1705948 -1.500743 0.491408 -0.4105897 -1.09776 -0.1610541
          [,56]     [,57]     [,58]      [,59]     [,60]      [,61]     [,62]
[1,] -0.3123864 0.3591599 0.6500321 -0.8332516 0.9654693 -0.8904212 -1.251817
[2,] -0.3123864 0.3591599 0.6500321 -0.8332516 0.9654693 -0.8904212 -1.251817
         [,63]      [,64]    [,65]     [,66]      [,67]     [,68]      [,69]
[1,] 0.5847584 -0.4474935 2.781252 -1.651024 -0.2594735 0.1359799 -0.7962116
[2,] 0.5847584 -0.4474935 2.781252 -1.651024 -0.2594735 0.1359799 -0.7962116
          [,70]      [,71]    [,72]      [,73]     [,74]     [,75]     [,76]
[1,] -0.4091207 -0.2429598 1.041931 -0.6015917 0.7206743 0.9095343 0.5219261
[2,] -0.4091207 -0.2429598 1.041931 -0.6015917 0.7206743 0.9095343 0.5219261
         [,77]     [,78]      [,79]    [,80]      [,81]      [,82]     [,83]
[1,] 0.2052536 -1.408373 -0.4610741 1.004756 -0.2950598 -0.4519079 0.8393313
[2,] 0.2052536 -1.408373 -0.4610741 1.004756 -0.2950598 -0.4519079 0.8393313
         [,84]       [,85]      [,86]      [,87]    [,88]     [,89]    [,90]
[1,] -1.126269 -0.01988138 0.07981063 -0.7271679 1.495161 -1.242226 0.524652
[2,] -1.126269 -0.01988138 0.07981063 -0.7271679 1.495161 -1.242226 0.524652
          [,91]      [,92]     [,93]     [,94]     [,95]      [,96]      [,97]
[1,] -0.4941654 -0.3891663 -1.473715 0.2107479 -1.227294 0.03162143 -0.5121152
[2,] -0.4941654 -0.3891663 -1.473715 0.2107479 -1.227294 0.03162143 -0.5121152
          [,98]     [,99]     [,100]
[1,] -0.1115957 -1.034289 -0.7318334
[2,] -0.1115957 -1.034289 -0.7318334
> 
> 
> Max(tmp2)
[1] 3.244247
> Min(tmp2)
[1] -3.076514
> mean(tmp2)
[1] -0.0474132
> Sum(tmp2)
[1] -4.74132
> Var(tmp2)
[1] 1.055154
> 
> rowMeans(tmp2)
  [1]  1.205427655 -0.457390839  0.328280841 -1.539021933  1.154740428
  [6] -0.152173348 -0.567860502 -1.489376942 -0.262564278 -0.261542549
 [11]  0.707336339 -0.365889306 -0.703421578 -1.031977626  0.875619197
 [16] -0.406808773 -0.284944218 -1.062181451 -1.072610401  0.157607819
 [21]  1.234571731 -0.648025985 -0.165524160  0.002908584 -1.571257701
 [26]  0.720840604  0.599908534  0.124183935  0.903786466  0.980190745
 [31] -1.047959841  0.277428878 -1.767471680 -1.871015898  0.818190022
 [36] -0.364575565  0.212698999  1.470242439 -0.321388546 -0.299626545
 [41] -0.518456148 -1.712943211  2.289785692 -0.176566869 -0.596498064
 [46] -0.265553296  0.539158622 -0.204329525 -0.567536609  1.698434888
 [51] -0.694747579  0.173902330 -1.290392045  1.192423752  0.283156791
 [56]  0.350964459 -0.561298162  0.187495400  0.177118511  1.429789409
 [61]  0.943068139 -0.229251340  1.204059672 -0.173258442  0.683522246
 [66]  2.103328525  0.904204660 -1.452847037 -0.785898427 -0.258938989
 [71]  0.629348947  0.593905585 -0.220888838 -3.076513744 -0.013963524
 [76] -0.365913523 -0.917170188  0.396785364  1.310603731  0.256112531
 [81]  0.520439400 -0.721994798 -2.217568536 -0.947879649  0.158963184
 [86] -0.145299729 -1.264331461  0.630106569 -2.274484199  0.203904396
 [91] -0.756575613  0.484602915 -0.678943882  0.956302221 -1.192129996
 [96]  0.269085798  1.355816125  0.435062356  3.244246605 -0.124199243
> rowSums(tmp2)
  [1]  1.205427655 -0.457390839  0.328280841 -1.539021933  1.154740428
  [6] -0.152173348 -0.567860502 -1.489376942 -0.262564278 -0.261542549
 [11]  0.707336339 -0.365889306 -0.703421578 -1.031977626  0.875619197
 [16] -0.406808773 -0.284944218 -1.062181451 -1.072610401  0.157607819
 [21]  1.234571731 -0.648025985 -0.165524160  0.002908584 -1.571257701
 [26]  0.720840604  0.599908534  0.124183935  0.903786466  0.980190745
 [31] -1.047959841  0.277428878 -1.767471680 -1.871015898  0.818190022
 [36] -0.364575565  0.212698999  1.470242439 -0.321388546 -0.299626545
 [41] -0.518456148 -1.712943211  2.289785692 -0.176566869 -0.596498064
 [46] -0.265553296  0.539158622 -0.204329525 -0.567536609  1.698434888
 [51] -0.694747579  0.173902330 -1.290392045  1.192423752  0.283156791
 [56]  0.350964459 -0.561298162  0.187495400  0.177118511  1.429789409
 [61]  0.943068139 -0.229251340  1.204059672 -0.173258442  0.683522246
 [66]  2.103328525  0.904204660 -1.452847037 -0.785898427 -0.258938989
 [71]  0.629348947  0.593905585 -0.220888838 -3.076513744 -0.013963524
 [76] -0.365913523 -0.917170188  0.396785364  1.310603731  0.256112531
 [81]  0.520439400 -0.721994798 -2.217568536 -0.947879649  0.158963184
 [86] -0.145299729 -1.264331461  0.630106569 -2.274484199  0.203904396
 [91] -0.756575613  0.484602915 -0.678943882  0.956302221 -1.192129996
 [96]  0.269085798  1.355816125  0.435062356  3.244246605 -0.124199243
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  1.205427655 -0.457390839  0.328280841 -1.539021933  1.154740428
  [6] -0.152173348 -0.567860502 -1.489376942 -0.262564278 -0.261542549
 [11]  0.707336339 -0.365889306 -0.703421578 -1.031977626  0.875619197
 [16] -0.406808773 -0.284944218 -1.062181451 -1.072610401  0.157607819
 [21]  1.234571731 -0.648025985 -0.165524160  0.002908584 -1.571257701
 [26]  0.720840604  0.599908534  0.124183935  0.903786466  0.980190745
 [31] -1.047959841  0.277428878 -1.767471680 -1.871015898  0.818190022
 [36] -0.364575565  0.212698999  1.470242439 -0.321388546 -0.299626545
 [41] -0.518456148 -1.712943211  2.289785692 -0.176566869 -0.596498064
 [46] -0.265553296  0.539158622 -0.204329525 -0.567536609  1.698434888
 [51] -0.694747579  0.173902330 -1.290392045  1.192423752  0.283156791
 [56]  0.350964459 -0.561298162  0.187495400  0.177118511  1.429789409
 [61]  0.943068139 -0.229251340  1.204059672 -0.173258442  0.683522246
 [66]  2.103328525  0.904204660 -1.452847037 -0.785898427 -0.258938989
 [71]  0.629348947  0.593905585 -0.220888838 -3.076513744 -0.013963524
 [76] -0.365913523 -0.917170188  0.396785364  1.310603731  0.256112531
 [81]  0.520439400 -0.721994798 -2.217568536 -0.947879649  0.158963184
 [86] -0.145299729 -1.264331461  0.630106569 -2.274484199  0.203904396
 [91] -0.756575613  0.484602915 -0.678943882  0.956302221 -1.192129996
 [96]  0.269085798  1.355816125  0.435062356  3.244246605 -0.124199243
> rowMin(tmp2)
  [1]  1.205427655 -0.457390839  0.328280841 -1.539021933  1.154740428
  [6] -0.152173348 -0.567860502 -1.489376942 -0.262564278 -0.261542549
 [11]  0.707336339 -0.365889306 -0.703421578 -1.031977626  0.875619197
 [16] -0.406808773 -0.284944218 -1.062181451 -1.072610401  0.157607819
 [21]  1.234571731 -0.648025985 -0.165524160  0.002908584 -1.571257701
 [26]  0.720840604  0.599908534  0.124183935  0.903786466  0.980190745
 [31] -1.047959841  0.277428878 -1.767471680 -1.871015898  0.818190022
 [36] -0.364575565  0.212698999  1.470242439 -0.321388546 -0.299626545
 [41] -0.518456148 -1.712943211  2.289785692 -0.176566869 -0.596498064
 [46] -0.265553296  0.539158622 -0.204329525 -0.567536609  1.698434888
 [51] -0.694747579  0.173902330 -1.290392045  1.192423752  0.283156791
 [56]  0.350964459 -0.561298162  0.187495400  0.177118511  1.429789409
 [61]  0.943068139 -0.229251340  1.204059672 -0.173258442  0.683522246
 [66]  2.103328525  0.904204660 -1.452847037 -0.785898427 -0.258938989
 [71]  0.629348947  0.593905585 -0.220888838 -3.076513744 -0.013963524
 [76] -0.365913523 -0.917170188  0.396785364  1.310603731  0.256112531
 [81]  0.520439400 -0.721994798 -2.217568536 -0.947879649  0.158963184
 [86] -0.145299729 -1.264331461  0.630106569 -2.274484199  0.203904396
 [91] -0.756575613  0.484602915 -0.678943882  0.956302221 -1.192129996
 [96]  0.269085798  1.355816125  0.435062356  3.244246605 -0.124199243
> 
> colMeans(tmp2)
[1] -0.0474132
> colSums(tmp2)
[1] -4.74132
> colVars(tmp2)
[1] 1.055154
> colSd(tmp2)
[1] 1.027207
> colMax(tmp2)
[1] 3.244247
> colMin(tmp2)
[1] -3.076514
> colMedians(tmp2)
[1] -0.1487365
> colRanges(tmp2)
          [,1]
[1,] -3.076514
[2,]  3.244247
> 
> 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]  1.9820844 -3.9101074 -1.2073149  2.6761063 -1.9950903 -0.2532113
 [7]  5.7936542 -1.8462114 -4.5923013  4.3528763
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5358330
[2,] -0.1168098
[3,]  0.2584932
[4,]  0.7971450
[5,]  1.2657024
> 
> rowApply(tmp,sum)
 [1] -1.1491012  4.0347322  2.7144346  0.8285878 -0.4943322 -5.0539162
 [7]  1.5459491  3.7915341 -0.4599451 -4.7574584
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    5    8    4    2    6   10    9    6    7     1
 [2,]    2    6    7    3    1    9    5    8    2     3
 [3,]    4    7    2    5    7    7    6    5    4     5
 [4,]    3    5   10    4    5    2    4    3    8    10
 [5,]   10    2    1    9    2    4    2    7    6     7
 [6,]    1    4    9    6    4    8    8    1    5     4
 [7,]    9    9    5    7    9    5    7    9    9     9
 [8,]    7    3    3   10   10    3    1   10    3     8
 [9,]    8    1    6    1    3    1   10    2    1     2
[10,]    6   10    8    8    8    6    3    4   10     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.18299748 -2.49280969 -2.52710214 -0.64421877  1.10959616 -2.14558995
 [7]  1.55317615  0.04512242 -3.99142762  1.23227163 -1.34333254  1.23675681
[13]  2.11355122  0.40774576  0.99406549  4.13756828 -2.42275269 -0.12848672
[19]  0.69769688 -1.47830080
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.8055477
[2,] -0.2726038
[3,]  0.9812235
[4,]  1.5512812
[5,]  1.7286442
> 
> rowApply(tmp,sum)
[1] -3.818081 -3.387610  5.857276  2.867131 -1.982188
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6    8   17   19   20
[2,]    5   12    7    2   11
[3,]    4    3   11   17    1
[4,]    9    7   14    3   15
[5,]   20    2   12    7   19
> 
> 
> as.matrix(tmp)
           [,1]        [,2]      [,3]       [,4]       [,5]       [,6]
[1,] -0.8055477 -1.05155385 -1.078372 -0.4914937  1.4339433 -0.5894654
[2,] -0.2726038  0.21460725 -1.745776 -0.4440643 -1.8370973 -1.8803689
[3,]  0.9812235  0.05293184  0.341002  0.9572427  0.4455143 -0.1432363
[4,]  1.7286442 -1.58243499  1.223581 -1.2957710 -0.1187756  1.5859173
[5,]  1.5512812 -0.12635994 -1.267537  0.6298676  1.1860114 -1.1184366
           [,7]       [,8]       [,9]      [,10]       [,11]      [,12]
[1,]  0.7252927  1.1133228 -3.2266231 -0.3606952  1.05201358  0.2347720
[2,] -0.1978496  1.9257658 -1.4919075  0.3954980  0.68121453  0.7256410
[3,]  1.3226907 -1.1369285 -0.1791647  0.2976375 -2.07808858 -0.2635128
[4,]  0.4714212 -0.8870772  0.1066370  0.5940975  0.02937377  0.7146902
[5,] -0.7683787 -0.9699604  0.7996306  0.3057338 -1.02784583 -0.1748336
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -0.7741243  0.6604124 -1.1291490  0.6340102 -1.5548909  0.3832863
[2,]  0.4427914 -0.1243058  0.6008724  0.9898195 -1.5885565 -0.8141257
[3,]  0.9757169  0.3390115  1.4005043  1.4227408  0.2965446  0.9585861
[4,]  0.3912606  0.3396464 -0.3578290  1.8570770 -0.1123460  0.5301359
[5,]  1.0779066 -0.8070188  0.4796668 -0.7660793  0.5364961 -1.1863692
           [,19]      [,20]
[1,]  0.06633954  0.9404411
[2,]  0.91645527  0.1163800
[3,]  0.67234838 -0.8054882
[4,] -1.88391747 -0.4671993
[5,]  0.92647116 -1.2624345
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1     col2       col3      col4     col5       col6      col7
row1 0.05235542 -1.20462 -0.9656507 -1.090947 0.840571 0.09357325 -0.535268
          col8      col9    col10    col11     col12     col13     col14
row1 0.8840218 0.4736145 0.335435 1.989209 -0.402684 -1.258364 0.7630695
           col15    col16     col17      col18   col19        col20
row1 -0.01063844 0.760407 0.8548113 -0.5797787 1.38549 -0.006105789
> tmp[,"col10"]
         col10
row1 0.3354350
row2 1.1998839
row3 0.3048637
row4 0.6602830
row5 0.5043884
> tmp[c("row1","row5"),]
           col1       col2       col3       col4       col5       col6
row1 0.05235542 -1.2046204 -0.9656507 -1.0909468  0.8405710 0.09357325
row5 0.93533164  0.2367815  0.6928933 -0.5606234 -0.3016924 2.00081318
          col7       col8       col9     col10    col11     col12     col13
row1 -0.535268  0.8840218  0.4736145 0.3354350 1.989209 -0.402684 -1.258364
row5  2.112524 -0.7314354 -0.1078632 0.5043884 0.768892 -1.002206 -1.231196
         col14       col15     col16     col17      col18      col19
row1 0.7630695 -0.01063844  0.760407 0.8548113 -0.5797787  1.3854902
row5 0.6889428  0.32028961 -0.399712 0.8149038 -1.0724496 -0.5348033
            col20
row1 -0.006105789
row5  0.776305937
> tmp[,c("col6","col20")]
            col6        col20
row1  0.09357325 -0.006105789
row2 -0.28156469 -0.443277041
row3  1.30750218  1.213512413
row4 -1.28583343  0.669086045
row5  2.00081318  0.776305937
> tmp[c("row1","row5"),c("col6","col20")]
           col6        col20
row1 0.09357325 -0.006105789
row5 2.00081318  0.776305937
> 
> 
> 
> 
> 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.42361 50.64519 49.88638 48.12533 51.08461 105.9231 49.23198 50.3299
         col9    col10    col11   col12    col13    col14    col15    col16
row1 48.81616 47.33353 50.05274 50.5834 49.13327 49.83474 50.80847 51.46156
        col17    col18    col19    col20
row1 50.45386 50.30609 48.56487 104.2848
> tmp[,"col10"]
        col10
row1 47.33353
row2 31.49672
row3 30.80802
row4 28.42879
row5 50.03586
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.42361 50.64519 49.88638 48.12533 51.08461 105.9231 49.23198 50.32990
row5 50.74609 50.26107 49.64672 50.09223 49.65722 103.4518 50.15938 49.53285
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.81616 47.33353 50.05274 50.58340 49.13327 49.83474 50.80847 51.46156
row5 49.01725 50.03586 49.73632 50.00594 49.87342 49.46039 50.59400 51.22846
        col17    col18    col19    col20
row1 50.45386 50.30609 48.56487 104.2848
row5 48.82692 49.78267 50.06632 105.5888
> tmp[,c("col6","col20")]
          col6     col20
row1 105.92315 104.28479
row2  74.53614  74.62126
row3  74.79249  75.97816
row4  75.55508  74.05790
row5 103.45178 105.58879
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.9231 104.2848
row5 103.4518 105.5888
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.9231 104.2848
row5 103.4518 105.5888
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.4439909
[2,] -0.4642162
[3,]  0.1706559
[4,] -0.2120447
[5,]  1.4354746
> tmp[,c("col17","col7")]
          col17        col7
[1,]  0.9971753  0.68025451
[2,] -1.5154798 -0.32460178
[3,]  1.1211297  3.01257546
[4,]  1.6063282  0.35029739
[5,] -0.1858421  0.05123272
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,]  1.51845002 -0.4261582
[2,] -1.00028038 -0.4818241
[3,]  0.09412242  2.4058847
[4,] -1.75538644 -1.5384433
[5,]  0.64970540 -0.7402479
> subBufferedMatrix(tmp,1,c("col6"))[,1]
        col1
[1,] 1.51845
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
         col6
[1,]  1.51845
[2,] -1.00028
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]       [,4]      [,5]       [,6]
row3 -0.2390798  0.3865937  0.6933823  0.8617728 1.0838351  0.3483824
row1 -0.9571761 -2.4138213 -0.5956025 -0.3994133 0.5422996 -1.1230703
            [,7]      [,8]       [,9]      [,10]    [,11]     [,12]      [,13]
row3 -0.61254970 -0.697848  0.3970973 -0.3352101 1.220627 0.7441411  0.2697051
row1 -0.06830471 -1.493222 -1.4856209  0.4794322 1.797827 0.8393974 -1.4483837
         [,14]    [,15]       [,16]      [,17]       [,18]     [,19]     [,20]
row3 -1.514035 1.854812  0.71678579 -0.8311669  0.06797271 0.5704959 0.9101099
row1 -1.747439 2.848005 -0.07740968 -0.5284791 -0.50336313 0.9175124 1.5359176
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]      [,2]      [,3]     [,4]      [,5]       [,6]      [,7]
row2 1.333985 0.0296909 -1.045474 1.023356 -3.432362 -0.4269969 -1.101885
          [,8]     [,9]     [,10]
row2 0.8857883 1.115738 0.1114478
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
            [,1]       [,2]     [,3]      [,4]       [,5]      [,6]        [,7]
row5 -0.08856461 -0.7858026 0.732044 0.7581299 -0.5565398 0.4200934 -0.08746156
          [,8]      [,9]     [,10]     [,11]    [,12]     [,13]     [,14]
row5 0.5482436 0.3637481 0.5994703 0.3816235 1.048535 0.6237659 -1.014636
        [,15]     [,16]     [,17]     [,18]    [,19]      [,20]
row5 1.280052 -1.068402 -3.003649 -0.874382 0.466016 -0.2293498
> 
> 
> 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: 0x561d1cf68e90>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020aae67202" 
 [2] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a51f9bf42"
 [3] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a11c60a02"
 [4] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a93ca8ce" 
 [5] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a6a3c1f5" 
 [6] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a249c0159"
 [7] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a17fd3c55"
 [8] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a78e14dca"
 [9] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a2e92049f"
[10] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a72c4785e"
[11] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a4f11584" 
[12] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a74d184f4"
[13] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a215ae8a9"
[14] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a63ffd42c"
[15] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM15020a5f129ad6"
> 
> 
> ### 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: 0x561d2079f840>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x561d2079f840>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x561d2079f840>
> rowMedians(tmp)
  [1] -0.638369472  0.432647489  0.174856407 -0.201667453  0.001912438
  [6]  0.269526575  0.393254033  0.068933670 -0.534968186  0.453443612
 [11] -0.370777623  0.201955603 -0.359645101 -0.236231922 -0.019842906
 [16]  0.100813479 -0.013810847 -0.049950668  0.504903556  0.196941869
 [21] -0.452408613 -0.058938431 -0.211656938  0.156496275  0.076008695
 [26]  0.295573337 -0.104822761 -0.123321793  0.273550253  0.190863030
 [31]  0.043943039  0.006042233  0.062762060  0.269600519 -0.323879814
 [36] -0.567855943 -0.581722141  0.148098328 -0.958151087  0.066626377
 [41] -0.243200416  0.025564808  0.004000812 -0.129188930  0.496189748
 [46]  0.040203998  0.020344000  0.252306013  0.340934209 -0.083957288
 [51]  0.216575210 -0.277007169  0.237091082 -0.692992185 -0.005379424
 [56] -0.717554494  0.007186337  0.168116247 -0.191862561 -0.298418849
 [61]  0.232969914 -0.184681502  0.258795566 -0.303824333  0.003154686
 [66]  0.246712992  0.098207924 -0.076113440  0.015185545 -0.947504235
 [71] -0.060341789 -0.074596406 -0.154954941 -0.133167386  0.014215322
 [76]  0.081215354 -0.387681880  0.003067599 -0.245640759 -0.074937097
 [81]  0.050222578 -0.141492873 -0.082444478 -0.194398692  0.227620368
 [86] -0.241183342  0.256458358 -0.371276903 -0.108045467  0.035706841
 [91] -0.030290675 -0.231758979  0.341218270  0.003476616 -0.044429529
 [96]  0.023840570  0.170048331 -0.678113599  0.005566498  0.174269909
[101]  0.037290876  0.063231900  0.092437808 -0.124983254  0.389290053
[106]  0.043018425 -0.484109103  0.011065840 -0.395551873 -0.230065099
[111]  0.286712450  0.370633851 -0.494218531  0.335292990  0.481387515
[116]  0.044730852  0.140993463  0.157607820 -0.329659900  0.070675066
[121]  0.134698199 -0.170042102  0.022570565  0.087303953 -0.570717466
[126] -0.195732451  0.011732601  0.059899398 -0.404680324  0.230693079
[131] -0.073286305  0.242470187  0.063712359  0.073382521  0.342958444
[136]  0.471033117  0.556020556 -0.506427837 -0.000559178 -0.183703293
[141]  0.190739026  0.032829346 -0.234562251  0.901367506 -0.220254318
[146]  0.147940817 -0.174652453 -0.659135987 -0.029611334 -0.124240122
[151] -0.185548612  0.823347552  0.226455526 -0.087572858 -0.119105115
[156] -0.139055113  0.260353695 -0.317683014 -0.694050489  0.016291491
[161] -0.025024660  0.029840873 -0.213610829  0.248434379 -0.361335416
[166]  0.030778619  0.037689743  0.510087908 -0.169592800  0.157852947
[171] -0.153214630  0.232356318 -0.135898696  0.248876907 -0.330201876
[176] -0.332974384 -0.059269190 -0.261091602 -0.108810573  0.423444772
[181]  0.602814515  0.346913837  0.290358544  0.433567755  0.977400717
[186]  0.530114055 -0.651185654  0.946017263  0.256788288  0.054464708
[191]  0.217580269 -0.045285727  0.091394979 -0.319308406  0.189193012
[196]  0.189697426 -0.189769634 -0.412964168  0.153953388  0.016960229
[201]  0.314360488 -0.316121272  0.006496640  0.146170501 -0.249577039
[206] -0.046366995  0.710263383  0.490662099 -0.048391405 -0.447409486
[211]  0.426998207 -0.171968605 -0.026121783  0.157164717  0.235989464
[216] -0.316267052 -0.459815454 -0.316934716  0.127289651 -0.411106181
[221] -0.260797033 -0.544218632  0.220457386  0.100593386  0.476825479
[226] -0.127606904  0.748515689  0.023702494  0.006243927  0.101278140
> 
> proc.time()
   user  system elapsed 
  1.322   0.610   1.918 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2023-02-14 r83833) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x55f9363fe880>
> .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: 0x55f9363fe880>
> .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: 0x55f9363fe880>
> .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: 0x55f9363fe880>
> 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: 0x55f9363432a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f9363432a0>
> .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: 0x55f9363432a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f9363432a0>
> .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: 0x55f9363432a0>
> 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: 0x55f934098860>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f934098860>
> .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: 0x55f934098860>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55f934098860>
> .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: 0x55f934098860>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x55f934098860>
> .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: 0x55f934098860>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x55f934098860>
> .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: 0x55f934098860>
> 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: 0x55f934a56630>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x55f934a56630>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f934a56630>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f934a56630>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1504d516c578"   "BufferedMatrixFile1504d53058f6b6"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1504d516c578"   "BufferedMatrixFile1504d53058f6b6"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f934aeba30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f934aeba30>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55f934aeba30>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55f934aeba30>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x55f934aeba30>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x55f934aeba30>
> .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: 0x55f9345f8900>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55f9345f8900>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55f9345f8900>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x55f9345f8900>
> 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: 0x55f935b1d4e0>
> .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: 0x55f935b1d4e0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.258   0.052   0.294 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2023-02-14 r83833) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.308   0.044   0.337 

Example timings