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

This page was generated on 2022-04-13 12:05:08 -0400 (Wed, 13 Apr 2022).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 20.04.4 LTS)x86_644.1.3 (2022-03-10) -- "One Push-Up" 4324
tokay2Windows Server 2012 R2 Standardx644.1.3 (2022-03-10) -- "One Push-Up" 4077
machv2macOS 10.14.6 Mojavex86_644.1.3 (2022-03-10) -- "One Push-Up" 4137
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 223/2083HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.58.0  (landing page)
Ben Bolstad
Snapshot Date: 2022-04-12 01:55:07 -0400 (Tue, 12 Apr 2022)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_14
git_last_commit: 2d3839c
git_last_commit_date: 2021-10-26 11:50:47 -0400 (Tue, 26 Oct 2021)
nebbiolo2Linux (Ubuntu 20.04.4 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
tokay2Windows Server 2012 R2 Standard / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
machv2macOS 10.14.6 Mojave / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published

Summary

Package: BufferedMatrix
Version: 1.58.0
Command: /home/biocbuild/bbs-3.14-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.14-bioc/R/library --no-vignettes --timings BufferedMatrix_1.58.0.tar.gz
StartedAt: 2022-04-12 06:38:58 -0400 (Tue, 12 Apr 2022)
EndedAt: 2022-04-12 06:39:19 -0400 (Tue, 12 Apr 2022)
EllapsedTime: 20.6 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.14-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.14-bioc/R/library --no-vignettes --timings BufferedMatrix_1.58.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.1.3 (2022-03-10)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.58.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 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 ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.14-bioc/R/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
gcc -I"/home/biocbuild/bbs-3.14-bioc/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.14-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.14-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.14-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.14-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.14-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.14-bioc/R/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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.223   0.062   0.269 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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.14-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 440871 23.6     932408 49.8   654445 35.0
Vcells 792814  6.1    8388608 64.0  2012904 15.4
> 
> 
> 
> 
> ##
> ## 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 12 06:39:14 2022"
> 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 12 06:39:14 2022"
> 
> 
> 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: 0x56186da51940>
> 
> 
> 
> 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 12 06:39:14 2022"
> 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 12 06:39:14 2022"
> 
> ColMode(tmp2)
<pointer: 0x56186da51940>
> 
> 
> 
> ### 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.7925066  0.01464674 -0.8366490 -1.8115178
[2,] -1.8984443 -0.63282235  0.1811331 -0.2297524
[3,]  1.1449970  0.68138361  0.7514797 -0.5407701
[4,]  0.8010893  2.32739599  0.3610668  1.4328151
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.14-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.7925066 0.01464674 0.8366490 1.8115178
[2,]  1.8984443 0.63282235 0.1811331 0.2297524
[3,]  1.1449970 0.68138361 0.7514797 0.5407701
[4,]  0.8010893 2.32739599 0.3610668 1.4328151
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.14-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.9896199 0.1210237 0.9146852 1.3459264
[2,] 1.3778405 0.7955013 0.4255973 0.4793249
[3,] 1.0700453 0.8254596 0.8668793 0.7353708
[4,] 0.8950359 1.5255805 0.6008883 1.1970026
> 
> 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.14-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.68871 26.22488 34.98350 40.27078
[2,]  40.67685 33.58784 29.43711 30.02300
[3,]  36.84545 33.93598 34.42027 32.89448
[4,]  34.75145 42.58320 31.36995 38.40284
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x56186d50b970>
> exp(tmp5)
<pointer: 0x56186d50b970>
> log(tmp5,2)
<pointer: 0x56186d50b970>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 467.6601
> Min(tmp5)
[1] 53.17427
> mean(tmp5)
[1] 73.61195
> Sum(tmp5)
[1] 14722.39
> Var(tmp5)
[1] 861.3596
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.31742 73.01246 72.94338 71.07784 70.65490 73.94721 73.02193 73.95050
 [9] 69.21467 68.97921
> rowSums(tmp5)
 [1] 1786.348 1460.249 1458.868 1421.557 1413.098 1478.944 1460.439 1479.010
 [9] 1384.293 1379.584
> rowVars(tmp5)
 [1] 8010.70601   82.88882   37.90748  101.96641   75.59479   61.39062
 [7]  107.96313   95.90539   69.61577   57.66168
> rowSd(tmp5)
 [1] 89.502548  9.104330  6.156905 10.097842  8.694527  7.835217 10.390531
 [8]  9.793130  8.343606  7.593529
> rowMax(tmp5)
 [1] 467.66010  90.51353  85.40947  91.09974  89.37573  87.95640  97.79751
 [8]  93.19980  83.77880  82.65512
> rowMin(tmp5)
 [1] 54.58366 53.17427 60.75433 57.49369 56.50024 59.04345 55.16364 56.58111
 [9] 56.78273 55.44797
> 
> colMeans(tmp5)
 [1] 111.90730  70.87421  68.68145  71.30961  69.77675  70.34820  68.95801
 [8]  71.35427  73.00367  73.19812  77.41121  70.51732  76.36208  71.72342
[15]  72.56854  71.99762  72.49759  67.84271  75.56797  66.33900
> colSums(tmp5)
 [1] 1119.0730  708.7421  686.8145  713.0961  697.7675  703.4820  689.5801
 [8]  713.5427  730.0367  731.9812  774.1121  705.1732  763.6208  717.2342
[15]  725.6854  719.9762  724.9759  678.4271  755.6797  663.3900
> colVars(tmp5)
 [1] 15693.70581   109.84386    87.96491    69.40833    66.32972    19.46377
 [7]    63.75094   109.06990    81.96344    85.48504    46.71980   137.71706
[13]    44.99173    37.91607   187.01860    56.29704    54.07562    66.83516
[19]    74.17331    79.12980
> colSd(tmp5)
 [1] 125.274522  10.480642   9.378961   8.331166   8.144306   4.411776
 [7]   7.984419  10.443654   9.053366   9.245812   6.835189  11.735291
[13]   6.707588   6.157603  13.675475   7.503136   7.353613   8.175277
[19]   8.612393   8.895493
> colMax(tmp5)
 [1] 467.66010  88.63135  90.03710  83.81836  82.73034  81.13677  85.16284
 [8]  85.45092  93.19980  87.95640  90.51353  90.12962  87.91480  79.02668
[15]  97.79751  80.47237  84.91942  78.49095  84.41298  83.12228
> colMin(tmp5)
 [1] 55.44797 54.58366 56.50024 61.24453 60.46334 64.34412 61.08208 57.54175
 [9] 62.01078 57.49369 65.04593 56.78273 66.83548 59.81995 56.58111 55.16364
[17] 59.17101 53.17427 59.36139 56.43856
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 89.31742 73.01246 72.94338 71.07784 70.65490 73.94721 73.02193 73.95050
 [9] 69.21467       NA
> rowSums(tmp5)
 [1] 1786.348 1460.249 1458.868 1421.557 1413.098 1478.944 1460.439 1479.010
 [9] 1384.293       NA
> rowVars(tmp5)
 [1] 8010.70601   82.88882   37.90748  101.96641   75.59479   61.39062
 [7]  107.96313   95.90539   69.61577   60.47413
> rowSd(tmp5)
 [1] 89.502548  9.104330  6.156905 10.097842  8.694527  7.835217 10.390531
 [8]  9.793130  8.343606  7.776511
> rowMax(tmp5)
 [1] 467.66010  90.51353  85.40947  91.09974  89.37573  87.95640  97.79751
 [8]  93.19980  83.77880        NA
> rowMin(tmp5)
 [1] 54.58366 53.17427 60.75433 57.49369 56.50024 59.04345 55.16364 56.58111
 [9] 56.78273       NA
> 
> colMeans(tmp5)
 [1] 111.90730  70.87421  68.68145  71.30961  69.77675  70.34820  68.95801
 [8]  71.35427  73.00367  73.19812  77.41121  70.51732  76.36208  71.72342
[15]  72.56854  71.99762        NA  67.84271  75.56797  66.33900
> colSums(tmp5)
 [1] 1119.0730  708.7421  686.8145  713.0961  697.7675  703.4820  689.5801
 [8]  713.5427  730.0367  731.9812  774.1121  705.1732  763.6208  717.2342
[15]  725.6854  719.9762        NA  678.4271  755.6797  663.3900
> colVars(tmp5)
 [1] 15693.70581   109.84386    87.96491    69.40833    66.32972    19.46377
 [7]    63.75094   109.06990    81.96344    85.48504    46.71980   137.71706
[13]    44.99173    37.91607   187.01860    56.29704          NA    66.83516
[19]    74.17331    79.12980
> colSd(tmp5)
 [1] 125.274522  10.480642   9.378961   8.331166   8.144306   4.411776
 [7]   7.984419  10.443654   9.053366   9.245812   6.835189  11.735291
[13]   6.707588   6.157603  13.675475   7.503136         NA   8.175277
[19]   8.612393   8.895493
> colMax(tmp5)
 [1] 467.66010  88.63135  90.03710  83.81836  82.73034  81.13677  85.16284
 [8]  85.45092  93.19980  87.95640  90.51353  90.12962  87.91480  79.02668
[15]  97.79751  80.47237        NA  78.49095  84.41298  83.12228
> colMin(tmp5)
 [1] 55.44797 54.58366 56.50024 61.24453 60.46334 64.34412 61.08208 57.54175
 [9] 62.01078 57.49369 65.04593 56.78273 66.83548 59.81995 56.58111 55.16364
[17]       NA 53.17427 59.36139 56.43856
> 
> Max(tmp5,na.rm=TRUE)
[1] 467.6601
> Min(tmp5,na.rm=TRUE)
[1] 53.17427
> mean(tmp5,na.rm=TRUE)
[1] 73.62224
> Sum(tmp5,na.rm=TRUE)
[1] 14650.83
> Var(tmp5,na.rm=TRUE)
[1] 865.6886
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.31742 73.01246 72.94338 71.07784 70.65490 73.94721 73.02193 73.95050
 [9] 69.21467 68.84313
> rowSums(tmp5,na.rm=TRUE)
 [1] 1786.348 1460.249 1458.868 1421.557 1413.098 1478.944 1460.439 1479.010
 [9] 1384.293 1308.019
> rowVars(tmp5,na.rm=TRUE)
 [1] 8010.70601   82.88882   37.90748  101.96641   75.59479   61.39062
 [7]  107.96313   95.90539   69.61577   60.47413
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.502548  9.104330  6.156905 10.097842  8.694527  7.835217 10.390531
 [8]  9.793130  8.343606  7.776511
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.66010  90.51353  85.40947  91.09974  89.37573  87.95640  97.79751
 [8]  93.19980  83.77880  82.65512
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.58366 53.17427 60.75433 57.49369 56.50024 59.04345 55.16364 56.58111
 [9] 56.78273 55.44797
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.90730  70.87421  68.68145  71.30961  69.77675  70.34820  68.95801
 [8]  71.35427  73.00367  73.19812  77.41121  70.51732  76.36208  71.72342
[15]  72.56854  71.99762  72.60122  67.84271  75.56797  66.33900
> colSums(tmp5,na.rm=TRUE)
 [1] 1119.0730  708.7421  686.8145  713.0961  697.7675  703.4820  689.5801
 [8]  713.5427  730.0367  731.9812  774.1121  705.1732  763.6208  717.2342
[15]  725.6854  719.9762  653.4110  678.4271  755.6797  663.3900
> colVars(tmp5,na.rm=TRUE)
 [1] 15693.70581   109.84386    87.96491    69.40833    66.32972    19.46377
 [7]    63.75094   109.06990    81.96344    85.48504    46.71980   137.71706
[13]    44.99173    37.91607   187.01860    56.29704    60.71426    66.83516
[19]    74.17331    79.12980
> colSd(tmp5,na.rm=TRUE)
 [1] 125.274522  10.480642   9.378961   8.331166   8.144306   4.411776
 [7]   7.984419  10.443654   9.053366   9.245812   6.835189  11.735291
[13]   6.707588   6.157603  13.675475   7.503136   7.791935   8.175277
[19]   8.612393   8.895493
> colMax(tmp5,na.rm=TRUE)
 [1] 467.66010  88.63135  90.03710  83.81836  82.73034  81.13677  85.16284
 [8]  85.45092  93.19980  87.95640  90.51353  90.12962  87.91480  79.02668
[15]  97.79751  80.47237  84.91942  78.49095  84.41298  83.12228
> colMin(tmp5,na.rm=TRUE)
 [1] 55.44797 54.58366 56.50024 61.24453 60.46334 64.34412 61.08208 57.54175
 [9] 62.01078 57.49369 65.04593 56.78273 66.83548 59.81995 56.58111 55.16364
[17] 59.17101 53.17427 59.36139 56.43856
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.31742 73.01246 72.94338 71.07784 70.65490 73.94721 73.02193 73.95050
 [9] 69.21467      NaN
> rowSums(tmp5,na.rm=TRUE)
 [1] 1786.348 1460.249 1458.868 1421.557 1413.098 1478.944 1460.439 1479.010
 [9] 1384.293    0.000
> rowVars(tmp5,na.rm=TRUE)
 [1] 8010.70601   82.88882   37.90748  101.96641   75.59479   61.39062
 [7]  107.96313   95.90539   69.61577         NA
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.502548  9.104330  6.156905 10.097842  8.694527  7.835217 10.390531
 [8]  9.793130  8.343606        NA
> rowMax(tmp5,na.rm=TRUE)
 [1] 467.66010  90.51353  85.40947  91.09974  89.37573  87.95640  97.79751
 [8]  93.19980  83.77880        NA
> rowMin(tmp5,na.rm=TRUE)
 [1] 54.58366 53.17427 60.75433 57.49369 56.50024 59.04345 55.16364 56.58111
 [9] 56.78273       NA
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 118.18056  71.42117  69.11368  71.01393  70.34353  71.01532  69.44052
 [8]  72.68711  73.58245  73.02938  77.10945  70.51221  76.88586  72.36458
[15]  71.90143  71.29089       NaN  67.82116  74.78050  67.43905
> colSums(tmp5,na.rm=TRUE)
 [1] 1063.6250  642.7905  622.0231  639.1254  633.0918  639.1378  624.9647
 [8]  654.1840  662.2421  657.2644  693.9851  634.6099  691.9727  651.2812
[15]  647.1129  641.6180    0.0000  610.3904  673.0245  606.9515
> colVars(tmp5,na.rm=TRUE)
 [1] 17212.68911   120.20876    96.85880    77.10086    71.00697    16.88994
 [7]    69.10057   102.71830    88.44022    95.85031    51.53538   154.93140
[13]    47.52927    38.03081   205.38931    57.71519          NA    75.18432
[19]    76.46889    75.40730
> colSd(tmp5,na.rm=TRUE)
 [1] 131.197138  10.963975   9.841687   8.780709   8.426563   4.109738
 [7]   8.312676  10.135004   9.404266   9.790317   7.178815  12.447144
[13]   6.894148   6.166912  14.331410   7.597051         NA   8.670889
[19]   8.744649   8.683737
> colMax(tmp5,na.rm=TRUE)
 [1] 467.66010  88.63135  90.03710  83.81836  82.73034  81.13677  85.16284
 [8]  85.45092  93.19980  87.95640  90.51353  90.12962  87.91480  79.02668
[15]  97.79751  80.47237      -Inf  78.49095  84.41298  83.12228
> colMin(tmp5,na.rm=TRUE)
 [1] 65.42331 54.58366 56.50024 61.24453 60.46334 66.41908 61.08208 57.54175
 [9] 62.01078 57.49369 65.04593 56.78273 66.83548 59.81995 56.58111 55.16364
[17]      Inf 53.17427 59.36139 56.57244
> 
> 
> 
> 
> 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] 302.87030 156.30603 407.90578 216.30019 282.00399  98.43126 178.14715
 [8] 147.38149 370.29138 153.78323
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 302.87030 156.30603 407.90578 216.30019 282.00399  98.43126 178.14715
 [8] 147.38149 370.29138 153.78323
> 
> 
> 
> 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]  1.705303e-13 -2.842171e-14 -2.273737e-13  4.547474e-13  2.842171e-14
 [6] -1.705303e-13  5.684342e-14  2.842171e-13  1.421085e-14 -5.684342e-14
[11]  2.842171e-13  3.410605e-13  8.526513e-14  8.526513e-14 -5.684342e-14
[16] -1.989520e-13  2.842171e-14  0.000000e+00  1.705303e-13  2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
10   9 
5   17 
2   9 
6   19 
2   9 
5   11 
9   11 
7   14 
1   12 
4   19 
6   11 
2   11 
10   16 
6   1 
3   14 
7   6 
1   3 
4   15 
5   11 
5   2 
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] 1.830853
> Min(tmp)
[1] -2.37352
> mean(tmp)
[1] -0.1918741
> Sum(tmp)
[1] -19.18741
> Var(tmp)
[1] 0.9463
> 
> rowMeans(tmp)
[1] -0.1918741
> rowSums(tmp)
[1] -19.18741
> rowVars(tmp)
[1] 0.9463
> rowSd(tmp)
[1] 0.9727795
> rowMax(tmp)
[1] 1.830853
> rowMin(tmp)
[1] -2.37352
> 
> colMeans(tmp)
  [1]  0.92731911  0.25727466  0.26155439 -0.61402260  0.36278386 -1.59414682
  [7]  1.35628872 -2.12505135  1.40732760 -0.13910566 -1.28958250  0.72930095
 [13] -0.37045065 -0.57775157  0.08157620  1.83085340 -0.53288458  1.71624300
 [19] -0.80486638 -0.07902942 -0.89746807 -0.69041152 -1.96421694 -0.10925520
 [25] -0.37562198 -1.09774481  0.18816690  0.06228843  0.27800293  0.02643284
 [31]  1.55850839  0.82245669 -0.55842705 -1.82084853 -0.45540349 -1.11245988
 [37]  0.98759300 -0.32565099  0.51163088  0.04437113  0.02436616  0.30279483
 [43]  0.35971908 -0.60729881 -0.79209095 -0.92186491  0.34730186 -1.21372347
 [49] -0.21354890 -0.62760943 -0.50113377 -0.15591675  0.77672238 -1.20801392
 [55]  1.66302939 -2.37351952 -0.21427676  0.26272187 -2.14889185 -0.34079541
 [61] -0.40358425  1.29765077  0.74901542 -1.14600649  1.01257540  0.17999698
 [67] -0.34150445 -1.66184095  1.68107780 -0.16069886  1.13084198  0.84458741
 [73] -2.09836310  1.11617306  1.07903855 -0.76193698 -0.39988610 -0.67097934
 [79] -0.61377948 -0.10802730  0.04281491  0.00957979 -0.56625867 -1.71416253
 [85] -0.47472756 -0.17372493  0.94959658 -0.03820938 -0.47477453  0.83237758
 [91] -2.26025487 -1.13268878 -0.45611968 -1.82966978  0.49421791 -1.23157752
 [97]  0.32761663  0.12234928 -1.01231181  0.38062206
> colSums(tmp)
  [1]  0.92731911  0.25727466  0.26155439 -0.61402260  0.36278386 -1.59414682
  [7]  1.35628872 -2.12505135  1.40732760 -0.13910566 -1.28958250  0.72930095
 [13] -0.37045065 -0.57775157  0.08157620  1.83085340 -0.53288458  1.71624300
 [19] -0.80486638 -0.07902942 -0.89746807 -0.69041152 -1.96421694 -0.10925520
 [25] -0.37562198 -1.09774481  0.18816690  0.06228843  0.27800293  0.02643284
 [31]  1.55850839  0.82245669 -0.55842705 -1.82084853 -0.45540349 -1.11245988
 [37]  0.98759300 -0.32565099  0.51163088  0.04437113  0.02436616  0.30279483
 [43]  0.35971908 -0.60729881 -0.79209095 -0.92186491  0.34730186 -1.21372347
 [49] -0.21354890 -0.62760943 -0.50113377 -0.15591675  0.77672238 -1.20801392
 [55]  1.66302939 -2.37351952 -0.21427676  0.26272187 -2.14889185 -0.34079541
 [61] -0.40358425  1.29765077  0.74901542 -1.14600649  1.01257540  0.17999698
 [67] -0.34150445 -1.66184095  1.68107780 -0.16069886  1.13084198  0.84458741
 [73] -2.09836310  1.11617306  1.07903855 -0.76193698 -0.39988610 -0.67097934
 [79] -0.61377948 -0.10802730  0.04281491  0.00957979 -0.56625867 -1.71416253
 [85] -0.47472756 -0.17372493  0.94959658 -0.03820938 -0.47477453  0.83237758
 [91] -2.26025487 -1.13268878 -0.45611968 -1.82966978  0.49421791 -1.23157752
 [97]  0.32761663  0.12234928 -1.01231181  0.38062206
> 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.92731911  0.25727466  0.26155439 -0.61402260  0.36278386 -1.59414682
  [7]  1.35628872 -2.12505135  1.40732760 -0.13910566 -1.28958250  0.72930095
 [13] -0.37045065 -0.57775157  0.08157620  1.83085340 -0.53288458  1.71624300
 [19] -0.80486638 -0.07902942 -0.89746807 -0.69041152 -1.96421694 -0.10925520
 [25] -0.37562198 -1.09774481  0.18816690  0.06228843  0.27800293  0.02643284
 [31]  1.55850839  0.82245669 -0.55842705 -1.82084853 -0.45540349 -1.11245988
 [37]  0.98759300 -0.32565099  0.51163088  0.04437113  0.02436616  0.30279483
 [43]  0.35971908 -0.60729881 -0.79209095 -0.92186491  0.34730186 -1.21372347
 [49] -0.21354890 -0.62760943 -0.50113377 -0.15591675  0.77672238 -1.20801392
 [55]  1.66302939 -2.37351952 -0.21427676  0.26272187 -2.14889185 -0.34079541
 [61] -0.40358425  1.29765077  0.74901542 -1.14600649  1.01257540  0.17999698
 [67] -0.34150445 -1.66184095  1.68107780 -0.16069886  1.13084198  0.84458741
 [73] -2.09836310  1.11617306  1.07903855 -0.76193698 -0.39988610 -0.67097934
 [79] -0.61377948 -0.10802730  0.04281491  0.00957979 -0.56625867 -1.71416253
 [85] -0.47472756 -0.17372493  0.94959658 -0.03820938 -0.47477453  0.83237758
 [91] -2.26025487 -1.13268878 -0.45611968 -1.82966978  0.49421791 -1.23157752
 [97]  0.32761663  0.12234928 -1.01231181  0.38062206
> colMin(tmp)
  [1]  0.92731911  0.25727466  0.26155439 -0.61402260  0.36278386 -1.59414682
  [7]  1.35628872 -2.12505135  1.40732760 -0.13910566 -1.28958250  0.72930095
 [13] -0.37045065 -0.57775157  0.08157620  1.83085340 -0.53288458  1.71624300
 [19] -0.80486638 -0.07902942 -0.89746807 -0.69041152 -1.96421694 -0.10925520
 [25] -0.37562198 -1.09774481  0.18816690  0.06228843  0.27800293  0.02643284
 [31]  1.55850839  0.82245669 -0.55842705 -1.82084853 -0.45540349 -1.11245988
 [37]  0.98759300 -0.32565099  0.51163088  0.04437113  0.02436616  0.30279483
 [43]  0.35971908 -0.60729881 -0.79209095 -0.92186491  0.34730186 -1.21372347
 [49] -0.21354890 -0.62760943 -0.50113377 -0.15591675  0.77672238 -1.20801392
 [55]  1.66302939 -2.37351952 -0.21427676  0.26272187 -2.14889185 -0.34079541
 [61] -0.40358425  1.29765077  0.74901542 -1.14600649  1.01257540  0.17999698
 [67] -0.34150445 -1.66184095  1.68107780 -0.16069886  1.13084198  0.84458741
 [73] -2.09836310  1.11617306  1.07903855 -0.76193698 -0.39988610 -0.67097934
 [79] -0.61377948 -0.10802730  0.04281491  0.00957979 -0.56625867 -1.71416253
 [85] -0.47472756 -0.17372493  0.94959658 -0.03820938 -0.47477453  0.83237758
 [91] -2.26025487 -1.13268878 -0.45611968 -1.82966978  0.49421791 -1.23157752
 [97]  0.32761663  0.12234928 -1.01231181  0.38062206
> colMedians(tmp)
  [1]  0.92731911  0.25727466  0.26155439 -0.61402260  0.36278386 -1.59414682
  [7]  1.35628872 -2.12505135  1.40732760 -0.13910566 -1.28958250  0.72930095
 [13] -0.37045065 -0.57775157  0.08157620  1.83085340 -0.53288458  1.71624300
 [19] -0.80486638 -0.07902942 -0.89746807 -0.69041152 -1.96421694 -0.10925520
 [25] -0.37562198 -1.09774481  0.18816690  0.06228843  0.27800293  0.02643284
 [31]  1.55850839  0.82245669 -0.55842705 -1.82084853 -0.45540349 -1.11245988
 [37]  0.98759300 -0.32565099  0.51163088  0.04437113  0.02436616  0.30279483
 [43]  0.35971908 -0.60729881 -0.79209095 -0.92186491  0.34730186 -1.21372347
 [49] -0.21354890 -0.62760943 -0.50113377 -0.15591675  0.77672238 -1.20801392
 [55]  1.66302939 -2.37351952 -0.21427676  0.26272187 -2.14889185 -0.34079541
 [61] -0.40358425  1.29765077  0.74901542 -1.14600649  1.01257540  0.17999698
 [67] -0.34150445 -1.66184095  1.68107780 -0.16069886  1.13084198  0.84458741
 [73] -2.09836310  1.11617306  1.07903855 -0.76193698 -0.39988610 -0.67097934
 [79] -0.61377948 -0.10802730  0.04281491  0.00957979 -0.56625867 -1.71416253
 [85] -0.47472756 -0.17372493  0.94959658 -0.03820938 -0.47477453  0.83237758
 [91] -2.26025487 -1.13268878 -0.45611968 -1.82966978  0.49421791 -1.23157752
 [97]  0.32761663  0.12234928 -1.01231181  0.38062206
> colRanges(tmp)
          [,1]      [,2]      [,3]       [,4]      [,5]      [,6]     [,7]
[1,] 0.9273191 0.2572747 0.2615544 -0.6140226 0.3627839 -1.594147 1.356289
[2,] 0.9273191 0.2572747 0.2615544 -0.6140226 0.3627839 -1.594147 1.356289
          [,8]     [,9]      [,10]     [,11]     [,12]      [,13]      [,14]
[1,] -2.125051 1.407328 -0.1391057 -1.289582 0.7293009 -0.3704506 -0.5777516
[2,] -2.125051 1.407328 -0.1391057 -1.289582 0.7293009 -0.3704506 -0.5777516
         [,15]    [,16]      [,17]    [,18]      [,19]       [,20]      [,21]
[1,] 0.0815762 1.830853 -0.5328846 1.716243 -0.8048664 -0.07902942 -0.8974681
[2,] 0.0815762 1.830853 -0.5328846 1.716243 -0.8048664 -0.07902942 -0.8974681
          [,22]     [,23]      [,24]     [,25]     [,26]     [,27]      [,28]
[1,] -0.6904115 -1.964217 -0.1092552 -0.375622 -1.097745 0.1881669 0.06228843
[2,] -0.6904115 -1.964217 -0.1092552 -0.375622 -1.097745 0.1881669 0.06228843
         [,29]      [,30]    [,31]     [,32]      [,33]     [,34]      [,35]
[1,] 0.2780029 0.02643284 1.558508 0.8224567 -0.5584271 -1.820849 -0.4554035
[2,] 0.2780029 0.02643284 1.558508 0.8224567 -0.5584271 -1.820849 -0.4554035
        [,36]    [,37]     [,38]     [,39]      [,40]      [,41]     [,42]
[1,] -1.11246 0.987593 -0.325651 0.5116309 0.04437113 0.02436616 0.3027948
[2,] -1.11246 0.987593 -0.325651 0.5116309 0.04437113 0.02436616 0.3027948
         [,43]      [,44]      [,45]      [,46]     [,47]     [,48]      [,49]
[1,] 0.3597191 -0.6072988 -0.7920909 -0.9218649 0.3473019 -1.213723 -0.2135489
[2,] 0.3597191 -0.6072988 -0.7920909 -0.9218649 0.3473019 -1.213723 -0.2135489
          [,50]      [,51]      [,52]     [,53]     [,54]    [,55]    [,56]
[1,] -0.6276094 -0.5011338 -0.1559167 0.7767224 -1.208014 1.663029 -2.37352
[2,] -0.6276094 -0.5011338 -0.1559167 0.7767224 -1.208014 1.663029 -2.37352
          [,57]     [,58]     [,59]      [,60]      [,61]    [,62]     [,63]
[1,] -0.2142768 0.2627219 -2.148892 -0.3407954 -0.4035843 1.297651 0.7490154
[2,] -0.2142768 0.2627219 -2.148892 -0.3407954 -0.4035843 1.297651 0.7490154
         [,64]    [,65]    [,66]      [,67]     [,68]    [,69]      [,70]
[1,] -1.146006 1.012575 0.179997 -0.3415044 -1.661841 1.681078 -0.1606989
[2,] -1.146006 1.012575 0.179997 -0.3415044 -1.661841 1.681078 -0.1606989
        [,71]     [,72]     [,73]    [,74]    [,75]     [,76]      [,77]
[1,] 1.130842 0.8445874 -2.098363 1.116173 1.079039 -0.761937 -0.3998861
[2,] 1.130842 0.8445874 -2.098363 1.116173 1.079039 -0.761937 -0.3998861
          [,78]      [,79]      [,80]      [,81]      [,82]      [,83]
[1,] -0.6709793 -0.6137795 -0.1080273 0.04281491 0.00957979 -0.5662587
[2,] -0.6709793 -0.6137795 -0.1080273 0.04281491 0.00957979 -0.5662587
         [,84]      [,85]      [,86]     [,87]       [,88]      [,89]     [,90]
[1,] -1.714163 -0.4747276 -0.1737249 0.9495966 -0.03820938 -0.4747745 0.8323776
[2,] -1.714163 -0.4747276 -0.1737249 0.9495966 -0.03820938 -0.4747745 0.8323776
         [,91]     [,92]      [,93]    [,94]     [,95]     [,96]     [,97]
[1,] -2.260255 -1.132689 -0.4561197 -1.82967 0.4942179 -1.231578 0.3276166
[2,] -2.260255 -1.132689 -0.4561197 -1.82967 0.4942179 -1.231578 0.3276166
         [,98]     [,99]    [,100]
[1,] 0.1223493 -1.012312 0.3806221
[2,] 0.1223493 -1.012312 0.3806221
> 
> 
> Max(tmp2)
[1] 2.728169
> Min(tmp2)
[1] -2.061296
> mean(tmp2)
[1] 0.08608301
> Sum(tmp2)
[1] 8.608301
> Var(tmp2)
[1] 0.9477542
> 
> rowMeans(tmp2)
  [1] -0.935653908 -0.623402353  1.756467523 -1.566714670 -2.061296202
  [6]  0.837431144  0.058522370 -0.620927939  1.809933138  1.679914056
 [11] -0.612446380  1.439734558 -0.661276194 -1.164817669 -0.519263892
 [16] -0.840852216  0.319397686  2.274417199  0.375639520  0.552093667
 [21] -0.157530432 -0.513708440  1.554105613  1.906308397  1.640986609
 [26]  1.227944207 -0.538153967  0.461087544 -0.227886546  0.864629399
 [31] -0.573395498 -1.013003568  0.132851046 -0.196534630 -1.092080513
 [36] -1.642154728  0.462951160  0.346996175 -0.857192966 -0.192452332
 [41]  0.445316325  0.338246946 -1.695718821  0.340287932 -1.236934680
 [46]  0.008178949 -0.719759482 -0.075050091 -0.474327997  0.205658170
 [51] -1.334565419 -0.580775696  0.354569181  0.271700684 -0.759383011
 [56]  1.651455350  1.785285474  1.827779849  0.019564780  0.356509952
 [61]  0.302388445  0.556104148  0.013931347 -0.024830717  0.507426569
 [66]  0.173511212 -0.503020174 -0.443266522  1.297711825  0.682551957
 [71] -0.015224592  0.555333541  0.444369735  0.472753253  0.207938122
 [76] -0.352194328 -1.501055164 -0.072505178  0.032640367  1.031767470
 [81] -1.491085093 -0.365439097 -1.193712402  0.247484398 -0.113455603
 [86] -0.317159608  0.182454962 -0.664939067 -0.697320062 -1.238633444
 [91] -1.023304390 -0.080156922  1.151230745  0.179843197  1.767344744
 [96]  0.147305883  2.728168570  0.571113963  0.261513498  1.372010694
> rowSums(tmp2)
  [1] -0.935653908 -0.623402353  1.756467523 -1.566714670 -2.061296202
  [6]  0.837431144  0.058522370 -0.620927939  1.809933138  1.679914056
 [11] -0.612446380  1.439734558 -0.661276194 -1.164817669 -0.519263892
 [16] -0.840852216  0.319397686  2.274417199  0.375639520  0.552093667
 [21] -0.157530432 -0.513708440  1.554105613  1.906308397  1.640986609
 [26]  1.227944207 -0.538153967  0.461087544 -0.227886546  0.864629399
 [31] -0.573395498 -1.013003568  0.132851046 -0.196534630 -1.092080513
 [36] -1.642154728  0.462951160  0.346996175 -0.857192966 -0.192452332
 [41]  0.445316325  0.338246946 -1.695718821  0.340287932 -1.236934680
 [46]  0.008178949 -0.719759482 -0.075050091 -0.474327997  0.205658170
 [51] -1.334565419 -0.580775696  0.354569181  0.271700684 -0.759383011
 [56]  1.651455350  1.785285474  1.827779849  0.019564780  0.356509952
 [61]  0.302388445  0.556104148  0.013931347 -0.024830717  0.507426569
 [66]  0.173511212 -0.503020174 -0.443266522  1.297711825  0.682551957
 [71] -0.015224592  0.555333541  0.444369735  0.472753253  0.207938122
 [76] -0.352194328 -1.501055164 -0.072505178  0.032640367  1.031767470
 [81] -1.491085093 -0.365439097 -1.193712402  0.247484398 -0.113455603
 [86] -0.317159608  0.182454962 -0.664939067 -0.697320062 -1.238633444
 [91] -1.023304390 -0.080156922  1.151230745  0.179843197  1.767344744
 [96]  0.147305883  2.728168570  0.571113963  0.261513498  1.372010694
> 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.935653908 -0.623402353  1.756467523 -1.566714670 -2.061296202
  [6]  0.837431144  0.058522370 -0.620927939  1.809933138  1.679914056
 [11] -0.612446380  1.439734558 -0.661276194 -1.164817669 -0.519263892
 [16] -0.840852216  0.319397686  2.274417199  0.375639520  0.552093667
 [21] -0.157530432 -0.513708440  1.554105613  1.906308397  1.640986609
 [26]  1.227944207 -0.538153967  0.461087544 -0.227886546  0.864629399
 [31] -0.573395498 -1.013003568  0.132851046 -0.196534630 -1.092080513
 [36] -1.642154728  0.462951160  0.346996175 -0.857192966 -0.192452332
 [41]  0.445316325  0.338246946 -1.695718821  0.340287932 -1.236934680
 [46]  0.008178949 -0.719759482 -0.075050091 -0.474327997  0.205658170
 [51] -1.334565419 -0.580775696  0.354569181  0.271700684 -0.759383011
 [56]  1.651455350  1.785285474  1.827779849  0.019564780  0.356509952
 [61]  0.302388445  0.556104148  0.013931347 -0.024830717  0.507426569
 [66]  0.173511212 -0.503020174 -0.443266522  1.297711825  0.682551957
 [71] -0.015224592  0.555333541  0.444369735  0.472753253  0.207938122
 [76] -0.352194328 -1.501055164 -0.072505178  0.032640367  1.031767470
 [81] -1.491085093 -0.365439097 -1.193712402  0.247484398 -0.113455603
 [86] -0.317159608  0.182454962 -0.664939067 -0.697320062 -1.238633444
 [91] -1.023304390 -0.080156922  1.151230745  0.179843197  1.767344744
 [96]  0.147305883  2.728168570  0.571113963  0.261513498  1.372010694
> rowMin(tmp2)
  [1] -0.935653908 -0.623402353  1.756467523 -1.566714670 -2.061296202
  [6]  0.837431144  0.058522370 -0.620927939  1.809933138  1.679914056
 [11] -0.612446380  1.439734558 -0.661276194 -1.164817669 -0.519263892
 [16] -0.840852216  0.319397686  2.274417199  0.375639520  0.552093667
 [21] -0.157530432 -0.513708440  1.554105613  1.906308397  1.640986609
 [26]  1.227944207 -0.538153967  0.461087544 -0.227886546  0.864629399
 [31] -0.573395498 -1.013003568  0.132851046 -0.196534630 -1.092080513
 [36] -1.642154728  0.462951160  0.346996175 -0.857192966 -0.192452332
 [41]  0.445316325  0.338246946 -1.695718821  0.340287932 -1.236934680
 [46]  0.008178949 -0.719759482 -0.075050091 -0.474327997  0.205658170
 [51] -1.334565419 -0.580775696  0.354569181  0.271700684 -0.759383011
 [56]  1.651455350  1.785285474  1.827779849  0.019564780  0.356509952
 [61]  0.302388445  0.556104148  0.013931347 -0.024830717  0.507426569
 [66]  0.173511212 -0.503020174 -0.443266522  1.297711825  0.682551957
 [71] -0.015224592  0.555333541  0.444369735  0.472753253  0.207938122
 [76] -0.352194328 -1.501055164 -0.072505178  0.032640367  1.031767470
 [81] -1.491085093 -0.365439097 -1.193712402  0.247484398 -0.113455603
 [86] -0.317159608  0.182454962 -0.664939067 -0.697320062 -1.238633444
 [91] -1.023304390 -0.080156922  1.151230745  0.179843197  1.767344744
 [96]  0.147305883  2.728168570  0.571113963  0.261513498  1.372010694
> 
> colMeans(tmp2)
[1] 0.08608301
> colSums(tmp2)
[1] 8.608301
> colVars(tmp2)
[1] 0.9477542
> colSd(tmp2)
[1] 0.9735267
> colMax(tmp2)
[1] 2.728169
> colMin(tmp2)
[1] -2.061296
> colMedians(tmp2)
[1] 0.04558137
> colRanges(tmp2)
          [,1]
[1,] -2.061296
[2,]  2.728169
> 
> 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.1588216  2.5967687 -1.5822154 -0.2174701 -0.7269352  2.3503964
 [7]  1.0654509  6.0749803  2.4281744  5.3977215
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.11139601
[2,] -0.21902010
[3,] -0.01583552
[4,]  0.31933349
[5,]  2.02358300
> 
> rowApply(tmp,sum)
 [1] -1.3995719  7.3894402  2.7371794  0.5985796  2.5885833 -0.4148566
 [7]  0.4963060  1.7825520  3.5160025  2.2514789
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    5    2    4   10    1    3    5    6    3    10
 [2,]    1    7   10    6    4    6    1   10    7     7
 [3,]    2   10    2    4    9    8    4    1    1     5
 [4,]    7    5    6    2    7    5    6    8    2     4
 [5,]    9    1    8    3    8    1    2    7    5     3
 [6,]   10    4    3    7    6    4    7    4   10     2
 [7,]    3    8    5    5   10    7    3    3    9     1
 [8,]    8    9    7    9    3    2   10    5    4     9
 [9,]    4    6    9    1    2   10    8    2    6     8
[10,]    6    3    1    8    5    9    9    9    8     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.0447688 -2.2671246  0.4670722 -1.3819494 -2.2281054  1.0338597
 [7] -1.4949032  2.7052186 -1.9552454  0.7562982 -3.5885659  1.2203177
[13] -0.8508175  0.4016647 -5.9188002 -0.3014335 -2.3061699  1.0854218
[19] -3.3561883 -0.1040787
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.28678996
[2,] -0.01348074
[3,]  0.53344213
[4,]  1.24562247
[5,]  1.56597491
> 
> rowApply(tmp,sum)
[1]  0.1793889 -8.7171777 -4.2252659  4.7496639 -7.0253694
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   11   20   11   18   17
[2,]   10   10    2   16    4
[3,]    6    3   20   12   13
[4,]    8   15   17    5    3
[5,]    9    2   16   11   15
> 
> 
> as.matrix(tmp)
            [,1]       [,2]        [,3]       [,4]       [,5]       [,6]
[1,] -0.01348074 -0.0996027 -0.63224952 -0.4667335 -0.3579494  0.8082992
[2,]  1.24562247 -0.4997326 -1.42970814  0.2845550 -2.7401346  0.6319455
[3,] -0.28678996 -1.6061782  2.20309132  0.6275788  0.3886158 -0.3944305
[4,]  1.56597491  1.0335973  0.38116667 -0.7210908  0.2469728 -0.4467778
[5,]  0.53344213 -1.0952084 -0.05522811 -1.1062589  0.2343900  0.4348232
            [,7]       [,8]       [,9]      [,10]        [,11]      [,12]
[1,]  0.48081944  1.2258590  0.7693612 -0.6984147 -0.009604687  0.1763933
[2,] -1.39704446  0.8320373 -0.5459067 -0.9341683 -0.209994126 -0.5154896
[3,] -0.05414074  1.4170941 -0.6351672  0.9966744 -1.511428917 -0.6999302
[4,]  0.42827525  0.7067725 -0.8507427  1.8727527 -0.903744312  1.2096280
[5,] -0.95281273 -1.4765442 -0.6927900 -0.4805460 -0.953793824  1.0497162
          [,13]       [,14]      [,15]      [,16]        [,17]      [,18]
[1,] -0.7404835  1.64687139 -0.5871283  1.0492842 -0.903194259  0.9130130
[2,]  0.6259118  0.14821149 -2.8828689 -0.3534604  1.180508769 -0.9589068
[3,] -0.6041624 -0.68790741 -0.3189779 -0.1089788 -2.677635474 -0.1105993
[4,] -1.2993349  0.07561147 -1.7356339  0.1810743  0.103604881  0.1044244
[5,]  1.1672515 -0.78112222 -0.3941911 -1.0693528 -0.009453837  1.1374905
          [,19]      [,20]
[1,] -0.8743530 -1.5073174
[2,] -1.4146337  0.2160785
[3,]  0.1635616 -0.3255552
[4,]  0.7342705  2.0628627
[5,] -1.9650336 -0.5501473
> 
> 
> 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.14-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.14-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1      col2      col3        col4       col5       col6      col7
row1 -1.290934 0.5792628 0.2929432 -0.07013572 -0.4003264 -0.4014679 -2.263183
           col8      col9     col10      col11    col12    col13     col14
row1 -0.4174322 -1.985914 -1.241657 -0.1807027 1.191731 3.209051 -0.134652
        col15     col16   col17     col18     col19     col20
row1 2.017015 0.3347337 0.49814 0.1950232 0.5028277 0.1826063
> tmp[,"col10"]
          col10
row1 -1.2416571
row2 -0.0747854
row3 -0.1250250
row4 -0.6520374
row5  0.1289455
> tmp[c("row1","row5"),]
          col1       col2       col3        col4       col5       col6
row1 -1.290934  0.5792628  0.2929432 -0.07013572 -0.4003264 -0.4014679
row5  1.061343 -0.6528671 -1.6732518  0.90091108  0.4366218  0.1594931
           col7       col8       col9      col10      col11        col12
row1 -2.2631834 -0.4174322 -1.9859144 -1.2416571 -0.1807027  1.191731493
row5  0.6522827 -2.1991744 -0.4555746  0.1289455 -0.2583105 -0.006318251
          col13      col14     col15     col16      col17      col18      col19
row1  3.2090512 -0.1346520 2.0170152 0.3347337  0.4981400  0.1950232 0.50282773
row5 -0.5415474 -0.2278796 0.7142213 1.1887434 -0.3273431 -0.8418010 0.09632694
          col20
row1  0.1826063
row5 -0.5177177
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.4014679  0.1826063
row2 -0.1301960 -0.8503421
row3  0.6748588  1.7941930
row4 -1.6441572  0.6166063
row5  0.1594931 -0.5177177
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.4014679  0.1826063
row5  0.1594931 -0.5177177
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.67643 50.61446 48.65525 49.34026 50.42622 105.6633 51.05941 49.94891
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.83095 49.92431 49.24382 49.37417 51.19203 50.50921 50.40005 49.86191
        col17   col18    col19    col20
row1 49.61792 50.4237 50.14564 104.6407
> tmp[,"col10"]
        col10
row1 49.92431
row2 29.65332
row3 30.75297
row4 31.88099
row5 49.28484
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.67643 50.61446 48.65525 49.34026 50.42622 105.6633 51.05941 49.94891
row5 48.71186 49.07662 50.63118 49.78307 50.37874 105.1349 49.58328 49.79605
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.83095 49.92431 49.24382 49.37417 51.19203 50.50921 50.40005 49.86191
row5 51.01960 49.28484 48.13674 48.44053 50.50298 51.44587 49.67349 50.84899
        col17    col18    col19    col20
row1 49.61792 50.42370 50.14564 104.6407
row5 50.15790 52.10689 50.12519 103.7369
> tmp[,c("col6","col20")]
          col6     col20
row1 105.66326 104.64070
row2  76.77853  75.07330
row3  76.01476  75.49519
row4  74.02431  74.86438
row5 105.13492 103.73694
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.6633 104.6407
row5 105.1349 103.7369
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.6633 104.6407
row5 105.1349 103.7369
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.7878908
[2,] -1.4739006
[3,] -0.6942503
[4,]  1.1526195
[5,]  1.8700805
> tmp[,c("col17","col7")]
           col17       col7
[1,]  1.24492625 -0.6773555
[2,]  0.74801384 -0.6185986
[3,] -0.67218755 -2.1048015
[4,] -0.14916776 -0.2058322
[5,] -0.06908463 -0.1404075
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,]  1.5133257 1.70930709
[2,] -0.3617282 0.07560518
[3,] -1.2626063 0.84510241
[4,]  0.3983258 0.78296150
[5,] -0.2355764 0.85551821
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.513326
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  1.5133257
[2,] -0.3617282
> 
> 
> 
> 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 1.6671282 0.3810971 -1.0834722 0.4357372 0.9214044 -0.6338083 -0.71794440
row1 0.3435776 0.5845422  0.2070315 0.2656564 2.0122495 -1.3762693 -0.02293103
           [,8]      [,9]     [,10]      [,11]      [,12]     [,13]      [,14]
row3  0.3181976 1.3642359 -1.545955 0.96569710 -0.6553647 -1.364675 -0.3691530
row1 -0.9929423 0.9834535  1.158435 0.01224577  1.7069143  2.379509 -0.4263639
         [,15]     [,16]       [,17]     [,18]      [,19]      [,20]
row3 0.4533605 0.3654477  0.42259980 0.3880108  0.2580708  0.3618901
row1 0.3977290 0.4917431 -0.08552609 0.2044654 -0.2143536 -2.4125218
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]     [,2]      [,3]       [,4]     [,5]       [,6]     [,7]
row2 1.092517 2.080477 0.5878029 -0.4870549 1.062081 -0.8401505 -1.54606
          [,8]      [,9]     [,10]
row2 0.6986508 -2.089483 -1.617158
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
           [,1]      [,2]         [,3]       [,4]      [,5]      [,6]
row5 -0.3776924 0.1917489 -0.009180899 -0.1171532 0.9116158 -1.341974
           [,7]      [,8]      [,9]    [,10]     [,11]      [,12]      [,13]
row5 -0.2981516 0.1740392 -1.036778 1.245047 0.5910268 -0.6448697 -0.4142833
          [,14]      [,15]     [,16]    [,17]     [,18]     [,19]    [,20]
row5 -0.5749953 -0.3739117 -2.207466 1.273024 0.2500928 0.6506191 2.150114
> 
> 
> 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: 0x56186d6a75f0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde5d2abeac"
 [2] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde100fcce5"
 [3] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde747edca1"
 [4] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde65c72be9"
 [5] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde1a11aab4"
 [6] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde1081d7e8"
 [7] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde16555fb9"
 [8] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde6dc57897"
 [9] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde6cc8e5fc"
[10] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde5171b32" 
[11] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde50e89f73"
[12] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde1e0b0c27"
[13] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde6821aa6" 
[14] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde2b1b8573"
[15] "/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM218bde9ab805c" 
> 
> 
> ### 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: 0x56186eaf99d0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x56186eaf99d0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x56186eaf99d0>
> rowMedians(tmp)
  [1]  0.020039336  0.121510791  0.491582029 -0.080502006 -0.127349832
  [6]  0.326903530 -0.401169570 -0.414702692  0.046821362 -0.694958868
 [11] -0.122391485 -0.199039212  0.518716974 -0.365053693 -0.324091385
 [16]  0.203893196  0.413036333  0.382663285  0.211132558  0.249839613
 [21]  0.137051905 -0.107550407  0.041947052  0.362173120 -0.196719738
 [26]  0.040612308  0.148999451  0.461524855  0.628981377 -0.340320195
 [31] -0.599794243 -0.395085041 -0.012710149  0.449956627 -0.133442477
 [36]  0.160474982 -0.193594283 -0.066529799 -0.418318977  0.173704728
 [41] -0.253360243 -0.171963149  0.001928924  0.161321087 -0.682722564
 [46]  0.393982919 -0.584347418  0.119430643  0.372248565 -0.047986274
 [51] -0.266539887  0.237200690  0.385795125  0.449959381 -0.044552532
 [56] -0.038394836 -0.288166524  0.023388038  0.359851949 -0.003551800
 [61]  0.053059723 -0.138542327 -0.351832597  0.290746035 -0.459029909
 [66]  0.224186618 -0.558505706  0.407934399 -0.016599309 -0.068601667
 [71]  0.020092679  0.139415025 -0.102285112  0.232033166  0.091405294
 [76] -0.324648981 -0.057209729 -0.048583166 -0.065794366  0.347401966
 [81] -0.281519310  0.128736281 -0.179985283 -0.343906941  0.143851803
 [86]  0.262305216 -0.279915237 -0.791916518 -0.225846062  0.365897542
 [91]  0.111751960 -0.040525987  0.229323747 -0.014366817  0.424519715
 [96] -0.124092250  0.124341166 -0.259845746  0.066141686 -0.173444194
[101] -0.063790639  0.416660003  0.380338712  0.308941544 -0.598923024
[106] -0.381826795  0.114910873 -0.186558489 -0.349112134 -0.045380811
[111] -0.519804706 -0.297265414 -0.112482844 -0.308992686  0.661497276
[116] -0.217293478 -0.076992488 -0.495022225 -0.572050405 -0.604158095
[121] -0.122452609  0.150054221  0.043780206 -0.061258216  0.009175288
[126] -0.291127096 -0.599242070  0.250695733 -0.422603660  0.536622684
[131] -0.071584053 -0.077258956  0.205860811  0.384543115  0.465818821
[136] -0.181016491  0.088454803 -0.080975563 -0.455227238 -0.133382973
[141] -0.430839240  0.485583719  0.216247520 -0.404043270  0.102751945
[146] -0.283832146 -0.257466814 -0.161476442 -0.658386440  0.052234307
[151] -0.009144498 -0.117080883 -0.311143938 -0.006667146 -0.285543171
[156]  0.052117177  0.464927948  0.713788699 -0.442753285 -0.204511144
[161] -0.131146069  0.288087262 -0.342886069 -0.414216870 -0.170945415
[166] -0.025636830 -0.432544044  0.025419215  0.027702359 -0.184307520
[171]  0.057390629 -0.476904340 -0.188035765  0.149920212  0.094846481
[176]  0.252856775  0.042909655  0.830105558  0.460000585 -0.685276185
[181] -0.269770310  0.152242274  0.013199818  0.057198898 -0.195112178
[186]  0.037111469 -0.045289884 -0.082197014 -0.086787704 -0.538536948
[191] -0.447548785  0.104225149  0.132317223 -0.205739081 -0.508468567
[196]  0.319844890  0.494589894  0.472017851 -0.234498475  0.111505390
[201]  0.147124081  0.336796917  0.610131950  0.636073775 -0.252454470
[206]  0.300684027  0.183896535 -0.134284958  0.491332504 -0.414012966
[211]  0.130094845  0.510591722  0.209079919 -0.049742730 -0.366721965
[216] -0.234609669 -0.017812632  0.387031476 -0.107322393 -0.602122986
[221] -0.230573155 -0.068648243 -0.041733468  0.194590478  0.348173913
[226] -0.119088560 -0.766625235 -0.137591808  0.039090254 -0.052038911
> 
> proc.time()
   user  system elapsed 
  1.239   0.576   1.807 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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: 0x55c1e9c5b940>
> .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: 0x55c1e9c5b940>
> .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: 0x55c1e9c5b940>
> .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: 0x55c1e9c5b940>
> 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: 0x55c1ea08a190>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c1ea08a190>
> .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: 0x55c1ea08a190>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c1ea08a190>
> .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: 0x55c1ea08a190>
> 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: 0x55c1ea628230>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c1ea628230>
> .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: 0x55c1ea628230>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55c1ea628230>
> .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: 0x55c1ea628230>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x55c1ea628230>
> .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: 0x55c1ea628230>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x55c1ea628230>
> .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: 0x55c1ea628230>
> 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: 0x55c1ea8a2330>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x55c1ea8a2330>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c1ea8a2330>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c1ea8a2330>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile218d8c191611bb" "BufferedMatrixFile218d8c4f5b4739"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile218d8c191611bb" "BufferedMatrixFile218d8c4f5b4739"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c1eb75ce80>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c1eb75ce80>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55c1eb75ce80>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x55c1eb75ce80>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x55c1eb75ce80>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x55c1eb75ce80>
> .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: 0x55c1e995e5d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x55c1e995e5d0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x55c1e995e5d0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x55c1e995e5d0>
> 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: 0x55c1e9957120>
> .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: 0x55c1e9957120>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.285   0.051   0.320 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 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.254   0.037   0.274 

Example timings