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

This page was generated on 2023-02-08 01:14:54 -0000 (Wed, 08 Feb 2023).

HostnameOSArch (*)R versionInstalled pkgs
kunpeng1Linux (Ubuntu 22.04.1 LTS)aarch64R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences" 4164
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/2164HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.63.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-02-06 00:12:45 -0000 (Mon, 06 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-06 19:43:16 -0000 (Mon, 06 Feb 2023)
EndedAt: 2023-02-06 19:43:48 -0000 (Mon, 06 Feb 2023)
EllapsedTime: 32.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.17-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.17-bioc/R/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.346   0.026   0.357 

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] "Mon Feb  6 19:43:35 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] "Mon Feb  6 19:43:35 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: 0xaaaae69778e0>
> 
> 
> 
> 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] "Mon Feb  6 19:43:36 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] "Mon Feb  6 19:43:36 2023"
> 
> ColMode(tmp2)
<pointer: 0xaaaae69778e0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]        [,2]       [,3]       [,4]
[1,] 99.8340965  0.02021106  0.2670532 -1.5349296
[2,] -1.3360961  1.29036535  1.2409206  0.4875652
[3,] -0.3816884  1.42004983 -0.9518254 -1.4060628
[4,]  0.5077188 -2.81514285 -2.3611427  0.8043706
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]       [,2]      [,3]      [,4]
[1,] 99.8340965 0.02021106 0.2670532 1.5349296
[2,]  1.3360961 1.29036535 1.2409206 0.4875652
[3,]  0.3816884 1.42004983 0.9518254 1.4060628
[4,]  0.5077188 2.81514285 2.3611427 0.8043706
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9917014 0.1421656 0.5167719 1.2389227
[2,] 1.1558962 1.1359425 1.1139662 0.6982587
[3,] 0.6178093 1.1916584 0.9756154 1.1857752
[4,] 0.7125439 1.6778387 1.5366010 0.8968671
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.75111 26.44187 30.43477 38.92416
[2,]  37.89506 37.64979 37.38058 32.47015
[3,]  31.55978 38.33663 35.70798 38.26381
[4,]  32.63316 44.59353 42.72715 34.77304
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0xaaaae60f6470>
> exp(tmp5)
<pointer: 0xaaaae60f6470>
> log(tmp5,2)
<pointer: 0xaaaae60f6470>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.79
> Min(tmp5)
[1] 53.62108
> mean(tmp5)
[1] 73.39161
> Sum(tmp5)
[1] 14678.32
> Var(tmp5)
[1] 859.5135
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.21983 68.49317 71.85821 78.62963 70.02766 69.29431 71.39794 71.42415
 [9] 70.78867 69.78248
> rowSums(tmp5)
 [1] 1844.397 1369.863 1437.164 1572.593 1400.553 1385.886 1427.959 1428.483
 [9] 1415.773 1395.650
> rowVars(tmp5)
 [1] 7903.09605  105.73683   65.22636   72.52306   65.07901   84.25372
 [7]   61.54198   67.29367   33.48343   55.58048
> rowSd(tmp5)
 [1] 88.899359 10.282842  8.076284  8.516047  8.067156  9.178983  7.844870
 [8]  8.203272  5.786487  7.455232
> rowMax(tmp5)
 [1] 467.78999  83.65336  81.32947  92.81559  86.17121  93.33132  88.22190
 [8]  82.12544  80.54518  84.72113
> rowMin(tmp5)
 [1] 55.03528 53.62108 53.72545 63.21452 54.58390 53.89311 56.36048 55.94562
 [9] 58.20816 58.70263
> 
> colMeans(tmp5)
 [1] 110.08318  72.67405  71.23350  73.68817  75.08311  69.01153  73.40787
 [8]  66.69818  71.08296  71.57443  73.76759  71.32612  71.67541  66.26323
[15]  64.81622  76.64561  73.37081  73.82902  68.07978  73.52133
> colSums(tmp5)
 [1] 1100.8318  726.7405  712.3350  736.8817  750.8311  690.1153  734.0787
 [8]  666.9818  710.8296  715.7443  737.6759  713.2612  716.7541  662.6323
[15]  648.1622  766.4561  733.7081  738.2902  680.7978  735.2133
> colVars(tmp5)
 [1] 15810.76870   126.68620    81.98593    33.44273    78.76942    80.91683
 [7]    84.37114    75.44366    79.86922    27.76626   101.10572    96.31585
[13]    77.20396    21.48541    47.18433    59.28016   127.00932    66.67762
[19]    94.39398    58.86756
> colSd(tmp5)
 [1] 125.740879  11.255496   9.054608   5.782969   8.875214   8.995378
 [7]   9.185376   8.685831   8.936958   5.269370  10.055134   9.814064
[13]   8.786578   4.635236   6.869085   7.699361  11.269841   8.165636
[19]   9.715656   7.672520
> colMax(tmp5)
 [1] 467.78999  92.81559  88.93097  81.29221  86.14849  79.43307  93.33132
 [8]  82.12544  82.48015  79.39467  88.22190  88.49674  84.72113  73.56661
[15]  76.32619  87.40440  90.92851  83.65336  81.32947  87.19155
> colMin(tmp5)
 [1] 65.68755 55.03528 58.23513 64.83396 58.37490 55.85254 58.70263 53.89311
 [9] 54.24847 60.57780 60.64110 57.18194 53.72545 57.85688 55.60856 61.90247
[17] 53.62108 57.34916 54.58390 63.94024
> 
> 
> ### 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] 92.21983 68.49317       NA 78.62963 70.02766 69.29431 71.39794 71.42415
 [9] 70.78867 69.78248
> rowSums(tmp5)
 [1] 1844.397 1369.863       NA 1572.593 1400.553 1385.886 1427.959 1428.483
 [9] 1415.773 1395.650
> rowVars(tmp5)
 [1] 7903.09605  105.73683   67.97058   72.52306   65.07901   84.25372
 [7]   61.54198   67.29367   33.48343   55.58048
> rowSd(tmp5)
 [1] 88.899359 10.282842  8.244427  8.516047  8.067156  9.178983  7.844870
 [8]  8.203272  5.786487  7.455232
> rowMax(tmp5)
 [1] 467.78999  83.65336        NA  92.81559  86.17121  93.33132  88.22190
 [8]  82.12544  80.54518  84.72113
> rowMin(tmp5)
 [1] 55.03528 53.62108       NA 63.21452 54.58390 53.89311 56.36048 55.94562
 [9] 58.20816 58.70263
> 
> colMeans(tmp5)
 [1] 110.08318  72.67405  71.23350  73.68817  75.08311  69.01153  73.40787
 [8]  66.69818  71.08296  71.57443  73.76759        NA  71.67541  66.26323
[15]  64.81622  76.64561  73.37081  73.82902  68.07978  73.52133
> colSums(tmp5)
 [1] 1100.8318  726.7405  712.3350  736.8817  750.8311  690.1153  734.0787
 [8]  666.9818  710.8296  715.7443  737.6759        NA  716.7541  662.6323
[15]  648.1622  766.4561  733.7081  738.2902  680.7978  735.2133
> colVars(tmp5)
 [1] 15810.76870   126.68620    81.98593    33.44273    78.76942    80.91683
 [7]    84.37114    75.44366    79.86922    27.76626   101.10572          NA
[13]    77.20396    21.48541    47.18433    59.28016   127.00932    66.67762
[19]    94.39398    58.86756
> colSd(tmp5)
 [1] 125.740879  11.255496   9.054608   5.782969   8.875214   8.995378
 [7]   9.185376   8.685831   8.936958   5.269370  10.055134         NA
[13]   8.786578   4.635236   6.869085   7.699361  11.269841   8.165636
[19]   9.715656   7.672520
> colMax(tmp5)
 [1] 467.78999  92.81559  88.93097  81.29221  86.14849  79.43307  93.33132
 [8]  82.12544  82.48015  79.39467  88.22190        NA  84.72113  73.56661
[15]  76.32619  87.40440  90.92851  83.65336  81.32947  87.19155
> colMin(tmp5)
 [1] 65.68755 55.03528 58.23513 64.83396 58.37490 55.85254 58.70263 53.89311
 [9] 54.24847 60.57780 60.64110       NA 53.72545 57.85688 55.60856 61.90247
[17] 53.62108 57.34916 54.58390 63.94024
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.79
> Min(tmp5,na.rm=TRUE)
[1] 53.62108
> mean(tmp5,na.rm=TRUE)
[1] 73.4188
> Sum(tmp5,na.rm=TRUE)
[1] 14610.34
> Var(tmp5,na.rm=TRUE)
[1] 863.7058
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.21983 68.49317 72.06231 78.62963 70.02766 69.29431 71.39794 71.42415
 [9] 70.78867 69.78248
> rowSums(tmp5,na.rm=TRUE)
 [1] 1844.397 1369.863 1369.184 1572.593 1400.553 1385.886 1427.959 1428.483
 [9] 1415.773 1395.650
> rowVars(tmp5,na.rm=TRUE)
 [1] 7903.09605  105.73683   67.97058   72.52306   65.07901   84.25372
 [7]   61.54198   67.29367   33.48343   55.58048
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.899359 10.282842  8.244427  8.516047  8.067156  9.178983  7.844870
 [8]  8.203272  5.786487  7.455232
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.78999  83.65336  81.32947  92.81559  86.17121  93.33132  88.22190
 [8]  82.12544  80.54518  84.72113
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.03528 53.62108 53.72545 63.21452 54.58390 53.89311 56.36048 55.94562
 [9] 58.20816 58.70263
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.08318  72.67405  71.23350  73.68817  75.08311  69.01153  73.40787
 [8]  66.69818  71.08296  71.57443  73.76759  71.69789  71.67541  66.26323
[15]  64.81622  76.64561  73.37081  73.82902  68.07978  73.52133
> colSums(tmp5,na.rm=TRUE)
 [1] 1100.8318  726.7405  712.3350  736.8817  750.8311  690.1153  734.0787
 [8]  666.9818  710.8296  715.7443  737.6759  645.2810  716.7541  662.6323
[15]  648.1622  766.4561  733.7081  738.2902  680.7978  735.2133
> colVars(tmp5,na.rm=TRUE)
 [1] 15810.76870   126.68620    81.98593    33.44273    78.76942    80.91683
 [7]    84.37114    75.44366    79.86922    27.76626   101.10572   106.80045
[13]    77.20396    21.48541    47.18433    59.28016   127.00932    66.67762
[19]    94.39398    58.86756
> colSd(tmp5,na.rm=TRUE)
 [1] 125.740879  11.255496   9.054608   5.782969   8.875214   8.995378
 [7]   9.185376   8.685831   8.936958   5.269370  10.055134  10.334430
[13]   8.786578   4.635236   6.869085   7.699361  11.269841   8.165636
[19]   9.715656   7.672520
> colMax(tmp5,na.rm=TRUE)
 [1] 467.78999  92.81559  88.93097  81.29221  86.14849  79.43307  93.33132
 [8]  82.12544  82.48015  79.39467  88.22190  88.49674  84.72113  73.56661
[15]  76.32619  87.40440  90.92851  83.65336  81.32947  87.19155
> colMin(tmp5,na.rm=TRUE)
 [1] 65.68755 55.03528 58.23513 64.83396 58.37490 55.85254 58.70263 53.89311
 [9] 54.24847 60.57780 60.64110 57.18194 53.72545 57.85688 55.60856 61.90247
[17] 53.62108 57.34916 54.58390 63.94024
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.21983 68.49317      NaN 78.62963 70.02766 69.29431 71.39794 71.42415
 [9] 70.78867 69.78248
> rowSums(tmp5,na.rm=TRUE)
 [1] 1844.397 1369.863    0.000 1572.593 1400.553 1385.886 1427.959 1428.483
 [9] 1415.773 1395.650
> rowVars(tmp5,na.rm=TRUE)
 [1] 7903.09605  105.73683         NA   72.52306   65.07901   84.25372
 [7]   61.54198   67.29367   33.48343   55.58048
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.899359 10.282842        NA  8.516047  8.067156  9.178983  7.844870
 [8]  8.203272  5.786487  7.455232
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.78999  83.65336        NA  92.81559  86.17121  93.33132  88.22190
 [8]  82.12544  80.54518  84.72113
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.03528 53.62108       NA 63.21452 54.58390 53.89311 56.36048 55.94562
 [9] 58.20816 58.70263
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.01603  71.88309  70.89039  73.02673  74.82975  68.23351  73.00522
 [8]  67.48739  72.37875  71.19637  73.21553       NaN  73.66985  66.28826
[15]  64.36390  76.18220  72.73424  74.33527  66.60759  74.19768
> colSums(tmp5,na.rm=TRUE)
 [1] 1035.1443  646.9478  638.0135  657.2406  673.4678  614.1016  657.0470
 [8]  607.3865  651.4087  640.7673  658.9398    0.0000  663.0286  596.5943
[15]  579.2751  685.6398  654.6082  669.0175  599.4683  667.7791
> colVars(tmp5,na.rm=TRUE)
 [1] 17513.36866   135.48379    90.90979    32.70118    87.89348    84.22174
 [7]    93.09361    77.86704    70.96347    29.62910   110.31529          NA
[13]    42.10430    24.16404    50.78071    64.27427   138.32672    72.12905
[19]    81.81070    61.07971
> colSd(tmp5,na.rm=TRUE)
 [1] 132.338085  11.639751   9.534662   5.718495   9.375152   9.177240
 [7]   9.648503   8.824230   8.423982   5.443262  10.503109         NA
[13]   6.488783   4.915693   7.126058   8.017123  11.761238   8.492883
[19]   9.044927   7.815351
> colMax(tmp5,na.rm=TRUE)
 [1] 467.78999  92.81559  88.93097  81.29221  86.14849  79.43307  93.33132
 [8]  82.12544  82.48015  79.39467  88.22190      -Inf  84.72113  73.56661
[15]  76.32619  87.40440  90.92851  83.65336  80.05394  87.19155
> colMin(tmp5,na.rm=TRUE)
 [1] 65.98660 55.03528 58.23513 64.83396 58.37490 55.85254 58.70263 53.89311
 [9] 54.24847 60.57780 60.64110      Inf 64.67902 57.85688 55.60856 61.90247
[17] 53.62108 57.34916 54.58390 63.94024
> 
> 
> 
> 
> 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] 133.5209 289.7186 184.5217 213.4885 223.2248 126.5134 422.5606 105.2870
 [9] 227.5293 281.5015
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 133.5209 289.7186 184.5217 213.4885 223.2248 126.5134 422.5606 105.2870
 [9] 227.5293 281.5015
> 
> 
> 
> 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]  0.000000e+00  5.684342e-14  5.684342e-14  5.684342e-14 -1.136868e-13
 [6] -1.421085e-13  0.000000e+00 -1.136868e-13  2.842171e-13 -1.989520e-13
[11]  1.421085e-13 -1.421085e-14  2.842171e-14  8.526513e-14  1.136868e-13
[16] -5.684342e-14 -8.526513e-14  0.000000e+00 -5.684342e-14 -1.136868e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
3   2 
5   10 
7   8 
3   14 
9   4 
10   3 
7   9 
2   14 
9   17 
3   9 
9   16 
1   18 
8   6 
9   4 
3   20 
5   18 
3   4 
9   4 
1   20 
9   19 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.457633
> Min(tmp)
[1] -1.982932
> mean(tmp)
[1] 0.05674519
> Sum(tmp)
[1] 5.674519
> Var(tmp)
[1] 0.9243427
> 
> rowMeans(tmp)
[1] 0.05674519
> rowSums(tmp)
[1] 5.674519
> rowVars(tmp)
[1] 0.9243427
> rowSd(tmp)
[1] 0.9614274
> rowMax(tmp)
[1] 2.457633
> rowMin(tmp)
[1] -1.982932
> 
> colMeans(tmp)
  [1] -1.58707985  0.43134122 -0.26840270 -0.04770171 -0.90292160  0.93456646
  [7]  0.26036317  0.94170377 -1.40070639 -0.30117065  0.21959168  0.71603217
 [13] -0.34508677  0.84080296  1.09025413 -1.98293209 -0.54793678 -0.42270688
 [19]  0.31116683  0.53246145  0.01253387 -0.35584959 -0.36328947  1.07750681
 [25] -0.86991657  2.25916474 -1.84671705 -0.27344931  0.56798301  0.22277900
 [31]  0.72985506 -1.06709275  0.77397673 -0.15607902 -1.39488458  1.11153453
 [37] -1.71322809  1.29944543  1.77450145 -1.75446758  0.62920907  0.18136640
 [43] -1.57654877 -0.34515045 -1.04769173  0.34794179  0.89012489 -1.12009290
 [49] -0.78467062 -0.33297403  1.19539772  1.67093463 -0.14047816  1.39343113
 [55]  1.56839476  0.43069655  0.64445114 -0.63557458  0.95151354 -1.53302237
 [61]  0.40336828 -1.22719877 -1.09476680  0.26744251  0.08015068  1.66228213
 [67]  0.45844335 -0.45252242 -1.03407856 -0.92384321  0.11845848  0.68316644
 [73] -0.28725956  0.98429098  1.10477371  0.35608857 -0.14525290 -0.57534755
 [79]  0.92299187  2.45763257  0.22202322 -0.38413020 -0.47101066 -0.57301822
 [85] -0.98394513  0.43490675 -0.77991284  1.20103462  0.50178684  1.01267567
 [91]  0.29245217  0.18000028  1.36360530 -1.61704752  0.30418247  0.59885471
 [97]  0.17903631 -0.12282361  0.55589607 -0.89206999
> colSums(tmp)
  [1] -1.58707985  0.43134122 -0.26840270 -0.04770171 -0.90292160  0.93456646
  [7]  0.26036317  0.94170377 -1.40070639 -0.30117065  0.21959168  0.71603217
 [13] -0.34508677  0.84080296  1.09025413 -1.98293209 -0.54793678 -0.42270688
 [19]  0.31116683  0.53246145  0.01253387 -0.35584959 -0.36328947  1.07750681
 [25] -0.86991657  2.25916474 -1.84671705 -0.27344931  0.56798301  0.22277900
 [31]  0.72985506 -1.06709275  0.77397673 -0.15607902 -1.39488458  1.11153453
 [37] -1.71322809  1.29944543  1.77450145 -1.75446758  0.62920907  0.18136640
 [43] -1.57654877 -0.34515045 -1.04769173  0.34794179  0.89012489 -1.12009290
 [49] -0.78467062 -0.33297403  1.19539772  1.67093463 -0.14047816  1.39343113
 [55]  1.56839476  0.43069655  0.64445114 -0.63557458  0.95151354 -1.53302237
 [61]  0.40336828 -1.22719877 -1.09476680  0.26744251  0.08015068  1.66228213
 [67]  0.45844335 -0.45252242 -1.03407856 -0.92384321  0.11845848  0.68316644
 [73] -0.28725956  0.98429098  1.10477371  0.35608857 -0.14525290 -0.57534755
 [79]  0.92299187  2.45763257  0.22202322 -0.38413020 -0.47101066 -0.57301822
 [85] -0.98394513  0.43490675 -0.77991284  1.20103462  0.50178684  1.01267567
 [91]  0.29245217  0.18000028  1.36360530 -1.61704752  0.30418247  0.59885471
 [97]  0.17903631 -0.12282361  0.55589607 -0.89206999
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -1.58707985  0.43134122 -0.26840270 -0.04770171 -0.90292160  0.93456646
  [7]  0.26036317  0.94170377 -1.40070639 -0.30117065  0.21959168  0.71603217
 [13] -0.34508677  0.84080296  1.09025413 -1.98293209 -0.54793678 -0.42270688
 [19]  0.31116683  0.53246145  0.01253387 -0.35584959 -0.36328947  1.07750681
 [25] -0.86991657  2.25916474 -1.84671705 -0.27344931  0.56798301  0.22277900
 [31]  0.72985506 -1.06709275  0.77397673 -0.15607902 -1.39488458  1.11153453
 [37] -1.71322809  1.29944543  1.77450145 -1.75446758  0.62920907  0.18136640
 [43] -1.57654877 -0.34515045 -1.04769173  0.34794179  0.89012489 -1.12009290
 [49] -0.78467062 -0.33297403  1.19539772  1.67093463 -0.14047816  1.39343113
 [55]  1.56839476  0.43069655  0.64445114 -0.63557458  0.95151354 -1.53302237
 [61]  0.40336828 -1.22719877 -1.09476680  0.26744251  0.08015068  1.66228213
 [67]  0.45844335 -0.45252242 -1.03407856 -0.92384321  0.11845848  0.68316644
 [73] -0.28725956  0.98429098  1.10477371  0.35608857 -0.14525290 -0.57534755
 [79]  0.92299187  2.45763257  0.22202322 -0.38413020 -0.47101066 -0.57301822
 [85] -0.98394513  0.43490675 -0.77991284  1.20103462  0.50178684  1.01267567
 [91]  0.29245217  0.18000028  1.36360530 -1.61704752  0.30418247  0.59885471
 [97]  0.17903631 -0.12282361  0.55589607 -0.89206999
> colMin(tmp)
  [1] -1.58707985  0.43134122 -0.26840270 -0.04770171 -0.90292160  0.93456646
  [7]  0.26036317  0.94170377 -1.40070639 -0.30117065  0.21959168  0.71603217
 [13] -0.34508677  0.84080296  1.09025413 -1.98293209 -0.54793678 -0.42270688
 [19]  0.31116683  0.53246145  0.01253387 -0.35584959 -0.36328947  1.07750681
 [25] -0.86991657  2.25916474 -1.84671705 -0.27344931  0.56798301  0.22277900
 [31]  0.72985506 -1.06709275  0.77397673 -0.15607902 -1.39488458  1.11153453
 [37] -1.71322809  1.29944543  1.77450145 -1.75446758  0.62920907  0.18136640
 [43] -1.57654877 -0.34515045 -1.04769173  0.34794179  0.89012489 -1.12009290
 [49] -0.78467062 -0.33297403  1.19539772  1.67093463 -0.14047816  1.39343113
 [55]  1.56839476  0.43069655  0.64445114 -0.63557458  0.95151354 -1.53302237
 [61]  0.40336828 -1.22719877 -1.09476680  0.26744251  0.08015068  1.66228213
 [67]  0.45844335 -0.45252242 -1.03407856 -0.92384321  0.11845848  0.68316644
 [73] -0.28725956  0.98429098  1.10477371  0.35608857 -0.14525290 -0.57534755
 [79]  0.92299187  2.45763257  0.22202322 -0.38413020 -0.47101066 -0.57301822
 [85] -0.98394513  0.43490675 -0.77991284  1.20103462  0.50178684  1.01267567
 [91]  0.29245217  0.18000028  1.36360530 -1.61704752  0.30418247  0.59885471
 [97]  0.17903631 -0.12282361  0.55589607 -0.89206999
> colMedians(tmp)
  [1] -1.58707985  0.43134122 -0.26840270 -0.04770171 -0.90292160  0.93456646
  [7]  0.26036317  0.94170377 -1.40070639 -0.30117065  0.21959168  0.71603217
 [13] -0.34508677  0.84080296  1.09025413 -1.98293209 -0.54793678 -0.42270688
 [19]  0.31116683  0.53246145  0.01253387 -0.35584959 -0.36328947  1.07750681
 [25] -0.86991657  2.25916474 -1.84671705 -0.27344931  0.56798301  0.22277900
 [31]  0.72985506 -1.06709275  0.77397673 -0.15607902 -1.39488458  1.11153453
 [37] -1.71322809  1.29944543  1.77450145 -1.75446758  0.62920907  0.18136640
 [43] -1.57654877 -0.34515045 -1.04769173  0.34794179  0.89012489 -1.12009290
 [49] -0.78467062 -0.33297403  1.19539772  1.67093463 -0.14047816  1.39343113
 [55]  1.56839476  0.43069655  0.64445114 -0.63557458  0.95151354 -1.53302237
 [61]  0.40336828 -1.22719877 -1.09476680  0.26744251  0.08015068  1.66228213
 [67]  0.45844335 -0.45252242 -1.03407856 -0.92384321  0.11845848  0.68316644
 [73] -0.28725956  0.98429098  1.10477371  0.35608857 -0.14525290 -0.57534755
 [79]  0.92299187  2.45763257  0.22202322 -0.38413020 -0.47101066 -0.57301822
 [85] -0.98394513  0.43490675 -0.77991284  1.20103462  0.50178684  1.01267567
 [91]  0.29245217  0.18000028  1.36360530 -1.61704752  0.30418247  0.59885471
 [97]  0.17903631 -0.12282361  0.55589607 -0.89206999
> colRanges(tmp)
         [,1]      [,2]       [,3]        [,4]       [,5]      [,6]      [,7]
[1,] -1.58708 0.4313412 -0.2684027 -0.04770171 -0.9029216 0.9345665 0.2603632
[2,] -1.58708 0.4313412 -0.2684027 -0.04770171 -0.9029216 0.9345665 0.2603632
          [,8]      [,9]      [,10]     [,11]     [,12]      [,13]    [,14]
[1,] 0.9417038 -1.400706 -0.3011706 0.2195917 0.7160322 -0.3450868 0.840803
[2,] 0.9417038 -1.400706 -0.3011706 0.2195917 0.7160322 -0.3450868 0.840803
        [,15]     [,16]      [,17]      [,18]     [,19]     [,20]      [,21]
[1,] 1.090254 -1.982932 -0.5479368 -0.4227069 0.3111668 0.5324614 0.01253387
[2,] 1.090254 -1.982932 -0.5479368 -0.4227069 0.3111668 0.5324614 0.01253387
          [,22]      [,23]    [,24]      [,25]    [,26]     [,27]      [,28]
[1,] -0.3558496 -0.3632895 1.077507 -0.8699166 2.259165 -1.846717 -0.2734493
[2,] -0.3558496 -0.3632895 1.077507 -0.8699166 2.259165 -1.846717 -0.2734493
        [,29]    [,30]     [,31]     [,32]     [,33]     [,34]     [,35]
[1,] 0.567983 0.222779 0.7298551 -1.067093 0.7739767 -0.156079 -1.394885
[2,] 0.567983 0.222779 0.7298551 -1.067093 0.7739767 -0.156079 -1.394885
        [,36]     [,37]    [,38]    [,39]     [,40]     [,41]     [,42]
[1,] 1.111535 -1.713228 1.299445 1.774501 -1.754468 0.6292091 0.1813664
[2,] 1.111535 -1.713228 1.299445 1.774501 -1.754468 0.6292091 0.1813664
         [,43]      [,44]     [,45]     [,46]     [,47]     [,48]      [,49]
[1,] -1.576549 -0.3451505 -1.047692 0.3479418 0.8901249 -1.120093 -0.7846706
[2,] -1.576549 -0.3451505 -1.047692 0.3479418 0.8901249 -1.120093 -0.7846706
         [,50]    [,51]    [,52]      [,53]    [,54]    [,55]     [,56]
[1,] -0.332974 1.195398 1.670935 -0.1404782 1.393431 1.568395 0.4306966
[2,] -0.332974 1.195398 1.670935 -0.1404782 1.393431 1.568395 0.4306966
         [,57]      [,58]     [,59]     [,60]     [,61]     [,62]     [,63]
[1,] 0.6444511 -0.6355746 0.9515135 -1.533022 0.4033683 -1.227199 -1.094767
[2,] 0.6444511 -0.6355746 0.9515135 -1.533022 0.4033683 -1.227199 -1.094767
         [,64]      [,65]    [,66]     [,67]      [,68]     [,69]      [,70]
[1,] 0.2674425 0.08015068 1.662282 0.4584433 -0.4525224 -1.034079 -0.9238432
[2,] 0.2674425 0.08015068 1.662282 0.4584433 -0.4525224 -1.034079 -0.9238432
         [,71]     [,72]      [,73]    [,74]    [,75]     [,76]      [,77]
[1,] 0.1184585 0.6831664 -0.2872596 0.984291 1.104774 0.3560886 -0.1452529
[2,] 0.1184585 0.6831664 -0.2872596 0.984291 1.104774 0.3560886 -0.1452529
          [,78]     [,79]    [,80]     [,81]      [,82]      [,83]      [,84]
[1,] -0.5753476 0.9229919 2.457633 0.2220232 -0.3841302 -0.4710107 -0.5730182
[2,] -0.5753476 0.9229919 2.457633 0.2220232 -0.3841302 -0.4710107 -0.5730182
          [,85]     [,86]      [,87]    [,88]     [,89]    [,90]     [,91]
[1,] -0.9839451 0.4349068 -0.7799128 1.201035 0.5017868 1.012676 0.2924522
[2,] -0.9839451 0.4349068 -0.7799128 1.201035 0.5017868 1.012676 0.2924522
         [,92]    [,93]     [,94]     [,95]     [,96]     [,97]      [,98]
[1,] 0.1800003 1.363605 -1.617048 0.3041825 0.5988547 0.1790363 -0.1228236
[2,] 0.1800003 1.363605 -1.617048 0.3041825 0.5988547 0.1790363 -0.1228236
         [,99]   [,100]
[1,] 0.5558961 -0.89207
[2,] 0.5558961 -0.89207
> 
> 
> Max(tmp2)
[1] 3.215825
> Min(tmp2)
[1] -2.052792
> mean(tmp2)
[1] 0.1039996
> Sum(tmp2)
[1] 10.39996
> Var(tmp2)
[1] 0.8770364
> 
> rowMeans(tmp2)
  [1]  0.67432711 -0.34875215 -0.64636814 -0.63846120  0.11030333 -0.04132767
  [7] -0.04089171 -2.05279164 -0.37694750  0.85364008 -0.06204956  1.57383868
 [13] -0.59076570  3.21582454  1.46389154  2.18139857 -0.81073297  0.91366085
 [19]  0.34025996 -0.29069211  0.16053132  1.15328157 -0.18413379  1.49097207
 [25]  0.85019058  0.49975473  0.02254259 -1.14038571 -0.11366888 -0.21299747
 [31] -0.64761130  0.76845520  2.18328708 -1.15259755  0.76494864 -0.43264619
 [37] -1.04034121 -0.81423582  0.55262987  0.16582805 -0.73351240 -0.59687769
 [43]  0.09386606  0.07445605  0.14287530  0.47315553 -0.56464216 -0.72948610
 [49] -0.67198456  0.51012053  0.71665700  0.18357668  0.24903393 -0.92575091
 [55]  0.44106182 -0.71553985 -2.04850844  0.04946201 -0.46343839  0.48855622
 [61] -0.67916195  1.65681914 -0.51641031  0.94688443  0.74149074  0.60670684
 [67] -0.92248354 -1.50940345  0.11396558 -0.27022434 -0.11619359 -0.23814117
 [73]  0.14480153  0.12544927  0.97402258  0.82005646  1.01329028  0.51574488
 [79] -0.62734008  0.12352506  0.60822962 -0.25296197  1.76974309 -1.34371710
 [85]  0.90558724  1.11478870 -0.54830971 -1.05716697 -1.93140674  0.66382524
 [91] -0.63875714  1.52315037 -0.65309526  1.62243612 -0.15394501 -0.08823283
 [97]  0.22034360 -0.30656968  1.81138325 -0.04301440
> rowSums(tmp2)
  [1]  0.67432711 -0.34875215 -0.64636814 -0.63846120  0.11030333 -0.04132767
  [7] -0.04089171 -2.05279164 -0.37694750  0.85364008 -0.06204956  1.57383868
 [13] -0.59076570  3.21582454  1.46389154  2.18139857 -0.81073297  0.91366085
 [19]  0.34025996 -0.29069211  0.16053132  1.15328157 -0.18413379  1.49097207
 [25]  0.85019058  0.49975473  0.02254259 -1.14038571 -0.11366888 -0.21299747
 [31] -0.64761130  0.76845520  2.18328708 -1.15259755  0.76494864 -0.43264619
 [37] -1.04034121 -0.81423582  0.55262987  0.16582805 -0.73351240 -0.59687769
 [43]  0.09386606  0.07445605  0.14287530  0.47315553 -0.56464216 -0.72948610
 [49] -0.67198456  0.51012053  0.71665700  0.18357668  0.24903393 -0.92575091
 [55]  0.44106182 -0.71553985 -2.04850844  0.04946201 -0.46343839  0.48855622
 [61] -0.67916195  1.65681914 -0.51641031  0.94688443  0.74149074  0.60670684
 [67] -0.92248354 -1.50940345  0.11396558 -0.27022434 -0.11619359 -0.23814117
 [73]  0.14480153  0.12544927  0.97402258  0.82005646  1.01329028  0.51574488
 [79] -0.62734008  0.12352506  0.60822962 -0.25296197  1.76974309 -1.34371710
 [85]  0.90558724  1.11478870 -0.54830971 -1.05716697 -1.93140674  0.66382524
 [91] -0.63875714  1.52315037 -0.65309526  1.62243612 -0.15394501 -0.08823283
 [97]  0.22034360 -0.30656968  1.81138325 -0.04301440
> 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.67432711 -0.34875215 -0.64636814 -0.63846120  0.11030333 -0.04132767
  [7] -0.04089171 -2.05279164 -0.37694750  0.85364008 -0.06204956  1.57383868
 [13] -0.59076570  3.21582454  1.46389154  2.18139857 -0.81073297  0.91366085
 [19]  0.34025996 -0.29069211  0.16053132  1.15328157 -0.18413379  1.49097207
 [25]  0.85019058  0.49975473  0.02254259 -1.14038571 -0.11366888 -0.21299747
 [31] -0.64761130  0.76845520  2.18328708 -1.15259755  0.76494864 -0.43264619
 [37] -1.04034121 -0.81423582  0.55262987  0.16582805 -0.73351240 -0.59687769
 [43]  0.09386606  0.07445605  0.14287530  0.47315553 -0.56464216 -0.72948610
 [49] -0.67198456  0.51012053  0.71665700  0.18357668  0.24903393 -0.92575091
 [55]  0.44106182 -0.71553985 -2.04850844  0.04946201 -0.46343839  0.48855622
 [61] -0.67916195  1.65681914 -0.51641031  0.94688443  0.74149074  0.60670684
 [67] -0.92248354 -1.50940345  0.11396558 -0.27022434 -0.11619359 -0.23814117
 [73]  0.14480153  0.12544927  0.97402258  0.82005646  1.01329028  0.51574488
 [79] -0.62734008  0.12352506  0.60822962 -0.25296197  1.76974309 -1.34371710
 [85]  0.90558724  1.11478870 -0.54830971 -1.05716697 -1.93140674  0.66382524
 [91] -0.63875714  1.52315037 -0.65309526  1.62243612 -0.15394501 -0.08823283
 [97]  0.22034360 -0.30656968  1.81138325 -0.04301440
> rowMin(tmp2)
  [1]  0.67432711 -0.34875215 -0.64636814 -0.63846120  0.11030333 -0.04132767
  [7] -0.04089171 -2.05279164 -0.37694750  0.85364008 -0.06204956  1.57383868
 [13] -0.59076570  3.21582454  1.46389154  2.18139857 -0.81073297  0.91366085
 [19]  0.34025996 -0.29069211  0.16053132  1.15328157 -0.18413379  1.49097207
 [25]  0.85019058  0.49975473  0.02254259 -1.14038571 -0.11366888 -0.21299747
 [31] -0.64761130  0.76845520  2.18328708 -1.15259755  0.76494864 -0.43264619
 [37] -1.04034121 -0.81423582  0.55262987  0.16582805 -0.73351240 -0.59687769
 [43]  0.09386606  0.07445605  0.14287530  0.47315553 -0.56464216 -0.72948610
 [49] -0.67198456  0.51012053  0.71665700  0.18357668  0.24903393 -0.92575091
 [55]  0.44106182 -0.71553985 -2.04850844  0.04946201 -0.46343839  0.48855622
 [61] -0.67916195  1.65681914 -0.51641031  0.94688443  0.74149074  0.60670684
 [67] -0.92248354 -1.50940345  0.11396558 -0.27022434 -0.11619359 -0.23814117
 [73]  0.14480153  0.12544927  0.97402258  0.82005646  1.01329028  0.51574488
 [79] -0.62734008  0.12352506  0.60822962 -0.25296197  1.76974309 -1.34371710
 [85]  0.90558724  1.11478870 -0.54830971 -1.05716697 -1.93140674  0.66382524
 [91] -0.63875714  1.52315037 -0.65309526  1.62243612 -0.15394501 -0.08823283
 [97]  0.22034360 -0.30656968  1.81138325 -0.04301440
> 
> colMeans(tmp2)
[1] 0.1039996
> colSums(tmp2)
[1] 10.39996
> colVars(tmp2)
[1] 0.8770364
> colSd(tmp2)
[1] 0.9365022
> colMax(tmp2)
[1] 3.215825
> colMin(tmp2)
[1] -2.052792
> colMedians(tmp2)
[1] 0.06195903
> colRanges(tmp2)
          [,1]
[1,] -2.052792
[2,]  3.215825
> 
> 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] -4.4266000  2.6055794  0.7610722 -2.6738039 -0.7673036  0.4999436
 [7] -3.1378015 -0.6196998  0.4182887  0.6506950
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.7028491
[2,] -1.1673982
[3,] -0.5991558
[4,]  0.1256948
[5,]  1.1284267
> 
> rowApply(tmp,sum)
 [1]  5.8476273  2.1373756 -3.7256752 -3.6143937 -3.5064656 -1.1428650
 [7] -3.8455350 -1.6197560  3.7281864 -0.9481288
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    4    8    5    3    4    5    2    2    9     2
 [2,]    9    1    9    9    2    4   10    8    1     8
 [3,]   10    7    3   10    1    1    9   10    4     3
 [4,]    7   10    1    4    7    3    4    3    6     5
 [5,]    6    2    7    7    6    7    6    4    3     6
 [6,]    2    6   10    6    3    2    7    9    8     7
 [7,]    1    5    4    2    5    6    1    1   10    10
 [8,]    5    4    8    5    8    9    8    6    2     1
 [9,]    3    9    6    1    9    8    3    7    7     9
[10,]    8    3    2    8   10   10    5    5    5     4
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.342770884  1.546321528 -1.388459030  0.743480378 -0.345236222
 [6]  0.002152129  0.864885129 -3.896048149  0.185411635 -2.503052665
[11]  1.134935403 -0.733007682 -1.575691467 -3.126630927 -1.807312413
[16] -0.991210721 -0.569096377 -2.275145349  2.303648382 -0.236915278
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.78623318
[2,] -0.37181429
[3,] -0.31125288
[4,]  0.05538260
[5,]  0.07114687
> 
> rowApply(tmp,sum)
[1] -10.734988  -2.662321   1.609898  -0.327665  -1.894667
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   13   11    9    5   10
[2,]    4   19   19    4   19
[3,]    1   14   16    8    9
[4,]   16   10    3   18   17
[5,]   11   17    6   11    7
> 
> 
> as.matrix(tmp)
            [,1]       [,2]        [,3]        [,4]        [,5]       [,6]
[1,] -0.37181429 -1.0658107 -2.38745549 -0.08279469 -0.43141945  0.7772922
[2,]  0.07114687  0.6971509  0.44032740  0.02475686  0.66031213 -0.6709385
[3,]  0.05538260  1.4989163  0.91940383 -0.94929464 -0.21650015  0.5113112
[4,] -0.78623318 -0.9802125 -0.02989173  0.95059763  0.04394489  0.5405367
[5,] -0.31125288  1.3962776 -0.33084303  0.80021521 -0.40157364 -1.1560495
           [,7]        [,8]        [,9]      [,10]      [,11]      [,12]
[1,]  0.8121915 -1.17247506 -0.03260996 -0.7643791 -0.4983722 -0.3856667
[2,]  0.2209575 -1.91350675 -0.30106241 -0.2809261  0.4894329  0.6836750
[3,] -0.1221357  0.09822240  0.28873007 -2.2445974  1.5414409  0.6886074
[4,] -0.4067743  0.03535961 -1.07280627  0.4347221  1.1404015 -1.3544088
[5,]  0.3606462 -0.94364834  1.30316021  0.3521278 -1.5379677 -0.3652147
          [,13]       [,14]       [,15]      [,16]       [,17]      [,18]
[1,] -1.4726584 -0.07614489 -0.93399230 -0.9369132 -0.49966494 -0.2064937
[2,] -0.7574582 -1.26936347  0.26080863 -0.9754720  2.31451556 -1.1216230
[3,]  1.1538774 -0.70654486 -0.08620434  1.4223631 -2.53188874 -0.3755695
[4,]  0.1998103 -1.00289190  0.39308727  0.1443712 -0.01636508 -0.4467762
[5,] -0.6992625 -0.07168580 -1.44101167 -0.6455599  0.16430682 -0.1246830
          [,19]      [,20]
[1,] -0.8471660 -0.1586402
[2,]  0.5430916 -1.7781459
[3,]  0.2402276  0.4241509
[4,]  0.7373772  1.1484865
[5,]  1.6301181  0.1272334
> 
> 
> 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 :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1     col2      col3     col4     col5      col6     col7
row1 0.5260891 2.030153 0.5243038 2.001077 1.283943 -1.196296 0.217429
          col8     col9      col10    col11     col12    col13     col14
row1 0.3211292 1.063886 -0.7693474 1.257646 -1.188719 1.306502 0.7696119
         col15      col16   col17       col18      col19      col20
row1 0.6249987 -0.1433048 2.39317 -0.07256963 -0.5952168 -0.4578854
> tmp[,"col10"]
          col10
row1 -0.7693474
row2 -1.7565252
row3  0.6846853
row4 -1.4124423
row5  1.0632687
> tmp[c("row1","row5"),]
           col1       col2       col3       col4       col5       col6
row1  0.5260891  2.0301528  0.5243038  2.0010768  1.2839430 -1.1962957
row5 -0.2707729 -0.6214256 -0.8555853 -0.7418127 -0.9832353  0.1183373
           col7       col8      col9      col10      col11     col12     col13
row1  0.2174290  0.3211292  1.063886 -0.7693474  1.2576463 -1.188719 1.3065022
row5 -0.6561836 -0.1859370 -1.883841  1.0632687 -0.7422207  1.466217 0.1122086
          col14      col15        col16     col17       col18      col19
row1  0.7696119  0.6249987 -0.143304817 2.3931701 -0.07256963 -0.5952168
row5 -1.5724658 -0.6669892 -0.008492669 0.1438678 -0.23836341  0.5412123
          col20
row1 -0.4578854
row5  0.6812998
> tmp[,c("col6","col20")]
           col6      col20
row1 -1.1962957 -0.4578854
row2  2.0937198 -0.3827671
row3  0.4824991  0.3668484
row4  0.5576785 -0.5654663
row5  0.1183373  0.6812998
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -1.1962957 -0.4578854
row5  0.1183373  0.6812998
> 
> 
> 
> 
> 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 52.27426 50.1155 51.67394 50.04069 49.10151 104.3558 49.63176 47.39654
         col9    col10    col11    col12    col13    col14    col15   col16
row1 51.11255 49.65116 51.60355 50.04325 50.49365 48.88797 50.63274 50.2226
        col17    col18    col19    col20
row1 51.00141 49.84468 50.02296 105.3181
> tmp[,"col10"]
        col10
row1 49.65116
row2 29.31575
row3 30.53266
row4 28.93957
row5 49.36131
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 52.27426 50.11550 51.67394 50.04069 49.10151 104.3558 49.63176 47.39654
row5 48.94581 51.81363 48.54218 50.85270 51.47247 107.0386 49.16761 48.70556
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.11255 49.65116 51.60355 50.04325 50.49365 48.88797 50.63274 50.22260
row5 50.78842 49.36131 50.08654 51.66069 48.17375 49.83925 51.45935 49.30581
        col17    col18    col19    col20
row1 51.00141 49.84468 50.02296 105.3181
row5 49.98902 48.11649 50.13525 104.9861
> tmp[,c("col6","col20")]
          col6     col20
row1 104.35576 105.31807
row2  74.62158  74.25416
row3  75.72724  75.53613
row4  73.52703  73.79336
row5 107.03863 104.98608
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.3558 105.3181
row5 107.0386 104.9861
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.3558 105.3181
row5 107.0386 104.9861
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.2340943
[2,] -0.9008058
[3,] -1.3517986
[4,]  1.6263616
[5,] -0.3229705
> tmp[,c("col17","col7")]
           col17       col7
[1,] -0.61791265  0.5021489
[2,]  1.02448521  0.3786541
[3,]  0.91537437 -0.0229861
[4,]  0.51489576  1.4164484
[5,]  0.04860153 -1.1270450
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.4534468  0.8336587
[2,] -0.7580215  0.9544808
[3,]  1.3288789 -0.1999762
[4,]  0.9127693  0.8678055
[5,] -1.6797614  0.1909683
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.4534468
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.4534468
[2,] -0.7580215
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]      [,2]         [,3]      [,4]      [,5]      [,6]       [,7]
row3 -0.4113487 -1.150650 -0.007556178 0.0162474 -1.354089 0.5474676  2.0844170
row1 -2.0436833 -1.475901  0.416817515 1.8781756  1.584829 0.7851878 -0.4723521
         [,8]       [,9]      [,10]      [,11]      [,12]      [,13]     [,14]
row3 0.898874 -0.3054156 -1.3649400 -0.7648153 -1.8493511 -1.2778551 0.9631715
row1 1.184050 -0.3235681  0.7281736 -0.5032014 -0.1789245 -0.9971759 0.9555614
          [,15]      [,16]     [,17]       [,18]      [,19]      [,20]
row3  1.7791708  0.5941933 0.7712274  0.08065236 -1.0649111 -0.4543647
row1 -0.5451255 -1.0353609 2.0559491 -0.97481213 -0.7017778 -1.8495523
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]     [,3]      [,4]       [,5]     [,6]     [,7]
row2 0.9137083 -0.6132775 1.269233 -0.839684 -0.6854677 1.198359 2.094395
          [,8]      [,9]      [,10]
row2 0.8498924 -1.865344 -0.5526448
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
            [,1]      [,2]       [,3]       [,4]    [,5]     [,6]     [,7]
row5 0.007606449 -1.894042 0.02527017 -0.5312601 1.86056 2.229222 1.260861
         [,8]        [,9]    [,10]     [,11]      [,12]     [,13]    [,14]
row5 1.503786 -0.08946939 1.024574 0.4329386 -0.1242576 0.2555591 1.453112
         [,15]     [,16]      [,17]     [,18]    [,19]     [,20]
row5 -1.139162 0.6484944 -0.2661859 -1.253562 1.995309 0.3655573
> 
> 
> 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: 0xaaaae8038ed0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe297a651135"
 [2] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe297925fd38"
 [3] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe297f44c2af"
 [4] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe291749b19b"
 [5] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe29337b3d91"
 [6] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe299df73d"  
 [7] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe29844db41" 
 [8] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe292366c274"
 [9] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe2974d3217d"
[10] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe296514dcf5"
[11] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe293dc26d92"
[12] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe297950e774"
[13] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe2945e26629"
[14] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe2913709ec1"
[15] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM22fe29243c0a4" 
> 
> 
> ### 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: 0xaaaae65bbb60>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xaaaae65bbb60>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xaaaae65bbb60>
> rowMedians(tmp)
  [1]  0.0056017458  0.5508129576 -0.0541118480  0.1997166125 -0.2759447132
  [6]  0.5374271010 -0.1674654688  0.0558804843 -0.0642129125 -0.1469900985
 [11]  0.0342574502  0.4071477415  0.2477730564  0.1330842235 -0.2952380369
 [16] -0.3664106124  0.3436963695  0.2851015003 -0.1924681334 -0.5476531846
 [21]  0.0573099587 -0.0004045959 -0.4584388596  0.1603553503 -0.0219371684
 [26]  0.5386544464 -0.2918747543  0.2450186026  0.1315439722  0.1214393746
 [31]  0.1709554546 -0.2083480919  0.0807731106 -0.0934213637 -0.1018997392
 [36] -0.3826948094 -0.0818248659  0.3185897219  0.2276035327  0.0605087667
 [41]  0.1488750650 -0.0205393121  1.0008091131  0.0695783418  0.0988970681
 [46] -0.2145359903  0.0165860890 -0.5435415080  0.1408784527  0.8968897706
 [51] -0.4480509181  0.0317308268 -0.8508307064  0.1196381671 -0.4762007597
 [56]  0.0702741950 -0.2389049004 -0.5458564126  0.1883087188 -0.5075851444
 [61]  0.6020267298 -0.0869307207 -0.2280902623  0.6279808741 -0.4039520168
 [66]  0.0058870385  0.1647775960 -0.5738264920 -0.0488030773 -0.5169346531
 [71]  0.0683503548  0.4607885732  0.1929069429 -0.0747771621 -0.0732614998
 [76]  0.4292616006  0.9491082226 -0.0140699226 -0.4182162664 -0.1515480913
 [81]  0.8753774690 -0.0410043780 -0.3823257386  0.1392988755 -0.3460274244
 [86] -0.3143556235  0.3330024333 -0.2754902063 -0.6144919546  0.0653921475
 [91] -0.0232772284 -0.4502273057 -0.0981150407 -0.2566120524 -0.2583330553
 [96]  0.3141713255 -0.0415170325  0.0628593566  0.2388768821 -0.2620968253
[101] -0.3786662261 -0.6322680104  0.4105641248 -0.8116239293  0.4086614320
[106]  0.0322505046  0.0170299479 -0.1457026814  0.2224851386 -0.0930277013
[111] -0.2035788187 -0.3115716362  0.1626847243  0.2765942073  0.4393722148
[116] -0.3353812419  0.4208033552 -0.0732530856  0.1851955961 -0.1802709841
[121] -0.3257108062  0.1602458352  0.0404088713 -0.2176036029  0.3245944771
[126]  0.1166290144  0.0682698453  0.2227444720 -0.5835707838  0.0023700824
[131] -0.0732844614 -0.2428954746 -0.6329674927 -0.0800651711  0.1090597573
[136]  0.6877154737  0.0034038322 -0.0383014128 -0.2025802760 -0.0939066675
[141]  0.3933241115 -0.2772743323 -0.4238682485  0.4711519717  0.0304853235
[146]  0.7366870589 -0.1165041141  0.1674468246  0.1682713090 -0.3100334624
[151] -0.0147270468 -0.6085218321 -0.2227012808  0.3300683860 -0.1632654681
[156]  0.0226849164  0.3777301342  0.0131281615  0.3416823157  0.0103516729
[161] -0.2968021170 -0.2471252048  0.1927953497  0.5717408706  0.1085599336
[166]  0.6804499320 -0.4118488470 -0.0768229246  0.1040411919  0.1033867545
[171] -0.0854792054  0.2915980423 -0.2538817814 -0.4275866423 -0.0571019878
[176]  0.2595396134  0.4123765539 -0.3003492257  0.3728329065  0.1961671367
[181]  0.1461464234 -0.4072324402 -0.4625255383  0.4349405268  0.1728195819
[186] -0.2073506102  0.5688351103  0.1674512602 -0.1403647736  0.5138242314
[191] -0.0793949939 -0.2400681217  0.3765846556 -0.3646735484 -0.1481016737
[196] -0.1244819102 -0.1556418154 -0.2496999254 -0.4862114049 -0.4832249450
[201]  0.0479856855  0.0658959478  0.1953923031  0.5200056624  0.0323892244
[206]  0.2527509494 -0.2513646446  0.3267707069 -0.2186745753 -0.2123575090
[211]  0.2209150903 -0.4003981956 -0.0333416579 -0.1655643350 -0.1895859745
[216] -0.1448072853  0.6315181995  0.1074816302 -0.1649450272  0.3688073730
[221] -0.2904657955  0.0756786035  0.8087682808  0.1839429486  0.1578608258
[226]  0.3353322458 -0.0695882770 -0.3261520039  0.3190272383 -0.1685733687
> 
> proc.time()
   user  system elapsed 
  1.998   1.206   3.245 

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: 0xaaaafbf0e8e0>
> .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: 0xaaaafbf0e8e0>
> .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: 0xaaaafbf0e8e0>
> .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: 0xaaaafbf0e8e0>
> 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: 0xaaaafc6cf270>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaafc6cf270>
> .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: 0xaaaafc6cf270>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaafc6cf270>
> .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: 0xaaaafc6cf270>
> 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: 0xaaaafbebcdc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaafbebcdc0>
> .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: 0xaaaafbebcdc0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaaafbebcdc0>
> .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: 0xaaaafbebcdc0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0xaaaafbebcdc0>
> .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: 0xaaaafbebcdc0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0xaaaafbebcdc0>
> .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: 0xaaaafbebcdc0>
> 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: 0xaaaafc73a370>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0xaaaafc73a370>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaafc73a370>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaafc73a370>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile22fe3c4344d70b" "BufferedMatrixFile22fe3c55067fc6"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile22fe3c4344d70b" "BufferedMatrixFile22fe3c55067fc6"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaafe073980>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaafe073980>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaaafe073980>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaaafe073980>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0xaaaafe073980>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0xaaaafe073980>
> .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: 0xaaaafdb49fe0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaafdb49fe0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaaafdb49fe0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0xaaaafdb49fe0>
> 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: 0xaaaafe07f500>
> .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: 0xaaaafe07f500>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.332   0.045   0.363 

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.348   0.038   0.371 

Example timings