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

This page was generated on 2023-02-27 02:34:30 -0000 (Mon, 27 Feb 2023).

HostnameOSArch (*)R versionInstalled pkgs
kunpeng1Linux (Ubuntu 22.04.1 LTS)aarch64R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences" 4259
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 kunpeng1


To the developers/maintainers of the BufferedMatrix package:
- Please 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 How and When does the builder pull? When will my changes propagate? for more information.
- Make sure to use the following settings in order to reproduce any error or warning you see on this page.

raw results

Package 228/2169HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.63.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-02-23 09:40:21 -0000 (Thu, 23 Feb 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: master
git_last_commit: e95ad0a
git_last_commit_date: 2022-11-01 14:42:48 -0000 (Tue, 01 Nov 2022)
kunpeng1Linux (Ubuntu 22.04.1 LTS) / aarch64  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/library --timings BufferedMatrix_1.63.0.tar.gz
StartedAt: 2023-02-24 08:11:13 -0000 (Fri, 24 Feb 2023)
EndedAt: 2023-02-24 08:11:48 -0000 (Fri, 24 Feb 2023)
EllapsedTime: 35.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/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-01-14 r83615)
* using platform: aarch64-unknown-linux-gnu (64-bit)
* R was compiled by
    gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
    GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
* running under: Ubuntu 22.04.1 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 11.3.0-1ubuntu1~22.04) 11.3.0’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking 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 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/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.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/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-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-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.331   0.064   0.380 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-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 456993 24.5     979984 52.4   651420 34.8
Vcells 842364  6.5    8388608 64.0  2047783 15.7
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Fri Feb 24 08:11:33 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] "Fri Feb 24 08:11:33 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: 0xaaab1cea7910>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Fri Feb 24 08:11:33 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] "Fri Feb 24 08:11:33 2023"
> 
> ColMode(tmp2)
<pointer: 0xaaab1cea7910>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]      [,3]       [,4]
[1,] 100.2595668 -0.1589055  1.611628  0.2625203
[2,]   1.1856836  0.4252815 -1.916579 -1.1262262
[3,]  -0.2585755  1.0257944  1.495150 -1.1573463
[4,]   0.7437231 -0.3810803  2.556633 -0.4282077
> 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,] 100.2595668 0.1589055 1.611628 0.2625203
[2,]   1.1856836 0.4252815 1.916579 1.1262262
[3,]   0.2585755 1.0257944 1.495150 1.1573463
[4,]   0.7437231 0.3810803 2.556633 0.4282077
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]     [,3]      [,4]
[1,] 10.0129699 0.3986295 1.269499 0.5123673
[2,]  1.0888910 0.6521361 1.384406 1.0612381
[3,]  0.5085032 1.0128151 1.222763 1.0758003
[4,]  0.8623938 0.6173170 1.598947 0.6543758
> 
> 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,] 225.38927 29.14520 39.30662 30.38619
[2,]  37.07459 31.94664 40.76064 36.73861
[3,]  30.34361 36.15395 38.72278 36.91535
[4,]  34.36766 31.55425 43.54611 31.97197
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0xaaab1c626470>
> exp(tmp5)
<pointer: 0xaaab1c626470>
> log(tmp5,2)
<pointer: 0xaaab1c626470>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.1182
> Min(tmp5)
[1] 55.28219
> mean(tmp5)
[1] 73.40595
> Sum(tmp5)
[1] 14681.19
> Var(tmp5)
[1] 852.1027
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.73326 72.26012 71.17121 69.28110 70.89375 72.32696 74.96421 69.69279
 [9] 71.04480 72.69127
> rowSums(tmp5)
 [1] 1794.665 1445.202 1423.424 1385.622 1417.875 1446.539 1499.284 1393.856
 [9] 1420.896 1453.825
> rowVars(tmp5)
 [1] 8069.57108   66.90386   67.02677   58.03981   52.60736   66.85815
 [7]   42.16218   21.91113   48.93400   94.13527
> rowSd(tmp5)
 [1] 89.830791  8.179478  8.186988  7.618386  7.253093  8.176683  6.493241
 [8]  4.680932  6.995284  9.702333
> rowMax(tmp5)
 [1] 469.11823  87.71707  87.18016  90.63551  88.41088  87.75929  87.58849
 [8]  78.86324  87.47546  92.10785
> rowMin(tmp5)
 [1] 55.28219 56.09955 56.13541 56.59591 57.55937 56.85017 62.41352 61.46430
 [9] 59.76577 60.45770
> 
> colMeans(tmp5)
 [1] 111.69852  69.19721  78.00105  72.54220  70.79490  72.66650  68.60633
 [8]  72.29317  67.25244  73.06701  71.82605  68.98919  69.81432  73.09453
[15]  72.60086  69.60669  66.89889  71.75471  74.02565  73.38874
> colSums(tmp5)
 [1] 1116.9852  691.9721  780.0105  725.4220  707.9490  726.6650  686.0633
 [8]  722.9317  672.5244  730.6701  718.2605  689.8919  698.1432  730.9453
[15]  726.0086  696.0669  668.9889  717.5471  740.2565  733.8874
> colVars(tmp5)
 [1] 15856.44875    44.20363    73.58102    38.01539    58.10724    62.81929
 [7]    66.20005    69.43729    23.74277    50.75008    68.81719    87.52739
[13]    80.12049    36.62579    60.10513    67.65868    58.41733    36.46856
[19]    50.13242    95.03454
> colSd(tmp5)
 [1] 125.922392   6.648581   8.577938   6.165662   7.622810   7.925862
 [7]   8.136341   8.332904   4.872655   7.123909   8.295613   9.355607
[13]   8.951005   6.051925   7.752750   8.225490   7.643123   6.038920
[19]   7.080425   9.748566
> colMax(tmp5)
 [1] 469.11823  77.97521  90.63551  84.48165  81.85310  87.18016  77.82651
 [8]  87.47546  75.02052  86.46882  87.58849  81.97076  89.46810  84.30296
[15]  87.71707  79.00181  77.33614  78.53875  88.41088  87.75929
> colMin(tmp5)
 [1] 59.76577 60.45770 62.13828 63.24488 63.08620 61.94177 56.85017 60.33417
 [9] 56.79904 62.62613 61.53147 56.09955 59.88043 64.06193 63.06553 55.28219
[17] 56.13541 60.70396 64.04682 61.46430
> 
> 
> ### 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] 89.73326 72.26012 71.17121 69.28110 70.89375 72.32696 74.96421 69.69279
 [9] 71.04480       NA
> rowSums(tmp5)
 [1] 1794.665 1445.202 1423.424 1385.622 1417.875 1446.539 1499.284 1393.856
 [9] 1420.896       NA
> rowVars(tmp5)
 [1] 8069.57108   66.90386   67.02677   58.03981   52.60736   66.85815
 [7]   42.16218   21.91113   48.93400   92.35025
> rowSd(tmp5)
 [1] 89.830791  8.179478  8.186988  7.618386  7.253093  8.176683  6.493241
 [8]  4.680932  6.995284  9.609904
> rowMax(tmp5)
 [1] 469.11823  87.71707  87.18016  90.63551  88.41088  87.75929  87.58849
 [8]  78.86324  87.47546        NA
> rowMin(tmp5)
 [1] 55.28219 56.09955 56.13541 56.59591 57.55937 56.85017 62.41352 61.46430
 [9] 59.76577       NA
> 
> colMeans(tmp5)
 [1] 111.69852  69.19721  78.00105  72.54220  70.79490  72.66650  68.60633
 [8]  72.29317  67.25244  73.06701  71.82605  68.98919  69.81432  73.09453
[15]  72.60086  69.60669        NA  71.75471  74.02565  73.38874
> colSums(tmp5)
 [1] 1116.9852  691.9721  780.0105  725.4220  707.9490  726.6650  686.0633
 [8]  722.9317  672.5244  730.6701  718.2605  689.8919  698.1432  730.9453
[15]  726.0086  696.0669        NA  717.5471  740.2565  733.8874
> colVars(tmp5)
 [1] 15856.44875    44.20363    73.58102    38.01539    58.10724    62.81929
 [7]    66.20005    69.43729    23.74277    50.75008    68.81719    87.52739
[13]    80.12049    36.62579    60.10513    67.65868          NA    36.46856
[19]    50.13242    95.03454
> colSd(tmp5)
 [1] 125.922392   6.648581   8.577938   6.165662   7.622810   7.925862
 [7]   8.136341   8.332904   4.872655   7.123909   8.295613   9.355607
[13]   8.951005   6.051925   7.752750   8.225490         NA   6.038920
[19]   7.080425   9.748566
> colMax(tmp5)
 [1] 469.11823  77.97521  90.63551  84.48165  81.85310  87.18016  77.82651
 [8]  87.47546  75.02052  86.46882  87.58849  81.97076  89.46810  84.30296
[15]  87.71707  79.00181        NA  78.53875  88.41088  87.75929
> colMin(tmp5)
 [1] 59.76577 60.45770 62.13828 63.24488 63.08620 61.94177 56.85017 60.33417
 [9] 56.79904 62.62613 61.53147 56.09955 59.88043 64.06193 63.06553 55.28219
[17]       NA 60.70396 64.04682 61.46430
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.1182
> Min(tmp5,na.rm=TRUE)
[1] 55.28219
> mean(tmp5,na.rm=TRUE)
[1] 73.46458
> Sum(tmp5,na.rm=TRUE)
[1] 14619.45
> Var(tmp5,na.rm=TRUE)
[1] 855.7153
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.73326 72.26012 71.17121 69.28110 70.89375 72.32696 74.96421 69.69279
 [9] 71.04480 73.26771
> rowSums(tmp5,na.rm=TRUE)
 [1] 1794.665 1445.202 1423.424 1385.622 1417.875 1446.539 1499.284 1393.856
 [9] 1420.896 1392.086
> rowVars(tmp5,na.rm=TRUE)
 [1] 8069.57108   66.90386   67.02677   58.03981   52.60736   66.85815
 [7]   42.16218   21.91113   48.93400   92.35025
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.830791  8.179478  8.186988  7.618386  7.253093  8.176683  6.493241
 [8]  4.680932  6.995284  9.609904
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.11823  87.71707  87.18016  90.63551  88.41088  87.75929  87.58849
 [8]  78.86324  87.47546  92.10785
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.28219 56.09955 56.13541 56.59591 57.55937 56.85017 62.41352 61.46430
 [9] 59.76577 60.45770
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.69852  69.19721  78.00105  72.54220  70.79490  72.66650  68.60633
 [8]  72.29317  67.25244  73.06701  71.82605  68.98919  69.81432  73.09453
[15]  72.60086  69.60669  67.47221  71.75471  74.02565  73.38874
> colSums(tmp5,na.rm=TRUE)
 [1] 1116.9852  691.9721  780.0105  725.4220  707.9490  726.6650  686.0633
 [8]  722.9317  672.5244  730.6701  718.2605  689.8919  698.1432  730.9453
[15]  726.0086  696.0669  607.2499  717.5471  740.2565  733.8874
> colVars(tmp5,na.rm=TRUE)
 [1] 15856.44875    44.20363    73.58102    38.01539    58.10724    62.81929
 [7]    66.20005    69.43729    23.74277    50.75008    68.81719    87.52739
[13]    80.12049    36.62579    60.10513    67.65868    62.02165    36.46856
[19]    50.13242    95.03454
> colSd(tmp5,na.rm=TRUE)
 [1] 125.922392   6.648581   8.577938   6.165662   7.622810   7.925862
 [7]   8.136341   8.332904   4.872655   7.123909   8.295613   9.355607
[13]   8.951005   6.051925   7.752750   8.225490   7.875383   6.038920
[19]   7.080425   9.748566
> colMax(tmp5,na.rm=TRUE)
 [1] 469.11823  77.97521  90.63551  84.48165  81.85310  87.18016  77.82651
 [8]  87.47546  75.02052  86.46882  87.58849  81.97076  89.46810  84.30296
[15]  87.71707  79.00181  77.33614  78.53875  88.41088  87.75929
> colMin(tmp5,na.rm=TRUE)
 [1] 59.76577 60.45770 62.13828 63.24488 63.08620 61.94177 56.85017 60.33417
 [9] 56.79904 62.62613 61.53147 56.09955 59.88043 64.06193 63.06553 55.28219
[17] 56.13541 60.70396 64.04682 61.46430
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.73326 72.26012 71.17121 69.28110 70.89375 72.32696 74.96421 69.69279
 [9] 71.04480      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1794.665 1445.202 1423.424 1385.622 1417.875 1446.539 1499.284 1393.856
 [9] 1420.896    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 8069.57108   66.90386   67.02677   58.03981   52.60736   66.85815
 [7]   42.16218   21.91113   48.93400         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.830791  8.179478  8.186988  7.618386  7.253093  8.176683  6.493241
 [8]  4.680932  6.995284        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.11823  87.71707  87.18016  90.63551  88.41088  87.75929  87.58849
 [8]  78.86324  87.47546        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.28219 56.09955 56.13541 56.59591 57.55937 56.85017 62.41352 61.46430
 [9] 59.76577       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.87527  70.16827  78.62273  72.91448  71.58682  71.97213  67.76953
 [8]  71.62875  67.55449  71.57791  72.96989  69.80166  67.63057  73.83783
[15]  72.27065  69.83037       NaN  71.44143  74.42791  72.35424
> colSums(tmp5,na.rm=TRUE)
 [1] 1024.8774  631.5144  707.6045  656.2303  644.2814  647.7492  609.9258
 [8]  644.6587  607.9904  644.2012  656.7290  628.2150  608.6751  664.5404
[15]  650.4358  628.4733    0.0000  642.9728  669.8512  651.1882
> colVars(tmp5,na.rm=TRUE)
 [1] 17785.20007    39.12086    78.43078    41.20816    58.31519    65.24747
 [7]    66.59736    73.15061    25.68419    32.14821    62.70013    91.04209
[13]    36.48683    34.98848    66.39157    75.55316          NA    39.92301
[19]    54.57862    94.87419
> colSd(tmp5,na.rm=TRUE)
 [1] 133.361164   6.254667   8.856115   6.419358   7.636438   8.077591
 [7]   8.160721   8.552813   5.067957   5.669939   7.918342   9.541598
[13]   6.040433   5.915106   8.148102   8.692132         NA   6.318466
[19]   7.387734   9.740339
> colMax(tmp5,na.rm=TRUE)
 [1] 469.11823  77.97521  90.63551  84.48165  81.85310  87.18016  77.82651
 [8]  87.47546  75.02052  77.86518  87.58849  81.97076  78.19493  84.30296
[15]  87.71707  79.00181      -Inf  78.53875  88.41088  87.75929
> colMin(tmp5,na.rm=TRUE)
 [1] 59.76577 60.66192 62.13828 63.24488 63.08620 61.94177 56.85017 60.33417
 [9] 56.79904 62.62613 63.48990 56.09955 59.88043 64.06193 63.06553 55.28219
[17]      Inf 60.70396 64.04682 61.46430
> 
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 3
> which.col  <- 1
> cat(which.row," ",which.col,"\n")
3   1 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> rowVars(tmp5,na.rm=TRUE)
 [1] 201.8649 166.3454 244.1035 229.0218 132.6894 165.5294 377.3763 190.5012
 [9] 119.1664 202.9056
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 201.8649 166.3454 244.1035 229.0218 132.6894 165.5294 377.3763 190.5012
 [9] 119.1664 202.9056
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14 -8.526513e-14  1.705303e-13  4.547474e-13 -1.989520e-13
 [6]  0.000000e+00 -1.989520e-13 -2.842171e-13  1.705303e-13  0.000000e+00
[11] -5.684342e-14 -2.842171e-14  5.684342e-14  2.842171e-14 -1.136868e-13
[16] -1.705303e-13  2.842171e-14 -1.136868e-13  1.136868e-13 -1.705303e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
4   13 
9   15 
8   6 
8   11 
2   18 
2   20 
5   10 
7   15 
7   3 
4   19 
10   20 
8   5 
4   9 
8   8 
7   13 
10   14 
8   11 
5   16 
4   18 
5   14 
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] 3.093933
> Min(tmp)
[1] -2.184655
> mean(tmp)
[1] 0.06783318
> Sum(tmp)
[1] 6.783318
> Var(tmp)
[1] 1.214117
> 
> rowMeans(tmp)
[1] 0.06783318
> rowSums(tmp)
[1] 6.783318
> rowVars(tmp)
[1] 1.214117
> rowSd(tmp)
[1] 1.10187
> rowMax(tmp)
[1] 3.093933
> rowMin(tmp)
[1] -2.184655
> 
> colMeans(tmp)
  [1] -0.21029769 -0.64473525  1.76967570 -0.48343749 -2.18465549 -1.11853703
  [7]  0.43046268  0.37679891  0.25778777 -0.88668358 -0.53255066 -0.85465069
 [13]  0.51675428  0.57625694  1.09476982  1.23151397  1.90242282 -0.88034564
 [19] -0.40525392 -0.89923823  1.14680732  0.94674576 -1.42799356 -0.30010057
 [25]  1.21100434  2.32577779  0.22778536 -0.06964000 -0.20539732  0.61884491
 [31] -0.06952551  3.09393296  1.65884755  0.45679419 -0.90643250  1.60994795
 [37]  0.08706516  0.93710048  0.24147166 -0.76448379  1.94170275 -0.51015957
 [43] -1.83835837 -0.32801857  1.82154450 -0.21088785 -0.19583383 -0.64309025
 [49] -0.88546901  2.61692910  0.84530207  0.93350108 -1.34176972 -0.97767453
 [55] -1.13305316  0.95346085 -0.18641897 -1.96160678  3.00726829  0.25824473
 [61]  0.28387277 -0.97976188 -0.21830409 -1.00506067 -0.68206520  0.33307330
 [67] -0.04667323 -1.39530849 -0.79561770  0.53130834  1.91774301 -1.19190036
 [73]  1.40415058 -0.76149371 -0.89445549 -1.10960885  0.17442632 -0.55433788
 [79] -0.89135535  0.23013984  0.26560614 -1.59431335  0.97131684  0.49563176
 [85] -0.29435426  0.88578440  0.85750736 -0.67679857 -0.10970941  0.63138183
 [91]  0.28026494 -0.05219247  0.11342993 -2.10762949 -0.59874540  0.39574672
 [97] -0.62887307 -0.77765520  0.53805204  1.79987409
> colSums(tmp)
  [1] -0.21029769 -0.64473525  1.76967570 -0.48343749 -2.18465549 -1.11853703
  [7]  0.43046268  0.37679891  0.25778777 -0.88668358 -0.53255066 -0.85465069
 [13]  0.51675428  0.57625694  1.09476982  1.23151397  1.90242282 -0.88034564
 [19] -0.40525392 -0.89923823  1.14680732  0.94674576 -1.42799356 -0.30010057
 [25]  1.21100434  2.32577779  0.22778536 -0.06964000 -0.20539732  0.61884491
 [31] -0.06952551  3.09393296  1.65884755  0.45679419 -0.90643250  1.60994795
 [37]  0.08706516  0.93710048  0.24147166 -0.76448379  1.94170275 -0.51015957
 [43] -1.83835837 -0.32801857  1.82154450 -0.21088785 -0.19583383 -0.64309025
 [49] -0.88546901  2.61692910  0.84530207  0.93350108 -1.34176972 -0.97767453
 [55] -1.13305316  0.95346085 -0.18641897 -1.96160678  3.00726829  0.25824473
 [61]  0.28387277 -0.97976188 -0.21830409 -1.00506067 -0.68206520  0.33307330
 [67] -0.04667323 -1.39530849 -0.79561770  0.53130834  1.91774301 -1.19190036
 [73]  1.40415058 -0.76149371 -0.89445549 -1.10960885  0.17442632 -0.55433788
 [79] -0.89135535  0.23013984  0.26560614 -1.59431335  0.97131684  0.49563176
 [85] -0.29435426  0.88578440  0.85750736 -0.67679857 -0.10970941  0.63138183
 [91]  0.28026494 -0.05219247  0.11342993 -2.10762949 -0.59874540  0.39574672
 [97] -0.62887307 -0.77765520  0.53805204  1.79987409
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -0.21029769 -0.64473525  1.76967570 -0.48343749 -2.18465549 -1.11853703
  [7]  0.43046268  0.37679891  0.25778777 -0.88668358 -0.53255066 -0.85465069
 [13]  0.51675428  0.57625694  1.09476982  1.23151397  1.90242282 -0.88034564
 [19] -0.40525392 -0.89923823  1.14680732  0.94674576 -1.42799356 -0.30010057
 [25]  1.21100434  2.32577779  0.22778536 -0.06964000 -0.20539732  0.61884491
 [31] -0.06952551  3.09393296  1.65884755  0.45679419 -0.90643250  1.60994795
 [37]  0.08706516  0.93710048  0.24147166 -0.76448379  1.94170275 -0.51015957
 [43] -1.83835837 -0.32801857  1.82154450 -0.21088785 -0.19583383 -0.64309025
 [49] -0.88546901  2.61692910  0.84530207  0.93350108 -1.34176972 -0.97767453
 [55] -1.13305316  0.95346085 -0.18641897 -1.96160678  3.00726829  0.25824473
 [61]  0.28387277 -0.97976188 -0.21830409 -1.00506067 -0.68206520  0.33307330
 [67] -0.04667323 -1.39530849 -0.79561770  0.53130834  1.91774301 -1.19190036
 [73]  1.40415058 -0.76149371 -0.89445549 -1.10960885  0.17442632 -0.55433788
 [79] -0.89135535  0.23013984  0.26560614 -1.59431335  0.97131684  0.49563176
 [85] -0.29435426  0.88578440  0.85750736 -0.67679857 -0.10970941  0.63138183
 [91]  0.28026494 -0.05219247  0.11342993 -2.10762949 -0.59874540  0.39574672
 [97] -0.62887307 -0.77765520  0.53805204  1.79987409
> colMin(tmp)
  [1] -0.21029769 -0.64473525  1.76967570 -0.48343749 -2.18465549 -1.11853703
  [7]  0.43046268  0.37679891  0.25778777 -0.88668358 -0.53255066 -0.85465069
 [13]  0.51675428  0.57625694  1.09476982  1.23151397  1.90242282 -0.88034564
 [19] -0.40525392 -0.89923823  1.14680732  0.94674576 -1.42799356 -0.30010057
 [25]  1.21100434  2.32577779  0.22778536 -0.06964000 -0.20539732  0.61884491
 [31] -0.06952551  3.09393296  1.65884755  0.45679419 -0.90643250  1.60994795
 [37]  0.08706516  0.93710048  0.24147166 -0.76448379  1.94170275 -0.51015957
 [43] -1.83835837 -0.32801857  1.82154450 -0.21088785 -0.19583383 -0.64309025
 [49] -0.88546901  2.61692910  0.84530207  0.93350108 -1.34176972 -0.97767453
 [55] -1.13305316  0.95346085 -0.18641897 -1.96160678  3.00726829  0.25824473
 [61]  0.28387277 -0.97976188 -0.21830409 -1.00506067 -0.68206520  0.33307330
 [67] -0.04667323 -1.39530849 -0.79561770  0.53130834  1.91774301 -1.19190036
 [73]  1.40415058 -0.76149371 -0.89445549 -1.10960885  0.17442632 -0.55433788
 [79] -0.89135535  0.23013984  0.26560614 -1.59431335  0.97131684  0.49563176
 [85] -0.29435426  0.88578440  0.85750736 -0.67679857 -0.10970941  0.63138183
 [91]  0.28026494 -0.05219247  0.11342993 -2.10762949 -0.59874540  0.39574672
 [97] -0.62887307 -0.77765520  0.53805204  1.79987409
> colMedians(tmp)
  [1] -0.21029769 -0.64473525  1.76967570 -0.48343749 -2.18465549 -1.11853703
  [7]  0.43046268  0.37679891  0.25778777 -0.88668358 -0.53255066 -0.85465069
 [13]  0.51675428  0.57625694  1.09476982  1.23151397  1.90242282 -0.88034564
 [19] -0.40525392 -0.89923823  1.14680732  0.94674576 -1.42799356 -0.30010057
 [25]  1.21100434  2.32577779  0.22778536 -0.06964000 -0.20539732  0.61884491
 [31] -0.06952551  3.09393296  1.65884755  0.45679419 -0.90643250  1.60994795
 [37]  0.08706516  0.93710048  0.24147166 -0.76448379  1.94170275 -0.51015957
 [43] -1.83835837 -0.32801857  1.82154450 -0.21088785 -0.19583383 -0.64309025
 [49] -0.88546901  2.61692910  0.84530207  0.93350108 -1.34176972 -0.97767453
 [55] -1.13305316  0.95346085 -0.18641897 -1.96160678  3.00726829  0.25824473
 [61]  0.28387277 -0.97976188 -0.21830409 -1.00506067 -0.68206520  0.33307330
 [67] -0.04667323 -1.39530849 -0.79561770  0.53130834  1.91774301 -1.19190036
 [73]  1.40415058 -0.76149371 -0.89445549 -1.10960885  0.17442632 -0.55433788
 [79] -0.89135535  0.23013984  0.26560614 -1.59431335  0.97131684  0.49563176
 [85] -0.29435426  0.88578440  0.85750736 -0.67679857 -0.10970941  0.63138183
 [91]  0.28026494 -0.05219247  0.11342993 -2.10762949 -0.59874540  0.39574672
 [97] -0.62887307 -0.77765520  0.53805204  1.79987409
> colRanges(tmp)
           [,1]       [,2]     [,3]       [,4]      [,5]      [,6]      [,7]
[1,] -0.2102977 -0.6447352 1.769676 -0.4834375 -2.184655 -1.118537 0.4304627
[2,] -0.2102977 -0.6447352 1.769676 -0.4834375 -2.184655 -1.118537 0.4304627
          [,8]      [,9]      [,10]      [,11]      [,12]     [,13]     [,14]
[1,] 0.3767989 0.2577878 -0.8866836 -0.5325507 -0.8546507 0.5167543 0.5762569
[2,] 0.3767989 0.2577878 -0.8866836 -0.5325507 -0.8546507 0.5167543 0.5762569
       [,15]    [,16]    [,17]      [,18]      [,19]      [,20]    [,21]
[1,] 1.09477 1.231514 1.902423 -0.8803456 -0.4052539 -0.8992382 1.146807
[2,] 1.09477 1.231514 1.902423 -0.8803456 -0.4052539 -0.8992382 1.146807
         [,22]     [,23]      [,24]    [,25]    [,26]     [,27]    [,28]
[1,] 0.9467458 -1.427994 -0.3001006 1.211004 2.325778 0.2277854 -0.06964
[2,] 0.9467458 -1.427994 -0.3001006 1.211004 2.325778 0.2277854 -0.06964
          [,29]     [,30]       [,31]    [,32]    [,33]     [,34]      [,35]
[1,] -0.2053973 0.6188449 -0.06952551 3.093933 1.658848 0.4567942 -0.9064325
[2,] -0.2053973 0.6188449 -0.06952551 3.093933 1.658848 0.4567942 -0.9064325
        [,36]      [,37]     [,38]     [,39]      [,40]    [,41]      [,42]
[1,] 1.609948 0.08706516 0.9371005 0.2414717 -0.7644838 1.941703 -0.5101596
[2,] 1.609948 0.08706516 0.9371005 0.2414717 -0.7644838 1.941703 -0.5101596
         [,43]      [,44]    [,45]      [,46]      [,47]      [,48]     [,49]
[1,] -1.838358 -0.3280186 1.821545 -0.2108879 -0.1958338 -0.6430902 -0.885469
[2,] -1.838358 -0.3280186 1.821545 -0.2108879 -0.1958338 -0.6430902 -0.885469
        [,50]     [,51]     [,52]    [,53]      [,54]     [,55]     [,56]
[1,] 2.616929 0.8453021 0.9335011 -1.34177 -0.9776745 -1.133053 0.9534608
[2,] 2.616929 0.8453021 0.9335011 -1.34177 -0.9776745 -1.133053 0.9534608
         [,57]     [,58]    [,59]     [,60]     [,61]      [,62]      [,63]
[1,] -0.186419 -1.961607 3.007268 0.2582447 0.2838728 -0.9797619 -0.2183041
[2,] -0.186419 -1.961607 3.007268 0.2582447 0.2838728 -0.9797619 -0.2183041
         [,64]      [,65]     [,66]       [,67]     [,68]      [,69]     [,70]
[1,] -1.005061 -0.6820652 0.3330733 -0.04667323 -1.395308 -0.7956177 0.5313083
[2,] -1.005061 -0.6820652 0.3330733 -0.04667323 -1.395308 -0.7956177 0.5313083
        [,71]   [,72]    [,73]      [,74]      [,75]     [,76]     [,77]
[1,] 1.917743 -1.1919 1.404151 -0.7614937 -0.8944555 -1.109609 0.1744263
[2,] 1.917743 -1.1919 1.404151 -0.7614937 -0.8944555 -1.109609 0.1744263
          [,78]      [,79]     [,80]     [,81]     [,82]     [,83]     [,84]
[1,] -0.5543379 -0.8913554 0.2301398 0.2656061 -1.594313 0.9713168 0.4956318
[2,] -0.5543379 -0.8913554 0.2301398 0.2656061 -1.594313 0.9713168 0.4956318
          [,85]     [,86]     [,87]      [,88]      [,89]     [,90]     [,91]
[1,] -0.2943543 0.8857844 0.8575074 -0.6767986 -0.1097094 0.6313818 0.2802649
[2,] -0.2943543 0.8857844 0.8575074 -0.6767986 -0.1097094 0.6313818 0.2802649
           [,92]     [,93]     [,94]      [,95]     [,96]      [,97]      [,98]
[1,] -0.05219247 0.1134299 -2.107629 -0.5987454 0.3957467 -0.6288731 -0.7776552
[2,] -0.05219247 0.1134299 -2.107629 -0.5987454 0.3957467 -0.6288731 -0.7776552
        [,99]   [,100]
[1,] 0.538052 1.799874
[2,] 0.538052 1.799874
> 
> 
> Max(tmp2)
[1] 2.482794
> Min(tmp2)
[1] -3.467938
> mean(tmp2)
[1] -0.04932791
> Sum(tmp2)
[1] -4.932791
> Var(tmp2)
[1] 1.026057
> 
> rowMeans(tmp2)
  [1] -1.21023388  0.60589722 -0.62480801 -1.41975039 -0.99432880 -0.44351798
  [7]  1.41218988 -0.47752839 -1.38039187  0.54251731 -1.38087931  0.57535954
 [13]  1.36802999  2.48279417  0.55231978  1.14988074 -1.01885013  1.24496605
 [19]  1.14045618 -0.38219375  1.52123554  0.95629609 -0.84840395  0.46126271
 [25]  2.03834349 -0.61177842  0.35191873 -0.10573409  0.12063577  0.58160754
 [31]  0.46612393  0.52689227  0.15013675  0.45035437 -0.04285073 -1.33903218
 [37] -2.03843088  0.23047645  0.51868103 -0.44668094 -3.46793791 -0.59936507
 [43] -1.29819729  0.16087531 -1.46442653 -0.52573063  0.84216412 -0.95285040
 [49] -0.86578062 -0.29535152  0.87120188  0.11196467 -1.32840429  0.01758171
 [55]  0.34256170 -0.49163599 -0.81660436 -0.47161586  0.40797656  1.03556090
 [61] -0.18990964 -1.10661623 -0.67936920 -0.30244269  0.03166153 -0.26307781
 [67]  0.77677946  0.85858262 -0.68275420  0.97831835 -0.64454561 -1.00836876
 [73]  1.89335566  0.23976342  0.97434403  1.18395936  0.29244791  0.16664024
 [79]  1.56017993  0.22880378 -0.88484284 -0.96308577  0.26243336  0.23407381
 [85]  0.58346237 -1.78360736 -1.42321259  0.04519700 -0.72692981  0.13352933
 [91]  1.61396010  0.63007023 -2.27960811 -0.70156317  0.37903500  1.13789205
 [97] -0.09895157 -0.20141331 -1.61783078  0.52588065
> rowSums(tmp2)
  [1] -1.21023388  0.60589722 -0.62480801 -1.41975039 -0.99432880 -0.44351798
  [7]  1.41218988 -0.47752839 -1.38039187  0.54251731 -1.38087931  0.57535954
 [13]  1.36802999  2.48279417  0.55231978  1.14988074 -1.01885013  1.24496605
 [19]  1.14045618 -0.38219375  1.52123554  0.95629609 -0.84840395  0.46126271
 [25]  2.03834349 -0.61177842  0.35191873 -0.10573409  0.12063577  0.58160754
 [31]  0.46612393  0.52689227  0.15013675  0.45035437 -0.04285073 -1.33903218
 [37] -2.03843088  0.23047645  0.51868103 -0.44668094 -3.46793791 -0.59936507
 [43] -1.29819729  0.16087531 -1.46442653 -0.52573063  0.84216412 -0.95285040
 [49] -0.86578062 -0.29535152  0.87120188  0.11196467 -1.32840429  0.01758171
 [55]  0.34256170 -0.49163599 -0.81660436 -0.47161586  0.40797656  1.03556090
 [61] -0.18990964 -1.10661623 -0.67936920 -0.30244269  0.03166153 -0.26307781
 [67]  0.77677946  0.85858262 -0.68275420  0.97831835 -0.64454561 -1.00836876
 [73]  1.89335566  0.23976342  0.97434403  1.18395936  0.29244791  0.16664024
 [79]  1.56017993  0.22880378 -0.88484284 -0.96308577  0.26243336  0.23407381
 [85]  0.58346237 -1.78360736 -1.42321259  0.04519700 -0.72692981  0.13352933
 [91]  1.61396010  0.63007023 -2.27960811 -0.70156317  0.37903500  1.13789205
 [97] -0.09895157 -0.20141331 -1.61783078  0.52588065
> 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.21023388  0.60589722 -0.62480801 -1.41975039 -0.99432880 -0.44351798
  [7]  1.41218988 -0.47752839 -1.38039187  0.54251731 -1.38087931  0.57535954
 [13]  1.36802999  2.48279417  0.55231978  1.14988074 -1.01885013  1.24496605
 [19]  1.14045618 -0.38219375  1.52123554  0.95629609 -0.84840395  0.46126271
 [25]  2.03834349 -0.61177842  0.35191873 -0.10573409  0.12063577  0.58160754
 [31]  0.46612393  0.52689227  0.15013675  0.45035437 -0.04285073 -1.33903218
 [37] -2.03843088  0.23047645  0.51868103 -0.44668094 -3.46793791 -0.59936507
 [43] -1.29819729  0.16087531 -1.46442653 -0.52573063  0.84216412 -0.95285040
 [49] -0.86578062 -0.29535152  0.87120188  0.11196467 -1.32840429  0.01758171
 [55]  0.34256170 -0.49163599 -0.81660436 -0.47161586  0.40797656  1.03556090
 [61] -0.18990964 -1.10661623 -0.67936920 -0.30244269  0.03166153 -0.26307781
 [67]  0.77677946  0.85858262 -0.68275420  0.97831835 -0.64454561 -1.00836876
 [73]  1.89335566  0.23976342  0.97434403  1.18395936  0.29244791  0.16664024
 [79]  1.56017993  0.22880378 -0.88484284 -0.96308577  0.26243336  0.23407381
 [85]  0.58346237 -1.78360736 -1.42321259  0.04519700 -0.72692981  0.13352933
 [91]  1.61396010  0.63007023 -2.27960811 -0.70156317  0.37903500  1.13789205
 [97] -0.09895157 -0.20141331 -1.61783078  0.52588065
> rowMin(tmp2)
  [1] -1.21023388  0.60589722 -0.62480801 -1.41975039 -0.99432880 -0.44351798
  [7]  1.41218988 -0.47752839 -1.38039187  0.54251731 -1.38087931  0.57535954
 [13]  1.36802999  2.48279417  0.55231978  1.14988074 -1.01885013  1.24496605
 [19]  1.14045618 -0.38219375  1.52123554  0.95629609 -0.84840395  0.46126271
 [25]  2.03834349 -0.61177842  0.35191873 -0.10573409  0.12063577  0.58160754
 [31]  0.46612393  0.52689227  0.15013675  0.45035437 -0.04285073 -1.33903218
 [37] -2.03843088  0.23047645  0.51868103 -0.44668094 -3.46793791 -0.59936507
 [43] -1.29819729  0.16087531 -1.46442653 -0.52573063  0.84216412 -0.95285040
 [49] -0.86578062 -0.29535152  0.87120188  0.11196467 -1.32840429  0.01758171
 [55]  0.34256170 -0.49163599 -0.81660436 -0.47161586  0.40797656  1.03556090
 [61] -0.18990964 -1.10661623 -0.67936920 -0.30244269  0.03166153 -0.26307781
 [67]  0.77677946  0.85858262 -0.68275420  0.97831835 -0.64454561 -1.00836876
 [73]  1.89335566  0.23976342  0.97434403  1.18395936  0.29244791  0.16664024
 [79]  1.56017993  0.22880378 -0.88484284 -0.96308577  0.26243336  0.23407381
 [85]  0.58346237 -1.78360736 -1.42321259  0.04519700 -0.72692981  0.13352933
 [91]  1.61396010  0.63007023 -2.27960811 -0.70156317  0.37903500  1.13789205
 [97] -0.09895157 -0.20141331 -1.61783078  0.52588065
> 
> colMeans(tmp2)
[1] -0.04932791
> colSums(tmp2)
[1] -4.932791
> colVars(tmp2)
[1] 1.026057
> colSd(tmp2)
[1] 1.012945
> colMax(tmp2)
[1] 2.482794
> colMin(tmp2)
[1] -3.467938
> colMedians(tmp2)
[1] 0.07858084
> colRanges(tmp2)
          [,1]
[1,] -3.467938
[2,]  2.482794
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.02384615 -2.57267716  1.26438626  0.72478742  1.58595991 -9.76710443
 [7] -1.10087706 -2.07651509 -0.29355638  4.34915571
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.00157041
[2,] -0.28497356
[3,]  0.03318193
[4,]  0.10819998
[5,]  2.41814838
> 
> rowApply(tmp,sum)
 [1] -5.3134126  3.0336315 -0.6963553 -2.4983643  1.2247786  3.3719330
 [7] -4.9665604 -2.3950852  0.8862742 -0.5094344
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    5    5    5    4   10    6    6    4     8
 [2,]    7    1    1    4    8    5    8    2   10     1
 [3,]    6    7    9   10    6    3    7    3    9     9
 [4,]    9    3    8    7    2    4    9    5    2     6
 [5,]   10    8    7    2   10    1    2    9    8     3
 [6,]    2    6    3    6    1    8    1    1    1     7
 [7,]    5    4    4    9    7    2    5    7    5     5
 [8,]    3    9    2    1    5    6    4   10    7     4
 [9,]    8    2   10    3    9    9    3    4    3     2
[10,]    4   10    6    8    3    7   10    8    6    10
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.4352556 -1.6909735 -1.4317232  3.7604393  0.3520055  1.3476592
 [7]  3.3980285 -1.4648248 -1.6788502  2.4263544  1.3635616  0.6490619
[13] -2.0731145 -1.8705541 -5.2705371  0.8315160  0.6137943 -0.9801708
[19] -0.2461183 -0.5042770
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.0060934
[2,] -0.5898705
[3,]  0.8548803
[4,]  0.8666598
[5,]  1.3096794
> 
> rowApply(tmp,sum)
[1]  9.323484 -5.378999 -8.904625  1.914710  2.011962
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   14   10   19    3   19
[2,]    1   16   14    7    4
[3,]    3    3   18    8    7
[4,]   18   14   20   15   10
[5,]   16   19    8   10    2
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]        [,5]       [,6]
[1,]  0.8666598 -0.8661957 -0.1262431  1.2578491  1.01382279  0.0423251
[2,] -0.5898705  0.5110599 -1.5578165  0.2508813  1.35359966  0.7872294
[3,]  0.8548803 -0.1606349  0.7241909  1.7182414 -0.69239474 -1.1145482
[4,] -1.0060934 -0.1852225 -0.1521912  0.6596890  0.07492085  1.1655109
[5,]  1.3096794 -0.9899803 -0.3196634 -0.1262214 -1.39794301  0.4671420
           [,7]       [,8]        [,9]      [,10]       [,11]       [,12]
[1,]  1.0384498  0.9073171 -0.09905745  1.3701420  0.08065723  0.50579183
[2,]  0.3939041 -0.7366793 -0.06489320 -1.1182303 -0.67871480  1.73833523
[3,] -0.4568685 -1.3629090 -0.20977252  0.5962965 -0.23467166 -1.37121469
[4,]  0.1129649  1.2027035 -1.39007752  0.4434381  0.90549878 -0.03530703
[5,]  2.3095782 -1.4752570  0.08495052  1.1347082  1.29079207 -0.18854344
          [,13]      [,14]      [,15]      [,16]      [,17]       [,18]
[1,] -0.4821015  0.4585083  0.7458277  1.3576550  0.4783620 -0.05246812
[2,] -0.6315455 -0.8363827 -2.4365947  1.1773034 -0.8227340 -1.88639679
[3,] -2.1701949 -0.4492302 -2.3015564 -0.7512455 -0.1273301 -0.51177212
[4,]  1.3884812 -0.7156201 -1.2601216 -0.5367721  0.8701836  0.20097486
[5,] -0.1777538 -0.3278294 -0.0180921 -0.4154247  0.2153128  1.26949141
           [,19]      [,20]
[1,]  0.48469589  0.3414868
[2,] -0.05356389 -0.1778895
[3,]  0.10516046 -0.9890508
[4,]  0.52219780 -0.3504476
[5,] -1.30460852  0.6716241
> 
> 
> 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 :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.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 1.211433 -0.6519422 1.055763 0.7168975 -0.7493754 0.4174491 -0.07871524
          col8     col9      col10     col11     col12      col13      col14
row1 0.7332413 0.674242 -0.5016965 -1.395564 0.7919441 -0.7790658 -0.1927717
         col15     col16     col17    col18     col19     col20
row1 -1.223846 -1.576528 0.6776459 1.244797 0.4501776 -2.300911
> tmp[,"col10"]
          col10
row1 -0.5016965
row2 -1.2927741
row3 -1.7508908
row4 -1.2346402
row5  0.3676499
> tmp[c("row1","row5"),]
          col1        col2       col3      col4       col5       col6
row1 1.2114332 -0.65194216 1.05576334 0.7168975 -0.7493754  0.4174491
row5 0.3467963  0.04882948 0.01631738 1.3507221  0.5356489 -0.2850436
            col7      col8      col9      col10     col11      col12      col13
row1 -0.07871524 0.7332413 0.6742420 -0.5016965 -1.395564 0.79194414 -0.7790658
row5  0.19098830 1.0620415 0.1285413  0.3676499  1.134773 0.06864253  0.6311019
          col14      col15      col16      col17    col18      col19      col20
row1 -0.1927717 -1.2238459 -1.5765282  0.6776459 1.244797  0.4501776 -2.3009109
row5  0.4789930 -0.3212982 -0.7885172 -0.3559707 1.063778 -2.1930544 -0.6063485
> tmp[,c("col6","col20")]
            col6      col20
row1  0.41744912 -2.3009109
row2 -0.01023848 -1.8860427
row3  1.29449460 -1.3307380
row4  1.51327349 -0.6205449
row5 -0.28504358 -0.6063485
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  0.4174491 -2.3009109
row5 -0.2850436 -0.6063485
> 
> 
> 
> 
> 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 51.25718 49.68477 49.22072 48.51188 50.24936 105.7492 50.86572 50.53983
         col9    col10    col11  col12    col13    col14    col15    col16
row1 50.71109 50.74005 48.82645 51.567 48.41413 48.72116 50.33281 51.61008
        col17    col18    col19    col20
row1 50.37839 49.28071 49.72559 103.3606
> tmp[,"col10"]
        col10
row1 50.74005
row2 28.30550
row3 30.33144
row4 28.75352
row5 51.19734
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.25718 49.68477 49.22072 48.51188 50.24936 105.7492 50.86572 50.53983
row5 49.39253 50.19338 51.27816 50.45850 49.89229 103.9327 50.56178 49.53590
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.71109 50.74005 48.82645 51.56700 48.41413 48.72116 50.33281 51.61008
row5 50.21499 51.19734 49.66447 49.28518 50.33594 49.73005 50.19048 51.88293
        col17    col18    col19    col20
row1 50.37839 49.28071 49.72559 103.3606
row5 49.23075 49.94392 50.14622 103.9427
> tmp[,c("col6","col20")]
          col6     col20
row1 105.74918 103.36055
row2  76.77449  75.67961
row3  76.26030  74.35518
row4  75.33436  75.76635
row5 103.93274 103.94266
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.7492 103.3606
row5 103.9327 103.9427
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.7492 103.3606
row5 103.9327 103.9427
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -0.54466570
[2,] -1.92556799
[3,]  0.34633598
[4,] -0.30225849
[5,] -0.05731927
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.4552930  1.0163123
[2,] -1.5061210  0.1057241
[3,]  2.0516713  0.4617977
[4,] -1.3789652 -0.2823507
[5,] -0.5185199 -0.6655292
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -0.32859885  0.8706774
[2,] -0.07350854  1.5158652
[3,] -1.84915702 -0.3943190
[4,]  0.83021722  0.9040473
[5,]  0.43052428 -1.5752265
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.3285988
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] -0.32859885
[2,] -0.07350854
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]       [,3]      [,4]       [,5]         [,6]
row3 1.6016757  0.3222501  0.1347314  1.031443 -0.4117513 -1.434496043
row1 0.4914814 -0.9941600 -1.2180375 -1.465915  0.3097731 -0.003097359
           [,7]      [,8]      [,9]      [,10]      [,11]      [,12]      [,13]
row3 -0.1771900 -1.551916 -1.597790 -0.9925248  0.4045346 0.03094472  0.9196098
row1  0.2232065  0.695837 -1.663329 -0.5468029 -1.1786131 1.30818988 -1.0713582
          [,14]      [,15]      [,16]      [,17]      [,18]     [,19]
row3  0.7673875 -0.7439819  0.7769879 -0.1092605  1.1708956  1.020351
row1 -0.6955491 -0.3774686 -0.1172052 -0.3711686 -0.1528833 -1.097124
           [,20]
row3 0.825575842
row1 0.005172927
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]       [,2]      [,3]       [,4]    [,5]      [,6]        [,7]
row2 -0.2042054 -0.5322041 0.1295967 0.06500065 1.37047 0.4673684 -0.07611888
           [,8]       [,9]      [,10]
row2 -0.3712524 0.09965826 -0.5429038
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]      [,4]      [,5]     [,6]     [,7]
row5 0.0591445 -0.1995165 0.1742892 0.3534153 0.3272675 1.126597 1.976564
           [,8]      [,9]      [,10]     [,11]      [,12]       [,13]
row5 -0.4373231 0.3162267 -0.7786957 0.4108388 -0.8397869 -0.02475916
          [,14]     [,15]     [,16]       [,17]     [,18]     [,19]     [,20]
row5 -0.3534782 0.6602275 0.4488391 0.007857584 -1.426013 0.9882005 0.3255809
> 
> 
> 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: 0xaaab1f06dc60>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM24311358d3889" 
 [2] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM24311324876521"
 [3] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2431133f65d439"
 [4] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM24311362b8ce8e"
 [5] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM243113a58421b" 
 [6] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM24311323863f37"
 [7] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2431132526a58b"
 [8] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2431136a684a2e"
 [9] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM24311376a20458"
[10] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2431132e25ee8d"
[11] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2431134cb81546"
[12] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2431133e5d00db"
[13] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2431135ff3b174"
[14] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM243113231c1300"
[15] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM24311335a64513"
> 
> 
> ### 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: 0xaaab200ffeb0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xaaab200ffeb0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xaaab200ffeb0>
> rowMedians(tmp)
  [1] -0.062797595  0.314495888 -0.857407909 -0.218972514  0.005572621
  [6] -0.332681526  0.202624439  0.457621755  0.095451775 -0.042688020
 [11]  0.016777184  0.563512173  0.099894585  0.022907687  0.264931184
 [16]  0.439764863 -0.193590728  0.356405777  0.266291448 -0.345399754
 [21]  0.073591694 -0.340408232  0.096419041 -0.400429139 -0.006094065
 [26] -0.319218077 -0.417176062 -0.652913996 -0.267368551  0.215391396
 [31] -0.370974157  0.048795481 -0.062037152 -0.119028467  0.082560080
 [36]  0.413489008 -0.321329852 -0.561004806  0.130404807 -0.327966077
 [41] -0.223423409  0.327807657  0.057307413 -0.787772057  0.274221985
 [46] -0.126775600  0.522159246  0.041157741 -0.259939398  0.112261823
 [51]  0.065108814 -0.084882682  0.063783936 -0.487337236 -0.501020329
 [56]  0.099595568  0.110904690 -0.057405217 -0.250337395 -0.286216550
 [61]  0.284456180 -0.346396292  0.124142952 -0.057588349 -0.477111551
 [66] -0.134566228  0.368907802  0.089140080  0.238856664 -0.182867095
 [71]  0.311587267 -0.112016591  0.170959417 -0.096145674 -0.515457171
 [76]  0.435418304 -0.152618888 -0.325761354  0.437597106  0.412662676
 [81]  0.246036633 -0.253994006 -0.971332105 -0.065637830  0.303503625
 [86]  0.299652843  0.213544450  0.219158061 -0.025183356  0.210555529
 [91]  0.529629915  0.695554331 -0.207969627 -0.237609412 -0.336245373
 [96]  0.053418808 -0.302858467 -0.218823358 -0.731448599 -0.081009518
[101]  0.117753611 -0.462001484 -0.156633186  0.228137785  0.738030362
[106] -0.015209474 -0.349793534 -0.075499928  0.272909999  0.409999354
[111] -0.536075544  0.089305287  0.010196149 -0.239347315 -0.526920286
[116]  0.555783597 -0.175456751  0.108173342  0.095576893 -0.087471626
[121]  0.413793153  0.177482082  0.191250806  0.913289267 -0.074712539
[126] -0.361830581  0.093221903  0.150976184 -0.311563531  0.070353441
[131]  0.023017216  0.328874075 -0.235160130  0.213927626 -0.176533046
[136]  0.282049859  0.529424903  0.391510775  0.001063209 -0.248990703
[141]  0.351264106 -0.091471504  0.156198118  0.198496388 -0.278282058
[146]  0.166336798 -0.240242866 -0.430346955 -0.029670613  0.045067327
[151]  0.243775455 -0.180483358  0.065417330  0.026283186  0.211509848
[156] -0.075349588  0.164203880 -0.024589740 -0.145968486 -0.390726371
[161]  0.210678605 -0.311553414 -0.387963982  0.147734471 -0.126418611
[166]  0.334454350  0.242684145 -0.340912830 -0.371504840 -0.187898295
[171]  0.427093790  0.453140050 -0.407404550  0.362982674  0.011430238
[176]  0.022820964 -0.173899765  0.275698508 -0.069071645 -0.407609724
[181]  0.182400473 -0.242174581  0.299217685  0.743777612  0.204566072
[186] -0.236113414  0.352130033  0.054959629  0.325239329  0.217041580
[191] -0.015558823  0.082177356  0.295845875 -0.394032137  0.280783635
[196]  0.160277208  0.194370718 -0.275000745 -0.194439350  0.181268472
[201]  0.242356696 -0.412482129 -0.188584770  0.505495367  0.064860970
[206] -0.388372533 -0.304798861  0.269098120 -0.263011616  0.231820124
[211] -0.297152325  0.361895403  0.043043713 -0.368506369  1.106355391
[216]  0.014230636 -0.192836341  0.116783040  0.501532889 -0.111572973
[221]  0.381670525 -0.040971792 -0.645713576  0.187362963 -0.275115541
[226] -0.220436460 -0.619737813  0.111433823 -0.024838895 -0.090206913
> 
> proc.time()
   user  system elapsed 
  2.134   1.187   3.310 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-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: 0xaaaac460b910>
> .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: 0xaaaac460b910>
> .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: 0xaaaac460b910>
> .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: 0xaaaac460b910>
> 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: 0xaaaac4dcc2a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac4dcc2a0>
> .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: 0xaaaac4dcc2a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac4dcc2a0>
> .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: 0xaaaac4dcc2a0>
> 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: 0xaaaac45b9df0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac45b9df0>
> .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: 0xaaaac45b9df0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaaac45b9df0>
> .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: 0xaaaac45b9df0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0xaaaac45b9df0>
> .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: 0xaaaac45b9df0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0xaaaac45b9df0>
> .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: 0xaaaac45b9df0>
> 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: 0xaaaac4e373a0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0xaaaac4e373a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac4e373a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac4e373a0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2431a83418ebbe" "BufferedMatrixFile2431a8e85ce79" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2431a83418ebbe" "BufferedMatrixFile2431a8e85ce79" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac67709b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac67709b0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaaac67709b0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaaac67709b0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0xaaaac67709b0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0xaaaac67709b0>
> .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: 0xaaaac6247010>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaac6247010>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaaac6247010>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0xaaaac6247010>
> 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: 0xaaaac677c530>
> .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: 0xaaaac677c530>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.325   0.059   0.368 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-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.342   0.050   0.378 

Example timings