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

This page was generated on 2023-05-31 05:44:30 -0000 (Wed, 31 May 2023).

HostnameOSArch (*)R versionInstalled pkgs
kunpeng1Linux (Ubuntu 22.04.1 LTS)aarch644.3.0 (2023-04-21) -- "Already Tomorrow" 4219
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:
- 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 241/2197HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.65.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-05-29 10:19:22 -0000 (Mon, 29 May 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: 5a16207
git_last_commit_date: 2023-04-25 13:44:48 -0000 (Tue, 25 Apr 2023)
kunpeng1Linux (Ubuntu 22.04.1 LTS) / aarch64  OK    OK    OK  

Summary

Package: BufferedMatrix
Version: 1.65.0
Command: /home/biocbuild/R/R-4.3.0/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/R/R-4.3.0/site-library --timings BufferedMatrix_1.65.0.tar.gz
StartedAt: 2023-05-30 02:19:31 -0000 (Tue, 30 May 2023)
EndedAt: 2023-05-30 02:19:57 -0000 (Tue, 30 May 2023)
EllapsedTime: 26.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.3.0 (2023-04-21)
* 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.2 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.65.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.1) 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 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.18-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/R/R-4.3.0/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/home/biocbuild/R/R-4.3.0/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0’
gcc -I"/home/biocbuild/R/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/R/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
gcc -I"/home/biocbuild/R/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/R/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/R/R-4.3.0/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/R/R-4.3.0/lib -lR
installing to /home/biocbuild/R/R-4.3.0/site-library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
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.333   0.039   0.355 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
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.18-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 457491 24.5     981592 52.5   651048 34.8
Vcells 842681  6.5    8388608 64.0  2063992 15.8
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Tue May 30 02:19:47 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] "Tue May 30 02:19:47 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: 0xaaaac80533f0>
> 
> 
> 
> 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] "Tue May 30 02:19:47 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] "Tue May 30 02:19:47 2023"
> 
> ColMode(tmp2)
<pointer: 0xaaaac80533f0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]       [,2]       [,3]       [,4]
[1,] 101.4814612  0.3112575  2.2168902  0.9601311
[2,]  -0.2700225 -0.2283436 -0.6060944  0.7714475
[3,]   2.5966166 -0.3961275  1.3520555  0.5855681
[4,]  -0.7742962 -1.4164393 -3.0951051 -0.1687762
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 101.4814612 0.3112575 2.2168902 0.9601311
[2,]   0.2700225 0.2283436 0.6060944 0.7714475
[3,]   2.5966166 0.3961275 1.3520555 0.5855681
[4,]   0.7742962 1.4164393 3.0951051 0.1687762
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0738007 0.5579046 1.4889225 0.9798628
[2,]  0.5196369 0.4778531 0.7785206 0.8783209
[3,]  1.6114021 0.6293866 1.1627792 0.7652242
[4,]  0.8799410 1.1901425 1.7592911 0.4108238
> 
> 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.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 227.21947 30.89030 42.10611 35.75876
[2,]  30.46639 30.00687 33.39130 34.55466
[3,]  43.71064 31.68999 37.97985 33.23781
[4,]  34.57371 38.31786 45.68802 29.27701
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0xaaaac7843960>
> exp(tmp5)
<pointer: 0xaaaac7843960>
> log(tmp5,2)
<pointer: 0xaaaac7843960>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 472.9276
> Min(tmp5)
[1] 52.77588
> mean(tmp5)
[1] 74.22859
> Sum(tmp5)
[1] 14845.72
> Var(tmp5)
[1] 873.9202
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.72931 71.26672 72.31099 70.58389 73.38841 71.89433 71.90645 71.42653
 [9] 73.35837 74.42092
> rowSums(tmp5)
 [1] 1834.586 1425.334 1446.220 1411.678 1467.768 1437.887 1438.129 1428.531
 [9] 1467.167 1488.418
> rowVars(tmp5)
 [1] 8130.55286   70.77070   79.40680  109.56206   74.01879   62.77154
 [7]   94.32995   52.80084   34.02879   74.18350
> rowSd(tmp5)
 [1] 90.169578  8.412532  8.911049 10.467190  8.603417  7.922850  9.712361
 [8]  7.266419  5.833420  8.612985
> rowMax(tmp5)
 [1] 472.92755  86.25078  90.97796  95.09362  87.11403  83.50374  94.52515
 [8]  84.94989  84.04851  89.21254
> rowMin(tmp5)
 [1] 58.85763 54.80503 58.30741 54.19647 53.87808 52.77588 56.17701 55.71792
 [9] 59.28644 53.68866
> 
> colMeans(tmp5)
 [1] 112.64748  68.90085  74.57701  70.16699  67.49585  72.95482  73.42239
 [8]  70.27845  76.29331  71.49286  73.92371  74.79572  69.18947  73.37874
[15]  74.02285  68.38820  71.70636  72.81456  74.94048  73.18173
> colSums(tmp5)
 [1] 1126.4748  689.0085  745.7701  701.6699  674.9585  729.5482  734.2239
 [8]  702.7845  762.9331  714.9286  739.2371  747.9572  691.8947  733.7874
[15]  740.2285  683.8820  717.0636  728.1456  749.4048  731.8173
> colVars(tmp5)
 [1] 16111.27447    75.82816   107.48504    61.34285    26.31008    89.45899
 [7]    52.06362   121.90671    34.48508    11.59195   104.45203    53.11480
[13]    29.09721   117.09950    75.68193    50.47213    94.23034    61.00736
[19]   116.04954    78.60356
> colSd(tmp5)
 [1] 126.930195   8.707937  10.367499   7.832167   5.129336   9.458276
 [7]   7.215512  11.041137   5.872400   3.404695  10.220178   7.287990
[13]   5.394183  10.821252   8.699536   7.104374   9.707231   7.810721
[19]  10.772629   8.865865
> colMax(tmp5)
 [1] 472.92755  80.31034  95.09362  84.94989  74.03182  87.07251  82.76257
 [8]  87.39910  82.73978  75.22067  89.21254  86.78945  76.79039  89.44218
[15]  89.31833  81.09224  89.83849  87.11403  94.52515  83.32930
> colMin(tmp5)
 [1] 59.28644 53.68866 61.61918 56.17701 58.88794 62.08329 62.45481 54.80503
 [9] 64.11079 63.44911 52.77588 65.20221 59.04127 53.87808 63.67437 59.03772
[17] 55.92468 55.71792 61.58850 54.19647
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 91.72931 71.26672 72.31099 70.58389 73.38841 71.89433 71.90645       NA
 [9] 73.35837 74.42092
> rowSums(tmp5)
 [1] 1834.586 1425.334 1446.220 1411.678 1467.768 1437.887 1438.129       NA
 [9] 1467.167 1488.418
> rowVars(tmp5)
 [1] 8130.55286   70.77070   79.40680  109.56206   74.01879   62.77154
 [7]   94.32995   53.36562   34.02879   74.18350
> rowSd(tmp5)
 [1] 90.169578  8.412532  8.911049 10.467190  8.603417  7.922850  9.712361
 [8]  7.305177  5.833420  8.612985
> rowMax(tmp5)
 [1] 472.92755  86.25078  90.97796  95.09362  87.11403  83.50374  94.52515
 [8]        NA  84.04851  89.21254
> rowMin(tmp5)
 [1] 58.85763 54.80503 58.30741 54.19647 53.87808 52.77588 56.17701       NA
 [9] 59.28644 53.68866
> 
> colMeans(tmp5)
 [1] 112.64748  68.90085  74.57701  70.16699  67.49585  72.95482        NA
 [8]  70.27845  76.29331  71.49286  73.92371  74.79572  69.18947  73.37874
[15]  74.02285  68.38820  71.70636  72.81456  74.94048  73.18173
> colSums(tmp5)
 [1] 1126.4748  689.0085  745.7701  701.6699  674.9585  729.5482        NA
 [8]  702.7845  762.9331  714.9286  739.2371  747.9572  691.8947  733.7874
[15]  740.2285  683.8820  717.0636  728.1456  749.4048  731.8173
> colVars(tmp5)
 [1] 16111.27447    75.82816   107.48504    61.34285    26.31008    89.45899
 [7]          NA   121.90671    34.48508    11.59195   104.45203    53.11480
[13]    29.09721   117.09950    75.68193    50.47213    94.23034    61.00736
[19]   116.04954    78.60356
> colSd(tmp5)
 [1] 126.930195   8.707937  10.367499   7.832167   5.129336   9.458276
 [7]         NA  11.041137   5.872400   3.404695  10.220178   7.287990
[13]   5.394183  10.821252   8.699536   7.104374   9.707231   7.810721
[19]  10.772629   8.865865
> colMax(tmp5)
 [1] 472.92755  80.31034  95.09362  84.94989  74.03182  87.07251        NA
 [8]  87.39910  82.73978  75.22067  89.21254  86.78945  76.79039  89.44218
[15]  89.31833  81.09224  89.83849  87.11403  94.52515  83.32930
> colMin(tmp5)
 [1] 59.28644 53.68866 61.61918 56.17701 58.88794 62.08329       NA 54.80503
 [9] 64.11079 63.44911 52.77588 65.20221 59.04127 53.87808 63.67437 59.03772
[17] 55.92468 55.71792 61.58850 54.19647
> 
> Max(tmp5,na.rm=TRUE)
[1] 472.9276
> Min(tmp5,na.rm=TRUE)
[1] 52.77588
> mean(tmp5,na.rm=TRUE)
[1] 74.27465
> Sum(tmp5,na.rm=TRUE)
[1] 14780.66
> Var(tmp5,na.rm=TRUE)
[1] 877.9075
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.72931 71.26672 72.31099 70.58389 73.38841 71.89433 71.90645 71.76149
 [9] 73.35837 74.42092
> rowSums(tmp5,na.rm=TRUE)
 [1] 1834.586 1425.334 1446.220 1411.678 1467.768 1437.887 1438.129 1363.468
 [9] 1467.167 1488.418
> rowVars(tmp5,na.rm=TRUE)
 [1] 8130.55286   70.77070   79.40680  109.56206   74.01879   62.77154
 [7]   94.32995   53.36562   34.02879   74.18350
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.169578  8.412532  8.911049 10.467190  8.603417  7.922850  9.712361
 [8]  7.305177  5.833420  8.612985
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.92755  86.25078  90.97796  95.09362  87.11403  83.50374  94.52515
 [8]  84.94989  84.04851  89.21254
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.85763 54.80503 58.30741 54.19647 53.87808 52.77588 56.17701 55.71792
 [9] 59.28644 53.68866
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.64748  68.90085  74.57701  70.16699  67.49585  72.95482  74.35129
 [8]  70.27845  76.29331  71.49286  73.92371  74.79572  69.18947  73.37874
[15]  74.02285  68.38820  71.70636  72.81456  74.94048  73.18173
> colSums(tmp5,na.rm=TRUE)
 [1] 1126.4748  689.0085  745.7701  701.6699  674.9585  729.5482  669.1616
 [8]  702.7845  762.9331  714.9286  739.2371  747.9572  691.8947  733.7874
[15]  740.2285  683.8820  717.0636  728.1456  749.4048  731.8173
> colVars(tmp5,na.rm=TRUE)
 [1] 16111.27447    75.82816   107.48504    61.34285    26.31008    89.45899
 [7]    48.86451   121.90671    34.48508    11.59195   104.45203    53.11480
[13]    29.09721   117.09950    75.68193    50.47213    94.23034    61.00736
[19]   116.04954    78.60356
> colSd(tmp5,na.rm=TRUE)
 [1] 126.930195   8.707937  10.367499   7.832167   5.129336   9.458276
 [7]   6.990316  11.041137   5.872400   3.404695  10.220178   7.287990
[13]   5.394183  10.821252   8.699536   7.104374   9.707231   7.810721
[19]  10.772629   8.865865
> colMax(tmp5,na.rm=TRUE)
 [1] 472.92755  80.31034  95.09362  84.94989  74.03182  87.07251  82.76257
 [8]  87.39910  82.73978  75.22067  89.21254  86.78945  76.79039  89.44218
[15]  89.31833  81.09224  89.83849  87.11403  94.52515  83.32930
> colMin(tmp5,na.rm=TRUE)
 [1] 59.28644 53.68866 61.61918 56.17701 58.88794 62.08329 62.45481 54.80503
 [9] 64.11079 63.44911 52.77588 65.20221 59.04127 53.87808 63.67437 59.03772
[17] 55.92468 55.71792 61.58850 54.19647
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.72931 71.26672 72.31099 70.58389 73.38841 71.89433 71.90645      NaN
 [9] 73.35837 74.42092
> rowSums(tmp5,na.rm=TRUE)
 [1] 1834.586 1425.334 1446.220 1411.678 1467.768 1437.887 1438.129    0.000
 [9] 1467.167 1488.418
> rowVars(tmp5,na.rm=TRUE)
 [1] 8130.55286   70.77070   79.40680  109.56206   74.01879   62.77154
 [7]   94.32995         NA   34.02879   74.18350
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.169578  8.412532  8.911049 10.467190  8.603417  7.922850  9.712361
 [8]        NA  5.833420  8.612985
> rowMax(tmp5,na.rm=TRUE)
 [1] 472.92755  86.25078  90.97796  95.09362  87.11403  83.50374  94.52515
 [8]        NA  84.04851  89.21254
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.85763 54.80503 58.30741 54.19647 53.87808 52.77588 56.17701       NA
 [9] 59.28644 53.68866
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.76076  68.24692  74.83137  68.52445  67.26096  73.70593       NaN
 [8]  69.60649  76.51866  71.07866  73.15856  74.53652  68.86199  74.18705
[15]  74.85662  69.17951  71.28881  74.71419  76.42403  72.70586
> colSums(tmp5,na.rm=TRUE)
 [1] 1050.8469  614.2222  673.4823  616.7200  605.3486  663.3534    0.0000
 [8]  626.4584  688.6680  639.7079  658.4270  670.8287  619.7579  667.6835
[15]  673.7096  622.6156  641.5993  672.4277  687.8163  654.3527
> colVars(tmp5,na.rm=TRUE)
 [1] 17934.84394    80.49580   120.19283    38.65873    28.97813    94.29446
 [7]          NA   132.06526    38.22441    11.11086   110.92223    58.99838
[13]    31.52783   124.38652    77.32146    49.73660   104.04780    28.03672
[19]   105.79526    85.88135
> colSd(tmp5,na.rm=TRUE)
 [1] 133.921036   8.971945  10.963249   6.217614   5.383134   9.710534
 [7]         NA  11.491965   6.182589   3.333296  10.531962   7.681040
[13]   5.614965  11.152871   8.793262   7.052418  10.200382   5.294971
[19]  10.285682   9.267219
> colMax(tmp5,na.rm=TRUE)
 [1] 472.92755  80.31034  95.09362  74.42717  74.03182  87.07251      -Inf
 [8]  87.39910  82.73978  74.18827  89.21254  86.78945  76.79039  89.44218
[15]  89.31833  81.09224  89.83849  87.11403  94.52515  83.32930
> colMin(tmp5,na.rm=TRUE)
 [1] 59.28644 53.68866 61.61918 56.17701 58.88794 62.08329      Inf 54.80503
 [9] 64.11079 63.44911 52.77588 65.20221 59.04127 53.87808 63.67437 59.03772
[17] 55.92468 68.16570 61.85078 54.19647
> 
> 
> 
> 
> 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] 160.1360 217.6100 163.9205 307.7580 198.3562 193.8130 167.5171 220.2981
 [9] 355.9141 292.5971
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 160.1360 217.6100 163.9205 307.7580 198.3562 193.8130 167.5171 220.2981
 [9] 355.9141 292.5971
> 
> 
> 
> 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.842171e-14 -3.410605e-13  0.000000e+00  1.705303e-13 -1.136868e-13
 [6]  5.684342e-14  2.557954e-13  2.842171e-14  2.842171e-14  0.000000e+00
[11]  5.684342e-14  2.273737e-13  0.000000e+00  0.000000e+00 -2.842171e-13
[16] -5.684342e-14  1.136868e-13 -3.979039e-13 -1.136868e-13 -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)
+ }
1   8 
7   8 
10   19 
9   14 
10   19 
6   4 
1   7 
5   5 
10   20 
6   1 
7   20 
4   4 
6   1 
10   9 
7   18 
4   8 
6   8 
7   17 
9   2 
4   10 
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.016698
> Min(tmp)
[1] -2.957161
> mean(tmp)
[1] 0.167914
> Sum(tmp)
[1] 16.7914
> Var(tmp)
[1] 1.024334
> 
> rowMeans(tmp)
[1] 0.167914
> rowSums(tmp)
[1] 16.7914
> rowVars(tmp)
[1] 1.024334
> rowSd(tmp)
[1] 1.012094
> rowMax(tmp)
[1] 2.016698
> rowMin(tmp)
[1] -2.957161
> 
> colMeans(tmp)
  [1] -0.46186375  1.62579786  0.27715582  0.25910262  1.10696854  0.29994584
  [7] -0.95426805  0.89079072  0.26357454  0.08427752  0.01614744 -0.15749850
 [13] -0.42353467 -0.32063188 -0.98365939  1.81720031  1.01558939 -0.36973281
 [19]  1.34533333  1.16003367  1.17293649  1.68939390  1.31765990  0.34565140
 [25] -1.93812182  0.28399529 -0.20923849  0.83476953 -0.11097442 -1.12501453
 [31]  0.59294883 -0.74333004  1.31394386  0.62423466  1.34502302 -1.84938684
 [37]  1.09394998 -0.25194562 -1.17608493 -0.01374789  0.68406218  0.63619574
 [43]  1.14568422  1.60403864  0.02916164  0.23032414  0.67931551 -0.33268871
 [49]  1.61036340  1.33931307  0.97624287  0.24106010 -1.66717133  0.85978398
 [55] -1.32840279 -0.14543082  1.67685871 -0.55893176  0.14338522  1.77388630
 [61] -0.25565409  0.70866835  1.93858490 -0.18399449 -0.30552277 -0.64388788
 [67]  0.28252544  0.86454162  0.77511473 -0.21657044 -1.05448287 -0.37635830
 [73]  1.50078802  0.53181978  0.77954888  1.17162616 -0.96223453  0.04241109
 [79] -0.98021040 -0.74760612 -0.43507032  0.62302867 -2.22037143 -0.42795274
 [85] -1.00773635  0.48884294 -1.37256646  0.74322397 -1.79119082  0.27720710
 [91]  0.20465858  0.16438387  2.01669769  0.55437915 -0.53310401  0.85871844
 [97] -1.34009070 -2.95716053  0.88267705 -0.09072545
> colSums(tmp)
  [1] -0.46186375  1.62579786  0.27715582  0.25910262  1.10696854  0.29994584
  [7] -0.95426805  0.89079072  0.26357454  0.08427752  0.01614744 -0.15749850
 [13] -0.42353467 -0.32063188 -0.98365939  1.81720031  1.01558939 -0.36973281
 [19]  1.34533333  1.16003367  1.17293649  1.68939390  1.31765990  0.34565140
 [25] -1.93812182  0.28399529 -0.20923849  0.83476953 -0.11097442 -1.12501453
 [31]  0.59294883 -0.74333004  1.31394386  0.62423466  1.34502302 -1.84938684
 [37]  1.09394998 -0.25194562 -1.17608493 -0.01374789  0.68406218  0.63619574
 [43]  1.14568422  1.60403864  0.02916164  0.23032414  0.67931551 -0.33268871
 [49]  1.61036340  1.33931307  0.97624287  0.24106010 -1.66717133  0.85978398
 [55] -1.32840279 -0.14543082  1.67685871 -0.55893176  0.14338522  1.77388630
 [61] -0.25565409  0.70866835  1.93858490 -0.18399449 -0.30552277 -0.64388788
 [67]  0.28252544  0.86454162  0.77511473 -0.21657044 -1.05448287 -0.37635830
 [73]  1.50078802  0.53181978  0.77954888  1.17162616 -0.96223453  0.04241109
 [79] -0.98021040 -0.74760612 -0.43507032  0.62302867 -2.22037143 -0.42795274
 [85] -1.00773635  0.48884294 -1.37256646  0.74322397 -1.79119082  0.27720710
 [91]  0.20465858  0.16438387  2.01669769  0.55437915 -0.53310401  0.85871844
 [97] -1.34009070 -2.95716053  0.88267705 -0.09072545
> 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.46186375  1.62579786  0.27715582  0.25910262  1.10696854  0.29994584
  [7] -0.95426805  0.89079072  0.26357454  0.08427752  0.01614744 -0.15749850
 [13] -0.42353467 -0.32063188 -0.98365939  1.81720031  1.01558939 -0.36973281
 [19]  1.34533333  1.16003367  1.17293649  1.68939390  1.31765990  0.34565140
 [25] -1.93812182  0.28399529 -0.20923849  0.83476953 -0.11097442 -1.12501453
 [31]  0.59294883 -0.74333004  1.31394386  0.62423466  1.34502302 -1.84938684
 [37]  1.09394998 -0.25194562 -1.17608493 -0.01374789  0.68406218  0.63619574
 [43]  1.14568422  1.60403864  0.02916164  0.23032414  0.67931551 -0.33268871
 [49]  1.61036340  1.33931307  0.97624287  0.24106010 -1.66717133  0.85978398
 [55] -1.32840279 -0.14543082  1.67685871 -0.55893176  0.14338522  1.77388630
 [61] -0.25565409  0.70866835  1.93858490 -0.18399449 -0.30552277 -0.64388788
 [67]  0.28252544  0.86454162  0.77511473 -0.21657044 -1.05448287 -0.37635830
 [73]  1.50078802  0.53181978  0.77954888  1.17162616 -0.96223453  0.04241109
 [79] -0.98021040 -0.74760612 -0.43507032  0.62302867 -2.22037143 -0.42795274
 [85] -1.00773635  0.48884294 -1.37256646  0.74322397 -1.79119082  0.27720710
 [91]  0.20465858  0.16438387  2.01669769  0.55437915 -0.53310401  0.85871844
 [97] -1.34009070 -2.95716053  0.88267705 -0.09072545
> colMin(tmp)
  [1] -0.46186375  1.62579786  0.27715582  0.25910262  1.10696854  0.29994584
  [7] -0.95426805  0.89079072  0.26357454  0.08427752  0.01614744 -0.15749850
 [13] -0.42353467 -0.32063188 -0.98365939  1.81720031  1.01558939 -0.36973281
 [19]  1.34533333  1.16003367  1.17293649  1.68939390  1.31765990  0.34565140
 [25] -1.93812182  0.28399529 -0.20923849  0.83476953 -0.11097442 -1.12501453
 [31]  0.59294883 -0.74333004  1.31394386  0.62423466  1.34502302 -1.84938684
 [37]  1.09394998 -0.25194562 -1.17608493 -0.01374789  0.68406218  0.63619574
 [43]  1.14568422  1.60403864  0.02916164  0.23032414  0.67931551 -0.33268871
 [49]  1.61036340  1.33931307  0.97624287  0.24106010 -1.66717133  0.85978398
 [55] -1.32840279 -0.14543082  1.67685871 -0.55893176  0.14338522  1.77388630
 [61] -0.25565409  0.70866835  1.93858490 -0.18399449 -0.30552277 -0.64388788
 [67]  0.28252544  0.86454162  0.77511473 -0.21657044 -1.05448287 -0.37635830
 [73]  1.50078802  0.53181978  0.77954888  1.17162616 -0.96223453  0.04241109
 [79] -0.98021040 -0.74760612 -0.43507032  0.62302867 -2.22037143 -0.42795274
 [85] -1.00773635  0.48884294 -1.37256646  0.74322397 -1.79119082  0.27720710
 [91]  0.20465858  0.16438387  2.01669769  0.55437915 -0.53310401  0.85871844
 [97] -1.34009070 -2.95716053  0.88267705 -0.09072545
> colMedians(tmp)
  [1] -0.46186375  1.62579786  0.27715582  0.25910262  1.10696854  0.29994584
  [7] -0.95426805  0.89079072  0.26357454  0.08427752  0.01614744 -0.15749850
 [13] -0.42353467 -0.32063188 -0.98365939  1.81720031  1.01558939 -0.36973281
 [19]  1.34533333  1.16003367  1.17293649  1.68939390  1.31765990  0.34565140
 [25] -1.93812182  0.28399529 -0.20923849  0.83476953 -0.11097442 -1.12501453
 [31]  0.59294883 -0.74333004  1.31394386  0.62423466  1.34502302 -1.84938684
 [37]  1.09394998 -0.25194562 -1.17608493 -0.01374789  0.68406218  0.63619574
 [43]  1.14568422  1.60403864  0.02916164  0.23032414  0.67931551 -0.33268871
 [49]  1.61036340  1.33931307  0.97624287  0.24106010 -1.66717133  0.85978398
 [55] -1.32840279 -0.14543082  1.67685871 -0.55893176  0.14338522  1.77388630
 [61] -0.25565409  0.70866835  1.93858490 -0.18399449 -0.30552277 -0.64388788
 [67]  0.28252544  0.86454162  0.77511473 -0.21657044 -1.05448287 -0.37635830
 [73]  1.50078802  0.53181978  0.77954888  1.17162616 -0.96223453  0.04241109
 [79] -0.98021040 -0.74760612 -0.43507032  0.62302867 -2.22037143 -0.42795274
 [85] -1.00773635  0.48884294 -1.37256646  0.74322397 -1.79119082  0.27720710
 [91]  0.20465858  0.16438387  2.01669769  0.55437915 -0.53310401  0.85871844
 [97] -1.34009070 -2.95716053  0.88267705 -0.09072545
> colRanges(tmp)
           [,1]     [,2]      [,3]      [,4]     [,5]      [,6]      [,7]
[1,] -0.4618638 1.625798 0.2771558 0.2591026 1.106969 0.2999458 -0.954268
[2,] -0.4618638 1.625798 0.2771558 0.2591026 1.106969 0.2999458 -0.954268
          [,8]      [,9]      [,10]      [,11]      [,12]      [,13]      [,14]
[1,] 0.8907907 0.2635745 0.08427752 0.01614744 -0.1574985 -0.4235347 -0.3206319
[2,] 0.8907907 0.2635745 0.08427752 0.01614744 -0.1574985 -0.4235347 -0.3206319
          [,15]  [,16]    [,17]      [,18]    [,19]    [,20]    [,21]    [,22]
[1,] -0.9836594 1.8172 1.015589 -0.3697328 1.345333 1.160034 1.172936 1.689394
[2,] -0.9836594 1.8172 1.015589 -0.3697328 1.345333 1.160034 1.172936 1.689394
       [,23]     [,24]     [,25]     [,26]      [,27]     [,28]      [,29]
[1,] 1.31766 0.3456514 -1.938122 0.2839953 -0.2092385 0.8347695 -0.1109744
[2,] 1.31766 0.3456514 -1.938122 0.2839953 -0.2092385 0.8347695 -0.1109744
         [,30]     [,31]    [,32]    [,33]     [,34]    [,35]     [,36]   [,37]
[1,] -1.125015 0.5929488 -0.74333 1.313944 0.6242347 1.345023 -1.849387 1.09395
[2,] -1.125015 0.5929488 -0.74333 1.313944 0.6242347 1.345023 -1.849387 1.09395
          [,38]     [,39]       [,40]     [,41]     [,42]    [,43]    [,44]
[1,] -0.2519456 -1.176085 -0.01374789 0.6840622 0.6361957 1.145684 1.604039
[2,] -0.2519456 -1.176085 -0.01374789 0.6840622 0.6361957 1.145684 1.604039
          [,45]     [,46]     [,47]      [,48]    [,49]    [,50]     [,51]
[1,] 0.02916164 0.2303241 0.6793155 -0.3326887 1.610363 1.339313 0.9762429
[2,] 0.02916164 0.2303241 0.6793155 -0.3326887 1.610363 1.339313 0.9762429
         [,52]     [,53]    [,54]     [,55]      [,56]    [,57]      [,58]
[1,] 0.2410601 -1.667171 0.859784 -1.328403 -0.1454308 1.676859 -0.5589318
[2,] 0.2410601 -1.667171 0.859784 -1.328403 -0.1454308 1.676859 -0.5589318
         [,59]    [,60]      [,61]     [,62]    [,63]      [,64]      [,65]
[1,] 0.1433852 1.773886 -0.2556541 0.7086684 1.938585 -0.1839945 -0.3055228
[2,] 0.1433852 1.773886 -0.2556541 0.7086684 1.938585 -0.1839945 -0.3055228
          [,66]     [,67]     [,68]     [,69]      [,70]     [,71]      [,72]
[1,] -0.6438879 0.2825254 0.8645416 0.7751147 -0.2165704 -1.054483 -0.3763583
[2,] -0.6438879 0.2825254 0.8645416 0.7751147 -0.2165704 -1.054483 -0.3763583
        [,73]     [,74]     [,75]    [,76]      [,77]      [,78]      [,79]
[1,] 1.500788 0.5318198 0.7795489 1.171626 -0.9622345 0.04241109 -0.9802104
[2,] 1.500788 0.5318198 0.7795489 1.171626 -0.9622345 0.04241109 -0.9802104
          [,80]      [,81]     [,82]     [,83]      [,84]     [,85]     [,86]
[1,] -0.7476061 -0.4350703 0.6230287 -2.220371 -0.4279527 -1.007736 0.4888429
[2,] -0.7476061 -0.4350703 0.6230287 -2.220371 -0.4279527 -1.007736 0.4888429
         [,87]    [,88]     [,89]     [,90]     [,91]     [,92]    [,93]
[1,] -1.372566 0.743224 -1.791191 0.2772071 0.2046586 0.1643839 2.016698
[2,] -1.372566 0.743224 -1.791191 0.2772071 0.2046586 0.1643839 2.016698
         [,94]     [,95]     [,96]     [,97]     [,98]    [,99]      [,100]
[1,] 0.5543791 -0.533104 0.8587184 -1.340091 -2.957161 0.882677 -0.09072545
[2,] 0.5543791 -0.533104 0.8587184 -1.340091 -2.957161 0.882677 -0.09072545
> 
> 
> Max(tmp2)
[1] 2.929547
> Min(tmp2)
[1] -1.826108
> mean(tmp2)
[1] 0.1943672
> Sum(tmp2)
[1] 19.43672
> Var(tmp2)
[1] 0.8711067
> 
> rowMeans(tmp2)
  [1]  0.273088911 -0.321783630  0.211043443  0.437030155  1.232369040
  [6] -0.628819832 -0.306798613  0.636021220  1.827427995 -0.779706981
 [11]  0.405308776 -0.231695420  0.656329923 -0.340332050 -0.081072657
 [16]  1.824197692  1.304227346  0.290043951 -0.843602534  1.371697404
 [21]  0.897549820  1.748288733  0.579619952  0.049805082 -0.406995004
 [26]  0.377928053 -0.004018630  2.929546959  0.902687855 -0.894077894
 [31]  0.779327287 -0.343313420  1.866423204 -0.087931722 -0.071257742
 [36]  1.159030169 -1.780139131  0.117314692 -0.150827407 -1.547682056
 [41] -0.249848961 -0.311291374 -0.262037723  0.828392408 -0.225129005
 [46] -0.408074999 -0.518517652  0.390409309  0.093135048 -0.351863061
 [51]  0.081302822 -1.826108136 -0.278366587 -0.627443323 -0.170748572
 [56] -0.585602361 -0.096168687 -0.703190414  0.037341347  0.617435283
 [61] -0.635370612 -0.795256749 -0.666604324  1.615963340 -0.056800830
 [66]  0.614561700 -0.744640161  2.240926332  0.244102696 -0.004906882
 [71]  0.089010612  1.559717226  1.445201305 -1.659585989 -0.900462409
 [76]  2.643799583  0.283720465 -0.164781744  0.991383676 -0.210823036
 [81] -0.656401431  1.871322134  0.529837010  0.218266046  0.424972967
 [86]  0.037855550 -0.199394093  1.605210429 -1.170345723  1.289494803
 [91]  0.160812622  1.518149202  0.118339226 -0.664491398 -0.512094581
 [96] -0.480913026  0.577360851  0.044664801  1.183701045 -0.838662232
> rowSums(tmp2)
  [1]  0.273088911 -0.321783630  0.211043443  0.437030155  1.232369040
  [6] -0.628819832 -0.306798613  0.636021220  1.827427995 -0.779706981
 [11]  0.405308776 -0.231695420  0.656329923 -0.340332050 -0.081072657
 [16]  1.824197692  1.304227346  0.290043951 -0.843602534  1.371697404
 [21]  0.897549820  1.748288733  0.579619952  0.049805082 -0.406995004
 [26]  0.377928053 -0.004018630  2.929546959  0.902687855 -0.894077894
 [31]  0.779327287 -0.343313420  1.866423204 -0.087931722 -0.071257742
 [36]  1.159030169 -1.780139131  0.117314692 -0.150827407 -1.547682056
 [41] -0.249848961 -0.311291374 -0.262037723  0.828392408 -0.225129005
 [46] -0.408074999 -0.518517652  0.390409309  0.093135048 -0.351863061
 [51]  0.081302822 -1.826108136 -0.278366587 -0.627443323 -0.170748572
 [56] -0.585602361 -0.096168687 -0.703190414  0.037341347  0.617435283
 [61] -0.635370612 -0.795256749 -0.666604324  1.615963340 -0.056800830
 [66]  0.614561700 -0.744640161  2.240926332  0.244102696 -0.004906882
 [71]  0.089010612  1.559717226  1.445201305 -1.659585989 -0.900462409
 [76]  2.643799583  0.283720465 -0.164781744  0.991383676 -0.210823036
 [81] -0.656401431  1.871322134  0.529837010  0.218266046  0.424972967
 [86]  0.037855550 -0.199394093  1.605210429 -1.170345723  1.289494803
 [91]  0.160812622  1.518149202  0.118339226 -0.664491398 -0.512094581
 [96] -0.480913026  0.577360851  0.044664801  1.183701045 -0.838662232
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  0.273088911 -0.321783630  0.211043443  0.437030155  1.232369040
  [6] -0.628819832 -0.306798613  0.636021220  1.827427995 -0.779706981
 [11]  0.405308776 -0.231695420  0.656329923 -0.340332050 -0.081072657
 [16]  1.824197692  1.304227346  0.290043951 -0.843602534  1.371697404
 [21]  0.897549820  1.748288733  0.579619952  0.049805082 -0.406995004
 [26]  0.377928053 -0.004018630  2.929546959  0.902687855 -0.894077894
 [31]  0.779327287 -0.343313420  1.866423204 -0.087931722 -0.071257742
 [36]  1.159030169 -1.780139131  0.117314692 -0.150827407 -1.547682056
 [41] -0.249848961 -0.311291374 -0.262037723  0.828392408 -0.225129005
 [46] -0.408074999 -0.518517652  0.390409309  0.093135048 -0.351863061
 [51]  0.081302822 -1.826108136 -0.278366587 -0.627443323 -0.170748572
 [56] -0.585602361 -0.096168687 -0.703190414  0.037341347  0.617435283
 [61] -0.635370612 -0.795256749 -0.666604324  1.615963340 -0.056800830
 [66]  0.614561700 -0.744640161  2.240926332  0.244102696 -0.004906882
 [71]  0.089010612  1.559717226  1.445201305 -1.659585989 -0.900462409
 [76]  2.643799583  0.283720465 -0.164781744  0.991383676 -0.210823036
 [81] -0.656401431  1.871322134  0.529837010  0.218266046  0.424972967
 [86]  0.037855550 -0.199394093  1.605210429 -1.170345723  1.289494803
 [91]  0.160812622  1.518149202  0.118339226 -0.664491398 -0.512094581
 [96] -0.480913026  0.577360851  0.044664801  1.183701045 -0.838662232
> rowMin(tmp2)
  [1]  0.273088911 -0.321783630  0.211043443  0.437030155  1.232369040
  [6] -0.628819832 -0.306798613  0.636021220  1.827427995 -0.779706981
 [11]  0.405308776 -0.231695420  0.656329923 -0.340332050 -0.081072657
 [16]  1.824197692  1.304227346  0.290043951 -0.843602534  1.371697404
 [21]  0.897549820  1.748288733  0.579619952  0.049805082 -0.406995004
 [26]  0.377928053 -0.004018630  2.929546959  0.902687855 -0.894077894
 [31]  0.779327287 -0.343313420  1.866423204 -0.087931722 -0.071257742
 [36]  1.159030169 -1.780139131  0.117314692 -0.150827407 -1.547682056
 [41] -0.249848961 -0.311291374 -0.262037723  0.828392408 -0.225129005
 [46] -0.408074999 -0.518517652  0.390409309  0.093135048 -0.351863061
 [51]  0.081302822 -1.826108136 -0.278366587 -0.627443323 -0.170748572
 [56] -0.585602361 -0.096168687 -0.703190414  0.037341347  0.617435283
 [61] -0.635370612 -0.795256749 -0.666604324  1.615963340 -0.056800830
 [66]  0.614561700 -0.744640161  2.240926332  0.244102696 -0.004906882
 [71]  0.089010612  1.559717226  1.445201305 -1.659585989 -0.900462409
 [76]  2.643799583  0.283720465 -0.164781744  0.991383676 -0.210823036
 [81] -0.656401431  1.871322134  0.529837010  0.218266046  0.424972967
 [86]  0.037855550 -0.199394093  1.605210429 -1.170345723  1.289494803
 [91]  0.160812622  1.518149202  0.118339226 -0.664491398 -0.512094581
 [96] -0.480913026  0.577360851  0.044664801  1.183701045 -0.838662232
> 
> colMeans(tmp2)
[1] 0.1943672
> colSums(tmp2)
[1] 19.43672
> colVars(tmp2)
[1] 0.8711067
> colSd(tmp2)
[1] 0.933331
> colMax(tmp2)
[1] 2.929547
> colMin(tmp2)
[1] -1.826108
> colMedians(tmp2)
[1] 0.04126018
> colRanges(tmp2)
          [,1]
[1,] -1.826108
[2,]  2.929547
> 
> 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.5178228 -3.7222119 -4.8833539 -0.6173750  0.3636737  0.5494144
 [7]  0.2616500 -3.6072028  1.5977632 -2.0138490
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8319404
[2,] -0.3611272
[3,] -0.2348113
[4,]  0.4079760
[5,]  1.5931607
> 
> rowApply(tmp,sum)
 [1] -1.7384473 -3.8939835 -2.5702261  1.3339211  1.3046653  1.6779486
 [7] -5.5139662 -2.3679984 -0.6974587 -0.1237688
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    2    9    2    9    9    4    6    7    8     6
 [2,]   10    3    1    3   10   10    4    1    4     1
 [3,]    6    8    4    4    2    3    3    6    2     2
 [4,]    1    7    7    2    1    8    9   10    9     3
 [5,]    9    5    5    8    5    5   10    3    6     5
 [6,]    7    6    8    5    6    2    1    8   10     8
 [7,]    5    4    9    7    7    6    2    5    7     7
 [8,]    8    1   10    6    8    1    5    4    3     4
 [9,]    3   10    6    1    4    9    8    9    1    10
[10,]    4    2    3   10    3    7    7    2    5     9
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  4.77641132  0.97973999 -0.26516262  0.87302348 -1.28528979 -0.02248327
 [7]  0.69913013  0.98873681  0.56248780 -0.93750214 -0.51950450  0.40647317
[13]  1.64514879  0.47920256  1.79071803 -0.36500348  0.32010358  0.12124671
[19] -0.22444024  3.35675587
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.3190162
[2,]  0.1772891
[3,]  1.1290590
[4,]  1.4787540
[5,]  2.3103255
> 
> rowApply(tmp,sum)
[1]  1.916948  2.443626  1.888124 -2.799326  9.930421
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   17   20    9    9   19
[2,]    9    5   19   18    2
[3,]    1   11   20   11    5
[4,]   19   13    1   17    8
[5,]    8    3   10    6   12
> 
> 
> as.matrix(tmp)
           [,1]       [,2]        [,3]        [,4]       [,5]       [,6]
[1,]  1.1290590 -0.3067811 -1.24894809  1.43875136 -0.3097969 -0.7712341
[2,]  2.3103255 -0.7660234  0.06785877  0.34851566 -0.9518911  0.2021641
[3,]  0.1772891  1.2685057  1.35825084 -1.69958699  0.1952002 -0.6470247
[4,] -0.3190162  1.3117539 -0.25932756  0.86591190 -0.8630820 -0.1882526
[5,]  1.4787540 -0.5277151 -0.18299658 -0.08056845  0.6442800  1.3818640
           [,7]        [,8]       [,9]      [,10]      [,11]      [,12]
[1,]  0.5138231  0.01150572  0.4691759 -0.3583488 -0.1597467 -0.5787177
[2,]  0.8424520  0.05036404  1.0364042 -0.9821340 -1.1765203  1.4282129
[3,]  0.2236531 -0.67329644  0.8622644 -0.4436757 -0.6828375  1.0974135
[4,] -2.0360800  1.73301795 -1.4195573  0.3058060  0.5520006 -1.3609719
[5,]  1.1552819 -0.13285447 -0.3857993  0.5408504  0.9475994 -0.1794636
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,]  0.5943386 -0.4078430 -0.6800070 -0.5783955  1.6298649  0.2098331
[2,] -0.9250474 -0.5356466 -0.4831068 -0.2507839  0.6237915 -0.1317550
[3,] -0.6834440  1.1157365  0.5637174  0.3811761 -1.2216898  0.4878271
[4,] -0.6782019  0.6631245  1.6852534  0.7779309 -1.3896550 -0.5974582
[5,]  3.3375035 -0.3561689  0.7048610 -0.6949310  0.6777919  0.1527998
          [,19]       [,20]
[1,]  0.1614926  1.15892233
[2,]  0.4100031  1.32644274
[3,] -0.8917523  1.10039730
[4,] -1.3124080 -0.27011463
[5,]  1.4082243  0.04110814
> 
> 
> 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.18-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.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  649  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  562  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.18-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.005379 -0.2042533 0.7097084 2.045623 -0.3415709 -0.1324054 0.3074825
          col8     col9    col10    col11     col12    col13    col14
row1 -0.526375 1.215263 1.134155 1.289732 0.9353714 1.853403 0.520565
          col15    col16    col17      col18      col19     col20
row1 -0.4794122 1.288559 0.108167 -0.1835524 -0.3445053 -1.577546
> tmp[,"col10"]
          col10
row1  1.1341546
row2  1.9005757
row3 -1.9547009
row4 -1.1191810
row5  0.3041576
> tmp[c("row1","row5"),]
         col1       col2      col3     col4       col5       col6        col7
row1 1.005379 -0.2042533 0.7097084 2.045623 -0.3415709 -0.1324054  0.30748250
row5 1.076345  0.1102592 1.6810072 1.519685  1.4554054 -0.5867209 -0.07153151
           col8      col9     col10      col11      col12    col13     col14
row1 -0.5263750 1.2152626 1.1341546  1.2897319  0.9353714 1.853403 0.5205650
row5  0.1633553 0.4797779 0.3041576 -0.2106924 -1.1572572 1.755638 0.4857409
          col15     col16     col17      col18      col19     col20
row1 -0.4794122  1.288559  0.108167 -0.1835524 -0.3445053 -1.577546
row5  0.2290894 -1.116783 -1.484556 -1.1813066  2.3971055 -1.069496
> tmp[,c("col6","col20")]
            col6      col20
row1 -0.13240538 -1.5775456
row2 -1.10186418 -0.2991780
row3  0.01833878  0.5771291
row4 -1.12065052  0.1018358
row5 -0.58672086 -1.0694956
> tmp[c("row1","row5"),c("col6","col20")]
           col6     col20
row1 -0.1324054 -1.577546
row5 -0.5867209 -1.069496
> 
> 
> 
> 
> 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 49.92675 49.63039 50.7997 50.50506 49.04638 104.9878 50.22144 48.04494
         col9    col10    col11    col12    col13    col14    col15   col16
row1 51.00351 49.48425 52.29507 48.19113 51.31837 49.50561 50.21805 48.7634
        col17    col18    col19    col20
row1 49.03603 48.00586 50.81193 104.8613
> tmp[,"col10"]
        col10
row1 49.48425
row2 28.82292
row3 29.78738
row4 29.73867
row5 51.53127
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.92675 49.63039 50.79970 50.50506 49.04638 104.9878 50.22144 48.04494
row5 48.10783 48.05477 50.15778 49.95507 49.66872 105.2857 50.95232 51.19262
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.00351 49.48425 52.29507 48.19113 51.31837 49.50561 50.21805 48.76340
row5 50.10113 51.53127 49.53471 49.59349 48.34932 49.73586 49.97572 48.77806
        col17    col18    col19    col20
row1 49.03603 48.00586 50.81193 104.8613
row5 50.23681 48.88365 51.05819 105.4551
> tmp[,c("col6","col20")]
          col6     col20
row1 104.98779 104.86134
row2  75.66821  76.33891
row3  75.69475  75.23098
row4  73.98907  74.73063
row5 105.28572 105.45506
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.9878 104.8613
row5 105.2857 105.4551
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.9878 104.8613
row5 105.2857 105.4551
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.2443024
[2,]  0.1049565
[3,]  0.1305160
[4,] -0.2838849
[5,]  0.1884513
> tmp[,c("col17","col7")]
          col17        col7
[1,]  1.0964277 -0.40228386
[2,]  1.0362728  0.89698057
[3,] -0.4829333  0.23391101
[4,] -0.1795308 -0.01962683
[5,]  2.1156559 -0.11062186
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6       col20
[1,] -1.43330862  0.07873309
[2,] -0.25306408  1.53552325
[3,] -0.07652937 -0.42457002
[4,]  2.55869356  0.33209994
[5,] -0.09588774  1.28653853
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -1.433309
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -1.4333086
[2,] -0.2530641
> 
> 
> 
> 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.644539 0.6710735  0.04839734 0.7547574  0.40447840 1.26272429
row1  2.647725 1.0436212 -0.07705641 0.3413155 -0.02125259 0.09373461
           [,7]        [,8]       [,9]     [,10]      [,11]      [,12]
row3 -0.5646136 -0.05203307 -0.2353559 1.3312788  0.8391532  1.0039243
row1 -0.9738245 -0.65731485 -0.3241807 0.9853953 -0.9822006 -0.8151814
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
row3  0.6823594 -1.2779551 -1.1663540 -0.7626421 -0.9186413 -0.4861206
row1 -0.6304507 -0.2882094  0.3836131  0.6346589  1.3182967 -0.5823038
         [,19]     [,20]
row3 0.4686420 0.2741502
row1 0.5865292 0.3963665
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]      [,2]       [,3]      [,4]       [,5]       [,6]     [,7]
row2 1.027775 0.2926552 -0.8570404 -1.949886 -0.6837991 -0.8407367 1.972252
          [,8]      [,9]      [,10]
row2 0.2280788 0.1261193 -0.8889439
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]    [,3]       [,4]      [,5]       [,6]      [,7]
row5 0.4554009 -0.4218949 0.52749 -0.8485476 -1.161193 -0.9208157 0.7738527
           [,8]      [,9]      [,10]      [,11]    [,12]      [,13]      [,14]
row5 -0.4609239 0.1102681 -0.6381406 0.07193092 1.488408 -0.4363016 -0.4063259
         [,15]      [,16]     [,17]      [,18]     [,19]    [,20]
row5 -0.515909 -0.3217054 -1.511975 -0.8606614 -1.202496 1.268418
> 
> 
> 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: 0xaaaac892a9b0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc8834045c340"
 [2] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc8832d562dc2"
 [3] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc883760eeae1"
 [4] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc883638e3fa" 
 [5] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc8831945c881"
 [6] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc8834d8382d1"
 [7] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc88350801251"
 [8] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc88360e05c3f"
 [9] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc8836f901aea"
[10] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc88366ec0e2f"
[11] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc88366afa898"
[12] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc8833919f3e3"
[13] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc883d6f48e3" 
[14] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc8835d988ef6"
[15] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BMdc88322497625"
> 
> 
> ### 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: 0xaaaac71da2c0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xaaaac71da2c0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xaaaac71da2c0>
> rowMedians(tmp)
  [1]  0.105007837  0.113665611  0.227586181  0.491819139  0.430557113
  [6] -0.325649108  0.657702881 -0.111787831 -0.259901554  0.386972882
 [11] -0.277350097 -0.002885932  0.312177865  0.322822462  0.204487250
 [16]  0.674594609  0.234608316 -0.242115709 -0.519541704 -0.123682056
 [21]  0.301784916 -0.235994791  0.058208508  0.170030044 -0.147522775
 [26] -0.481552605  0.066282055 -0.105953805  0.284524474 -0.056281193
 [31] -0.101640936 -0.314814399  0.270487874 -0.269740946  0.084624101
 [36]  0.247111490  0.155766969  0.256739233 -0.248414906 -0.116436410
 [41]  0.150973759 -0.103010438  0.048625691 -0.119082185  0.553416237
 [46] -0.415724538  0.102048496 -0.586093199  0.084671911  0.199580917
 [51]  0.276202244  0.176973205 -0.438556759 -0.308385808 -0.062155271
 [56]  0.067230196  0.343903935  0.153951219  0.482759436 -0.241581053
 [61]  0.414363567 -0.228042195  0.195047055  0.064156677  0.374012984
 [66] -0.434051787  0.631104673  0.053523856 -0.193707703  0.090922787
 [71]  0.134857818 -0.490102394  0.028044901  0.019078376  0.256802107
 [76] -0.220171330 -0.415018307 -0.434867060 -0.700945586  0.468026423
 [81] -0.162205326 -0.524914411 -0.217774275  0.114268418  0.203078533
 [86] -0.613834687 -0.361094677  0.276571237  0.099818964  0.203238230
 [91]  0.076571446 -0.328341262 -0.138953595  0.434020748 -0.078850204
 [96] -0.166510245  0.364147998 -0.079046607  0.022042798  0.159721480
[101] -0.504860009 -0.196949570  0.190249661  0.158556293  0.066722693
[106]  0.086411733  0.175982559 -0.126478254  0.276207772 -0.193877367
[111] -0.092279849  0.603634572 -0.103882339 -0.139027164 -0.365923729
[116] -0.541395868  0.101919532 -0.284140196  0.018479742  0.305095603
[121]  0.010968978 -0.067516417 -0.069179095  0.598316434 -0.196869813
[126] -0.048020624 -0.116605512  0.088188066  0.175802842  0.025402099
[131]  0.079968247 -0.138740544 -0.395904646  1.016568624 -0.127830971
[136]  0.050260237 -0.181184111  0.478771806 -0.577549467  0.209650377
[141]  0.351073625 -0.303285740  0.163863845  0.262336194 -0.293683164
[146]  0.015060334  0.035005236  0.281479749 -0.131938542 -0.149178232
[151] -0.406333237  0.237184697 -0.588087862 -0.343258827  0.592697212
[156]  0.552386609 -0.306148566  0.323914190 -0.337023813 -0.156139969
[161]  0.410821734  0.205440260 -0.264204489 -0.149451096  0.097600722
[166]  0.267649857 -0.170845199 -0.142052853  0.151612770  0.036073597
[171]  0.334705205  0.240006748 -0.201485002 -0.059766092 -0.685249085
[176]  0.182218957 -0.156094802  0.242196301 -1.284144189 -0.299851686
[181]  0.234588517 -0.224159370 -0.163989618 -0.830162604 -0.120117905
[186] -0.172971550 -0.320068995 -0.265848672 -0.697901704 -0.721103116
[191] -0.105933232 -0.366484228  0.377546467 -0.159464196  0.349659068
[196]  0.411261909  0.432277931  0.581189184 -0.288936756  0.081367152
[201]  0.539089250 -0.323365227  0.653673295  0.214729797  0.115514172
[206] -0.007377515 -0.075642626 -0.263400074  0.464239161 -0.068207061
[211] -0.674448109 -0.440752776  0.500049157 -0.412531621  0.477166018
[216] -0.372996208 -0.084545706 -0.268933544  0.398600768 -0.103415398
[221] -0.070288817  0.363689806  0.318123665  0.428189455  0.527901697
[226] -0.207749435  0.089061270 -0.116409002  0.473045362  0.411617650
> 
> proc.time()
   user  system elapsed 
  1.883   1.380   3.284 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
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: 0xaaab2336a3f0>
> .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: 0xaaab2336a3f0>
> .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: 0xaaab2336a3f0>
> .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: 0xaaab2336a3f0>
> 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: 0xaaab21b24e60>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab21b24e60>
> .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: 0xaaab21b24e60>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab21b24e60>
> .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: 0xaaab21b24e60>
> 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: 0xaaab22bf87f0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab22bf87f0>
> .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: 0xaaab22bf87f0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaab22bf87f0>
> .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: 0xaaab22bf87f0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0xaaab22bf87f0>
> .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: 0xaaab22bf87f0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0xaaab22bf87f0>
> .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: 0xaaab22bf87f0>
> 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: 0xaaab21c72830>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0xaaab21c72830>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab21c72830>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab21c72830>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFiledc89c57a4ff1d" "BufferedMatrixFiledc89c7c55aaa" 
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFiledc89c57a4ff1d" "BufferedMatrixFiledc89c7c55aaa" 
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab22119380>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab22119380>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaab22119380>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaab22119380>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0xaaab22119380>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0xaaab22119380>
> .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: 0xaaab21921d40>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab21921d40>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaab21921d40>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0xaaab21921d40>
> 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: 0xaaab2252ccb0>
> .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: 0xaaab2252ccb0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.336   0.047   0.366 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
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.330   0.038   0.351 

Example timings