Back to Multiple platform build/check report for BioC 3.16:   simplified   long
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

This page was generated on 2023-04-12 11:04:59 -0400 (Wed, 12 Apr 2023).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 20.04.5 LTS)x86_644.2.3 (2023-03-15) -- "Shortstop Beagle" 4502
palomino4Windows Server 2022 Datacenterx644.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle" 4282
lconwaymacOS 12.5.1 Montereyx86_644.2.3 (2023-03-15) -- "Shortstop Beagle" 4310
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

CHECK results for BufferedMatrix on nebbiolo2


To the developers/maintainers of the BufferedMatrix package:
- Please allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to
reflect on this report. See How and When does the builder pull? When will my changes propagate? for more information.
- Make sure to use the following settings in order to reproduce any error or warning you see on this page.

raw results

Package 232/2183HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.62.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-04-10 14:00:05 -0400 (Mon, 10 Apr 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_16
git_last_commit: fce9086
git_last_commit_date: 2022-11-01 10:42:48 -0400 (Tue, 01 Nov 2022)
nebbiolo2Linux (Ubuntu 20.04.5 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino4Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
lconwaymacOS 12.5.1 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published

Summary

Package: BufferedMatrix
Version: 1.62.0
Command: /home/biocbuild/bbs-3.16-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.16-bioc/R/site-library --timings BufferedMatrix_1.62.0.tar.gz
StartedAt: 2023-04-10 19:26:45 -0400 (Mon, 10 Apr 2023)
EndedAt: 2023-04-10 19:27:09 -0400 (Mon, 10 Apr 2023)
EllapsedTime: 24.3 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.2.3 (2023-03-15)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.62.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
* 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.16-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.16-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
gcc -I"/home/biocbuild/bbs-3.16-bioc/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.16-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.16-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.16-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.16-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.16-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.16-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.2.3 (2023-03-15) -- "Shortstop Beagle"
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.319   0.036   0.335 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
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.16-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 444084 23.8     953921   51   629780 33.7
Vcells 800801  6.2    8388608   64  1915324 14.7
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Apr 10 19:27:02 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon Apr 10 19:27:02 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: 0x564e481a1400>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Apr 10 19:27:02 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon Apr 10 19:27:02 2023"
> 
> ColMode(tmp2)
<pointer: 0x564e481a1400>
> 
> 
> 
> ### 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,] 102.34238851  0.39266984 -1.0902142 -0.65699931
[2,]  -0.09241697  0.66563681  3.2209660 -0.05530266
[3,]  -1.40964244  0.87096830  0.3794316  1.02324400
[4,]   0.05240489 -0.05420876  0.7757459  0.96744386
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.16-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,] 102.34238851 0.39266984 1.0902142 0.65699931
[2,]   0.09241697 0.66563681 3.2209660 0.05530266
[3,]   1.40964244 0.87096830 0.3794316 1.02324400
[4,]   0.05240489 0.05420876 0.7757459 0.96744386
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.1164415 0.6266337 1.0441332 0.8105549
[2,]  0.3040016 0.8158657 1.7947050 0.2351652
[3,]  1.1872836 0.9332568 0.6159802 1.0115552
[4,]  0.2289211 0.2328278 0.8807644 0.9835872
> 
> 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.16-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,] 228.50680 31.65901 36.53155 33.76255
[2,]  28.13243 33.82429 46.16802 27.40695
[3,]  38.28248 35.20354 31.53923 36.13880
[4,]  27.34162 27.38249 34.58339 35.80332
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x564e46d477c0>
> exp(tmp5)
<pointer: 0x564e46d477c0>
> log(tmp5,2)
<pointer: 0x564e46d477c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 475.607
> Min(tmp5)
[1] 54.14436
> mean(tmp5)
[1] 73.04361
> Sum(tmp5)
[1] 14608.72
> Var(tmp5)
[1] 891.3772
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 96.05708 68.91291 71.55359 73.08465 70.00424 71.01810 69.80628 68.41152
 [9] 69.77614 71.81159
> rowSums(tmp5)
 [1] 1921.142 1378.258 1431.072 1461.693 1400.085 1420.362 1396.126 1368.230
 [9] 1395.523 1436.232
> rowVars(tmp5)
 [1] 8049.06376   90.90908   52.26326  100.35311   69.60019   65.46223
 [7]   50.61610   80.73361   70.35263   68.35941
> rowSd(tmp5)
 [1] 89.716575  9.534625  7.229333 10.017640  8.342673  8.090873  7.114499
 [8]  8.985188  8.387647  8.267975
> rowMax(tmp5)
 [1] 475.60697  96.09268  81.80336  91.40352  87.40378  82.53960  84.56582
 [8]  82.52885  91.62200  83.45387
> rowMin(tmp5)
 [1] 60.11236 54.46326 55.00838 56.90799 54.14436 56.18603 57.82729 56.66412
 [9] 57.67233 54.75755
> 
> colMeans(tmp5)
 [1] 110.26534  68.43385  74.03066  72.63286  74.08390  71.49491  68.98630
 [8]  65.24046  73.21602  68.04313  78.75573  71.84481  69.86337  69.01191
[15]  68.21810  68.65470  72.24793  71.78280  70.46441  73.60103
> colSums(tmp5)
 [1] 1102.6534  684.3385  740.3066  726.3286  740.8390  714.9491  689.8630
 [8]  652.4046  732.1602  680.4313  787.5573  718.4481  698.6337  690.1191
[15]  682.1810  686.5470  722.4793  717.8280  704.6441  736.0103
> colVars(tmp5)
 [1] 16567.07879    58.89548   116.97090    58.30472    47.70836    47.17313
 [7]    99.18152    70.34983    41.73258    55.29607    41.16173    38.53885
[13]    56.96172   106.46072    65.06712    49.00681   165.41790    91.19540
[19]    30.34145    95.95928
> colSd(tmp5)
 [1] 128.713165   7.674339  10.815309   7.635753   6.907124   6.868269
 [7]   9.958992   8.387480   6.460076   7.436133   6.415741   6.207967
[13]   7.547299  10.317980   8.066419   7.000486  12.861489   9.549628
[19]   5.508307   9.795881
> colMax(tmp5)
 [1] 475.60697  82.52885  96.09268  81.32399  82.20168  82.39125  81.80336
 [8]  81.04057  86.40051  77.97901  91.62200  82.26644  82.58008  87.63814
[15]  79.53144  83.45387  90.15843  91.40352  79.24691  87.51968
> colMin(tmp5)
 [1] 56.90799 56.99306 59.99878 57.04398 64.25857 61.65072 56.18603 54.46326
 [9] 64.15407 57.73227 69.49883 63.05183 56.66412 57.31425 54.14436 60.71365
[17] 55.00838 59.04918 63.47776 54.75755
> 
> 
> ### 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] 96.05708 68.91291 71.55359 73.08465 70.00424 71.01810 69.80628 68.41152
 [9] 69.77614       NA
> rowSums(tmp5)
 [1] 1921.142 1378.258 1431.072 1461.693 1400.085 1420.362 1396.126 1368.230
 [9] 1395.523       NA
> rowVars(tmp5)
 [1] 8049.06376   90.90908   52.26326  100.35311   69.60019   65.46223
 [7]   50.61610   80.73361   70.35263   67.39942
> rowSd(tmp5)
 [1] 89.716575  9.534625  7.229333 10.017640  8.342673  8.090873  7.114499
 [8]  8.985188  8.387647  8.209715
> rowMax(tmp5)
 [1] 475.60697  96.09268  81.80336  91.40352  87.40378  82.53960  84.56582
 [8]  82.52885  91.62200        NA
> rowMin(tmp5)
 [1] 60.11236 54.46326 55.00838 56.90799 54.14436 56.18603 57.82729 56.66412
 [9] 57.67233       NA
> 
> colMeans(tmp5)
 [1] 110.26534  68.43385  74.03066  72.63286  74.08390  71.49491  68.98630
 [8]  65.24046  73.21602  68.04313  78.75573  71.84481  69.86337  69.01191
[15]        NA  68.65470  72.24793  71.78280  70.46441  73.60103
> colSums(tmp5)
 [1] 1102.6534  684.3385  740.3066  726.3286  740.8390  714.9491  689.8630
 [8]  652.4046  732.1602  680.4313  787.5573  718.4481  698.6337  690.1191
[15]        NA  686.5470  722.4793  717.8280  704.6441  736.0103
> colVars(tmp5)
 [1] 16567.07879    58.89548   116.97090    58.30472    47.70836    47.17313
 [7]    99.18152    70.34983    41.73258    55.29607    41.16173    38.53885
[13]    56.96172   106.46072          NA    49.00681   165.41790    91.19540
[19]    30.34145    95.95928
> colSd(tmp5)
 [1] 128.713165   7.674339  10.815309   7.635753   6.907124   6.868269
 [7]   9.958992   8.387480   6.460076   7.436133   6.415741   6.207967
[13]   7.547299  10.317980         NA   7.000486  12.861489   9.549628
[19]   5.508307   9.795881
> colMax(tmp5)
 [1] 475.60697  82.52885  96.09268  81.32399  82.20168  82.39125  81.80336
 [8]  81.04057  86.40051  77.97901  91.62200  82.26644  82.58008  87.63814
[15]        NA  83.45387  90.15843  91.40352  79.24691  87.51968
> colMin(tmp5)
 [1] 56.90799 56.99306 59.99878 57.04398 64.25857 61.65072 56.18603 54.46326
 [9] 64.15407 57.73227 69.49883 63.05183 56.66412 57.31425       NA 60.71365
[17] 55.00838 59.04918 63.47776 54.75755
> 
> Max(tmp5,na.rm=TRUE)
[1] 475.607
> Min(tmp5,na.rm=TRUE)
[1] 54.14436
> mean(tmp5,na.rm=TRUE)
[1] 73.09513
> Sum(tmp5,na.rm=TRUE)
[1] 14545.93
> Var(tmp5,na.rm=TRUE)
[1] 895.3456
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 96.05708 68.91291 71.55359 73.08465 70.00424 71.01810 69.80628 68.41152
 [9] 69.77614 72.28632
> rowSums(tmp5,na.rm=TRUE)
 [1] 1921.142 1378.258 1431.072 1461.693 1400.085 1420.362 1396.126 1368.230
 [9] 1395.523 1373.440
> rowVars(tmp5,na.rm=TRUE)
 [1] 8049.06376   90.90908   52.26326  100.35311   69.60019   65.46223
 [7]   50.61610   80.73361   70.35263   67.39942
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.716575  9.534625  7.229333 10.017640  8.342673  8.090873  7.114499
 [8]  8.985188  8.387647  8.209715
> rowMax(tmp5,na.rm=TRUE)
 [1] 475.60697  96.09268  81.80336  91.40352  87.40378  82.53960  84.56582
 [8]  82.52885  91.62200  83.45387
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.11236 54.46326 55.00838 56.90799 54.14436 56.18603 57.82729 56.66412
 [9] 57.67233 54.75755
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 110.26534  68.43385  74.03066  72.63286  74.08390  71.49491  68.98630
 [8]  65.24046  73.21602  68.04313  78.75573  71.84481  69.86337  69.01191
[15]  68.82103  68.65470  72.24793  71.78280  70.46441  73.60103
> colSums(tmp5,na.rm=TRUE)
 [1] 1102.6534  684.3385  740.3066  726.3286  740.8390  714.9491  689.8630
 [8]  652.4046  732.1602  680.4313  787.5573  718.4481  698.6337  690.1191
[15]  619.3892  686.5470  722.4793  717.8280  704.6441  736.0103
> colVars(tmp5,na.rm=TRUE)
 [1] 16567.07879    58.89548   116.97090    58.30472    47.70836    47.17313
 [7]    99.18152    70.34983    41.73258    55.29607    41.16173    38.53885
[13]    56.96172   106.46072    69.11091    49.00681   165.41790    91.19540
[19]    30.34145    95.95928
> colSd(tmp5,na.rm=TRUE)
 [1] 128.713165   7.674339  10.815309   7.635753   6.907124   6.868269
 [7]   9.958992   8.387480   6.460076   7.436133   6.415741   6.207967
[13]   7.547299  10.317980   8.313297   7.000486  12.861489   9.549628
[19]   5.508307   9.795881
> colMax(tmp5,na.rm=TRUE)
 [1] 475.60697  82.52885  96.09268  81.32399  82.20168  82.39125  81.80336
 [8]  81.04057  86.40051  77.97901  91.62200  82.26644  82.58008  87.63814
[15]  79.53144  83.45387  90.15843  91.40352  79.24691  87.51968
> colMin(tmp5,na.rm=TRUE)
 [1] 56.90799 56.99306 59.99878 57.04398 64.25857 61.65072 56.18603 54.46326
 [9] 64.15407 57.73227 69.49883 63.05183 56.66412 57.31425 54.14436 60.71365
[17] 55.00838 59.04918 63.47776 54.75755
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 96.05708 68.91291 71.55359 73.08465 70.00424 71.01810 69.80628 68.41152
 [9] 69.77614      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1921.142 1378.258 1431.072 1461.693 1400.085 1420.362 1396.126 1368.230
 [9] 1395.523    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 8049.06376   90.90908   52.26326  100.35311   69.60019   65.46223
 [7]   50.61610   80.73361   70.35263         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.716575  9.534625  7.229333 10.017640  8.342673  8.090873  7.114499
 [8]  8.985188  8.387647        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 475.60697  96.09268  81.80336  91.40352  87.40378  82.53960  84.56582
 [8]  82.52885  91.62200        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.11236 54.46326 55.00838 56.90799 54.14436 56.18603 57.82729 56.66412
 [9] 57.67233       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.92203  67.72837  74.32507  71.97292  73.46970  71.17587  68.33556
 [8]  64.45530  72.47708  68.90604  78.44330  72.82181  69.49344  67.59150
[15]       NaN  67.01034  72.19179  72.40676  70.36736  75.69475
> colSums(tmp5,na.rm=TRUE)
 [1] 1043.2983  609.5553  668.9257  647.7563  661.2273  640.5828  615.0201
 [8]  580.0977  652.2937  620.1544  705.9897  655.3963  625.4410  608.3235
[15]    0.0000  603.0931  649.7261  651.6609  633.3062  681.2528
> colVars(tmp5,na.rm=TRUE)
 [1] 18277.98467    60.65831   130.61711    60.69334    49.42802    51.92465
 [7]   106.81537    72.20822    40.80626    53.83108    45.20880    32.61778
[13]    62.54239    97.07090          NA    24.71383   186.05967    98.21486
[19]    34.02815    58.63796
> colSd(tmp5,na.rm=TRUE)
 [1] 135.196097   7.788345  11.428784   7.790593   7.030507   7.205876
 [7]  10.335152   8.497542   6.387977   7.336967   6.723749   5.711198
[13]   7.908375   9.852457         NA   4.971301  13.640369   9.910341
[19]   5.833365   7.657543
> colMax(tmp5,na.rm=TRUE)
 [1] 475.60697  82.52885  96.09268  81.32399  82.20168  82.39125  81.80336
 [8]  81.04057  86.40051  77.97901  91.62200  82.26644  82.58008  87.63814
[15]      -Inf  76.49016  90.15843  91.40352  79.24691  87.51968
> colMin(tmp5,na.rm=TRUE)
 [1] 56.90799 56.99306 59.99878 57.04398 64.25857 61.65072 56.18603 54.46326
 [9] 64.15407 57.73227 69.49883 64.83285 56.66412 57.31425      Inf 60.71365
[17] 55.00838 59.04918 63.47776 64.73252
> 
> 
> 
> 
> 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] 190.5262 150.9048 113.3545 190.5203 191.8663 197.4096 369.4204 328.7930
 [9] 134.6383 262.3623
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 190.5262 150.9048 113.3545 190.5203 191.8663 197.4096 369.4204 328.7930
 [9] 134.6383 262.3623
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  2.842171e-14  7.105427e-14  8.526513e-14 -2.842171e-14 -2.842171e-14
 [6]  1.421085e-13  2.842171e-14 -2.842171e-14  8.526513e-14  5.684342e-14
[11] -1.136868e-13  4.263256e-14  1.136868e-13  2.273737e-13 -8.526513e-14
[16] -7.105427e-14  2.842171e-14  5.684342e-14  2.842171e-14  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
4   13 
8   4 
6   5 
2   5 
9   15 
4   19 
9   11 
1   20 
6   14 
3   7 
5   19 
2   4 
5   7 
9   12 
2   5 
7   3 
6   20 
4   12 
8   7 
9   15 
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.822056
> Min(tmp)
[1] -2.492887
> mean(tmp)
[1] 0.06613705
> Sum(tmp)
[1] 6.613705
> Var(tmp)
[1] 1.077604
> 
> rowMeans(tmp)
[1] 0.06613705
> rowSums(tmp)
[1] 6.613705
> rowVars(tmp)
[1] 1.077604
> rowSd(tmp)
[1] 1.038077
> rowMax(tmp)
[1] 2.822056
> rowMin(tmp)
[1] -2.492887
> 
> colMeans(tmp)
  [1] -2.29398485 -0.06373387  0.72894134 -2.33987300  1.19112951  0.89499837
  [7]  1.22088930  1.83133424  1.28148787  0.22043580 -2.49288699  0.98690150
 [13] -2.12742756 -1.01147279  1.76839570  1.65411906  0.71849990  0.64966874
 [19]  1.17489034 -0.46104850 -0.11667559 -0.92175118 -0.20028077  1.01404066
 [25] -0.61770583  0.69218707 -0.44772472  1.34097627  0.01431211  0.77565744
 [31] -0.08902253 -0.44444116  0.30390622 -0.87910274  0.36146985 -0.14077647
 [37] -0.45355698  1.05492736  1.40383630 -0.46239206  0.27080016 -1.12923686
 [43]  0.27804049 -0.78447979 -0.40910507  1.48655244  0.07249288 -0.89694986
 [49]  0.46777219 -0.95489189  0.41534955 -0.10105137  1.78696462 -1.40706714
 [55]  0.30466228  0.14510752 -0.76498496 -1.53493165  1.54477021  0.65396764
 [61]  0.65436413  1.28755633 -0.48305014  1.15091021 -0.29081147 -1.22171620
 [67] -0.55306686  0.56168949 -0.79330997 -0.47347168  0.08786368 -2.10859995
 [73]  1.48144437 -0.04256233 -0.26462955 -0.20655692  0.54459956  1.10817386
 [79] -0.33214474  0.44469112  0.59018516 -1.07999825  0.29966895  0.34884790
 [85]  0.18383592 -0.43633674  1.41515192  0.53136820 -0.09134722 -1.45317036
 [91]  2.82205564 -1.62129006 -0.00332294 -0.53181595  1.13159212 -0.14323970
 [97]  1.21983828 -1.18511407  0.13723137 -1.23473672
> colSums(tmp)
  [1] -2.29398485 -0.06373387  0.72894134 -2.33987300  1.19112951  0.89499837
  [7]  1.22088930  1.83133424  1.28148787  0.22043580 -2.49288699  0.98690150
 [13] -2.12742756 -1.01147279  1.76839570  1.65411906  0.71849990  0.64966874
 [19]  1.17489034 -0.46104850 -0.11667559 -0.92175118 -0.20028077  1.01404066
 [25] -0.61770583  0.69218707 -0.44772472  1.34097627  0.01431211  0.77565744
 [31] -0.08902253 -0.44444116  0.30390622 -0.87910274  0.36146985 -0.14077647
 [37] -0.45355698  1.05492736  1.40383630 -0.46239206  0.27080016 -1.12923686
 [43]  0.27804049 -0.78447979 -0.40910507  1.48655244  0.07249288 -0.89694986
 [49]  0.46777219 -0.95489189  0.41534955 -0.10105137  1.78696462 -1.40706714
 [55]  0.30466228  0.14510752 -0.76498496 -1.53493165  1.54477021  0.65396764
 [61]  0.65436413  1.28755633 -0.48305014  1.15091021 -0.29081147 -1.22171620
 [67] -0.55306686  0.56168949 -0.79330997 -0.47347168  0.08786368 -2.10859995
 [73]  1.48144437 -0.04256233 -0.26462955 -0.20655692  0.54459956  1.10817386
 [79] -0.33214474  0.44469112  0.59018516 -1.07999825  0.29966895  0.34884790
 [85]  0.18383592 -0.43633674  1.41515192  0.53136820 -0.09134722 -1.45317036
 [91]  2.82205564 -1.62129006 -0.00332294 -0.53181595  1.13159212 -0.14323970
 [97]  1.21983828 -1.18511407  0.13723137 -1.23473672
> 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] -2.29398485 -0.06373387  0.72894134 -2.33987300  1.19112951  0.89499837
  [7]  1.22088930  1.83133424  1.28148787  0.22043580 -2.49288699  0.98690150
 [13] -2.12742756 -1.01147279  1.76839570  1.65411906  0.71849990  0.64966874
 [19]  1.17489034 -0.46104850 -0.11667559 -0.92175118 -0.20028077  1.01404066
 [25] -0.61770583  0.69218707 -0.44772472  1.34097627  0.01431211  0.77565744
 [31] -0.08902253 -0.44444116  0.30390622 -0.87910274  0.36146985 -0.14077647
 [37] -0.45355698  1.05492736  1.40383630 -0.46239206  0.27080016 -1.12923686
 [43]  0.27804049 -0.78447979 -0.40910507  1.48655244  0.07249288 -0.89694986
 [49]  0.46777219 -0.95489189  0.41534955 -0.10105137  1.78696462 -1.40706714
 [55]  0.30466228  0.14510752 -0.76498496 -1.53493165  1.54477021  0.65396764
 [61]  0.65436413  1.28755633 -0.48305014  1.15091021 -0.29081147 -1.22171620
 [67] -0.55306686  0.56168949 -0.79330997 -0.47347168  0.08786368 -2.10859995
 [73]  1.48144437 -0.04256233 -0.26462955 -0.20655692  0.54459956  1.10817386
 [79] -0.33214474  0.44469112  0.59018516 -1.07999825  0.29966895  0.34884790
 [85]  0.18383592 -0.43633674  1.41515192  0.53136820 -0.09134722 -1.45317036
 [91]  2.82205564 -1.62129006 -0.00332294 -0.53181595  1.13159212 -0.14323970
 [97]  1.21983828 -1.18511407  0.13723137 -1.23473672
> colMin(tmp)
  [1] -2.29398485 -0.06373387  0.72894134 -2.33987300  1.19112951  0.89499837
  [7]  1.22088930  1.83133424  1.28148787  0.22043580 -2.49288699  0.98690150
 [13] -2.12742756 -1.01147279  1.76839570  1.65411906  0.71849990  0.64966874
 [19]  1.17489034 -0.46104850 -0.11667559 -0.92175118 -0.20028077  1.01404066
 [25] -0.61770583  0.69218707 -0.44772472  1.34097627  0.01431211  0.77565744
 [31] -0.08902253 -0.44444116  0.30390622 -0.87910274  0.36146985 -0.14077647
 [37] -0.45355698  1.05492736  1.40383630 -0.46239206  0.27080016 -1.12923686
 [43]  0.27804049 -0.78447979 -0.40910507  1.48655244  0.07249288 -0.89694986
 [49]  0.46777219 -0.95489189  0.41534955 -0.10105137  1.78696462 -1.40706714
 [55]  0.30466228  0.14510752 -0.76498496 -1.53493165  1.54477021  0.65396764
 [61]  0.65436413  1.28755633 -0.48305014  1.15091021 -0.29081147 -1.22171620
 [67] -0.55306686  0.56168949 -0.79330997 -0.47347168  0.08786368 -2.10859995
 [73]  1.48144437 -0.04256233 -0.26462955 -0.20655692  0.54459956  1.10817386
 [79] -0.33214474  0.44469112  0.59018516 -1.07999825  0.29966895  0.34884790
 [85]  0.18383592 -0.43633674  1.41515192  0.53136820 -0.09134722 -1.45317036
 [91]  2.82205564 -1.62129006 -0.00332294 -0.53181595  1.13159212 -0.14323970
 [97]  1.21983828 -1.18511407  0.13723137 -1.23473672
> colMedians(tmp)
  [1] -2.29398485 -0.06373387  0.72894134 -2.33987300  1.19112951  0.89499837
  [7]  1.22088930  1.83133424  1.28148787  0.22043580 -2.49288699  0.98690150
 [13] -2.12742756 -1.01147279  1.76839570  1.65411906  0.71849990  0.64966874
 [19]  1.17489034 -0.46104850 -0.11667559 -0.92175118 -0.20028077  1.01404066
 [25] -0.61770583  0.69218707 -0.44772472  1.34097627  0.01431211  0.77565744
 [31] -0.08902253 -0.44444116  0.30390622 -0.87910274  0.36146985 -0.14077647
 [37] -0.45355698  1.05492736  1.40383630 -0.46239206  0.27080016 -1.12923686
 [43]  0.27804049 -0.78447979 -0.40910507  1.48655244  0.07249288 -0.89694986
 [49]  0.46777219 -0.95489189  0.41534955 -0.10105137  1.78696462 -1.40706714
 [55]  0.30466228  0.14510752 -0.76498496 -1.53493165  1.54477021  0.65396764
 [61]  0.65436413  1.28755633 -0.48305014  1.15091021 -0.29081147 -1.22171620
 [67] -0.55306686  0.56168949 -0.79330997 -0.47347168  0.08786368 -2.10859995
 [73]  1.48144437 -0.04256233 -0.26462955 -0.20655692  0.54459956  1.10817386
 [79] -0.33214474  0.44469112  0.59018516 -1.07999825  0.29966895  0.34884790
 [85]  0.18383592 -0.43633674  1.41515192  0.53136820 -0.09134722 -1.45317036
 [91]  2.82205564 -1.62129006 -0.00332294 -0.53181595  1.13159212 -0.14323970
 [97]  1.21983828 -1.18511407  0.13723137 -1.23473672
> colRanges(tmp)
          [,1]        [,2]      [,3]      [,4]    [,5]      [,6]     [,7]
[1,] -2.293985 -0.06373387 0.7289413 -2.339873 1.19113 0.8949984 1.220889
[2,] -2.293985 -0.06373387 0.7289413 -2.339873 1.19113 0.8949984 1.220889
         [,8]     [,9]     [,10]     [,11]     [,12]     [,13]     [,14]
[1,] 1.831334 1.281488 0.2204358 -2.492887 0.9869015 -2.127428 -1.011473
[2,] 1.831334 1.281488 0.2204358 -2.492887 0.9869015 -2.127428 -1.011473
        [,15]    [,16]     [,17]     [,18]   [,19]      [,20]      [,21]
[1,] 1.768396 1.654119 0.7184999 0.6496687 1.17489 -0.4610485 -0.1166756
[2,] 1.768396 1.654119 0.7184999 0.6496687 1.17489 -0.4610485 -0.1166756
          [,22]      [,23]    [,24]      [,25]     [,26]      [,27]    [,28]
[1,] -0.9217512 -0.2002808 1.014041 -0.6177058 0.6921871 -0.4477247 1.340976
[2,] -0.9217512 -0.2002808 1.014041 -0.6177058 0.6921871 -0.4477247 1.340976
          [,29]     [,30]       [,31]      [,32]     [,33]      [,34]     [,35]
[1,] 0.01431211 0.7756574 -0.08902253 -0.4444412 0.3039062 -0.8791027 0.3614698
[2,] 0.01431211 0.7756574 -0.08902253 -0.4444412 0.3039062 -0.8791027 0.3614698
          [,36]     [,37]    [,38]    [,39]      [,40]     [,41]     [,42]
[1,] -0.1407765 -0.453557 1.054927 1.403836 -0.4623921 0.2708002 -1.129237
[2,] -0.1407765 -0.453557 1.054927 1.403836 -0.4623921 0.2708002 -1.129237
         [,43]      [,44]      [,45]    [,46]      [,47]      [,48]     [,49]
[1,] 0.2780405 -0.7844798 -0.4091051 1.486552 0.07249288 -0.8969499 0.4677722
[2,] 0.2780405 -0.7844798 -0.4091051 1.486552 0.07249288 -0.8969499 0.4677722
          [,50]     [,51]      [,52]    [,53]     [,54]     [,55]     [,56]
[1,] -0.9548919 0.4153496 -0.1010514 1.786965 -1.407067 0.3046623 0.1451075
[2,] -0.9548919 0.4153496 -0.1010514 1.786965 -1.407067 0.3046623 0.1451075
         [,57]     [,58]   [,59]     [,60]     [,61]    [,62]      [,63]
[1,] -0.764985 -1.534932 1.54477 0.6539676 0.6543641 1.287556 -0.4830501
[2,] -0.764985 -1.534932 1.54477 0.6539676 0.6543641 1.287556 -0.4830501
       [,64]      [,65]     [,66]      [,67]     [,68]    [,69]      [,70]
[1,] 1.15091 -0.2908115 -1.221716 -0.5530669 0.5616895 -0.79331 -0.4734717
[2,] 1.15091 -0.2908115 -1.221716 -0.5530669 0.5616895 -0.79331 -0.4734717
          [,71]   [,72]    [,73]       [,74]      [,75]      [,76]     [,77]
[1,] 0.08786368 -2.1086 1.481444 -0.04256233 -0.2646295 -0.2065569 0.5445996
[2,] 0.08786368 -2.1086 1.481444 -0.04256233 -0.2646295 -0.2065569 0.5445996
        [,78]      [,79]     [,80]     [,81]     [,82]     [,83]     [,84]
[1,] 1.108174 -0.3321447 0.4446911 0.5901852 -1.079998 0.2996689 0.3488479
[2,] 1.108174 -0.3321447 0.4446911 0.5901852 -1.079998 0.2996689 0.3488479
         [,85]      [,86]    [,87]     [,88]       [,89]    [,90]    [,91]
[1,] 0.1838359 -0.4363367 1.415152 0.5313682 -0.09134722 -1.45317 2.822056
[2,] 0.1838359 -0.4363367 1.415152 0.5313682 -0.09134722 -1.45317 2.822056
        [,92]       [,93]      [,94]    [,95]      [,96]    [,97]     [,98]
[1,] -1.62129 -0.00332294 -0.5318159 1.131592 -0.1432397 1.219838 -1.185114
[2,] -1.62129 -0.00332294 -0.5318159 1.131592 -0.1432397 1.219838 -1.185114
         [,99]    [,100]
[1,] 0.1372314 -1.234737
[2,] 0.1372314 -1.234737
> 
> 
> Max(tmp2)
[1] 2.086103
> Min(tmp2)
[1] -3.076678
> mean(tmp2)
[1] -0.1418059
> Sum(tmp2)
[1] -14.18059
> Var(tmp2)
[1] 0.8802007
> 
> rowMeans(tmp2)
  [1] -0.28501868  0.47948137  0.87857595  0.34128777 -2.44225906  1.24409457
  [7]  0.84015111  1.08312635 -1.71945479 -0.28609324  0.37051113 -0.68576434
 [13]  0.54413531 -1.11291539 -0.39990723 -1.03453365 -0.07029947 -0.77922803
 [19] -0.09815984  0.25008948 -0.85961031  1.58986738  0.35645388  0.54407725
 [25] -0.21496416  0.17765613  1.76985399  0.12236409  0.45578388 -0.60797467
 [31]  0.98916850 -1.28644157  0.31615665 -0.10729415  2.00749978 -1.95200982
 [37] -0.10880713  0.16623252 -0.81184936 -0.97374070  0.41751630 -2.40125091
 [43] -0.45943705 -0.48829812  0.34155481 -0.70671506  0.31196112 -1.22348169
 [49]  0.24614907 -0.30308651  1.22904090 -0.01754509 -0.46072526 -0.75210353
 [55] -0.47823288 -2.02910257 -0.79765999  0.92409306 -1.13831068  2.08610282
 [61] -0.07171931 -1.00674581 -0.83766042  0.09494260 -0.42508328 -0.85537589
 [67]  0.62802618 -0.98554142 -0.89002271  1.76736479 -1.39142839 -0.11515637
 [73]  0.23313597 -0.03019055  0.48112453 -3.07667793 -0.12511011  1.36739413
 [79] -0.82833151 -0.49932274 -0.01095936  0.43260076 -0.16860069  0.85303512
 [85] -0.42725268 -0.34051922 -0.65142410  1.42585933 -0.08851861 -0.08026622
 [91]  0.55083288  0.07069194  0.36357626 -0.86473650 -0.31997654  0.45261900
 [97] -0.48025020 -0.40665059 -1.06804872  0.15306646
> rowSums(tmp2)
  [1] -0.28501868  0.47948137  0.87857595  0.34128777 -2.44225906  1.24409457
  [7]  0.84015111  1.08312635 -1.71945479 -0.28609324  0.37051113 -0.68576434
 [13]  0.54413531 -1.11291539 -0.39990723 -1.03453365 -0.07029947 -0.77922803
 [19] -0.09815984  0.25008948 -0.85961031  1.58986738  0.35645388  0.54407725
 [25] -0.21496416  0.17765613  1.76985399  0.12236409  0.45578388 -0.60797467
 [31]  0.98916850 -1.28644157  0.31615665 -0.10729415  2.00749978 -1.95200982
 [37] -0.10880713  0.16623252 -0.81184936 -0.97374070  0.41751630 -2.40125091
 [43] -0.45943705 -0.48829812  0.34155481 -0.70671506  0.31196112 -1.22348169
 [49]  0.24614907 -0.30308651  1.22904090 -0.01754509 -0.46072526 -0.75210353
 [55] -0.47823288 -2.02910257 -0.79765999  0.92409306 -1.13831068  2.08610282
 [61] -0.07171931 -1.00674581 -0.83766042  0.09494260 -0.42508328 -0.85537589
 [67]  0.62802618 -0.98554142 -0.89002271  1.76736479 -1.39142839 -0.11515637
 [73]  0.23313597 -0.03019055  0.48112453 -3.07667793 -0.12511011  1.36739413
 [79] -0.82833151 -0.49932274 -0.01095936  0.43260076 -0.16860069  0.85303512
 [85] -0.42725268 -0.34051922 -0.65142410  1.42585933 -0.08851861 -0.08026622
 [91]  0.55083288  0.07069194  0.36357626 -0.86473650 -0.31997654  0.45261900
 [97] -0.48025020 -0.40665059 -1.06804872  0.15306646
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.28501868  0.47948137  0.87857595  0.34128777 -2.44225906  1.24409457
  [7]  0.84015111  1.08312635 -1.71945479 -0.28609324  0.37051113 -0.68576434
 [13]  0.54413531 -1.11291539 -0.39990723 -1.03453365 -0.07029947 -0.77922803
 [19] -0.09815984  0.25008948 -0.85961031  1.58986738  0.35645388  0.54407725
 [25] -0.21496416  0.17765613  1.76985399  0.12236409  0.45578388 -0.60797467
 [31]  0.98916850 -1.28644157  0.31615665 -0.10729415  2.00749978 -1.95200982
 [37] -0.10880713  0.16623252 -0.81184936 -0.97374070  0.41751630 -2.40125091
 [43] -0.45943705 -0.48829812  0.34155481 -0.70671506  0.31196112 -1.22348169
 [49]  0.24614907 -0.30308651  1.22904090 -0.01754509 -0.46072526 -0.75210353
 [55] -0.47823288 -2.02910257 -0.79765999  0.92409306 -1.13831068  2.08610282
 [61] -0.07171931 -1.00674581 -0.83766042  0.09494260 -0.42508328 -0.85537589
 [67]  0.62802618 -0.98554142 -0.89002271  1.76736479 -1.39142839 -0.11515637
 [73]  0.23313597 -0.03019055  0.48112453 -3.07667793 -0.12511011  1.36739413
 [79] -0.82833151 -0.49932274 -0.01095936  0.43260076 -0.16860069  0.85303512
 [85] -0.42725268 -0.34051922 -0.65142410  1.42585933 -0.08851861 -0.08026622
 [91]  0.55083288  0.07069194  0.36357626 -0.86473650 -0.31997654  0.45261900
 [97] -0.48025020 -0.40665059 -1.06804872  0.15306646
> rowMin(tmp2)
  [1] -0.28501868  0.47948137  0.87857595  0.34128777 -2.44225906  1.24409457
  [7]  0.84015111  1.08312635 -1.71945479 -0.28609324  0.37051113 -0.68576434
 [13]  0.54413531 -1.11291539 -0.39990723 -1.03453365 -0.07029947 -0.77922803
 [19] -0.09815984  0.25008948 -0.85961031  1.58986738  0.35645388  0.54407725
 [25] -0.21496416  0.17765613  1.76985399  0.12236409  0.45578388 -0.60797467
 [31]  0.98916850 -1.28644157  0.31615665 -0.10729415  2.00749978 -1.95200982
 [37] -0.10880713  0.16623252 -0.81184936 -0.97374070  0.41751630 -2.40125091
 [43] -0.45943705 -0.48829812  0.34155481 -0.70671506  0.31196112 -1.22348169
 [49]  0.24614907 -0.30308651  1.22904090 -0.01754509 -0.46072526 -0.75210353
 [55] -0.47823288 -2.02910257 -0.79765999  0.92409306 -1.13831068  2.08610282
 [61] -0.07171931 -1.00674581 -0.83766042  0.09494260 -0.42508328 -0.85537589
 [67]  0.62802618 -0.98554142 -0.89002271  1.76736479 -1.39142839 -0.11515637
 [73]  0.23313597 -0.03019055  0.48112453 -3.07667793 -0.12511011  1.36739413
 [79] -0.82833151 -0.49932274 -0.01095936  0.43260076 -0.16860069  0.85303512
 [85] -0.42725268 -0.34051922 -0.65142410  1.42585933 -0.08851861 -0.08026622
 [91]  0.55083288  0.07069194  0.36357626 -0.86473650 -0.31997654  0.45261900
 [97] -0.48025020 -0.40665059 -1.06804872  0.15306646
> 
> colMeans(tmp2)
[1] -0.1418059
> colSums(tmp2)
[1] -14.18059
> colVars(tmp2)
[1] 0.8802007
> colSd(tmp2)
[1] 0.9381901
> colMax(tmp2)
[1] 2.086103
> colMin(tmp2)
[1] -3.076678
> colMedians(tmp2)
[1] -0.1080506
> colRanges(tmp2)
          [,1]
[1,] -3.076678
[2,]  2.086103
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.64574178  2.70448759 -4.86894579  0.07977272 -3.13376018 -2.86387218
 [7]  1.81682061  1.35303405 -1.80175798 -0.92572307
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8775338
[2,] -0.2018005
[3,] -0.1049020
[4,]  0.4748409
[5,]  0.6764634
> 
> rowApply(tmp,sum)
 [1] -2.4213855 -3.9489520 -0.7148956 -1.7276734  2.7946215 -1.7708809
 [7] -0.2868639 -1.1473023  0.3909943 -0.4533482
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    5    4    5    9    3    9    7    7    1     5
 [2,]    6    8   10    2    9    2   10    2    8    10
 [3,]    7    1    9    7    6    5    1    1    2     2
 [4,]   10    9    7    1    1   10    8    3    4     7
 [5,]    3    7    8    4    2    7    9    4    3     4
 [6,]    2    3    4    5    8    6    5    6    5     1
 [7,]    8    5    2    6    7    4    2   10    9     9
 [8,]    1   10    1   10    5    8    4    9    6     8
 [9,]    4    6    6    8   10    1    6    5    7     6
[10,]    9    2    3    3    4    3    3    8   10     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.3323767729 -0.5165027153  2.5227593258  0.3618066576 -0.8711142105
 [6] -2.6271665575 -1.4903903137 -3.3839428841 -1.7674616238 -2.2231027349
[11] -1.8030546493 -1.4423946269  1.1193023750 -0.0004215632  0.5501104335
[16]  1.9174617273 -0.4048783861  2.7622284931 -3.4543438177 -3.3960720221
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.1119460
[2,] -0.5968085
[3,] -0.1061362
[4,]  0.4896730
[5,]  1.6575944
> 
> rowApply(tmp,sum)
[1] -2.912188  4.748206 -4.851297 -1.919930 -8.879591
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   20    4   16   12    3
[2,]   12   12    8    5   17
[3,]   14    8   20   16   16
[4,]    6   16    7   20    6
[5,]    9    9   15   13    2
> 
> 
> as.matrix(tmp)
           [,1]        [,2]        [,3]       [,4]       [,5]       [,6]
[1,]  1.6575944 -0.08724728  0.07185386 -0.4359326 -0.3166426 -1.6550448
[2,] -0.5968085  0.49059650  0.06706589  0.9730622  0.1051912  1.1239403
[3,]  0.4896730 -0.55546456  1.83091126 -0.6810176  0.3399156 -1.3797245
[4,] -0.1061362 -0.66721857  0.57278048  1.4852803  0.3370772 -0.1840960
[5,] -1.1119460  0.30283119 -0.01985217 -0.9795856 -1.3366556 -0.5322417
            [,7]       [,8]       [,9]       [,10]      [,11]      [,12]
[1,] -1.41971446 -1.6218300  0.7588185 -0.34241498 -0.5495918  0.3357793
[2,] -0.56354998 -0.0430211 -1.2351195  1.28556666  0.1495986 -0.7767074
[3,]  0.05574648 -0.7843174 -1.6787051 -0.01566368 -0.2036884 -0.3680527
[4,]  0.52375416 -0.3202681  1.4101689 -2.52940240 -0.3896766 -1.1524838
[5,] -0.08662652 -0.6145063 -1.0226244 -0.62118833 -0.8096964  0.5190700
          [,13]       [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -0.5271972  0.66590305  0.7094489 -0.1824590 -0.4106173  0.6942046
[2,]  0.6822764 -0.73377076  0.5718252  1.9504409 -0.5146252  1.0187064
[3,] -1.3100088 -0.07485145  0.6414289  0.9597237 -0.4139375  0.8711795
[4,]  1.1683768  1.04383211 -0.3180157 -0.2543818 -0.2484997  0.4131763
[5,]  1.1058552 -0.90153451 -1.0545769 -0.5558621  1.1828014 -0.2350383
          [,19]      [,20]
[1,] -0.0274530 -0.2296455
[2,]  0.5612958  0.2322428
[3,] -0.7573582 -1.8170859
[4,] -1.6393431 -1.0648545
[5,] -1.5914853 -0.5167290
> 
> 
> 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.16-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.16-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.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  562  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.16-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.5275382 0.7963622 -0.3636468 0.7871186 -0.1362482 -0.3804809 0.02695642
          col8       col9      col10     col11    col12     col13      col14
row1 0.4957004 -0.1213287 -0.1534587 0.1345878 1.368665 0.5201636 -0.8606943
          col15    col16       col17    col18    col19     col20
row1 -0.6624096 1.401834 -0.03446318 -2.22575 1.120212 0.4527283
> tmp[,"col10"]
          col10
row1 -0.1534587
row2  0.9871983
row3  0.1468037
row4 -1.1720923
row5  0.4154686
> tmp[c("row1","row5"),]
            col1       col2       col3      col4       col5       col6
row1  0.52753820  0.7963622 -0.3636468 0.7871186 -0.1362482 -0.3804809
row5 -0.07745503 -1.8991005 -0.5309208 1.0024419 -0.3968450  0.7607392
           col7      col8       col9      col10      col11     col12      col13
row1 0.02695642 0.4957004 -0.1213287 -0.1534587  0.1345878  1.368665  0.5201636
row5 0.35993367 1.8176391  0.8771015  0.4154686 -1.1252005 -1.845296 -0.8597593
          col14      col15     col16       col17     col18      col19
row1 -0.8606943 -0.6624096 1.4018339 -0.03446318 -2.225750 1.12021231
row5  0.7642779 -0.8249638 0.2677119 -0.61648145 -2.176733 0.05938362
          col20
row1  0.4527283
row5 -0.2525177
> tmp[,c("col6","col20")]
             col6      col20
row1 -0.380480877  0.4527283
row2  0.003943092 -1.2015461
row3 -1.591938014  0.9041334
row4 -0.452415236 -0.5539976
row5  0.760739195 -0.2525177
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.3804809  0.4527283
row5  0.7607392 -0.2525177
> 
> 
> 
> 
> 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 48.63492 50.91937 49.77884 51.31591 50.5719 105.9148 49.27295 49.90226
         col9    col10    col11   col12    col13    col14    col15    col16
row1 50.30547 51.29037 49.63152 48.1664 51.75081 50.29604 49.39017 50.15189
        col17    col18    col19    col20
row1 49.27989 48.44918 50.68361 105.8797
> tmp[,"col10"]
        col10
row1 51.29037
row2 29.25341
row3 29.59805
row4 30.47362
row5 50.74549
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.63492 50.91937 49.77884 51.31591 50.57190 105.9148 49.27295 49.90226
row5 48.79222 50.08647 50.46709 50.32070 49.48974 104.6730 47.70184 51.00178
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.30547 51.29037 49.63152 48.16640 51.75081 50.29604 49.39017 50.15189
row5 51.39168 50.74549 50.66247 50.63554 49.61625 51.06199 50.74084 50.21975
        col17    col18    col19    col20
row1 49.27989 48.44918 50.68361 105.8797
row5 51.43661 49.31311 51.58061 104.7694
> tmp[,c("col6","col20")]
          col6     col20
row1 105.91481 105.87968
row2  75.33252  75.57750
row3  73.26407  75.11375
row4  73.32577  74.79257
row5 104.67297 104.76941
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.9148 105.8797
row5 104.6730 104.7694
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.9148 105.8797
row5 104.6730 104.7694
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  0.72727774
[2,] -2.14467417
[3,] -1.22597861
[4,] -0.34128684
[5,]  0.08924229
> tmp[,c("col17","col7")]
          col17       col7
[1,] -1.8520689  0.6162731
[2,] -0.9034236  1.0370901
[3,] -0.8300349 -0.2404026
[4,]  0.1759477 -1.0082700
[5,]  1.0019575 -0.7219563
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,] -1.0611959 -1.69923709
[2,]  0.7792572  0.04253195
[3,]  0.2461811 -0.75571257
[4,] -0.5689546  2.01420536
[5,] -0.3379242  0.25913816
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -1.061196
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -1.0611959
[2,]  0.7792572
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]       [,4]       [,5]      [,6]      [,7]
row3 -0.2662524 0.04368194 0.7469249 0.15773539 -0.4097168 -1.055098 -1.129942
row1 -2.0213311 0.14354567 1.4843671 0.08191703  0.7605243  1.083542  1.078775
          [,8]        [,9]      [,10]       [,11]     [,12]      [,13]
row3 -1.429739  0.04213796 -0.5951278  0.01945607 1.6753192  0.1598279
row1  1.011421 -0.10561773  0.3284162 -0.14184385 0.1119739 -1.1258848
         [,14]      [,15]      [,16]      [,17]      [,18]     [,19]     [,20]
row3 0.9522855  0.4111701 -1.7535457 -0.2089844  0.9920628 -1.882661 0.3598216
row1 0.2620410 -0.5814269  0.7482123 -0.9546981 -1.0844419  3.017733 0.1899054
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]      [,2]      [,3]       [,4]      [,5]      [,6]      [,7]
row2 1.137074 0.8584987 0.3480136 -0.9000065 0.2240043 -2.043939 0.9463576
          [,8]       [,9]     [,10]
row2 0.8275182 -0.1573261 0.9952898
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
        [,1]       [,2]       [,3]     [,4]      [,5]      [,6]       [,7]
row5 1.09474 -0.7245323 -0.1109607 -1.02987 0.2896883 0.4215385 -0.1490782
           [,8]     [,9]      [,10]      [,11]     [,12]     [,13]    [,14]
row5 -0.5823595 1.036447 -0.5058636 -0.3636589 0.7763065 0.5427279 1.932613
         [,15]     [,16]      [,17]     [,18]      [,19]      [,20]
row5 0.6740161 0.7687233 -0.4348615 0.3165725 -0.4693568 -0.9033428
> 
> 
> 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: 0x564e4734ccf0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d13e29266"
 [2] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d7b05e293"
 [3] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d4319d27b"
 [4] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d598351e9"
 [5] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d28dc7451"
 [6] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d3be034dc"
 [7] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d1fc6a6a7"
 [8] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d7be7f425"
 [9] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d10cc2932"
[10] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d3951d15e"
[11] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d5a33e172"
[12] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d63b1acc3"
[13] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d25e53677"
[14] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d387b64ab"
[15] "/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM25894d19564c5e"
> 
> 
> ### 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: 0x564e47faa800>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x564e47faa800>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x564e47faa800>
> rowMedians(tmp)
  [1]  0.047663843 -0.276205796  0.371263016  0.575084195 -0.196516838
  [6] -0.704484536 -0.431982415  0.169267243  0.479658609  0.160188435
 [11] -0.340145765  0.017065836 -0.446150355 -0.019544778 -0.072819769
 [16] -0.006114917  0.286125180 -0.043521382  0.058788538 -0.104481769
 [21]  0.297910664  0.106259837 -0.071137655  0.028430873 -0.057150978
 [26] -0.008262095 -0.116887605  0.423476736 -0.398850812  0.582360818
 [31]  0.237660075  0.098949535 -0.094140439  0.320259918  0.010355863
 [36] -0.419732927  0.054254277 -0.202867982 -0.630991643  0.066956339
 [41]  0.481913310  0.014528535  0.255289297 -0.027805936  0.243199067
 [46] -0.095947727 -0.015036939 -0.079324659  0.170894277  0.329242566
 [51]  0.344680027 -0.599671108  0.493837336  0.079276468  0.506833522
 [56] -0.589115138  0.285901980 -0.525106858 -0.529745485  0.337231263
 [61] -0.016397120  0.035766425  0.271189444 -0.687745079 -0.146396385
 [66] -0.018646115  0.297085562  0.515881385  0.544989638 -0.412661950
 [71] -0.467620016  0.008206551 -0.166331879 -0.389533910 -0.773127790
 [76]  0.024255996  0.028043346 -0.064542804  0.098187055 -0.320390963
 [81] -0.082053352  0.301811169  0.231471490  0.120250061  0.107884074
 [86] -0.275309755 -0.388371308  0.210566882 -0.708204669  0.251249936
 [91] -0.058697391 -0.017428487 -0.082321298  0.161074169 -0.292227110
 [96]  0.183423539  0.193212776  0.742654679 -0.256349379  0.542063089
[101] -0.284526841  0.720094213 -0.001308810 -0.258688566  0.061478565
[106] -0.019702245 -0.292751378  0.435616466 -0.060891835  0.250441071
[111] -0.329646279 -0.402229157 -0.291377318 -0.314442361 -0.395321584
[116]  0.040867250  0.048546353 -0.599685757 -0.384159014 -0.173478292
[121] -0.044734488  0.334670513 -0.336520907 -0.031222791 -0.231799322
[126] -0.103845724 -0.129156360 -0.093785189  0.357867907 -0.427011732
[131] -0.579990012  0.033499319 -0.110541834 -0.223604860 -0.116303587
[136] -0.319148798 -0.404232890  0.238165516  0.145041876  0.558143657
[141]  0.036375373  0.645108500 -0.382747566  0.508784660 -0.430237366
[146]  0.464658844  0.349881537  0.145965366  0.069607176  0.168427735
[151] -0.281389359 -0.289449254  0.117814788 -0.085008531 -0.233080529
[156]  0.548959876 -0.452591456 -0.687605123  0.326861589  0.171226960
[161] -0.300457595  0.147719320 -0.430174394  0.091439981 -0.430793250
[166]  0.041187532 -0.242927064 -0.258484973 -0.160083295  0.385625712
[171]  0.257661607 -0.401210751  0.143819166  0.240798853  0.135034538
[176]  0.023045419  0.342666561 -0.333573848  0.132669349 -0.132432376
[181]  0.430073631  0.219562138  0.233529542 -0.316463648 -0.651681083
[186] -0.196524091 -0.252034029  0.218298468 -0.276160780 -0.013209619
[191]  0.176543642 -0.248234331 -0.075823501  0.263135722  0.645007862
[196] -0.243320262 -0.170923746 -0.093744793  0.364668180  0.263738515
[201]  0.604826031 -0.224700519 -0.319669663  0.280494072  0.163965621
[206] -0.265831202 -0.273663349  0.034428784 -0.067112090  0.188762984
[211] -0.274624031 -0.072900328  0.381968021  0.139748207  0.687904861
[216] -0.142700476 -0.029768046 -0.084222246 -0.372916278 -0.117170259
[221] -0.002649165 -0.444231597 -0.105282266  0.379337599  0.099503920
[226] -0.298011613 -0.194955589 -0.270919203  0.239829793  0.140173115
> 
> proc.time()
   user  system elapsed 
  1.471   0.578   2.039 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
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: 0x563aad3a6400>
> .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: 0x563aad3a6400>
> .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: 0x563aad3a6400>
> .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: 0x563aad3a6400>
> 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: 0x563aad3f19d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x563aad3f19d0>
> .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: 0x563aad3f19d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x563aad3f19d0>
> .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: 0x563aad3f19d0>
> 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: 0x563aac22b450>
> .Call("R_bm_AddColumn",P)
<pointer: 0x563aac22b450>
> .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: 0x563aac22b450>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x563aac22b450>
> .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: 0x563aac22b450>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x563aac22b450>
> .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: 0x563aac22b450>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x563aac22b450>
> .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: 0x563aac22b450>
> 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: 0x563aabbd0dc0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x563aabbd0dc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x563aabbd0dc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x563aabbd0dc0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile258c433b800083" "BufferedMatrixFile258c435930cb37"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile258c433b800083" "BufferedMatrixFile258c435930cb37"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x563aad0cede0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x563aad0cede0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x563aad0cede0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x563aad0cede0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x563aad0cede0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x563aad0cede0>
> .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: 0x563aab4092c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x563aab4092c0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x563aab4092c0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x563aab4092c0>
> 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: 0x563aab408920>
> .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: 0x563aab408920>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.313   0.048   0.345 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
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.290   0.038   0.311 

Example timings