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

This page was generated on 2022-04-13 12:07:43 -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 machv2


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: /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings BufferedMatrix_1.58.0.tar.gz
StartedAt: 2022-04-12 11:03:56 -0400 (Tue, 12 Apr 2022)
EndedAt: 2022-04-12 11:04:50 -0400 (Tue, 12 Apr 2022)
EllapsedTime: 54.0 seconds
RetCode: 0
Status:   WARNINGS  
CheckDir: BufferedMatrix.Rcheck
Warnings: 1

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/Library/Frameworks/R.framework/Resources/library --no-vignettes --timings BufferedMatrix_1.58.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.1.3 (2022-03-10)
* using platform: x86_64-apple-darwin17.0 (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 ... WARNING
Found the following significant warnings:
  doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
See ‘/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/00install.out’ for details.
* 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 sizes of PDF files under ‘inst/doc’ ... OK
* 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: 1 WARNING, 2 NOTEs
See
  ‘/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ~
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c init_package.c -o init_package.o
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.1/Resources/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-apple-darwin17.0 (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.482   0.132   0.588 

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-apple-darwin17.0 (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] "/Users/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) limit (Mb) max used (Mb)
Ncells 445257 23.8     947360 50.6         NA   649605 34.7
Vcells 803666  6.2    8388608 64.0      65536  2031734 15.6
> 
> 
> 
> 
> ##
> ## 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 11:04:24 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 11:04:25 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: 0x7fc1c1c02d10>
> 
> 
> 
> 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 11:04:29 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 11:04:30 2022"
> 
> ColMode(tmp2)
<pointer: 0x7fc1c1c02d10>
> 
> 
> 
> ### 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,] 98.9516361 0.09133552  1.5886706 -0.002047099
[2,]  0.9933596 1.80804188 -0.4775266  0.569538441
[3,]  0.8528708 0.74051322  0.1749133 -0.944447785
[4,] -0.3780421 0.72050174 -0.3222489  0.353792843
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]       [,2]      [,3]        [,4]
[1,] 98.9516361 0.09133552 1.5886706 0.002047099
[2,]  0.9933596 1.80804188 0.4775266 0.569538441
[3,]  0.8528708 0.74051322 0.1749133 0.944447785
[4,]  0.3780421 0.72050174 0.3222489 0.353792843
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]       [,4]
[1,] 9.9474437 0.3022177 1.2604248 0.04524488
[2,] 0.9966743 1.3446345 0.6910330 0.75467771
[3,] 0.9235100 0.8605308 0.4182264 0.97182703
[4,] 0.6148513 0.8488237 0.5676697 0.59480488
> 
> 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:    /Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 223.42607 28.11351 39.19292 25.45450
[2,]  35.96010 40.25439 32.38786 33.11632
[3,]  35.08797 34.34582 29.35718 35.66272
[4,]  31.52656 34.20874 30.99895 31.30184
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7fc171ca2810>
> exp(tmp5)
<pointer: 0x7fc171ca2810>
> log(tmp5,2)
<pointer: 0x7fc171ca2810>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 465.0321
> Min(tmp5)
[1] 52.19815
> mean(tmp5)
[1] 72.47299
> Sum(tmp5)
[1] 14494.6
> Var(tmp5)
[1] 850.9076
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.25952 68.62475 72.34764 73.24501 70.11662 70.75467 69.76163 72.81366
 [9] 66.34910 71.45730
> rowSums(tmp5)
 [1] 1785.190 1372.495 1446.953 1464.900 1402.332 1415.093 1395.233 1456.273
 [9] 1326.982 1429.146
> rowVars(tmp5)
 [1] 7902.23806   64.52211   66.64624   42.26753  102.99552  102.19122
 [7]   51.19126   84.34699   56.59893   68.91396
> rowSd(tmp5)
 [1] 88.894533  8.032566  8.163715  6.501348 10.148671 10.108967  7.154807
 [8]  9.184062  7.523226  8.301443
> rowMax(tmp5)
 [1] 465.03210  83.78423  90.94939  82.48079  89.45321  93.41962  82.33372
 [8]  89.47291  77.95739  84.93438
> rowMin(tmp5)
 [1] 52.19815 56.95544 55.78363 59.59436 56.86478 55.24640 58.12762 58.94853
 [9] 56.50679 54.76693
> 
> colMeans(tmp5)
 [1] 107.74011  69.64398  68.35068  64.28544  72.14626  71.06946  73.77838
 [8]  74.03868  70.55333  71.91733  67.87565  73.62637  70.64209  70.85205
[15]  64.89295  73.38423  73.87276  69.59386  72.96275  68.23347
> colSums(tmp5)
 [1] 1077.4011  696.4398  683.5068  642.8544  721.4626  710.6946  737.7838
 [8]  740.3868  705.5333  719.1733  678.7565  736.2637  706.4209  708.5205
[15]  648.9295  733.8423  738.7276  695.9386  729.6275  682.3347
> colVars(tmp5)
 [1] 15883.40658    58.85872    81.03309    48.20828    58.48433    72.43364
 [7]    56.22506    73.38991   106.52976    34.12459    50.12222    42.45729
[13]    70.82433    47.26869    51.52702    47.46066   136.28579    61.72002
[19]   126.27792    84.29385
> colSd(tmp5)
 [1] 126.029388   7.671944   9.001838   6.943218   7.647505   8.510795
 [7]   7.498337   8.566791  10.321326   5.841626   7.079704   6.515926
[13]   8.415719   6.875223   7.178233   6.889170  11.674150   7.856209
[19]  11.237345   9.181168
> colMax(tmp5)
 [1] 465.03210  83.78423  83.95283  74.22728  81.68665  82.06023  83.61275
 [8]  90.94939  93.41962  82.24113  77.46585  79.91416  82.74547  80.14026
[15]  77.01876  84.14507  89.45321  75.43706  86.32711  80.06725
> colMin(tmp5)
 [1] 56.44752 58.51459 59.52239 52.98020 58.97808 58.34090 60.58310 62.64036
 [9] 57.38979 62.02807 56.95544 58.12667 59.47984 60.40716 54.76693 59.59436
[17] 57.10774 52.19815 55.78363 55.24640
> 
> 
> ### 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.25952 68.62475 72.34764 73.24501 70.11662 70.75467 69.76163 72.81366
 [9]       NA 71.45730
> rowSums(tmp5)
 [1] 1785.190 1372.495 1446.953 1464.900 1402.332 1415.093 1395.233 1456.273
 [9]       NA 1429.146
> rowVars(tmp5)
 [1] 7902.23806   64.52211   66.64624   42.26753  102.99552  102.19122
 [7]   51.19126   84.34699   59.39556   68.91396
> rowSd(tmp5)
 [1] 88.894533  8.032566  8.163715  6.501348 10.148671 10.108967  7.154807
 [8]  9.184062  7.706851  8.301443
> rowMax(tmp5)
 [1] 465.03210  83.78423  90.94939  82.48079  89.45321  93.41962  82.33372
 [8]  89.47291        NA  84.93438
> rowMin(tmp5)
 [1] 52.19815 56.95544 55.78363 59.59436 56.86478 55.24640 58.12762 58.94853
 [9]       NA 54.76693
> 
> colMeans(tmp5)
 [1] 107.74011  69.64398  68.35068  64.28544  72.14626        NA  73.77838
 [8]  74.03868  70.55333  71.91733  67.87565  73.62637  70.64209  70.85205
[15]  64.89295  73.38423  73.87276  69.59386  72.96275  68.23347
> colSums(tmp5)
 [1] 1077.4011  696.4398  683.5068  642.8544  721.4626        NA  737.7838
 [8]  740.3868  705.5333  719.1733  678.7565  736.2637  706.4209  708.5205
[15]  648.9295  733.8423  738.7276  695.9386  729.6275  682.3347
> colVars(tmp5)
 [1] 15883.40658    58.85872    81.03309    48.20828    58.48433          NA
 [7]    56.22506    73.38991   106.52976    34.12459    50.12222    42.45729
[13]    70.82433    47.26869    51.52702    47.46066   136.28579    61.72002
[19]   126.27792    84.29385
> colSd(tmp5)
 [1] 126.029388   7.671944   9.001838   6.943218   7.647505         NA
 [7]   7.498337   8.566791  10.321326   5.841626   7.079704   6.515926
[13]   8.415719   6.875223   7.178233   6.889170  11.674150   7.856209
[19]  11.237345   9.181168
> colMax(tmp5)
 [1] 465.03210  83.78423  83.95283  74.22728  81.68665        NA  83.61275
 [8]  90.94939  93.41962  82.24113  77.46585  79.91416  82.74547  80.14026
[15]  77.01876  84.14507  89.45321  75.43706  86.32711  80.06725
> colMin(tmp5)
 [1] 56.44752 58.51459 59.52239 52.98020 58.97808       NA 60.58310 62.64036
 [9] 57.38979 62.02807 56.95544 58.12667 59.47984 60.40716 54.76693 59.59436
[17] 57.10774 52.19815 55.78363 55.24640
> 
> Max(tmp5,na.rm=TRUE)
[1] 465.0321
> Min(tmp5,na.rm=TRUE)
[1] 52.19815
> mean(tmp5,na.rm=TRUE)
[1] 72.51602
> Sum(tmp5,na.rm=TRUE)
[1] 14430.69
> Var(tmp5,na.rm=TRUE)
[1] 854.833
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.25952 68.62475 72.34764 73.24501 70.11662 70.75467 69.76163 72.81366
 [9] 66.47744 71.45730
> rowSums(tmp5,na.rm=TRUE)
 [1] 1785.190 1372.495 1446.953 1464.900 1402.332 1415.093 1395.233 1456.273
 [9] 1263.071 1429.146
> rowVars(tmp5,na.rm=TRUE)
 [1] 7902.23806   64.52211   66.64624   42.26753  102.99552  102.19122
 [7]   51.19126   84.34699   59.39556   68.91396
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.894533  8.032566  8.163715  6.501348 10.148671 10.108967  7.154807
 [8]  9.184062  7.706851  8.301443
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.03210  83.78423  90.94939  82.48079  89.45321  93.41962  82.33372
 [8]  89.47291  77.95739  84.93438
> rowMin(tmp5,na.rm=TRUE)
 [1] 52.19815 56.95544 55.78363 59.59436 56.86478 55.24640 58.12762 58.94853
 [9] 56.50679 54.76693
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 107.74011  69.64398  68.35068  64.28544  72.14626  71.86490  73.77838
 [8]  74.03868  70.55333  71.91733  67.87565  73.62637  70.64209  70.85205
[15]  64.89295  73.38423  73.87276  69.59386  72.96275  68.23347
> colSums(tmp5,na.rm=TRUE)
 [1] 1077.4011  696.4398  683.5068  642.8544  721.4626  646.7841  737.7838
 [8]  740.3868  705.5333  719.1733  678.7565  736.2637  706.4209  708.5205
[15]  648.9295  733.8423  738.7276  695.9386  729.6275  682.3347
> colVars(tmp5,na.rm=TRUE)
 [1] 15883.40658    58.85872    81.03309    48.20828    58.48433    74.36971
 [7]    56.22506    73.38991   106.52976    34.12459    50.12222    42.45729
[13]    70.82433    47.26869    51.52702    47.46066   136.28579    61.72002
[19]   126.27792    84.29385
> colSd(tmp5,na.rm=TRUE)
 [1] 126.029388   7.671944   9.001838   6.943218   7.647505   8.623787
 [7]   7.498337   8.566791  10.321326   5.841626   7.079704   6.515926
[13]   8.415719   6.875223   7.178233   6.889170  11.674150   7.856209
[19]  11.237345   9.181168
> colMax(tmp5,na.rm=TRUE)
 [1] 465.03210  83.78423  83.95283  74.22728  81.68665  82.06023  83.61275
 [8]  90.94939  93.41962  82.24113  77.46585  79.91416  82.74547  80.14026
[15]  77.01876  84.14507  89.45321  75.43706  86.32711  80.06725
> colMin(tmp5,na.rm=TRUE)
 [1] 56.44752 58.51459 59.52239 52.98020 58.97808 58.34090 60.58310 62.64036
 [9] 57.38979 62.02807 56.95544 58.12667 59.47984 60.40716 54.76693 59.59436
[17] 57.10774 52.19815 55.78363 55.24640
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.25952 68.62475 72.34764 73.24501 70.11662 70.75467 69.76163 72.81366
 [9]      NaN 71.45730
> rowSums(tmp5,na.rm=TRUE)
 [1] 1785.190 1372.495 1446.953 1464.900 1402.332 1415.093 1395.233 1456.273
 [9]    0.000 1429.146
> rowVars(tmp5,na.rm=TRUE)
 [1] 7902.23806   64.52211   66.64624   42.26753  102.99552  102.19122
 [7]   51.19126   84.34699         NA   68.91396
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.894533  8.032566  8.163715  6.501348 10.148671 10.108967  7.154807
 [8]  9.184062        NA  8.301443
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.03210  83.78423  90.94939  82.48079  89.45321  93.41962  82.33372
 [8]  89.47291        NA  84.93438
> rowMin(tmp5,na.rm=TRUE)
 [1] 52.19815 56.95544 55.78363 59.59436 56.86478 55.24640 58.12762 58.94853
 [9]       NA 54.76693
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.43270  70.77839  67.89656  65.04339  71.87745       NaN  73.31405
 [8]  73.82400  70.66182  73.01613  68.94877  75.34856  71.88234  71.63261
[15]  63.54564  73.34652  74.84901  70.75751  73.56069  67.48743
> colSums(tmp5,na.rm=TRUE)
 [1] 1020.8943  637.0055  611.0690  585.3905  646.8971    0.0000  659.8264
 [8]  664.4160  635.9564  657.1452  620.5389  678.1371  646.9411  644.6935
[15]  571.9108  660.1187  673.6410  636.8176  662.0462  607.3868
> colVars(tmp5,na.rm=TRUE)
 [1] 17504.26942    51.73843    88.84216    47.77130    64.98200          NA
 [7]    60.82762    82.04516   119.71357    24.80720    43.43207    14.39768
[13]    62.37239    46.32294    37.54637    53.37725   142.59973    54.20155
[19]   138.04035    88.56912
> colSd(tmp5,na.rm=TRUE)
 [1] 132.303701   7.192943   9.425612   6.911679   8.061142         NA
 [7]   7.799206   9.057878  10.941370   4.980683   6.590301   3.794427
[13]   7.897619   6.806095   6.127509   7.305974  11.941513   7.362170
[19]  11.749058   9.411117
> colMax(tmp5,na.rm=TRUE)
 [1] 465.03210  83.78423  83.95283  74.22728  81.68665      -Inf  83.61275
 [8]  90.94939  93.41962  82.24113  77.46585  79.91416  82.74547  80.14026
[15]  72.54381  84.14507  89.45321  75.43706  86.32711  80.06725
> colMin(tmp5,na.rm=TRUE)
 [1] 56.44752 58.51459 59.52239 52.98020 58.97808      Inf 60.58310 62.64036
 [9] 57.38979 66.30470 56.95544 69.52142 60.16635 60.40716 54.76693 59.59436
[17] 57.10774 52.19815 55.78363 55.24640
> 
> 
> 
> 
> 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] 145.1159 320.4036 258.2122 247.9001 187.9449 262.5937 188.2797 252.4455
 [9] 219.6882 137.5953
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 145.1159 320.4036 258.2122 247.9001 187.9449 262.5937 188.2797 252.4455
 [9] 219.6882 137.5953
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  5.684342e-14  1.136868e-13 -2.273737e-13 -5.684342e-14  0.000000e+00
 [6] -8.526513e-14  1.705303e-13  8.526513e-14  0.000000e+00  5.684342e-14
[11]  2.842171e-14  1.136868e-13 -1.421085e-13 -5.684342e-14  1.136868e-13
[16] -1.989520e-13  2.842171e-13  0.000000e+00  5.684342e-14 -5.684342e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
5   5 
9   13 
5   11 
7   17 
9   8 
10   16 
4   11 
7   15 
2   20 
2   6 
3   17 
8   19 
4   15 
8   6 
9   5 
2   19 
2   3 
8   1 
9   1 
6   17 
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.763764
> Min(tmp)
[1] -2.53632
> mean(tmp)
[1] 0.04673834
> Sum(tmp)
[1] 4.673834
> Var(tmp)
[1] 0.6823057
> 
> rowMeans(tmp)
[1] 0.04673834
> rowSums(tmp)
[1] 4.673834
> rowVars(tmp)
[1] 0.6823057
> rowSd(tmp)
[1] 0.826018
> rowMax(tmp)
[1] 1.763764
> rowMin(tmp)
[1] -2.53632
> 
> colMeans(tmp)
  [1] -0.56575049  0.21497543 -0.39723649 -0.51569372 -0.20855858  1.15789868
  [7] -0.62010122  0.66184952  0.02710191  0.16210295 -0.48807256 -0.01927296
 [13]  0.30615129  0.78645232  0.16759282  0.03847382  0.59268152  0.18948303
 [19]  0.04989644  0.12524029  1.08836483 -0.76042201  0.97252004  0.47240810
 [25]  0.03169489 -0.06183488 -0.08981465  0.25760654 -0.86027226 -0.48378766
 [31]  0.27142912  0.53692436  0.59671929 -0.96976385 -0.75329005 -1.02172536
 [37] -0.19142141 -1.26143596  0.24138419  0.22174744  0.03011850 -0.15345524
 [43] -0.40038098  0.86575194  0.32300368  0.13484433 -0.11108681  0.05813013
 [49]  1.76376434  0.17332511  0.23891343  0.09564053 -0.98213498 -0.17434155
 [55] -1.26923668 -1.27425112 -0.93670078  0.60086588  0.17769964 -2.53631975
 [61] -1.58236669  1.10262169  1.17608093  1.18701131  1.20863271  1.44658848
 [67]  1.55842418 -0.69560496  0.40966983  0.49190413  0.99239417 -0.28350331
 [73] -0.90789099 -0.95123779  0.96078375 -1.62437928  1.09564040  0.47625185
 [79] -0.53755651  0.08591837 -0.41648399 -0.83414147  1.18081482 -0.34493944
 [85]  0.82009229 -0.40783779 -0.79664730  0.28089025 -0.43628114  0.22062841
 [91]  1.01156966  0.82903411  1.57770296  0.92097115  0.81786691  1.28014155
 [97] -1.62286400 -1.15883683 -0.93599865  0.55237632
> colSums(tmp)
  [1] -0.56575049  0.21497543 -0.39723649 -0.51569372 -0.20855858  1.15789868
  [7] -0.62010122  0.66184952  0.02710191  0.16210295 -0.48807256 -0.01927296
 [13]  0.30615129  0.78645232  0.16759282  0.03847382  0.59268152  0.18948303
 [19]  0.04989644  0.12524029  1.08836483 -0.76042201  0.97252004  0.47240810
 [25]  0.03169489 -0.06183488 -0.08981465  0.25760654 -0.86027226 -0.48378766
 [31]  0.27142912  0.53692436  0.59671929 -0.96976385 -0.75329005 -1.02172536
 [37] -0.19142141 -1.26143596  0.24138419  0.22174744  0.03011850 -0.15345524
 [43] -0.40038098  0.86575194  0.32300368  0.13484433 -0.11108681  0.05813013
 [49]  1.76376434  0.17332511  0.23891343  0.09564053 -0.98213498 -0.17434155
 [55] -1.26923668 -1.27425112 -0.93670078  0.60086588  0.17769964 -2.53631975
 [61] -1.58236669  1.10262169  1.17608093  1.18701131  1.20863271  1.44658848
 [67]  1.55842418 -0.69560496  0.40966983  0.49190413  0.99239417 -0.28350331
 [73] -0.90789099 -0.95123779  0.96078375 -1.62437928  1.09564040  0.47625185
 [79] -0.53755651  0.08591837 -0.41648399 -0.83414147  1.18081482 -0.34493944
 [85]  0.82009229 -0.40783779 -0.79664730  0.28089025 -0.43628114  0.22062841
 [91]  1.01156966  0.82903411  1.57770296  0.92097115  0.81786691  1.28014155
 [97] -1.62286400 -1.15883683 -0.93599865  0.55237632
> 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.56575049  0.21497543 -0.39723649 -0.51569372 -0.20855858  1.15789868
  [7] -0.62010122  0.66184952  0.02710191  0.16210295 -0.48807256 -0.01927296
 [13]  0.30615129  0.78645232  0.16759282  0.03847382  0.59268152  0.18948303
 [19]  0.04989644  0.12524029  1.08836483 -0.76042201  0.97252004  0.47240810
 [25]  0.03169489 -0.06183488 -0.08981465  0.25760654 -0.86027226 -0.48378766
 [31]  0.27142912  0.53692436  0.59671929 -0.96976385 -0.75329005 -1.02172536
 [37] -0.19142141 -1.26143596  0.24138419  0.22174744  0.03011850 -0.15345524
 [43] -0.40038098  0.86575194  0.32300368  0.13484433 -0.11108681  0.05813013
 [49]  1.76376434  0.17332511  0.23891343  0.09564053 -0.98213498 -0.17434155
 [55] -1.26923668 -1.27425112 -0.93670078  0.60086588  0.17769964 -2.53631975
 [61] -1.58236669  1.10262169  1.17608093  1.18701131  1.20863271  1.44658848
 [67]  1.55842418 -0.69560496  0.40966983  0.49190413  0.99239417 -0.28350331
 [73] -0.90789099 -0.95123779  0.96078375 -1.62437928  1.09564040  0.47625185
 [79] -0.53755651  0.08591837 -0.41648399 -0.83414147  1.18081482 -0.34493944
 [85]  0.82009229 -0.40783779 -0.79664730  0.28089025 -0.43628114  0.22062841
 [91]  1.01156966  0.82903411  1.57770296  0.92097115  0.81786691  1.28014155
 [97] -1.62286400 -1.15883683 -0.93599865  0.55237632
> colMin(tmp)
  [1] -0.56575049  0.21497543 -0.39723649 -0.51569372 -0.20855858  1.15789868
  [7] -0.62010122  0.66184952  0.02710191  0.16210295 -0.48807256 -0.01927296
 [13]  0.30615129  0.78645232  0.16759282  0.03847382  0.59268152  0.18948303
 [19]  0.04989644  0.12524029  1.08836483 -0.76042201  0.97252004  0.47240810
 [25]  0.03169489 -0.06183488 -0.08981465  0.25760654 -0.86027226 -0.48378766
 [31]  0.27142912  0.53692436  0.59671929 -0.96976385 -0.75329005 -1.02172536
 [37] -0.19142141 -1.26143596  0.24138419  0.22174744  0.03011850 -0.15345524
 [43] -0.40038098  0.86575194  0.32300368  0.13484433 -0.11108681  0.05813013
 [49]  1.76376434  0.17332511  0.23891343  0.09564053 -0.98213498 -0.17434155
 [55] -1.26923668 -1.27425112 -0.93670078  0.60086588  0.17769964 -2.53631975
 [61] -1.58236669  1.10262169  1.17608093  1.18701131  1.20863271  1.44658848
 [67]  1.55842418 -0.69560496  0.40966983  0.49190413  0.99239417 -0.28350331
 [73] -0.90789099 -0.95123779  0.96078375 -1.62437928  1.09564040  0.47625185
 [79] -0.53755651  0.08591837 -0.41648399 -0.83414147  1.18081482 -0.34493944
 [85]  0.82009229 -0.40783779 -0.79664730  0.28089025 -0.43628114  0.22062841
 [91]  1.01156966  0.82903411  1.57770296  0.92097115  0.81786691  1.28014155
 [97] -1.62286400 -1.15883683 -0.93599865  0.55237632
> colMedians(tmp)
  [1] -0.56575049  0.21497543 -0.39723649 -0.51569372 -0.20855858  1.15789868
  [7] -0.62010122  0.66184952  0.02710191  0.16210295 -0.48807256 -0.01927296
 [13]  0.30615129  0.78645232  0.16759282  0.03847382  0.59268152  0.18948303
 [19]  0.04989644  0.12524029  1.08836483 -0.76042201  0.97252004  0.47240810
 [25]  0.03169489 -0.06183488 -0.08981465  0.25760654 -0.86027226 -0.48378766
 [31]  0.27142912  0.53692436  0.59671929 -0.96976385 -0.75329005 -1.02172536
 [37] -0.19142141 -1.26143596  0.24138419  0.22174744  0.03011850 -0.15345524
 [43] -0.40038098  0.86575194  0.32300368  0.13484433 -0.11108681  0.05813013
 [49]  1.76376434  0.17332511  0.23891343  0.09564053 -0.98213498 -0.17434155
 [55] -1.26923668 -1.27425112 -0.93670078  0.60086588  0.17769964 -2.53631975
 [61] -1.58236669  1.10262169  1.17608093  1.18701131  1.20863271  1.44658848
 [67]  1.55842418 -0.69560496  0.40966983  0.49190413  0.99239417 -0.28350331
 [73] -0.90789099 -0.95123779  0.96078375 -1.62437928  1.09564040  0.47625185
 [79] -0.53755651  0.08591837 -0.41648399 -0.83414147  1.18081482 -0.34493944
 [85]  0.82009229 -0.40783779 -0.79664730  0.28089025 -0.43628114  0.22062841
 [91]  1.01156966  0.82903411  1.57770296  0.92097115  0.81786691  1.28014155
 [97] -1.62286400 -1.15883683 -0.93599865  0.55237632
> colRanges(tmp)
           [,1]      [,2]       [,3]       [,4]       [,5]     [,6]       [,7]
[1,] -0.5657505 0.2149754 -0.3972365 -0.5156937 -0.2085586 1.157899 -0.6201012
[2,] -0.5657505 0.2149754 -0.3972365 -0.5156937 -0.2085586 1.157899 -0.6201012
          [,8]       [,9]     [,10]      [,11]       [,12]     [,13]     [,14]
[1,] 0.6618495 0.02710191 0.1621029 -0.4880726 -0.01927296 0.3061513 0.7864523
[2,] 0.6618495 0.02710191 0.1621029 -0.4880726 -0.01927296 0.3061513 0.7864523
         [,15]      [,16]     [,17]    [,18]      [,19]     [,20]    [,21]
[1,] 0.1675928 0.03847382 0.5926815 0.189483 0.04989644 0.1252403 1.088365
[2,] 0.1675928 0.03847382 0.5926815 0.189483 0.04989644 0.1252403 1.088365
         [,22]   [,23]     [,24]      [,25]       [,26]       [,27]     [,28]
[1,] -0.760422 0.97252 0.4724081 0.03169489 -0.06183488 -0.08981465 0.2576065
[2,] -0.760422 0.97252 0.4724081 0.03169489 -0.06183488 -0.08981465 0.2576065
          [,29]      [,30]     [,31]     [,32]     [,33]      [,34]    [,35]
[1,] -0.8602723 -0.4837877 0.2714291 0.5369244 0.5967193 -0.9697638 -0.75329
[2,] -0.8602723 -0.4837877 0.2714291 0.5369244 0.5967193 -0.9697638 -0.75329
         [,36]      [,37]     [,38]     [,39]     [,40]     [,41]      [,42]
[1,] -1.021725 -0.1914214 -1.261436 0.2413842 0.2217474 0.0301185 -0.1534552
[2,] -1.021725 -0.1914214 -1.261436 0.2413842 0.2217474 0.0301185 -0.1534552
         [,43]     [,44]     [,45]     [,46]      [,47]      [,48]    [,49]
[1,] -0.400381 0.8657519 0.3230037 0.1348443 -0.1110868 0.05813013 1.763764
[2,] -0.400381 0.8657519 0.3230037 0.1348443 -0.1110868 0.05813013 1.763764
         [,50]     [,51]      [,52]     [,53]      [,54]     [,55]     [,56]
[1,] 0.1733251 0.2389134 0.09564053 -0.982135 -0.1743416 -1.269237 -1.274251
[2,] 0.1733251 0.2389134 0.09564053 -0.982135 -0.1743416 -1.269237 -1.274251
          [,57]     [,58]     [,59]    [,60]     [,61]    [,62]    [,63]
[1,] -0.9367008 0.6008659 0.1776996 -2.53632 -1.582367 1.102622 1.176081
[2,] -0.9367008 0.6008659 0.1776996 -2.53632 -1.582367 1.102622 1.176081
        [,64]    [,65]    [,66]    [,67]     [,68]     [,69]     [,70]
[1,] 1.187011 1.208633 1.446588 1.558424 -0.695605 0.4096698 0.4919041
[2,] 1.187011 1.208633 1.446588 1.558424 -0.695605 0.4096698 0.4919041
         [,71]      [,72]     [,73]      [,74]     [,75]     [,76]   [,77]
[1,] 0.9923942 -0.2835033 -0.907891 -0.9512378 0.9607838 -1.624379 1.09564
[2,] 0.9923942 -0.2835033 -0.907891 -0.9512378 0.9607838 -1.624379 1.09564
         [,78]      [,79]      [,80]     [,81]      [,82]    [,83]      [,84]
[1,] 0.4762519 -0.5375565 0.08591837 -0.416484 -0.8341415 1.180815 -0.3449394
[2,] 0.4762519 -0.5375565 0.08591837 -0.416484 -0.8341415 1.180815 -0.3449394
         [,85]      [,86]      [,87]     [,88]      [,89]     [,90]   [,91]
[1,] 0.8200923 -0.4078378 -0.7966473 0.2808903 -0.4362811 0.2206284 1.01157
[2,] 0.8200923 -0.4078378 -0.7966473 0.2808903 -0.4362811 0.2206284 1.01157
         [,92]    [,93]     [,94]     [,95]    [,96]     [,97]     [,98]
[1,] 0.8290341 1.577703 0.9209711 0.8178669 1.280142 -1.622864 -1.158837
[2,] 0.8290341 1.577703 0.9209711 0.8178669 1.280142 -1.622864 -1.158837
          [,99]    [,100]
[1,] -0.9359987 0.5523763
[2,] -0.9359987 0.5523763
> 
> 
> Max(tmp2)
[1] 3.035908
> Min(tmp2)
[1] -2.519423
> mean(tmp2)
[1] 0.2148995
> Sum(tmp2)
[1] 21.48995
> Var(tmp2)
[1] 1.039998
> 
> rowMeans(tmp2)
  [1]  1.541407588  0.844360851 -0.903417269  0.605168726 -1.093338228
  [6]  2.138552045  0.007721516  0.933447815 -0.868135521 -1.102066746
 [11] -0.305139027  0.842848359 -0.110883082  0.073341687 -1.137633830
 [16]  1.414738928  0.893780707 -0.291534660  0.797452801 -0.318037671
 [21]  0.154087463 -0.030765850 -1.330028376  1.987187365  1.547608148
 [26] -1.073976471  1.158392161  0.278483506 -0.008651713  0.927170037
 [31]  2.013841125 -1.608638500  2.025633683 -0.885362787 -0.467080060
 [36] -0.832248470  0.785442076  0.866041010  0.748740223 -0.319654853
 [41]  1.163537277  0.647859511  0.435085526 -1.860943088 -0.872637493
 [46] -0.595367004  0.905898628  0.292719856  1.049820400 -0.594595630
 [51]  0.664215460  0.601158461 -2.519422838 -0.885066196  0.651639071
 [56]  0.434930300 -0.617488483  1.308775470  1.614716673  0.267177288
 [61]  3.035908057  1.162572782 -0.544934430 -1.340464280  0.627331210
 [66] -1.074616371 -0.054685684  2.119208081  0.600646770  0.997644675
 [71] -0.020304479 -0.336799966  0.437715562  0.378440682  0.838219784
 [76]  0.430067661  0.466946842  1.372608376 -0.753459853  0.285184597
 [81] -0.012285451  0.131493571  1.762414643  0.082335852 -1.693486432
 [86]  0.137594536  0.318965298  0.110275625  1.696060940 -0.678994908
 [91] -0.922954919 -0.667896336  0.514918891  1.521234371  0.845406181
 [96] -0.618977490 -0.664989817  0.410936157 -1.206231879 -0.193963955
> rowSums(tmp2)
  [1]  1.541407588  0.844360851 -0.903417269  0.605168726 -1.093338228
  [6]  2.138552045  0.007721516  0.933447815 -0.868135521 -1.102066746
 [11] -0.305139027  0.842848359 -0.110883082  0.073341687 -1.137633830
 [16]  1.414738928  0.893780707 -0.291534660  0.797452801 -0.318037671
 [21]  0.154087463 -0.030765850 -1.330028376  1.987187365  1.547608148
 [26] -1.073976471  1.158392161  0.278483506 -0.008651713  0.927170037
 [31]  2.013841125 -1.608638500  2.025633683 -0.885362787 -0.467080060
 [36] -0.832248470  0.785442076  0.866041010  0.748740223 -0.319654853
 [41]  1.163537277  0.647859511  0.435085526 -1.860943088 -0.872637493
 [46] -0.595367004  0.905898628  0.292719856  1.049820400 -0.594595630
 [51]  0.664215460  0.601158461 -2.519422838 -0.885066196  0.651639071
 [56]  0.434930300 -0.617488483  1.308775470  1.614716673  0.267177288
 [61]  3.035908057  1.162572782 -0.544934430 -1.340464280  0.627331210
 [66] -1.074616371 -0.054685684  2.119208081  0.600646770  0.997644675
 [71] -0.020304479 -0.336799966  0.437715562  0.378440682  0.838219784
 [76]  0.430067661  0.466946842  1.372608376 -0.753459853  0.285184597
 [81] -0.012285451  0.131493571  1.762414643  0.082335852 -1.693486432
 [86]  0.137594536  0.318965298  0.110275625  1.696060940 -0.678994908
 [91] -0.922954919 -0.667896336  0.514918891  1.521234371  0.845406181
 [96] -0.618977490 -0.664989817  0.410936157 -1.206231879 -0.193963955
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  1.541407588  0.844360851 -0.903417269  0.605168726 -1.093338228
  [6]  2.138552045  0.007721516  0.933447815 -0.868135521 -1.102066746
 [11] -0.305139027  0.842848359 -0.110883082  0.073341687 -1.137633830
 [16]  1.414738928  0.893780707 -0.291534660  0.797452801 -0.318037671
 [21]  0.154087463 -0.030765850 -1.330028376  1.987187365  1.547608148
 [26] -1.073976471  1.158392161  0.278483506 -0.008651713  0.927170037
 [31]  2.013841125 -1.608638500  2.025633683 -0.885362787 -0.467080060
 [36] -0.832248470  0.785442076  0.866041010  0.748740223 -0.319654853
 [41]  1.163537277  0.647859511  0.435085526 -1.860943088 -0.872637493
 [46] -0.595367004  0.905898628  0.292719856  1.049820400 -0.594595630
 [51]  0.664215460  0.601158461 -2.519422838 -0.885066196  0.651639071
 [56]  0.434930300 -0.617488483  1.308775470  1.614716673  0.267177288
 [61]  3.035908057  1.162572782 -0.544934430 -1.340464280  0.627331210
 [66] -1.074616371 -0.054685684  2.119208081  0.600646770  0.997644675
 [71] -0.020304479 -0.336799966  0.437715562  0.378440682  0.838219784
 [76]  0.430067661  0.466946842  1.372608376 -0.753459853  0.285184597
 [81] -0.012285451  0.131493571  1.762414643  0.082335852 -1.693486432
 [86]  0.137594536  0.318965298  0.110275625  1.696060940 -0.678994908
 [91] -0.922954919 -0.667896336  0.514918891  1.521234371  0.845406181
 [96] -0.618977490 -0.664989817  0.410936157 -1.206231879 -0.193963955
> rowMin(tmp2)
  [1]  1.541407588  0.844360851 -0.903417269  0.605168726 -1.093338228
  [6]  2.138552045  0.007721516  0.933447815 -0.868135521 -1.102066746
 [11] -0.305139027  0.842848359 -0.110883082  0.073341687 -1.137633830
 [16]  1.414738928  0.893780707 -0.291534660  0.797452801 -0.318037671
 [21]  0.154087463 -0.030765850 -1.330028376  1.987187365  1.547608148
 [26] -1.073976471  1.158392161  0.278483506 -0.008651713  0.927170037
 [31]  2.013841125 -1.608638500  2.025633683 -0.885362787 -0.467080060
 [36] -0.832248470  0.785442076  0.866041010  0.748740223 -0.319654853
 [41]  1.163537277  0.647859511  0.435085526 -1.860943088 -0.872637493
 [46] -0.595367004  0.905898628  0.292719856  1.049820400 -0.594595630
 [51]  0.664215460  0.601158461 -2.519422838 -0.885066196  0.651639071
 [56]  0.434930300 -0.617488483  1.308775470  1.614716673  0.267177288
 [61]  3.035908057  1.162572782 -0.544934430 -1.340464280  0.627331210
 [66] -1.074616371 -0.054685684  2.119208081  0.600646770  0.997644675
 [71] -0.020304479 -0.336799966  0.437715562  0.378440682  0.838219784
 [76]  0.430067661  0.466946842  1.372608376 -0.753459853  0.285184597
 [81] -0.012285451  0.131493571  1.762414643  0.082335852 -1.693486432
 [86]  0.137594536  0.318965298  0.110275625  1.696060940 -0.678994908
 [91] -0.922954919 -0.667896336  0.514918891  1.521234371  0.845406181
 [96] -0.618977490 -0.664989817  0.410936157 -1.206231879 -0.193963955
> 
> colMeans(tmp2)
[1] 0.2148995
> colSums(tmp2)
[1] 21.48995
> colVars(tmp2)
[1] 1.039998
> colSd(tmp2)
[1] 1.019803
> colMax(tmp2)
[1] 3.035908
> colMin(tmp2)
[1] -2.519423
> colMedians(tmp2)
[1] 0.2818341
> colRanges(tmp2)
          [,1]
[1,] -2.519423
[2,]  3.035908
> 
> 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.9740634  0.1334229 -1.6669841  4.7083088 -0.9995599 -1.1131938
 [7] -2.9382339  2.2159026 -2.3034038  4.5748742
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -1.16744718
[2,]  0.07691742
[3,]  0.37819142
[4,]  0.71083610
[5,]  1.38051786
> 
> rowApply(tmp,sum)
 [1]  1.5927830  3.2537205  0.2758084 -0.7852874 -0.4832212  2.0584503
 [7] -2.9212614 -2.5122618  5.3433140 -0.2368481
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    7    9    9    7    7    1    3    5     6
 [2,]    6    1    4    2    6    9    9    9    6     9
 [3,]    2    6    5   10    3    8    3    5    1     8
 [4,]    7    8    8    4    9   10    8    8    8     2
 [5,]    8    4    6    3    1    1   10    7    2     4
 [6,]    1    3   10    5    8    6    2    1    3     7
 [7,]    3    5    1    7    5    4    6    4    7     1
 [8,]   10   10    3    6    4    2    7    2    4    10
 [9,]    4    2    2    8    2    3    4    6    9     5
[10,]    5    9    7    1   10    5    5   10   10     3
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.7756454 -0.9840921  1.4253538  0.4485482 -2.9414031 -1.5957047
 [7]  2.3489096 -0.5892233 -1.2502611 -0.4454090  1.4888568 -2.3793113
[13] -1.9484507  0.5612413  0.8777669  1.7108042 -1.1036025  0.7983666
[19] -3.6287718  0.2673724
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.49528580
[2,] -0.99223566
[3,] -0.80149518
[4,]  0.04820434
[5,]  1.46516690
> 
> rowApply(tmp,sum)
[1] -2.512066  8.674001 -6.370807 -5.089833 -4.415950
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   12   18    6    5    1
[2,]   17    5   18    2   10
[3,]    5   16   12   12   18
[4,]   13    8   19    3   13
[5,]    1   15    9   18    8
> 
> 
> as.matrix(tmp)
            [,1]       [,2]        [,3]        [,4]       [,5]        [,6]
[1,]  0.04820434  0.9344498 -0.64704605  0.28000848 -3.8759175  0.76453219
[2,]  1.46516690 -0.2959844  1.35863103  0.04833819  1.1715444  0.35364850
[3,] -0.99223566  0.9509719 -0.38042303  1.04639831 -0.7003452 -0.83020971
[4,] -0.80149518 -2.3771531 -0.07542999 -1.04126518  0.8165415 -0.06368697
[5,] -2.49528580 -0.1963762  1.16962181  0.11506844 -0.3532264 -1.81998873
           [,7]       [,8]       [,9]      [,10]       [,11]      [,12]
[1,]  0.6894595 -0.9291353  1.3044736 -1.3942855 -0.07527108  1.1437787
[2,]  0.9956407  0.7239465  1.3810033  1.5416653  0.60622246 -0.5324338
[3,] -1.7475169 -1.3878316 -1.2734319  0.5859429 -0.01555299 -0.9552995
[4,]  0.6341268 -0.7126616 -2.5597162 -0.1736787  1.62575109 -0.6788568
[5,]  1.7771996  1.7164587 -0.1025899 -1.0050530 -0.65229272 -1.3564998
           [,13]      [,14]      [,15]      [,16]       [,17]       [,18]
[1,] -0.58659496  1.3075246 -0.2883151 -0.3761767  0.86488580 -0.41159355
[2,] -1.36322737 -0.7071754  0.4912936  0.7505861  0.02798167 -0.05560417
[3,] -1.20188678  0.6153651 -0.4100710  1.7888591 -0.46201406  0.62258212
[4,]  1.29046634 -0.9189947  0.6683377 -0.2053425 -0.40595677 -0.04755651
[5,] -0.08720797  0.2645217  0.4165217 -0.2471219 -1.12849917  0.69053871
          [,19]      [,20]
[1,] -0.8327667 -0.4322810
[2,] -1.1291436  1.8419011
[3,] -1.5120715 -0.1120364
[4,] -0.6580257  0.5947631
[5,]  0.5032357 -1.6249744
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /Users/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:    /Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  650  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  563  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/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.372242 0.321757 1.319175 1.483656 -0.5855439 0.1878883 -1.105076
          col8      col9    col10      col11      col12     col13      col14
row1 -0.343128 0.9357857 1.379099 -0.7451625 -0.5118701 0.1213795 0.04586612
          col15     col16    col17    col18    col19    col20
row1 -0.7594755 -2.180178 1.236317 1.158107 2.168251 1.672197
> tmp[,"col10"]
          col10
row1  1.3790993
row2  1.7814008
row3  0.7954109
row4 -0.1251355
row5  1.0412464
> tmp[c("row1","row5"),]
          col1      col2      col3      col4       col5      col6       col7
row1 1.3722416 0.3217570  1.319175 1.4836560 -0.5855439 0.1878883 -1.1050758
row5 0.8734574 0.4953281 -1.381026 0.9232126 -2.0763926 0.9157973  0.1218763
           col8      col9    col10      col11      col12      col13      col14
row1 -0.3431280 0.9357857 1.379099 -0.7451625 -0.5118701  0.1213795 0.04586612
row5  0.6114295 0.6228742 1.041246 -1.5793954 -0.1465985 -1.5225526 4.57575961
          col15     col16    col17      col18      col19     col20
row1 -0.7594755 -2.180178 1.236317  1.1581074  2.1682509  1.672197
row5 -0.1246240  1.534027 0.105858 -0.7676301 -0.3692087 -0.995675
> tmp[,c("col6","col20")]
           col6      col20
row1  0.1878883  1.6721967
row2  0.7637953 -0.6922494
row3  0.8824051  0.1139367
row4 -1.5103729  0.6122904
row5  0.9157973 -0.9956750
> tmp[c("row1","row5"),c("col6","col20")]
          col6     col20
row1 0.1878883  1.672197
row5 0.9157973 -0.995675
> 
> 
> 
> 
> 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 51.36493 49.72959 50.08766 48.70786 48.66352 104.7904 48.41249 49.50522
         col9   col10    col11    col12    col13    col14    col15    col16
row1 49.20883 48.8844 49.73531 52.15968 48.38588 48.94914 49.98572 49.78427
        col17    col18    col19    col20
row1 50.68912 48.40159 50.45777 104.2119
> tmp[,"col10"]
        col10
row1 48.88440
row2 30.58393
row3 30.29702
row4 27.98369
row5 49.85363
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.36493 49.72959 50.08766 48.70786 48.66352 104.7904 48.41249 49.50522
row5 51.99657 49.97369 49.51849 49.86439 49.75867 105.3642 49.37328 50.01424
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.20883 48.88440 49.73531 52.15968 48.38588 48.94914 49.98572 49.78427
row5 50.57836 49.85363 49.71691 48.20322 49.67886 49.52379 50.42261 50.48936
        col17    col18    col19    col20
row1 50.68912 48.40159 50.45777 104.2119
row5 47.65408 50.03293 52.30534 105.0146
> tmp[,c("col6","col20")]
          col6     col20
row1 104.79044 104.21187
row2  72.81053  74.93958
row3  75.54337  75.16815
row4  74.29424  75.13958
row5 105.36417 105.01462
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.7904 104.2119
row5 105.3642 105.0146
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.7904 104.2119
row5 105.3642 105.0146
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -1.36475763
[2,] -2.10885777
[3,]  0.08519922
[4,]  0.70753203
[5,]  0.36205775
> tmp[,c("col17","col7")]
          col17       col7
[1,]  0.4560031  0.8227432
[2,] -0.2867809 -0.1706928
[3,]  0.9809907 -0.9068887
[4,]  0.7757606 -0.2692635
[5,] -1.0267797 -0.1030356
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
             col6      col20
[1,]  0.007245062  0.8856985
[2,]  1.537762314 -0.1957987
[3,] -0.475892472  1.1451029
[4,]  0.166035421  0.8016201
[5,] -0.880775578  0.3443540
> subBufferedMatrix(tmp,1,c("col6"))[,1]
            col1
[1,] 0.007245062
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
            col6
[1,] 0.007245062
[2,] 1.537762314
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]       [,3]       [,4]      [,5]     [,6]       [,7]
row3 -0.3669037 -0.0407433 -1.6472439 -0.9219794 0.3474422 1.349676 -1.4157945
row1 -1.3536665 -0.7831792 -0.2854529 -1.0870894 0.2347544 0.633049  0.9237515
           [,8]       [,9]     [,10]     [,11]    [,12]      [,13]      [,14]
row3  2.0361332  0.1164718 0.7651202 -2.229480 1.138845 -0.3590144 0.02703403
row1 -0.6741791 -0.7639018 1.5014184  1.439807 1.487742  0.7223072 1.02924527
          [,15]      [,16]      [,17]      [,18]     [,19]      [,20]
row3 -0.4547231 -0.8015022  0.4796146  0.2022201 0.3858547 -0.6921493
row1  1.1702511  0.1204200 -0.6246393 -0.1951790 1.5022056  1.1604141
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]     [,3]      [,4]       [,5]     [,6]      [,7]
row2 0.6039581 0.2212683 0.922836 0.4946728 -0.2238814 1.671798 0.1491435
           [,8]      [,9]      [,10]
row2 -0.4842519 0.6844758 -0.2909295
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]     [,2]       [,3]     [,4]      [,5]     [,6]     [,7]
row5 0.5413645 0.725353 -0.1099321 1.292214 0.2923253 1.796094 1.131766
          [,8]       [,9]     [,10]      [,11]      [,12]     [,13]     [,14]
row5 0.5333555 0.07715284 0.3318226 -0.5593646 -0.3096736 0.6146422 -1.969307
          [,15]    [,16]     [,17]     [,18]      [,19]     [,20]
row5 -0.4085585 1.648966 0.7074051 -1.410695 -0.8931411 0.3649649
> 
> 
> 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: 0x7fc141d009d0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f656afcf2"
 [2] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f5304a7e2"
 [3] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f56aa1102"
 [4] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f3742c6c1"
 [5] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f106c53f" 
 [6] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f637fab9f"
 [7] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f52dc86c1"
 [8] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8fc131367" 
 [9] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f385ed562"
[10] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f5a0b31d7"
[11] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f14f54870"
[12] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f7366bbcf"
[13] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f5db44e39"
[14] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f687bb03e"
[15] "/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests/BM3d8f106fec09"
> 
> 
> ### 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: 0x7fc151e022b0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7fc151e022b0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.14-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7fc151e022b0>
> rowMedians(tmp)
  [1]  0.146695605 -0.141485540 -0.043195781  0.023363749 -0.001642133
  [6]  0.170715165  0.350068349 -0.148216929  0.096756153  0.187507069
 [11]  0.158840555 -0.368108007 -0.282710842 -0.560106833  0.140803110
 [16] -0.011150297 -0.659226444  0.039770306 -0.253163353  0.159413788
 [21]  0.256452693  0.242059808 -0.275209904  0.207081799  0.047779616
 [26] -0.167959699 -0.308881467  0.826961805 -0.237217756 -0.521237122
 [31]  0.414308671 -0.014408067 -0.357548652  0.717394963 -0.245375791
 [36]  0.738448521 -0.231717335  0.289301608  0.103687015 -0.169026387
 [41] -0.417207828 -0.180934872  0.003813595  0.097598718 -0.005982063
 [46] -0.011053913  0.062287033  0.271710845  0.068278668  0.349095782
 [51] -0.337683656 -0.038709236 -0.512549263  0.570470265  0.321580264
 [56]  0.012602308 -0.174765889 -0.010624045  0.143894307 -0.122938272
 [61]  0.352032103 -0.405291110 -0.131836790 -0.368265659 -0.238878758
 [66] -0.323237326  0.105034298  0.358553353 -0.327864506  0.046961867
 [71] -0.144098603 -0.246654403 -0.274124275  0.130978926 -0.431679165
 [76]  0.037924212  0.176949739 -0.367571935  0.214215567 -0.136559913
 [81]  0.312506527 -0.146778854 -0.055004389  0.001798168  0.098135234
 [86] -0.108104746  0.502935172  0.017334902  0.057152142  0.280137368
 [91] -0.269569417  0.017822655  0.241767087  0.066350948 -0.186471188
 [96]  0.100032719  0.491767260  0.093649263 -0.018595282  0.766011250
[101]  0.308220511 -0.043539960 -0.274225322 -0.137607106 -0.323069581
[106]  0.397680224 -0.348049881 -0.258061957 -0.318433107  0.255629669
[111]  0.260139074 -0.240046504 -0.445970546 -0.050990632  0.583228848
[116]  0.408539285 -0.423434860 -0.127840504 -0.371757936 -0.081307290
[121]  0.012554175 -0.136259531 -0.040985424 -0.024720694  0.765280077
[126] -0.424572783 -0.026516763 -0.239869739 -0.133292727 -0.020079626
[131] -0.015982269 -0.111794543  0.302637833  0.126467051 -0.428401041
[136] -0.040471181  0.456641165 -0.121774192  0.556975102  0.126789333
[141]  0.009236152 -0.376791506 -0.232605686 -0.341740452 -0.307525369
[146] -0.247913124  0.304040996 -0.603780585 -0.217612067 -0.177594313
[151]  0.340884547  0.102706207  0.220262530 -0.447799607  0.333672423
[156] -0.007323087  0.031041097 -0.225649646  0.162296070  0.340721452
[161]  0.130107340  0.919395883 -0.609019252 -0.291687652  0.089062986
[166]  0.623444012 -0.038159095  0.625378631  0.814644810  0.384606494
[171]  0.290385330  0.222262001  0.097381634 -0.433617584  0.242962731
[176]  0.624131991 -0.101392582 -0.506077818 -0.486987655  0.028985296
[181]  0.315038038  0.405508406  0.264120325 -0.277569674 -0.185888834
[186]  0.235546088  0.214695174 -0.515931040 -0.004629758 -0.375719525
[191]  0.359143928 -0.201821507 -0.298408421 -0.109148674 -0.065987234
[196]  0.512681047 -0.204261535  0.509374398 -0.724482405  0.109512318
[201] -0.073123253 -0.580012583 -0.418847322  0.205984113  0.184246813
[206] -0.099503498  0.235659644  0.049079492  0.022204991 -0.117738108
[211]  0.001025340 -0.526573242 -0.312549714 -0.149539316  0.426450396
[216] -0.288882404  0.401804839 -0.267624831  0.481739761 -0.520212972
[221] -0.003775694  0.485929851  0.379776232  0.343857481  0.182365994
[226]  0.240425352 -0.010507227  0.137422439  0.709111626 -0.214115075
> 
> proc.time()
   user  system elapsed 
  3.834  12.462  16.562 

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-apple-darwin17.0 (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: 0x7fc73361b250>
> .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: 0x7fc73361b250>
> .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: 0x7fc73361b250>
> .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: 0x7fc73361b250>
> 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: 0x7fc7034007d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fc7034007d0>
> .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: 0x7fc7034007d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fc7034007d0>
> .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: 0x7fc7034007d0>
> 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: 0x7fc703400840>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fc703400840>
> .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: 0x7fc703400840>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fc703400840>
> .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: 0x7fc703400840>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7fc703400840>
> .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: 0x7fc703400840>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7fc703400840>
> .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: 0x7fc703400840>
> 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: 0x7fc693600090>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7fc693600090>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fc693600090>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fc693600090>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile403610a709e0" "BufferedMatrixFile4036256af3b9"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile403610a709e0" "BufferedMatrixFile4036256af3b9"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fc6936003b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fc6936003b0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fc6936003b0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fc6936003b0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7fc6936003b0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7fc6936003b0>
> .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: 0x7fc6936007c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fc6936007c0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fc6936007c0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7fc6936007c0>
> 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: 0x7fc693600ba0>
> .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: 0x7fc693600ba0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.488   0.142   0.605 

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-apple-darwin17.0 (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.494   0.092   0.560 

Example timings