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

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

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 22.04.1 LTS)x86_644.3.0 alpha (2023-04-03 r84154) 4547
nebbiolo2Linux (Ubuntu 20.04.5 LTS)x86_64R Under development (unstable) (2023-02-14 r83833) -- "Unsuffered Consequences" 4333
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

CHECK results for BufferedMatrix on nebbiolo1


To the developers/maintainers of the BufferedMatrix package:
- Allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to reflect on this report. See Troubleshooting Build Report for more information.

- Use the following Renviron settings to reproduce errors and warnings.

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

raw results

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

Summary

Package: BufferedMatrix
Version: 1.63.0
Command: /home/biocbuild/bbs-3.17-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.17-bioc/R/site-library --timings BufferedMatrix_1.63.0.tar.gz
StartedAt: 2023-04-11 19:00:35 -0400 (Tue, 11 Apr 2023)
EndedAt: 2023-04-11 19:00:59 -0400 (Tue, 11 Apr 2023)
EllapsedTime: 24.3 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.3.0 alpha (2023-04-03 r84154)
* using platform: x86_64-pc-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.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 loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ...
  ‘BufferedMatrix.Rnw’... OK
 OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.17-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 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/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 alpha (2023-04-03 r84154)
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.236   0.078   0.303 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.3.0 alpha (2023-04-03 r84154)
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 457438 24.5     981480 52.5   650971 34.8
Vcells 842767  6.5    8388608 64.0  2064055 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 Apr 11 19:00:50 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 Apr 11 19:00:50 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: 0x5560d114cf50>
> 
> 
> 
> 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 Apr 11 19:00:51 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 Apr 11 19:00:51 2023"
> 
> ColMode(tmp2)
<pointer: 0x5560d114cf50>
> 
> 
> 
> ### 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.70787207 -1.1855258 -0.2127399  1.0386479
[2,] -0.00964319 -0.8451245 -2.5099201  0.4125944
[3,]  0.91671045  1.1841789 -1.1460604  1.3862741
[4,]  0.13959057 -0.1108675  1.0594453 -0.6045817
> 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.70787207 1.1855258 0.2127399 1.0386479
[2,]  0.00964319 0.8451245 2.5099201 0.4125944
[3,]  0.91671045 1.1841789 1.1460604 1.3862741
[4,]  0.13959057 0.1108675 1.0594453 0.6045817
> 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.98538292 1.0888185 0.4612374 1.0191408
[2,] 0.09819975 0.9193065 1.5842727 0.6423351
[3,] 0.95744997 1.0881998 1.0705421 1.1774014
[4,] 0.37361822 0.3329677 1.0292936 0.7775485
> 
> 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.56170 37.07371 29.82511 36.23006
[2,]  25.99164 35.03819 43.35265 31.83595
[3,]  35.49121 37.06618 36.85148 38.16029
[4,]  28.87577 28.44054 36.35238 33.38007
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5560d0b3e160>
> exp(tmp5)
<pointer: 0x5560d0b3e160>
> log(tmp5,2)
<pointer: 0x5560d0b3e160>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.3958
> Min(tmp5)
[1] 54.09819
> mean(tmp5)
[1] 73.21703
> Sum(tmp5)
[1] 14643.41
> Var(tmp5)
[1] 846.5524
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.35985 70.65466 74.07761 70.68985 68.83934 72.97802 73.52163 72.36095
 [9] 70.46942 68.21898
> rowSums(tmp5)
 [1] 1807.197 1413.093 1481.552 1413.797 1376.787 1459.560 1470.433 1447.219
 [9] 1409.388 1364.380
> rowVars(tmp5)
 [1] 7940.05590   80.35704   28.03498  107.15613   40.62657   61.53290
 [7]   37.42724   82.46514   46.84191   62.92403
> rowSd(tmp5)
 [1] 89.106991  8.964209  5.294807 10.351625  6.373897  7.844291  6.117780
 [8]  9.081032  6.844115  7.932467
> rowMax(tmp5)
 [1] 467.39576  90.23286  82.03159  90.64828  85.23538  90.25740  83.49470
 [8]  91.25572  82.12168  81.09880
> rowMin(tmp5)
 [1] 56.53147 54.09819 62.21934 58.91629 60.05593 61.93981 64.93922 59.31204
 [9] 54.69786 54.41569
> 
> colMeans(tmp5)
 [1] 110.08899  72.15717  72.01882  73.47378  64.11119  71.97216  70.49241
 [8]  69.09729  70.99834  77.13748  72.16284  74.35516  69.88679  70.08443
[15]  70.44703  71.04836  70.04676  71.00578  71.51213  72.24372
> colSums(tmp5)
 [1] 1100.8899  721.5717  720.1882  734.7378  641.1119  719.7216  704.9241
 [8]  690.9729  709.9834  771.3748  721.6284  743.5516  698.8679  700.8443
[15]  704.4703  710.4836  700.4676  710.0578  715.1213  722.4372
> colVars(tmp5)
 [1] 15825.16460    45.45916    82.94490    34.95374    37.24411    84.26765
 [7]    64.36566    42.49717    69.49766    50.35644    86.23566    48.42834
[13]    56.74439    77.71106    51.80954    38.71684    87.28497    75.13603
[19]    67.07674    74.76290
> colSd(tmp5)
 [1] 125.798110   6.742341   9.107409   5.912169   6.102795   9.179742
 [7]   8.022821   6.518986   8.336525   7.096227   9.286316   6.959048
[13]   7.532887   8.815388   7.197884   6.222286   9.342642   8.668104
[19]   8.190039   8.646554
> colMax(tmp5)
 [1] 467.39576  84.20282  90.23286  81.95847  73.12949  89.99577  90.25740
 [8]  77.74719  90.64828  91.25572  84.13151  83.30479  82.87723  85.23538
[15]  82.12168  78.67137  81.95479  82.62963  82.26016  83.69180
> colMin(tmp5)
 [1] 54.09819 59.19527 60.66230 64.17292 54.90333 63.06616 63.94346 56.53147
 [9] 62.21934 67.29959 54.41569 60.56813 58.91629 59.82682 59.17976 59.31204
[17] 54.69786 58.13758 60.05593 61.03463
> 
> 
> ### 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] 90.35985 70.65466 74.07761 70.68985 68.83934       NA 73.52163 72.36095
 [9] 70.46942 68.21898
> rowSums(tmp5)
 [1] 1807.197 1413.093 1481.552 1413.797 1376.787       NA 1470.433 1447.219
 [9] 1409.388 1364.380
> rowVars(tmp5)
 [1] 7940.05590   80.35704   28.03498  107.15613   40.62657   59.01465
 [7]   37.42724   82.46514   46.84191   62.92403
> rowSd(tmp5)
 [1] 89.106991  8.964209  5.294807 10.351625  6.373897  7.682100  6.117780
 [8]  9.081032  6.844115  7.932467
> rowMax(tmp5)
 [1] 467.39576  90.23286  82.03159  90.64828  85.23538        NA  83.49470
 [8]  91.25572  82.12168  81.09880
> rowMin(tmp5)
 [1] 56.53147 54.09819 62.21934 58.91629 60.05593       NA 64.93922 59.31204
 [9] 54.69786 54.41569
> 
> colMeans(tmp5)
 [1] 110.08899  72.15717  72.01882  73.47378        NA  71.97216  70.49241
 [8]  69.09729  70.99834  77.13748  72.16284  74.35516  69.88679  70.08443
[15]  70.44703  71.04836  70.04676  71.00578  71.51213  72.24372
> colSums(tmp5)
 [1] 1100.8899  721.5717  720.1882  734.7378        NA  719.7216  704.9241
 [8]  690.9729  709.9834  771.3748  721.6284  743.5516  698.8679  700.8443
[15]  704.4703  710.4836  700.4676  710.0578  715.1213  722.4372
> colVars(tmp5)
 [1] 15825.16460    45.45916    82.94490    34.95374          NA    84.26765
 [7]    64.36566    42.49717    69.49766    50.35644    86.23566    48.42834
[13]    56.74439    77.71106    51.80954    38.71684    87.28497    75.13603
[19]    67.07674    74.76290
> colSd(tmp5)
 [1] 125.798110   6.742341   9.107409   5.912169         NA   9.179742
 [7]   8.022821   6.518986   8.336525   7.096227   9.286316   6.959048
[13]   7.532887   8.815388   7.197884   6.222286   9.342642   8.668104
[19]   8.190039   8.646554
> colMax(tmp5)
 [1] 467.39576  84.20282  90.23286  81.95847        NA  89.99577  90.25740
 [8]  77.74719  90.64828  91.25572  84.13151  83.30479  82.87723  85.23538
[15]  82.12168  78.67137  81.95479  82.62963  82.26016  83.69180
> colMin(tmp5)
 [1] 54.09819 59.19527 60.66230 64.17292       NA 63.06616 63.94346 56.53147
 [9] 62.21934 67.29959 54.41569 60.56813 58.91629 59.82682 59.17976 59.31204
[17] 54.69786 58.13758 60.05593 61.03463
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.3958
> Min(tmp5,na.rm=TRUE)
[1] 54.09819
> mean(tmp5,na.rm=TRUE)
[1] 73.26886
> Sum(tmp5,na.rm=TRUE)
[1] 14580.5
> Var(tmp5,na.rm=TRUE)
[1] 850.2879
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.35985 70.65466 74.07761 70.68985 68.83934 73.50832 73.52163 72.36095
 [9] 70.46942 68.21898
> rowSums(tmp5,na.rm=TRUE)
 [1] 1807.197 1413.093 1481.552 1413.797 1376.787 1396.658 1470.433 1447.219
 [9] 1409.388 1364.380
> rowVars(tmp5,na.rm=TRUE)
 [1] 7940.05590   80.35704   28.03498  107.15613   40.62657   59.01465
 [7]   37.42724   82.46514   46.84191   62.92403
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.106991  8.964209  5.294807 10.351625  6.373897  7.682100  6.117780
 [8]  9.081032  6.844115  7.932467
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.39576  90.23286  82.03159  90.64828  85.23538  90.25740  83.49470
 [8]  91.25572  82.12168  81.09880
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.53147 54.09819 62.21934 58.91629 60.05593 61.93981 64.93922 59.31204
 [9] 54.69786 54.41569
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.08899  72.15717  72.01882  73.47378  64.24550  71.97216  70.49241
 [8]  69.09729  70.99834  77.13748  72.16284  74.35516  69.88679  70.08443
[15]  70.44703  71.04836  70.04676  71.00578  71.51213  72.24372
> colSums(tmp5,na.rm=TRUE)
 [1] 1100.8899  721.5717  720.1882  734.7378  578.2095  719.7216  704.9241
 [8]  690.9729  709.9834  771.3748  721.6284  743.5516  698.8679  700.8443
[15]  704.4703  710.4836  700.4676  710.0578  715.1213  722.4372
> colVars(tmp5,na.rm=TRUE)
 [1] 15825.16460    45.45916    82.94490    34.95374    41.69668    84.26765
 [7]    64.36566    42.49717    69.49766    50.35644    86.23566    48.42834
[13]    56.74439    77.71106    51.80954    38.71684    87.28497    75.13603
[19]    67.07674    74.76290
> colSd(tmp5,na.rm=TRUE)
 [1] 125.798110   6.742341   9.107409   5.912169   6.457297   9.179742
 [7]   8.022821   6.518986   8.336525   7.096227   9.286316   6.959048
[13]   7.532887   8.815388   7.197884   6.222286   9.342642   8.668104
[19]   8.190039   8.646554
> colMax(tmp5,na.rm=TRUE)
 [1] 467.39576  84.20282  90.23286  81.95847  73.12949  89.99577  90.25740
 [8]  77.74719  90.64828  91.25572  84.13151  83.30479  82.87723  85.23538
[15]  82.12168  78.67137  81.95479  82.62963  82.26016  83.69180
> colMin(tmp5,na.rm=TRUE)
 [1] 54.09819 59.19527 60.66230 64.17292 54.90333 63.06616 63.94346 56.53147
 [9] 62.21934 67.29959 54.41569 60.56813 58.91629 59.82682 59.17976 59.31204
[17] 54.69786 58.13758 60.05593 61.03463
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.35985 70.65466 74.07761 70.68985 68.83934      NaN 73.52163 72.36095
 [9] 70.46942 68.21898
> rowSums(tmp5,na.rm=TRUE)
 [1] 1807.197 1413.093 1481.552 1413.797 1376.787    0.000 1470.433 1447.219
 [9] 1409.388 1364.380
> rowVars(tmp5,na.rm=TRUE)
 [1] 7940.05590   80.35704   28.03498  107.15613   40.62657         NA
 [7]   37.42724   82.46514   46.84191   62.92403
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.106991  8.964209  5.294807 10.351625  6.373897        NA  6.117780
 [8]  9.081032  6.844115  7.932467
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.39576  90.23286  82.03159  90.64828  85.23538        NA  83.49470
 [8]  91.25572  82.12168  81.09880
> rowMin(tmp5,na.rm=TRUE)
 [1] 56.53147 54.09819 62.21934 58.91629 60.05593       NA 64.93922 59.31204
 [9] 54.69786 54.41569
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.91248  70.81876  72.81640  73.34190       NaN  72.96172  68.29630
 [8]  68.38200  71.63354  77.45443  72.31494  74.63219  69.64899  70.78106
[15]  69.84014  70.25261  68.78779  70.99561  72.57572  71.17963
> colSums(tmp5,na.rm=TRUE)
 [1] 1025.2124  637.3689  655.3476  660.0771    0.0000  656.6555  614.6667
 [8]  615.4380  644.7019  697.0899  650.8345  671.6897  626.8409  637.0295
[15]  628.5613  632.2735  619.0901  638.9605  653.1815  640.6167
> colVars(tmp5,na.rm=TRUE)
 [1] 17638.84556    30.98911    86.15644    39.12731          NA    83.78487
 [7]    18.15378    42.05349    73.64566    55.52085    96.75484    53.61847
[13]    63.20128    81.96545    54.14225    36.43278    80.36430    84.52687
[19]    62.73503    71.37013
> colSd(tmp5,na.rm=TRUE)
 [1] 132.811316   5.566786   9.282049   6.255183         NA   9.153408
 [7]   4.260726   6.484866   8.581705   7.451231   9.836404   7.322464
[13]   7.949923   9.053477   7.358142   6.035957   8.964614   9.193850
[19]   7.920545   8.448085
> colMax(tmp5,na.rm=TRUE)
 [1] 467.39576  77.16407  90.23286  81.95847      -Inf  89.99577  76.85093
 [8]  77.74719  90.64828  91.25572  84.13151  83.30479  82.87723  85.23538
[15]  82.12168  78.67137  81.95479  82.62963  82.26016  83.69180
> colMin(tmp5,na.rm=TRUE)
 [1] 54.09819 59.19527 60.66230 64.17292      Inf 63.11694 63.94346 56.53147
 [9] 62.21934 67.29959 54.41569 60.56813 58.91629 59.82682 59.17976 59.31204
[17] 54.69786 58.13758 60.05593 61.03463
> 
> 
> 
> 
> 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] 300.6284 272.1526 139.5076 346.7385 141.8787 313.8187 244.2605 148.3189
 [9] 270.1720 219.4099
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 300.6284 272.1526 139.5076 346.7385 141.8787 313.8187 244.2605 148.3189
 [9] 270.1720 219.4099
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14 -1.136868e-13 -2.842171e-14 -5.684342e-14 -2.842171e-14
 [6] -1.421085e-13  4.263256e-14 -1.705303e-13  1.136868e-13  5.684342e-14
[11]  0.000000e+00  2.273737e-13  0.000000e+00 -2.842171e-14 -2.842171e-14
[16]  5.684342e-14  2.842171e-14 -1.136868e-13  2.842171e-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)
+ }
2   5 
1   19 
1   8 
10   14 
6   15 
4   20 
5   16 
2   12 
9   5 
7   5 
7   2 
4   4 
5   9 
1   15 
3   14 
3   14 
10   2 
1   17 
8   14 
5   18 
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.873938
> Min(tmp)
[1] -2.715211
> mean(tmp)
[1] -0.1407467
> Sum(tmp)
[1] -14.07467
> Var(tmp)
[1] 1.277883
> 
> rowMeans(tmp)
[1] -0.1407467
> rowSums(tmp)
[1] -14.07467
> rowVars(tmp)
[1] 1.277883
> rowSd(tmp)
[1] 1.130435
> rowMax(tmp)
[1] 2.873938
> rowMin(tmp)
[1] -2.715211
> 
> colMeans(tmp)
  [1]  0.08337627 -0.19680023 -0.43397779 -2.61514103  1.40840188 -0.78220811
  [7]  1.16667541 -2.15671787  0.93614073 -0.04082392 -0.08869283 -1.19015470
 [13] -0.26624963 -2.12708119  1.03026065  1.95110313  2.34017387 -0.23695277
 [19] -0.40486678  0.05848853 -0.98589836  0.51745930  0.53585315 -0.67654436
 [25]  1.76119390 -0.24689453 -1.30927565 -2.12335980 -1.06123725 -0.57753141
 [31]  0.49615261 -0.66324252 -0.51125748 -0.14340492 -0.11887199  1.84714897
 [37]  1.44785233  0.03640784  0.82185364 -2.10311411 -0.06588743 -0.65927058
 [43] -0.33062806 -0.62121912 -1.21685301 -0.25537669  0.65166356 -1.56848475
 [49] -2.04762841  0.65817854  0.99307052  0.89952243  0.03505215 -0.38583707
 [55] -0.80106793  0.77507340 -1.10726634  1.18525352 -0.81732022  1.32200234
 [61]  0.76466794 -0.67667941  1.45553704 -0.33991142  0.40864290 -2.71521148
 [67] -0.14881490 -0.80329537  0.78759498 -1.73107164 -0.12274374  0.16879775
 [73]  0.91519397 -0.32791892  0.50453196  0.09281214  1.38653627  0.03144121
 [79] -2.01380855  0.10248020 -1.65016910 -0.50508217 -0.98373261  0.62526710
 [85] -1.44755328  0.29010774  1.13026304  1.22144956 -1.99667791 -1.39847741
 [91] -0.24304818 -1.36548015  0.02722734 -1.53165610  2.87393793 -0.63482400
 [97]  0.29138720 -0.38165219  0.55782731  1.28621036
> colSums(tmp)
  [1]  0.08337627 -0.19680023 -0.43397779 -2.61514103  1.40840188 -0.78220811
  [7]  1.16667541 -2.15671787  0.93614073 -0.04082392 -0.08869283 -1.19015470
 [13] -0.26624963 -2.12708119  1.03026065  1.95110313  2.34017387 -0.23695277
 [19] -0.40486678  0.05848853 -0.98589836  0.51745930  0.53585315 -0.67654436
 [25]  1.76119390 -0.24689453 -1.30927565 -2.12335980 -1.06123725 -0.57753141
 [31]  0.49615261 -0.66324252 -0.51125748 -0.14340492 -0.11887199  1.84714897
 [37]  1.44785233  0.03640784  0.82185364 -2.10311411 -0.06588743 -0.65927058
 [43] -0.33062806 -0.62121912 -1.21685301 -0.25537669  0.65166356 -1.56848475
 [49] -2.04762841  0.65817854  0.99307052  0.89952243  0.03505215 -0.38583707
 [55] -0.80106793  0.77507340 -1.10726634  1.18525352 -0.81732022  1.32200234
 [61]  0.76466794 -0.67667941  1.45553704 -0.33991142  0.40864290 -2.71521148
 [67] -0.14881490 -0.80329537  0.78759498 -1.73107164 -0.12274374  0.16879775
 [73]  0.91519397 -0.32791892  0.50453196  0.09281214  1.38653627  0.03144121
 [79] -2.01380855  0.10248020 -1.65016910 -0.50508217 -0.98373261  0.62526710
 [85] -1.44755328  0.29010774  1.13026304  1.22144956 -1.99667791 -1.39847741
 [91] -0.24304818 -1.36548015  0.02722734 -1.53165610  2.87393793 -0.63482400
 [97]  0.29138720 -0.38165219  0.55782731  1.28621036
> 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.08337627 -0.19680023 -0.43397779 -2.61514103  1.40840188 -0.78220811
  [7]  1.16667541 -2.15671787  0.93614073 -0.04082392 -0.08869283 -1.19015470
 [13] -0.26624963 -2.12708119  1.03026065  1.95110313  2.34017387 -0.23695277
 [19] -0.40486678  0.05848853 -0.98589836  0.51745930  0.53585315 -0.67654436
 [25]  1.76119390 -0.24689453 -1.30927565 -2.12335980 -1.06123725 -0.57753141
 [31]  0.49615261 -0.66324252 -0.51125748 -0.14340492 -0.11887199  1.84714897
 [37]  1.44785233  0.03640784  0.82185364 -2.10311411 -0.06588743 -0.65927058
 [43] -0.33062806 -0.62121912 -1.21685301 -0.25537669  0.65166356 -1.56848475
 [49] -2.04762841  0.65817854  0.99307052  0.89952243  0.03505215 -0.38583707
 [55] -0.80106793  0.77507340 -1.10726634  1.18525352 -0.81732022  1.32200234
 [61]  0.76466794 -0.67667941  1.45553704 -0.33991142  0.40864290 -2.71521148
 [67] -0.14881490 -0.80329537  0.78759498 -1.73107164 -0.12274374  0.16879775
 [73]  0.91519397 -0.32791892  0.50453196  0.09281214  1.38653627  0.03144121
 [79] -2.01380855  0.10248020 -1.65016910 -0.50508217 -0.98373261  0.62526710
 [85] -1.44755328  0.29010774  1.13026304  1.22144956 -1.99667791 -1.39847741
 [91] -0.24304818 -1.36548015  0.02722734 -1.53165610  2.87393793 -0.63482400
 [97]  0.29138720 -0.38165219  0.55782731  1.28621036
> colMin(tmp)
  [1]  0.08337627 -0.19680023 -0.43397779 -2.61514103  1.40840188 -0.78220811
  [7]  1.16667541 -2.15671787  0.93614073 -0.04082392 -0.08869283 -1.19015470
 [13] -0.26624963 -2.12708119  1.03026065  1.95110313  2.34017387 -0.23695277
 [19] -0.40486678  0.05848853 -0.98589836  0.51745930  0.53585315 -0.67654436
 [25]  1.76119390 -0.24689453 -1.30927565 -2.12335980 -1.06123725 -0.57753141
 [31]  0.49615261 -0.66324252 -0.51125748 -0.14340492 -0.11887199  1.84714897
 [37]  1.44785233  0.03640784  0.82185364 -2.10311411 -0.06588743 -0.65927058
 [43] -0.33062806 -0.62121912 -1.21685301 -0.25537669  0.65166356 -1.56848475
 [49] -2.04762841  0.65817854  0.99307052  0.89952243  0.03505215 -0.38583707
 [55] -0.80106793  0.77507340 -1.10726634  1.18525352 -0.81732022  1.32200234
 [61]  0.76466794 -0.67667941  1.45553704 -0.33991142  0.40864290 -2.71521148
 [67] -0.14881490 -0.80329537  0.78759498 -1.73107164 -0.12274374  0.16879775
 [73]  0.91519397 -0.32791892  0.50453196  0.09281214  1.38653627  0.03144121
 [79] -2.01380855  0.10248020 -1.65016910 -0.50508217 -0.98373261  0.62526710
 [85] -1.44755328  0.29010774  1.13026304  1.22144956 -1.99667791 -1.39847741
 [91] -0.24304818 -1.36548015  0.02722734 -1.53165610  2.87393793 -0.63482400
 [97]  0.29138720 -0.38165219  0.55782731  1.28621036
> colMedians(tmp)
  [1]  0.08337627 -0.19680023 -0.43397779 -2.61514103  1.40840188 -0.78220811
  [7]  1.16667541 -2.15671787  0.93614073 -0.04082392 -0.08869283 -1.19015470
 [13] -0.26624963 -2.12708119  1.03026065  1.95110313  2.34017387 -0.23695277
 [19] -0.40486678  0.05848853 -0.98589836  0.51745930  0.53585315 -0.67654436
 [25]  1.76119390 -0.24689453 -1.30927565 -2.12335980 -1.06123725 -0.57753141
 [31]  0.49615261 -0.66324252 -0.51125748 -0.14340492 -0.11887199  1.84714897
 [37]  1.44785233  0.03640784  0.82185364 -2.10311411 -0.06588743 -0.65927058
 [43] -0.33062806 -0.62121912 -1.21685301 -0.25537669  0.65166356 -1.56848475
 [49] -2.04762841  0.65817854  0.99307052  0.89952243  0.03505215 -0.38583707
 [55] -0.80106793  0.77507340 -1.10726634  1.18525352 -0.81732022  1.32200234
 [61]  0.76466794 -0.67667941  1.45553704 -0.33991142  0.40864290 -2.71521148
 [67] -0.14881490 -0.80329537  0.78759498 -1.73107164 -0.12274374  0.16879775
 [73]  0.91519397 -0.32791892  0.50453196  0.09281214  1.38653627  0.03144121
 [79] -2.01380855  0.10248020 -1.65016910 -0.50508217 -0.98373261  0.62526710
 [85] -1.44755328  0.29010774  1.13026304  1.22144956 -1.99667791 -1.39847741
 [91] -0.24304818 -1.36548015  0.02722734 -1.53165610  2.87393793 -0.63482400
 [97]  0.29138720 -0.38165219  0.55782731  1.28621036
> colRanges(tmp)
           [,1]       [,2]       [,3]      [,4]     [,5]       [,6]     [,7]
[1,] 0.08337627 -0.1968002 -0.4339778 -2.615141 1.408402 -0.7822081 1.166675
[2,] 0.08337627 -0.1968002 -0.4339778 -2.615141 1.408402 -0.7822081 1.166675
          [,8]      [,9]       [,10]       [,11]     [,12]      [,13]     [,14]
[1,] -2.156718 0.9361407 -0.04082392 -0.08869283 -1.190155 -0.2662496 -2.127081
[2,] -2.156718 0.9361407 -0.04082392 -0.08869283 -1.190155 -0.2662496 -2.127081
        [,15]    [,16]    [,17]      [,18]      [,19]      [,20]      [,21]
[1,] 1.030261 1.951103 2.340174 -0.2369528 -0.4048668 0.05848853 -0.9858984
[2,] 1.030261 1.951103 2.340174 -0.2369528 -0.4048668 0.05848853 -0.9858984
         [,22]     [,23]      [,24]    [,25]      [,26]     [,27]    [,28]
[1,] 0.5174593 0.5358531 -0.6765444 1.761194 -0.2468945 -1.309276 -2.12336
[2,] 0.5174593 0.5358531 -0.6765444 1.761194 -0.2468945 -1.309276 -2.12336
         [,29]      [,30]     [,31]      [,32]      [,33]      [,34]     [,35]
[1,] -1.061237 -0.5775314 0.4961526 -0.6632425 -0.5112575 -0.1434049 -0.118872
[2,] -1.061237 -0.5775314 0.4961526 -0.6632425 -0.5112575 -0.1434049 -0.118872
        [,36]    [,37]      [,38]     [,39]     [,40]       [,41]      [,42]
[1,] 1.847149 1.447852 0.03640784 0.8218536 -2.103114 -0.06588743 -0.6592706
[2,] 1.847149 1.447852 0.03640784 0.8218536 -2.103114 -0.06588743 -0.6592706
          [,43]      [,44]     [,45]      [,46]     [,47]     [,48]     [,49]
[1,] -0.3306281 -0.6212191 -1.216853 -0.2553767 0.6516636 -1.568485 -2.047628
[2,] -0.3306281 -0.6212191 -1.216853 -0.2553767 0.6516636 -1.568485 -2.047628
         [,50]     [,51]     [,52]      [,53]      [,54]      [,55]     [,56]
[1,] 0.6581785 0.9930705 0.8995224 0.03505215 -0.3858371 -0.8010679 0.7750734
[2,] 0.6581785 0.9930705 0.8995224 0.03505215 -0.3858371 -0.8010679 0.7750734
         [,57]    [,58]      [,59]    [,60]     [,61]      [,62]    [,63]
[1,] -1.107266 1.185254 -0.8173202 1.322002 0.7646679 -0.6766794 1.455537
[2,] -1.107266 1.185254 -0.8173202 1.322002 0.7646679 -0.6766794 1.455537
          [,64]     [,65]     [,66]      [,67]      [,68]    [,69]     [,70]
[1,] -0.3399114 0.4086429 -2.715211 -0.1488149 -0.8032954 0.787595 -1.731072
[2,] -0.3399114 0.4086429 -2.715211 -0.1488149 -0.8032954 0.787595 -1.731072
          [,71]     [,72]    [,73]      [,74]    [,75]      [,76]    [,77]
[1,] -0.1227437 0.1687977 0.915194 -0.3279189 0.504532 0.09281214 1.386536
[2,] -0.1227437 0.1687977 0.915194 -0.3279189 0.504532 0.09281214 1.386536
          [,78]     [,79]     [,80]     [,81]      [,82]      [,83]     [,84]
[1,] 0.03144121 -2.013809 0.1024802 -1.650169 -0.5050822 -0.9837326 0.6252671
[2,] 0.03144121 -2.013809 0.1024802 -1.650169 -0.5050822 -0.9837326 0.6252671
         [,85]     [,86]    [,87]   [,88]     [,89]     [,90]      [,91]
[1,] -1.447553 0.2901077 1.130263 1.22145 -1.996678 -1.398477 -0.2430482
[2,] -1.447553 0.2901077 1.130263 1.22145 -1.996678 -1.398477 -0.2430482
        [,92]      [,93]     [,94]    [,95]     [,96]     [,97]      [,98]
[1,] -1.36548 0.02722734 -1.531656 2.873938 -0.634824 0.2913872 -0.3816522
[2,] -1.36548 0.02722734 -1.531656 2.873938 -0.634824 0.2913872 -0.3816522
         [,99]  [,100]
[1,] 0.5578273 1.28621
[2,] 0.5578273 1.28621
> 
> 
> Max(tmp2)
[1] 3.04842
> Min(tmp2)
[1] -2.253619
> mean(tmp2)
[1] 0.05029617
> Sum(tmp2)
[1] 5.029617
> Var(tmp2)
[1] 0.8583649
> 
> rowMeans(tmp2)
  [1] -1.085493733 -1.422215355 -0.677505608 -0.917356326  0.774549966
  [6] -0.145152954  0.896976829  0.570093507 -0.357898649 -0.097864761
 [11]  0.636931744 -0.166748819 -0.414394811  0.433758290 -0.005898911
 [16]  1.055400762  0.050165372  0.734852953  2.054075819 -2.253619359
 [21]  1.079462817  0.779303078 -1.596107712  0.468785446 -0.297244395
 [26]  0.186725952  1.785110914 -0.523073208 -0.517794258  0.232573876
 [31] -2.012825316  0.155357416 -0.392011418  0.239665497 -0.438873028
 [36]  0.358750584 -0.338551599 -0.083223221  0.392911435 -1.128254491
 [41] -1.158814289 -1.007333997 -0.600485840 -0.177912042 -0.250366174
 [46] -0.618934492  0.710035652  0.729860404  1.349964474 -0.472020072
 [51] -0.100221011 -0.345685429  0.392386993 -0.063029878  3.048420125
 [56] -0.811455348 -0.310173350  1.049564140  1.485877737 -1.420589999
 [61]  0.154397553  0.308458041 -0.020399911 -1.077377706  0.961392072
 [66] -1.067373748  1.050880804  1.118158248 -0.832182113 -1.235767014
 [71] -0.915844605  1.087171935  0.466851472 -0.999131952  1.825422891
 [76]  0.616391105  0.959377550  0.315534879  1.675129040 -0.170103907
 [81] -0.330468550 -0.733320496 -1.141936293  1.363402602  0.738443165
 [86]  0.182303846  0.079414807  0.298248152  0.005197932  1.136396292
 [91] -0.486829344 -0.750701242  0.883682500  0.358706668  1.192120469
 [96] -0.884593435  0.973099508 -0.064567293 -0.985313159 -0.467085316
> rowSums(tmp2)
  [1] -1.085493733 -1.422215355 -0.677505608 -0.917356326  0.774549966
  [6] -0.145152954  0.896976829  0.570093507 -0.357898649 -0.097864761
 [11]  0.636931744 -0.166748819 -0.414394811  0.433758290 -0.005898911
 [16]  1.055400762  0.050165372  0.734852953  2.054075819 -2.253619359
 [21]  1.079462817  0.779303078 -1.596107712  0.468785446 -0.297244395
 [26]  0.186725952  1.785110914 -0.523073208 -0.517794258  0.232573876
 [31] -2.012825316  0.155357416 -0.392011418  0.239665497 -0.438873028
 [36]  0.358750584 -0.338551599 -0.083223221  0.392911435 -1.128254491
 [41] -1.158814289 -1.007333997 -0.600485840 -0.177912042 -0.250366174
 [46] -0.618934492  0.710035652  0.729860404  1.349964474 -0.472020072
 [51] -0.100221011 -0.345685429  0.392386993 -0.063029878  3.048420125
 [56] -0.811455348 -0.310173350  1.049564140  1.485877737 -1.420589999
 [61]  0.154397553  0.308458041 -0.020399911 -1.077377706  0.961392072
 [66] -1.067373748  1.050880804  1.118158248 -0.832182113 -1.235767014
 [71] -0.915844605  1.087171935  0.466851472 -0.999131952  1.825422891
 [76]  0.616391105  0.959377550  0.315534879  1.675129040 -0.170103907
 [81] -0.330468550 -0.733320496 -1.141936293  1.363402602  0.738443165
 [86]  0.182303846  0.079414807  0.298248152  0.005197932  1.136396292
 [91] -0.486829344 -0.750701242  0.883682500  0.358706668  1.192120469
 [96] -0.884593435  0.973099508 -0.064567293 -0.985313159 -0.467085316
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -1.085493733 -1.422215355 -0.677505608 -0.917356326  0.774549966
  [6] -0.145152954  0.896976829  0.570093507 -0.357898649 -0.097864761
 [11]  0.636931744 -0.166748819 -0.414394811  0.433758290 -0.005898911
 [16]  1.055400762  0.050165372  0.734852953  2.054075819 -2.253619359
 [21]  1.079462817  0.779303078 -1.596107712  0.468785446 -0.297244395
 [26]  0.186725952  1.785110914 -0.523073208 -0.517794258  0.232573876
 [31] -2.012825316  0.155357416 -0.392011418  0.239665497 -0.438873028
 [36]  0.358750584 -0.338551599 -0.083223221  0.392911435 -1.128254491
 [41] -1.158814289 -1.007333997 -0.600485840 -0.177912042 -0.250366174
 [46] -0.618934492  0.710035652  0.729860404  1.349964474 -0.472020072
 [51] -0.100221011 -0.345685429  0.392386993 -0.063029878  3.048420125
 [56] -0.811455348 -0.310173350  1.049564140  1.485877737 -1.420589999
 [61]  0.154397553  0.308458041 -0.020399911 -1.077377706  0.961392072
 [66] -1.067373748  1.050880804  1.118158248 -0.832182113 -1.235767014
 [71] -0.915844605  1.087171935  0.466851472 -0.999131952  1.825422891
 [76]  0.616391105  0.959377550  0.315534879  1.675129040 -0.170103907
 [81] -0.330468550 -0.733320496 -1.141936293  1.363402602  0.738443165
 [86]  0.182303846  0.079414807  0.298248152  0.005197932  1.136396292
 [91] -0.486829344 -0.750701242  0.883682500  0.358706668  1.192120469
 [96] -0.884593435  0.973099508 -0.064567293 -0.985313159 -0.467085316
> rowMin(tmp2)
  [1] -1.085493733 -1.422215355 -0.677505608 -0.917356326  0.774549966
  [6] -0.145152954  0.896976829  0.570093507 -0.357898649 -0.097864761
 [11]  0.636931744 -0.166748819 -0.414394811  0.433758290 -0.005898911
 [16]  1.055400762  0.050165372  0.734852953  2.054075819 -2.253619359
 [21]  1.079462817  0.779303078 -1.596107712  0.468785446 -0.297244395
 [26]  0.186725952  1.785110914 -0.523073208 -0.517794258  0.232573876
 [31] -2.012825316  0.155357416 -0.392011418  0.239665497 -0.438873028
 [36]  0.358750584 -0.338551599 -0.083223221  0.392911435 -1.128254491
 [41] -1.158814289 -1.007333997 -0.600485840 -0.177912042 -0.250366174
 [46] -0.618934492  0.710035652  0.729860404  1.349964474 -0.472020072
 [51] -0.100221011 -0.345685429  0.392386993 -0.063029878  3.048420125
 [56] -0.811455348 -0.310173350  1.049564140  1.485877737 -1.420589999
 [61]  0.154397553  0.308458041 -0.020399911 -1.077377706  0.961392072
 [66] -1.067373748  1.050880804  1.118158248 -0.832182113 -1.235767014
 [71] -0.915844605  1.087171935  0.466851472 -0.999131952  1.825422891
 [76]  0.616391105  0.959377550  0.315534879  1.675129040 -0.170103907
 [81] -0.330468550 -0.733320496 -1.141936293  1.363402602  0.738443165
 [86]  0.182303846  0.079414807  0.298248152  0.005197932  1.136396292
 [91] -0.486829344 -0.750701242  0.883682500  0.358706668  1.192120469
 [96] -0.884593435  0.973099508 -0.064567293 -0.985313159 -0.467085316
> 
> colMeans(tmp2)
[1] 0.05029617
> colSums(tmp2)
[1] 5.029617
> colVars(tmp2)
[1] 0.8583649
> colSd(tmp2)
[1] 0.9264798
> colMax(tmp2)
[1] 3.04842
> colMin(tmp2)
[1] -2.253619
> colMedians(tmp2)
[1] -0.01314941
> colRanges(tmp2)
          [,1]
[1,] -2.253619
[2,]  3.048420
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.7881733 -8.1222096 -0.3151333 -0.8694146  0.4707511 -3.0316958
 [7]  1.2380829 -1.4375608  1.4736830  0.2101141
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.9112090
[2,] -1.3196254
[3,] -0.4314572
[4,]  1.0537247
[5,]  1.7361680
> 
> rowApply(tmp,sum)
 [1] -4.5612129 -0.3651335  2.5925236  3.0711968 -4.1286519 -6.3224357
 [7]  0.9968458 -2.0197922 -1.7257096 -0.7091866
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    5   10   10   10    1    2    1    4     7
 [2,]    3    3    7    1    1    6    4    2    2     2
 [3,]    7    8    8    7    5    4    8    5    7     1
 [4,]    9    7    3    6    6    2    3    8    9     5
 [5,]    5    6    5    8    7    9    6    6    6     6
 [6,]    8    9    2    3    9    3    5    4    5     3
 [7,]    2   10    9    2    4   10    1    9    1    10
 [8,]    4    1    4    4    8    5    9   10    3     8
 [9,]   10    4    1    5    2    7   10    7   10     4
[10,]    6    2    6    9    3    8    7    3    8     9
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.3364676 -2.6487648 -0.1227105  2.1626577 -4.0963386  0.1638309
 [7] -3.2929527 -1.0929622 -1.9449535 -3.6888787  1.5566071  2.3923051
[13] -0.1447604 -5.1679658 -2.8477436  2.2496781 -1.0057087  1.5805018
[19] -1.1333961  1.4950955
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1862764
[2,] -0.6656186
[3,]  0.4415963
[4,]  0.6475820
[5,]  1.0991843
> 
> rowApply(tmp,sum)
[1]  5.283772 -6.321408 -8.438252 -4.120607 -1.653496
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    1   18   15   16    6
[2,]   12   10    7    8    7
[3,]   20    1    6   18    4
[4,]    5   20   20    6   19
[5,]   14    5    2    7    5
> 
> 
> as.matrix(tmp)
           [,1]        [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -1.1862764 -0.09320149  2.5673115 -0.3977051  0.7511499 -0.3728292
[2,]  1.0991843 -0.36407694 -2.3540148  1.4927245 -1.0610012 -0.3984911
[3,]  0.4415963 -1.01320180 -1.0546165  1.2272627 -2.4014479  1.0182604
[4,]  0.6475820 -0.59413707  1.6089480 -1.3335790 -0.6485644 -0.4557689
[5,] -0.6656186 -0.58414750 -0.8903387  1.1739546 -0.7364750  0.3726596
           [,7]       [,8]       [,9]      [,10]      [,11]       [,12]
[1,]  1.2442756 -0.4722234  1.1921362  0.4269404 -0.6125059 -0.32762738
[2,]  0.6380349  0.1698058  0.3069975 -1.7084387  0.5111504  0.05909703
[3,] -2.7645766  0.6839267 -1.3621258 -0.4744796  1.0883615  0.17688726
[4,] -1.8611298 -1.3709727 -1.8836706 -0.1095314 -0.3933109  2.56939811
[5,] -0.5495567 -0.1034985 -0.1982908 -1.8233695  0.9629120 -0.08544995
           [,13]      [,14]      [,15]       [,16]      [,17]       [,18]
[1,]  2.12542748 -0.2186005 -0.2318021  0.92540442 -0.2054230  1.06033695
[2,] -2.10999103 -0.9847443 -1.8266352  1.12456752 -0.9489031  0.59745849
[3,] -0.81480550 -1.1455055 -1.7146538 -0.25695065  1.1652357 -0.65297980
[4,]  0.75054979 -1.3927566 -1.8036565 -0.02503542  0.3552243  0.59418093
[5,] -0.09594109 -1.4263590  2.7290039  0.48169227 -1.3718426 -0.01849472
          [,19]      [,20]
[1,] -0.6398212 -0.2511948
[2,] -0.7284770  0.1643444
[3,]  0.2674334 -0.8518724
[4,] -0.5398611  1.7654839
[5,]  0.5073298  0.6683343
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
         col1     col2     col3     col4       col5       col6      col7
row1 0.279127 1.364673 1.236662 2.479537 -0.4485195 -0.6921091 0.2233154
          col8       col9     col10      col11     col12     col13     col14
row1 0.1269378 -0.3193101 -0.479723 -0.6037291 0.4935687 0.5103654 0.7011215
         col15     col16     col17    col18     col19     col20
row1 -0.829062 0.2810254 0.1829834 1.903953 0.2929672 -2.425244
> tmp[,"col10"]
          col10
row1 -0.4797230
row2  1.8184704
row3 -0.4402134
row4 -0.7839511
row5 -2.0392321
> tmp[c("row1","row5"),]
          col1       col2      col3      col4       col5        col6      col7
row1 0.2791270  1.3646728  1.236662 2.4795369 -0.4485195 -0.69210910 0.2233154
row5 0.6920211 -0.4852819 -1.043491 0.9292921 -0.2184650 -0.06916423 1.6728947
           col8       col9     col10      col11      col12      col13     col14
row1  0.1269378 -0.3193101 -0.479723 -0.6037291  0.4935687  0.5103654 0.7011215
row5 -0.2703533  0.3828394 -2.039232  0.5073475 -0.2975099 -1.6678552 0.1814546
          col15     col16     col17     col18       col19      col20
row1 -0.8290620 0.2810254 0.1829834 1.9039527  0.29296716 -2.4252435
row5  0.7197822 1.1709165 0.1781464 0.2472329 -0.08746505  0.2709212
> tmp[,c("col6","col20")]
            col6      col20
row1 -0.69210910 -2.4252435
row2 -0.89261600  1.1103957
row3 -1.02608378  0.2670051
row4  1.05923694 -0.2731038
row5 -0.06916423  0.2709212
> tmp[c("row1","row5"),c("col6","col20")]
            col6      col20
row1 -0.69210910 -2.4252435
row5 -0.06916423  0.2709212
> 
> 
> 
> 
> 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.5559 49.2436 49.0975 49.7004 50.61089 104.5613 49.98432 50.00417
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.40098 53.06916 50.44435 49.98861 50.12452 49.22035 49.72365 49.75518
        col17    col18    col19    col20
row1 48.51027 51.44649 50.03623 105.2746
> tmp[,"col10"]
        col10
row1 53.06916
row2 30.67079
row3 30.38912
row4 30.74426
row5 49.63171
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 52.55590 49.24360 49.09750 49.70040 50.61089 104.5613 49.98432 50.00417
row5 48.83789 49.88838 49.62946 50.16563 50.24524 106.8056 49.66406 50.52442
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.40098 53.06916 50.44435 49.98861 50.12452 49.22035 49.72365 49.75518
row5 49.05070 49.63171 50.13556 48.81142 49.95406 50.64145 48.17525 50.82291
        col17    col18    col19    col20
row1 48.51027 51.44649 50.03623 105.2746
row5 50.70309 49.23510 50.06120 105.3270
> tmp[,c("col6","col20")]
          col6     col20
row1 104.56133 105.27462
row2  75.59372  75.24803
row3  76.12975  73.50013
row4  74.53765  75.18814
row5 106.80558 105.32703
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.5613 105.2746
row5 106.8056 105.3270
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.5613 105.2746
row5 106.8056 105.3270
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.4480748
[2,]  0.1716249
[3,] -0.2856069
[4,]  0.3525065
[5,]  2.6531057
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.9092845  1.4007410
[2,]  0.7046091 -0.3414969
[3,] -0.2851502  0.9964118
[4,] -1.7104268 -1.5211113
[5,]  1.1331780  0.4312711
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6       col20
[1,]  0.20506907 -0.21529177
[2,]  0.85416168  0.69670499
[3,] -0.08445862  0.67230839
[4,]  1.02317792 -0.03123712
[5,]  1.10469813  0.28925775
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.2050691
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 0.2050691
[2,] 0.8541617
> 
> 
> 
> 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.9219030  0.6211379 -0.5705971 -1.2093301 0.3462119 -0.03324183
row1 0.9003995 -0.8983126 -0.4188738  0.1190326 1.7186516 -0.21377164
            [,7]       [,8]       [,9]     [,10]      [,11]      [,12]
row3 -0.07590217  2.4163238 -0.2337223  1.323922  0.8962505 -0.4204112
row1 -1.07770981 -0.1106625  1.1079420 -2.371469 -0.2007173  1.0750066
          [,13]     [,14]     [,15]      [,16]      [,17]      [,18]
row3  0.7903053 0.1519304 0.1631478  1.0322001 -0.3384904 -0.6143269
row1 -0.5631745 1.1474156 0.1166667 -0.7494738 -1.0543778 -1.8839454
            [,19]      [,20]
row3  2.271896215 -0.1173634
row1 -0.003787827 -0.4826192
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]       [,2]       [,3]      [,4]       [,5]      [,6]      [,7]
row2 1.200242 -0.3734695 -0.9887716 0.3020752 -0.7311229 0.4097139 -1.804484
          [,8]      [,9]     [,10]
row2 -0.908063 -1.156784 0.8509532
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]       [,2]      [,3]      [,4]       [,5]      [,6]      [,7]
row5 -0.5767735 -0.8751344 0.6678944 0.5972126 -0.3206129 -1.726779 -1.807424
           [,8]       [,9]    [,10]      [,11]     [,12]    [,13]    [,14]
row5 -0.8035656 -0.3035719 1.316324 -0.1793101 0.1502038 0.298832 -1.03588
         [,15]      [,16]      [,17]     [,18]      [,19]     [,20]
row5 0.5122353 -0.3460126 0.01480945 -1.038172 0.05759502 0.4728781
> 
> 
> 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: 0x5560d2488460>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c3153c54db2"
 [2] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c3168e60bba"
 [3] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c3117834fba"
 [4] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c317263290c"
 [5] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c316461d9f9"
 [6] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c315bf2ef3c"
 [7] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c311ce1a4f5"
 [8] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c314da6646f"
 [9] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c313b481494"
[10] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c314e4b1605"
[11] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c31769764c4"
[12] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c3119346878"
[13] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c31466d1f4f"
[14] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c313f3628c6"
[15] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM115c313095f199"
> 
> 
> ### 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: 0x5560d2e85860>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5560d2e85860>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5560d2e85860>
> rowMedians(tmp)
  [1] -0.218698686  0.053952237  0.097918110 -0.279459414 -0.204996297
  [6] -0.560258865  0.152713465  0.641838536 -0.403902861 -0.080360119
 [11]  0.069328498 -0.145270412  0.138030424 -0.077091880  0.096327360
 [16]  0.237150181  0.146468973  0.314625257  0.201203694 -0.280312053
 [21] -0.097334681  0.166241494 -0.031454719 -0.642431395 -0.757105766
 [26]  0.009626492 -0.683631279  0.050088386  0.217362141 -0.429942287
 [31]  0.296551528  0.032252301  0.116593877  0.027427878  0.044306310
 [36] -0.523514800  0.084860911  0.069615969 -0.058194892 -0.004357898
 [41]  0.228174647  0.166986770 -0.653756976  0.070890387 -0.394837656
 [46]  0.225728473  0.495989633  0.280664157 -0.114465746 -0.405749387
 [51]  0.375563739 -0.030596508  0.166114904 -0.104499774 -0.184404298
 [56]  0.002451379  0.080273521  0.146304850 -0.109543385  0.128351154
 [61]  0.259875211  0.275014763 -0.003207166  0.086505293 -0.301930979
 [66] -0.177779610  0.100864052 -0.352203176 -0.096120006  0.525012730
 [71] -0.060536209  0.458013413  0.128398746 -0.118034638 -0.141877405
 [76]  0.093430043  0.483836496 -0.063338111 -0.372573471  0.557310724
 [81]  0.043781488  0.148426337  0.565902819  0.529091539 -0.418973305
 [86] -0.068879934  0.361289610  0.158584295  0.159483327  0.153482366
 [91] -0.046811693 -0.079398711  0.044097294  0.093869614  0.271949640
 [96] -0.405650820 -0.219003528  0.182512822 -0.067838461 -0.340865820
[101] -0.323538458  0.189088068 -0.026266771  0.028653087 -0.298451232
[106] -0.367892539  0.367650101 -0.072319036 -0.191057912  0.487191699
[111] -0.451723806 -0.098443018  0.093020407  0.030491965  0.283790596
[116] -0.626644123 -0.094381394 -0.359725855  0.108396282  0.137798263
[121] -0.565934220  0.666893028  0.183057827 -0.491920597 -0.303630976
[126] -0.334822976 -0.553194761  0.011530732  0.143566385  0.070118246
[131]  0.043690442  0.200763100  0.295064610 -0.364616606  0.117473187
[136]  0.352716661  0.455022113  0.128782530  0.060751303 -0.428731753
[141] -0.440492667  0.016463299 -0.087551519 -0.014164416  0.562633679
[146] -0.016169624 -0.349661633 -0.363837802  0.011415308 -0.207240036
[151] -0.619195734  0.233465371  0.422997401 -0.110594418  0.061421198
[156] -0.373064889  0.534095993  0.286282351  0.474038815 -0.209232117
[161]  0.032689318  0.083598506 -0.291251194 -0.163436105 -0.021849739
[166]  0.659270658 -0.680188906  0.683817889 -0.433380862  0.045472978
[171]  0.059856250 -0.417917891 -0.195662317  0.049915802 -0.264267520
[176]  0.025927264  0.211493547  0.010682253 -0.375900934 -0.473756355
[181] -0.003081995 -0.350482761 -0.059513324  0.075567537 -0.017417594
[186]  0.277345769 -0.453029486 -0.403424535  0.128919282  0.592505185
[191]  0.116703299 -0.280986618 -0.032516644  0.220664966 -0.803319352
[196] -0.143221726  0.216296073  0.465881609 -0.189642017 -0.419867763
[201]  0.195682839 -0.524356516  0.200474635 -0.029526171 -0.247503730
[206] -0.001085268  0.402062373 -0.266260280 -0.165926346  0.279264062
[211]  0.539459990  0.231826601 -0.198353202 -0.670378081  0.235206605
[216] -0.034625865  0.372708305  0.187232055  0.278927396 -0.100335267
[221]  0.156743653  0.077772174 -0.156455170  0.128083832  0.136675741
[226]  0.299355198 -0.738813631  0.269327885  0.112614470 -0.142598155
> 
> proc.time()
   user  system elapsed 
  1.439   1.570   3.026 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.3.0 alpha (2023-04-03 r84154)
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x555bad8c5110>
> .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: 0x555bad8c5110>
> .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: 0x555bad8c5110>
> .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: 0x555bad8c5110>
> 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: 0x555bad4c0330>
> .Call("R_bm_AddColumn",P)
<pointer: 0x555bad4c0330>
> .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: 0x555bad4c0330>
> .Call("R_bm_AddColumn",P)
<pointer: 0x555bad4c0330>
> .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: 0x555bad4c0330>
> 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: 0x555bae46c870>
> .Call("R_bm_AddColumn",P)
<pointer: 0x555bae46c870>
> .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: 0x555bae46c870>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x555bae46c870>
> .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: 0x555bae46c870>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x555bae46c870>
> .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: 0x555bae46c870>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x555bae46c870>
> .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: 0x555bae46c870>
> 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: 0x555bade97290>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x555bade97290>
> .Call("R_bm_AddColumn",P)
<pointer: 0x555bade97290>
> .Call("R_bm_AddColumn",P)
<pointer: 0x555bade97290>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1161ba432660f0" "BufferedMatrixFile1161ba6897f78a"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1161ba432660f0" "BufferedMatrixFile1161ba6897f78a"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x555bae3d0db0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x555bae3d0db0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x555bae3d0db0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x555bae3d0db0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x555bae3d0db0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x555bae3d0db0>
> .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: 0x555bad394bc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x555bad394bc0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x555bad394bc0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x555bad394bc0>
> 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: 0x555bad55db50>
> .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: 0x555bad55db50>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.257   0.058   0.301 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.3.0 alpha (2023-04-03 r84154)
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.259   0.034   0.280 

Example timings