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

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

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

CHECK results for BufferedMatrix on lconway


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

raw results

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

Summary

Package: BufferedMatrix
Version: 1.62.0
Command: /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.62.0.tar.gz
StartedAt: 2023-04-10 19:10:37 -0400 (Mon, 10 Apr 2023)
EndedAt: 2023-04-10 19:12:09 -0400 (Mon, 10 Apr 2023)
EllapsedTime: 92.1 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.62.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.2.3 (2023-03-15)
* 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.62.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... 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.16-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.16-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.2/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.2/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.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 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.321   0.205   1.903 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-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.16-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
Ncells 448605 24.0     969425 51.8         NA   624605 33.4
Vcells 811930  6.2    8388608 64.0      98304  1889187 14.5
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Apr 10 19:11:05 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon Apr 10 19:11:07 2023"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x60000254c000>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Mon Apr 10 19:11:25 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Mon Apr 10 19:11:29 2023"
> 
> ColMode(tmp2)
<pointer: 0x60000254c000>
> 
> 
> 
> ### 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,] 101.6631575  1.1514225 0.1720080  0.1268592
[2,]   1.0664085 -2.1076650 1.0710948 -0.1895638
[3,]   0.4308063  1.4534216 0.1370200 -3.2103057
[4,]  -0.2196170  0.2281656 0.1743593  0.2192946
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.16-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,] 101.6631575 1.1514225 0.1720080 0.1268592
[2,]   1.0664085 2.1076650 1.0710948 0.1895638
[3,]   0.4308063 1.4534216 0.1370200 3.2103057
[4,]   0.2196170 0.2281656 0.1743593 0.2192946
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.16-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,] 10.0828150 1.0730436 0.4147385 0.3561730
[2,]  1.0326706 1.4517799 1.0349371 0.4353892
[3,]  0.6563584 1.2055794 0.3701621 1.7917326
[4,]  0.4686332 0.4776668 0.4175636 0.4682890
> 
> 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.16-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,] 227.49131 36.88186 29.31939 28.68859
[2,]  36.39311 41.62546 36.42047 29.54346
[3,]  31.99439 38.50922 28.83864 46.12763
[4,]  29.90595 30.00483 29.34999 29.90218
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x6000025200c0>
> exp(tmp5)
<pointer: 0x6000025200c0>
> log(tmp5,2)
<pointer: 0x6000025200c0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 473.4934
> Min(tmp5)
[1] 52.37768
> mean(tmp5)
[1] 72.22258
> Sum(tmp5)
[1] 14444.52
> Var(tmp5)
[1] 893.381
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 93.74500 69.97967 69.25264 69.95783 69.26291 70.06179 71.65685 69.22325
 [9] 69.61035 69.47549
> rowSums(tmp5)
 [1] 1874.900 1399.593 1385.053 1399.157 1385.258 1401.236 1433.137 1384.465
 [9] 1392.207 1389.510
> rowVars(tmp5)
 [1] 8049.31620   93.31133   83.32622   83.91493   97.83352   79.15999
 [7]   94.24336   90.28525   89.54206   49.41540
> rowSd(tmp5)
 [1] 89.717981  9.659779  9.128320  9.160509  9.891083  8.897190  9.707902
 [8]  9.501855  9.462667  7.029609
> rowMax(tmp5)
 [1] 473.49335  86.63795  96.00862  86.15628  92.43497  86.53577  93.27954
 [8]  84.14962  90.89071  80.90977
> rowMin(tmp5)
 [1] 59.71154 54.46284 54.38572 54.81102 54.22158 57.45539 54.99172 52.37768
 [9] 55.22932 57.32599
> 
> colMeans(tmp5)
 [1] 113.67686  73.68637  67.29105  71.50421  72.59195  65.37331  68.32404
 [8]  70.92994  70.07107  70.52049  76.46878  68.03169  69.54460  67.04955
[15]  70.76779  69.41669  70.55840  71.87200  67.59905  69.17375
> colSums(tmp5)
 [1] 1136.7686  736.8637  672.9105  715.0421  725.9195  653.7331  683.2404
 [8]  709.2994  700.7107  705.2049  764.6878  680.3169  695.4460  670.4955
[15]  707.6779  694.1669  705.5840  718.7200  675.9905  691.7375
> colVars(tmp5)
 [1] 16043.29993   127.52427    35.12796   127.39730   137.62068    61.95647
 [7]    82.69131    76.52372    36.47981   116.76012    76.50454    70.73738
[13]    63.59281    68.95233    71.02021    69.67462    94.87691    82.60088
[19]    94.09140    71.81228
> colSd(tmp5)
 [1] 126.662149  11.292664   5.926884  11.287041  11.731184   7.871243
 [7]   9.093476   8.747784   6.039852  10.805560   8.746688   8.410552
[13]   7.974510   8.303754   8.427349   8.347132   9.740478   9.088503
[19]   9.700072   8.474213
> colMax(tmp5)
 [1] 473.49335  86.63795  75.86261  96.00862  92.43497  78.14904  83.29457
 [8]  86.15628  78.19470  93.27954  90.89071  81.32565  81.76614  80.90977
[15]  85.63677  80.42572  85.39621  83.49734  83.03205  84.22657
> colMin(tmp5)
 [1] 62.24531 54.99172 60.02385 59.71154 56.16304 55.66778 58.12542 58.31029
 [9] 62.10558 52.37768 65.24643 57.32599 59.97135 57.45539 54.22158 55.22932
[17] 54.81102 54.38572 54.46284 58.20944
> 
> 
> ### 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] 93.74500       NA 69.25264 69.95783 69.26291 70.06179 71.65685 69.22325
 [9] 69.61035 69.47549
> rowSums(tmp5)
 [1] 1874.900       NA 1385.053 1399.157 1385.258 1401.236 1433.137 1384.465
 [9] 1392.207 1389.510
> rowVars(tmp5)
 [1] 8049.31620   84.41506   83.32622   83.91493   97.83352   79.15999
 [7]   94.24336   90.28525   89.54206   49.41540
> rowSd(tmp5)
 [1] 89.717981  9.187767  9.128320  9.160509  9.891083  8.897190  9.707902
 [8]  9.501855  9.462667  7.029609
> rowMax(tmp5)
 [1] 473.49335        NA  96.00862  86.15628  92.43497  86.53577  93.27954
 [8]  84.14962  90.89071  80.90977
> rowMin(tmp5)
 [1] 59.71154       NA 54.38572 54.81102 54.22158 57.45539 54.99172 52.37768
 [9] 55.22932 57.32599
> 
> colMeans(tmp5)
 [1] 113.67686  73.68637  67.29105  71.50421  72.59195  65.37331  68.32404
 [8]  70.92994  70.07107  70.52049  76.46878  68.03169  69.54460  67.04955
[15]  70.76779  69.41669  70.55840  71.87200        NA  69.17375
> colSums(tmp5)
 [1] 1136.7686  736.8637  672.9105  715.0421  725.9195  653.7331  683.2404
 [8]  709.2994  700.7107  705.2049  764.6878  680.3169  695.4460  670.4955
[15]  707.6779  694.1669  705.5840  718.7200        NA  691.7375
> colVars(tmp5)
 [1] 16043.29993   127.52427    35.12796   127.39730   137.62068    61.95647
 [7]    82.69131    76.52372    36.47981   116.76012    76.50454    70.73738
[13]    63.59281    68.95233    71.02021    69.67462    94.87691    82.60088
[19]          NA    71.81228
> colSd(tmp5)
 [1] 126.662149  11.292664   5.926884  11.287041  11.731184   7.871243
 [7]   9.093476   8.747784   6.039852  10.805560   8.746688   8.410552
[13]   7.974510   8.303754   8.427349   8.347132   9.740478   9.088503
[19]         NA   8.474213
> colMax(tmp5)
 [1] 473.49335  86.63795  75.86261  96.00862  92.43497  78.14904  83.29457
 [8]  86.15628  78.19470  93.27954  90.89071  81.32565  81.76614  80.90977
[15]  85.63677  80.42572  85.39621  83.49734        NA  84.22657
> colMin(tmp5)
 [1] 62.24531 54.99172 60.02385 59.71154 56.16304 55.66778 58.12542 58.31029
 [9] 62.10558 52.37768 65.24643 57.32599 59.97135 57.45539 54.22158 55.22932
[17] 54.81102 54.38572       NA 58.20944
> 
> Max(tmp5,na.rm=TRUE)
[1] 473.4934
> Min(tmp5,na.rm=TRUE)
[1] 52.37768
> mean(tmp5,na.rm=TRUE)
[1] 72.31182
> Sum(tmp5,na.rm=TRUE)
[1] 14390.05
> Var(tmp5,na.rm=TRUE)
[1] 896.292
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.74500 70.79634 69.25264 69.95783 69.26291 70.06179 71.65685 69.22325
 [9] 69.61035 69.47549
> rowSums(tmp5,na.rm=TRUE)
 [1] 1874.900 1345.130 1385.053 1399.157 1385.258 1401.236 1433.137 1384.465
 [9] 1392.207 1389.510
> rowVars(tmp5,na.rm=TRUE)
 [1] 8049.31620   84.41506   83.32622   83.91493   97.83352   79.15999
 [7]   94.24336   90.28525   89.54206   49.41540
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.717981  9.187767  9.128320  9.160509  9.891083  8.897190  9.707902
 [8]  9.501855  9.462667  7.029609
> rowMax(tmp5,na.rm=TRUE)
 [1] 473.49335  86.63795  96.00862  86.15628  92.43497  86.53577  93.27954
 [8]  84.14962  90.89071  80.90977
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.71154 57.95682 54.38572 54.81102 54.22158 57.45539 54.99172 52.37768
 [9] 55.22932 57.32599
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.67686  73.68637  67.29105  71.50421  72.59195  65.37331  68.32404
 [8]  70.92994  70.07107  70.52049  76.46878  68.03169  69.54460  67.04955
[15]  70.76779  69.41669  70.55840  71.87200  69.05863  69.17375
> colSums(tmp5,na.rm=TRUE)
 [1] 1136.7686  736.8637  672.9105  715.0421  725.9195  653.7331  683.2404
 [8]  709.2994  700.7107  705.2049  764.6878  680.3169  695.4460  670.4955
[15]  707.6779  694.1669  705.5840  718.7200  621.5276  691.7375
> colVars(tmp5,na.rm=TRUE)
 [1] 16043.29993   127.52427    35.12796   127.39730   137.62068    61.95647
 [7]    82.69131    76.52372    36.47981   116.76012    76.50454    70.73738
[13]    63.59281    68.95233    71.02021    69.67462    94.87691    82.60088
[19]    81.88614    71.81228
> colSd(tmp5,na.rm=TRUE)
 [1] 126.662149  11.292664   5.926884  11.287041  11.731184   7.871243
 [7]   9.093476   8.747784   6.039852  10.805560   8.746688   8.410552
[13]   7.974510   8.303754   8.427349   8.347132   9.740478   9.088503
[19]   9.049096   8.474213
> colMax(tmp5,na.rm=TRUE)
 [1] 473.49335  86.63795  75.86261  96.00862  92.43497  78.14904  83.29457
 [8]  86.15628  78.19470  93.27954  90.89071  81.32565  81.76614  80.90977
[15]  85.63677  80.42572  85.39621  83.49734  83.03205  84.22657
> colMin(tmp5,na.rm=TRUE)
 [1] 62.24531 54.99172 60.02385 59.71154 56.16304 55.66778 58.12542 58.31029
 [9] 62.10558 52.37768 65.24643 57.32599 59.97135 57.45539 54.22158 55.22932
[17] 54.81102 54.38572 58.01830 58.20944
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 93.74500      NaN 69.25264 69.95783 69.26291 70.06179 71.65685 69.22325
 [9] 69.61035 69.47549
> rowSums(tmp5,na.rm=TRUE)
 [1] 1874.900    0.000 1385.053 1399.157 1385.258 1401.236 1433.137 1384.465
 [9] 1392.207 1389.510
> rowVars(tmp5,na.rm=TRUE)
 [1] 8049.31620         NA   83.32622   83.91493   97.83352   79.15999
 [7]   94.24336   90.28525   89.54206   49.41540
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.717981        NA  9.128320  9.160509  9.891083  8.897190  9.707902
 [8]  9.501855  9.462667  7.029609
> rowMax(tmp5,na.rm=TRUE)
 [1] 473.49335        NA  96.00862  86.15628  92.43497  86.53577  93.27954
 [8]  84.14962  90.89071  80.90977
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.71154       NA 54.38572 54.81102 54.22158 57.45539 54.99172 52.37768
 [9] 55.22932 57.32599
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 117.89124  72.24731  66.34512  72.61680  74.04584  66.15310  67.90665
 [8]  71.39421  69.20672  71.45235  75.66659  69.15112  69.47945  66.66375
[15]  70.04226  68.71069  68.90975  72.88864       NaN  69.60561
> colSums(tmp5,na.rm=TRUE)
 [1] 1061.0211  650.2258  597.1060  653.5512  666.4125  595.3779  611.1599
 [8]  642.5479  622.8605  643.0711  680.9993  622.3601  625.3151  599.9738
[15]  630.3803  618.3962  620.1878  655.9977    0.0000  626.4505
> colVars(tmp5,na.rm=TRUE)
 [1] 17848.90176   120.16711    29.45262   129.39590   131.04318    62.86018
 [7]    91.06783    83.66428    32.63503   121.58617    78.82816    65.48192
[13]    71.49416    75.89695    73.97578    72.77657    76.15865    81.29845
[19]          NA    78.69066
> colSd(tmp5,na.rm=TRUE)
 [1] 133.599782  10.962076   5.427026  11.375232  11.447409   7.928441
 [7]   9.542946   9.146818   5.712708  11.026612   8.878522   8.092090
[13]   8.455422   8.711885   8.600917   8.530918   8.726892   9.016565
[19]         NA   8.870776
> colMax(tmp5,na.rm=TRUE)
 [1] 473.49335  86.53577  75.86261  96.00862  92.43497  78.14904  83.29457
 [8]  86.15628  78.19470  93.27954  90.89071  81.32565  81.76614  80.90977
[15]  85.63677  80.42572  81.62042  83.49734      -Inf  84.22657
> colMin(tmp5,na.rm=TRUE)
 [1] 62.24531 54.99172 60.02385 59.71154 56.16304 55.66778 58.12542 58.31029
 [9] 62.10558 52.37768 65.24643 57.32599 59.97135 57.45539 54.22158 55.22932
[17] 54.81102 54.38572      Inf 58.20944
> 
> 
> 
> 
> 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] 143.3553 342.4220 131.6664 277.9926 156.8183 247.9354 301.6599 214.3795
 [9] 188.8959 305.9053
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 143.3553 342.4220 131.6664 277.9926 156.8183 247.9354 301.6599 214.3795
 [9] 188.8959 305.9053
> 
> 
> 
> 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.705303e-13 -5.684342e-14  7.105427e-14 -5.684342e-14
 [6] -1.705303e-13 -5.684342e-14  5.684342e-14 -7.105427e-14  1.136868e-13
[11] -4.973799e-14  0.000000e+00 -1.989520e-13  5.684342e-14  5.684342e-14
[16] -5.684342e-14 -4.263256e-14 -5.684342e-14  2.842171e-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)
+ }
4   11 
8   2 
7   12 
3   6 
9   15 
6   5 
5   16 
7   14 
9   12 
9   6 
6   5 
10   19 
2   8 
10   16 
9   15 
9   11 
6   9 
5   4 
5   2 
8   5 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.686031
> Min(tmp)
[1] -3.0612
> mean(tmp)
[1] 0.007732439
> Sum(tmp)
[1] 0.7732439
> Var(tmp)
[1] 1.101651
> 
> rowMeans(tmp)
[1] 0.007732439
> rowSums(tmp)
[1] 0.7732439
> rowVars(tmp)
[1] 1.101651
> rowSd(tmp)
[1] 1.049596
> rowMax(tmp)
[1] 2.686031
> rowMin(tmp)
[1] -3.0612
> 
> colMeans(tmp)
  [1]  1.51296601 -1.55353175  1.41832885  0.65523449  0.62371321  0.16673383
  [7]  0.30651835 -0.68339952  1.54070302 -2.20502635  0.47302164 -1.24792764
 [13] -1.10842791  1.21327918 -1.53585066 -1.37544930  0.15868676  1.65908477
 [19]  0.55408184  0.69527724 -1.23623057 -3.06119977  0.52678808  0.43653829
 [25] -0.83670033  0.33492666  0.28615171 -0.52810654  1.07507117 -0.79974984
 [31]  0.32373440  0.19653804  0.06147551 -0.15331669 -1.28671251 -0.04164491
 [37]  0.59873980 -0.33584024 -0.43911739 -0.70020265  1.44571971 -1.27010206
 [43]  0.21960901 -0.21727855  0.95448776  0.56869362 -0.06477602 -0.49151454
 [49]  2.53978390  1.03544923 -0.41675850 -0.60716300  0.81302434  0.72694201
 [55] -1.25192498  1.45335949 -0.01825764 -0.06934377 -0.54052316  2.68603124
 [61] -0.33357628  0.29840997  1.41107617 -0.17118220  0.78411246 -2.82906556
 [67]  0.65869385 -0.11210997  0.04401439  0.13283939  0.35978739 -2.33512263
 [73]  0.53009098 -0.05056615 -0.71447282  0.73465285 -0.40326088 -0.48974865
 [79] -0.23479031  0.30137490  1.18858804 -0.58301982  0.16569507  0.05602347
 [85]  0.16423419  2.51986163 -0.15819183 -0.48295522  0.54006546 -0.10431560
 [91]  0.55420064 -1.33198717 -0.83776286 -0.16700020  1.44337477 -1.54081445
 [97] -1.40699119  1.02743481 -0.38795380 -0.65101533
> colSums(tmp)
  [1]  1.51296601 -1.55353175  1.41832885  0.65523449  0.62371321  0.16673383
  [7]  0.30651835 -0.68339952  1.54070302 -2.20502635  0.47302164 -1.24792764
 [13] -1.10842791  1.21327918 -1.53585066 -1.37544930  0.15868676  1.65908477
 [19]  0.55408184  0.69527724 -1.23623057 -3.06119977  0.52678808  0.43653829
 [25] -0.83670033  0.33492666  0.28615171 -0.52810654  1.07507117 -0.79974984
 [31]  0.32373440  0.19653804  0.06147551 -0.15331669 -1.28671251 -0.04164491
 [37]  0.59873980 -0.33584024 -0.43911739 -0.70020265  1.44571971 -1.27010206
 [43]  0.21960901 -0.21727855  0.95448776  0.56869362 -0.06477602 -0.49151454
 [49]  2.53978390  1.03544923 -0.41675850 -0.60716300  0.81302434  0.72694201
 [55] -1.25192498  1.45335949 -0.01825764 -0.06934377 -0.54052316  2.68603124
 [61] -0.33357628  0.29840997  1.41107617 -0.17118220  0.78411246 -2.82906556
 [67]  0.65869385 -0.11210997  0.04401439  0.13283939  0.35978739 -2.33512263
 [73]  0.53009098 -0.05056615 -0.71447282  0.73465285 -0.40326088 -0.48974865
 [79] -0.23479031  0.30137490  1.18858804 -0.58301982  0.16569507  0.05602347
 [85]  0.16423419  2.51986163 -0.15819183 -0.48295522  0.54006546 -0.10431560
 [91]  0.55420064 -1.33198717 -0.83776286 -0.16700020  1.44337477 -1.54081445
 [97] -1.40699119  1.02743481 -0.38795380 -0.65101533
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  1.51296601 -1.55353175  1.41832885  0.65523449  0.62371321  0.16673383
  [7]  0.30651835 -0.68339952  1.54070302 -2.20502635  0.47302164 -1.24792764
 [13] -1.10842791  1.21327918 -1.53585066 -1.37544930  0.15868676  1.65908477
 [19]  0.55408184  0.69527724 -1.23623057 -3.06119977  0.52678808  0.43653829
 [25] -0.83670033  0.33492666  0.28615171 -0.52810654  1.07507117 -0.79974984
 [31]  0.32373440  0.19653804  0.06147551 -0.15331669 -1.28671251 -0.04164491
 [37]  0.59873980 -0.33584024 -0.43911739 -0.70020265  1.44571971 -1.27010206
 [43]  0.21960901 -0.21727855  0.95448776  0.56869362 -0.06477602 -0.49151454
 [49]  2.53978390  1.03544923 -0.41675850 -0.60716300  0.81302434  0.72694201
 [55] -1.25192498  1.45335949 -0.01825764 -0.06934377 -0.54052316  2.68603124
 [61] -0.33357628  0.29840997  1.41107617 -0.17118220  0.78411246 -2.82906556
 [67]  0.65869385 -0.11210997  0.04401439  0.13283939  0.35978739 -2.33512263
 [73]  0.53009098 -0.05056615 -0.71447282  0.73465285 -0.40326088 -0.48974865
 [79] -0.23479031  0.30137490  1.18858804 -0.58301982  0.16569507  0.05602347
 [85]  0.16423419  2.51986163 -0.15819183 -0.48295522  0.54006546 -0.10431560
 [91]  0.55420064 -1.33198717 -0.83776286 -0.16700020  1.44337477 -1.54081445
 [97] -1.40699119  1.02743481 -0.38795380 -0.65101533
> colMin(tmp)
  [1]  1.51296601 -1.55353175  1.41832885  0.65523449  0.62371321  0.16673383
  [7]  0.30651835 -0.68339952  1.54070302 -2.20502635  0.47302164 -1.24792764
 [13] -1.10842791  1.21327918 -1.53585066 -1.37544930  0.15868676  1.65908477
 [19]  0.55408184  0.69527724 -1.23623057 -3.06119977  0.52678808  0.43653829
 [25] -0.83670033  0.33492666  0.28615171 -0.52810654  1.07507117 -0.79974984
 [31]  0.32373440  0.19653804  0.06147551 -0.15331669 -1.28671251 -0.04164491
 [37]  0.59873980 -0.33584024 -0.43911739 -0.70020265  1.44571971 -1.27010206
 [43]  0.21960901 -0.21727855  0.95448776  0.56869362 -0.06477602 -0.49151454
 [49]  2.53978390  1.03544923 -0.41675850 -0.60716300  0.81302434  0.72694201
 [55] -1.25192498  1.45335949 -0.01825764 -0.06934377 -0.54052316  2.68603124
 [61] -0.33357628  0.29840997  1.41107617 -0.17118220  0.78411246 -2.82906556
 [67]  0.65869385 -0.11210997  0.04401439  0.13283939  0.35978739 -2.33512263
 [73]  0.53009098 -0.05056615 -0.71447282  0.73465285 -0.40326088 -0.48974865
 [79] -0.23479031  0.30137490  1.18858804 -0.58301982  0.16569507  0.05602347
 [85]  0.16423419  2.51986163 -0.15819183 -0.48295522  0.54006546 -0.10431560
 [91]  0.55420064 -1.33198717 -0.83776286 -0.16700020  1.44337477 -1.54081445
 [97] -1.40699119  1.02743481 -0.38795380 -0.65101533
> colMedians(tmp)
  [1]  1.51296601 -1.55353175  1.41832885  0.65523449  0.62371321  0.16673383
  [7]  0.30651835 -0.68339952  1.54070302 -2.20502635  0.47302164 -1.24792764
 [13] -1.10842791  1.21327918 -1.53585066 -1.37544930  0.15868676  1.65908477
 [19]  0.55408184  0.69527724 -1.23623057 -3.06119977  0.52678808  0.43653829
 [25] -0.83670033  0.33492666  0.28615171 -0.52810654  1.07507117 -0.79974984
 [31]  0.32373440  0.19653804  0.06147551 -0.15331669 -1.28671251 -0.04164491
 [37]  0.59873980 -0.33584024 -0.43911739 -0.70020265  1.44571971 -1.27010206
 [43]  0.21960901 -0.21727855  0.95448776  0.56869362 -0.06477602 -0.49151454
 [49]  2.53978390  1.03544923 -0.41675850 -0.60716300  0.81302434  0.72694201
 [55] -1.25192498  1.45335949 -0.01825764 -0.06934377 -0.54052316  2.68603124
 [61] -0.33357628  0.29840997  1.41107617 -0.17118220  0.78411246 -2.82906556
 [67]  0.65869385 -0.11210997  0.04401439  0.13283939  0.35978739 -2.33512263
 [73]  0.53009098 -0.05056615 -0.71447282  0.73465285 -0.40326088 -0.48974865
 [79] -0.23479031  0.30137490  1.18858804 -0.58301982  0.16569507  0.05602347
 [85]  0.16423419  2.51986163 -0.15819183 -0.48295522  0.54006546 -0.10431560
 [91]  0.55420064 -1.33198717 -0.83776286 -0.16700020  1.44337477 -1.54081445
 [97] -1.40699119  1.02743481 -0.38795380 -0.65101533
> colRanges(tmp)
         [,1]      [,2]     [,3]      [,4]      [,5]      [,6]      [,7]
[1,] 1.512966 -1.553532 1.418329 0.6552345 0.6237132 0.1667338 0.3065183
[2,] 1.512966 -1.553532 1.418329 0.6552345 0.6237132 0.1667338 0.3065183
           [,8]     [,9]     [,10]     [,11]     [,12]     [,13]    [,14]
[1,] -0.6833995 1.540703 -2.205026 0.4730216 -1.247928 -1.108428 1.213279
[2,] -0.6833995 1.540703 -2.205026 0.4730216 -1.247928 -1.108428 1.213279
         [,15]     [,16]     [,17]    [,18]     [,19]     [,20]     [,21]
[1,] -1.535851 -1.375449 0.1586868 1.659085 0.5540818 0.6952772 -1.236231
[2,] -1.535851 -1.375449 0.1586868 1.659085 0.5540818 0.6952772 -1.236231
       [,22]     [,23]     [,24]      [,25]     [,26]     [,27]      [,28]
[1,] -3.0612 0.5267881 0.4365383 -0.8367003 0.3349267 0.2861517 -0.5281065
[2,] -3.0612 0.5267881 0.4365383 -0.8367003 0.3349267 0.2861517 -0.5281065
        [,29]      [,30]     [,31]    [,32]      [,33]      [,34]     [,35]
[1,] 1.075071 -0.7997498 0.3237344 0.196538 0.06147551 -0.1533167 -1.286713
[2,] 1.075071 -0.7997498 0.3237344 0.196538 0.06147551 -0.1533167 -1.286713
           [,36]     [,37]      [,38]      [,39]      [,40]   [,41]     [,42]
[1,] -0.04164491 0.5987398 -0.3358402 -0.4391174 -0.7002027 1.44572 -1.270102
[2,] -0.04164491 0.5987398 -0.3358402 -0.4391174 -0.7002027 1.44572 -1.270102
        [,43]      [,44]     [,45]     [,46]       [,47]      [,48]    [,49]
[1,] 0.219609 -0.2172785 0.9544878 0.5686936 -0.06477602 -0.4915145 2.539784
[2,] 0.219609 -0.2172785 0.9544878 0.5686936 -0.06477602 -0.4915145 2.539784
        [,50]      [,51]     [,52]     [,53]    [,54]     [,55]    [,56]
[1,] 1.035449 -0.4167585 -0.607163 0.8130243 0.726942 -1.251925 1.453359
[2,] 1.035449 -0.4167585 -0.607163 0.8130243 0.726942 -1.251925 1.453359
           [,57]       [,58]      [,59]    [,60]      [,61]   [,62]    [,63]
[1,] -0.01825764 -0.06934377 -0.5405232 2.686031 -0.3335763 0.29841 1.411076
[2,] -0.01825764 -0.06934377 -0.5405232 2.686031 -0.3335763 0.29841 1.411076
          [,64]     [,65]     [,66]     [,67]    [,68]      [,69]     [,70]
[1,] -0.1711822 0.7841125 -2.829066 0.6586939 -0.11211 0.04401439 0.1328394
[2,] -0.1711822 0.7841125 -2.829066 0.6586939 -0.11211 0.04401439 0.1328394
         [,71]     [,72]    [,73]       [,74]      [,75]     [,76]      [,77]
[1,] 0.3597874 -2.335123 0.530091 -0.05056615 -0.7144728 0.7346529 -0.4032609
[2,] 0.3597874 -2.335123 0.530091 -0.05056615 -0.7144728 0.7346529 -0.4032609
          [,78]      [,79]     [,80]    [,81]      [,82]     [,83]      [,84]
[1,] -0.4897486 -0.2347903 0.3013749 1.188588 -0.5830198 0.1656951 0.05602347
[2,] -0.4897486 -0.2347903 0.3013749 1.188588 -0.5830198 0.1656951 0.05602347
         [,85]    [,86]      [,87]      [,88]     [,89]      [,90]     [,91]
[1,] 0.1642342 2.519862 -0.1581918 -0.4829552 0.5400655 -0.1043156 0.5542006
[2,] 0.1642342 2.519862 -0.1581918 -0.4829552 0.5400655 -0.1043156 0.5542006
         [,92]      [,93]      [,94]    [,95]     [,96]     [,97]    [,98]
[1,] -1.331987 -0.8377629 -0.1670002 1.443375 -1.540814 -1.406991 1.027435
[2,] -1.331987 -0.8377629 -0.1670002 1.443375 -1.540814 -1.406991 1.027435
          [,99]     [,100]
[1,] -0.3879538 -0.6510153
[2,] -0.3879538 -0.6510153
> 
> 
> Max(tmp2)
[1] 2.108765
> Min(tmp2)
[1] -1.722456
> mean(tmp2)
[1] 0.1139423
> Sum(tmp2)
[1] 11.39423
> Var(tmp2)
[1] 0.7917013
> 
> rowMeans(tmp2)
  [1]  0.56417504 -1.11001798 -0.22011769  1.19815403  0.76925509  0.31664380
  [7] -1.13775834  0.57247662 -0.75924534  0.80039269 -0.57806719 -0.47078283
 [13]  0.91682680  0.73212216  0.09328969  1.76756340 -1.37921321  0.59467389
 [19] -0.50655313 -0.83206485 -0.49412450 -0.51950600  0.38142585 -0.42819686
 [25]  1.23940206  0.39839167 -0.30356688 -1.47620422 -0.98008051  0.65300433
 [31]  0.97242945  1.18451734  1.69787971  0.46652039 -1.09657486 -0.63725344
 [37] -0.41664626  0.08932743 -1.24724612  0.35600972  1.34799594  0.60696068
 [43]  0.67380273  0.46563954 -0.63530950 -0.40870322  0.33352973 -0.86109420
 [49] -0.63756886  0.68714299  0.11539337  0.88393137  0.89841342  0.39661250
 [55]  1.80723321 -0.27847362  0.38053527  0.43212294  0.89939735  1.13950503
 [61]  1.33375016 -1.52240679  0.32985139 -0.78622196  0.22479328  2.10876466
 [67] -1.49255932  0.20436080 -0.21805918  0.26827385  1.34774941  0.34071719
 [73] -0.65609846  0.52110337  1.80100595  0.26206909  0.87108774 -1.44989675
 [79] -1.59261388  0.72282326 -0.61155382 -0.63385947  0.50200374 -1.17473680
 [85] -0.86706941  1.50666279  0.71061590 -0.06820746 -0.86489260  0.43068636
 [91]  1.28713834  0.37346576 -0.50519177 -0.31926249  0.47194597  0.72945749
 [97] -0.16638693 -1.72245562 -0.42257895  0.70162550
> rowSums(tmp2)
  [1]  0.56417504 -1.11001798 -0.22011769  1.19815403  0.76925509  0.31664380
  [7] -1.13775834  0.57247662 -0.75924534  0.80039269 -0.57806719 -0.47078283
 [13]  0.91682680  0.73212216  0.09328969  1.76756340 -1.37921321  0.59467389
 [19] -0.50655313 -0.83206485 -0.49412450 -0.51950600  0.38142585 -0.42819686
 [25]  1.23940206  0.39839167 -0.30356688 -1.47620422 -0.98008051  0.65300433
 [31]  0.97242945  1.18451734  1.69787971  0.46652039 -1.09657486 -0.63725344
 [37] -0.41664626  0.08932743 -1.24724612  0.35600972  1.34799594  0.60696068
 [43]  0.67380273  0.46563954 -0.63530950 -0.40870322  0.33352973 -0.86109420
 [49] -0.63756886  0.68714299  0.11539337  0.88393137  0.89841342  0.39661250
 [55]  1.80723321 -0.27847362  0.38053527  0.43212294  0.89939735  1.13950503
 [61]  1.33375016 -1.52240679  0.32985139 -0.78622196  0.22479328  2.10876466
 [67] -1.49255932  0.20436080 -0.21805918  0.26827385  1.34774941  0.34071719
 [73] -0.65609846  0.52110337  1.80100595  0.26206909  0.87108774 -1.44989675
 [79] -1.59261388  0.72282326 -0.61155382 -0.63385947  0.50200374 -1.17473680
 [85] -0.86706941  1.50666279  0.71061590 -0.06820746 -0.86489260  0.43068636
 [91]  1.28713834  0.37346576 -0.50519177 -0.31926249  0.47194597  0.72945749
 [97] -0.16638693 -1.72245562 -0.42257895  0.70162550
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  0.56417504 -1.11001798 -0.22011769  1.19815403  0.76925509  0.31664380
  [7] -1.13775834  0.57247662 -0.75924534  0.80039269 -0.57806719 -0.47078283
 [13]  0.91682680  0.73212216  0.09328969  1.76756340 -1.37921321  0.59467389
 [19] -0.50655313 -0.83206485 -0.49412450 -0.51950600  0.38142585 -0.42819686
 [25]  1.23940206  0.39839167 -0.30356688 -1.47620422 -0.98008051  0.65300433
 [31]  0.97242945  1.18451734  1.69787971  0.46652039 -1.09657486 -0.63725344
 [37] -0.41664626  0.08932743 -1.24724612  0.35600972  1.34799594  0.60696068
 [43]  0.67380273  0.46563954 -0.63530950 -0.40870322  0.33352973 -0.86109420
 [49] -0.63756886  0.68714299  0.11539337  0.88393137  0.89841342  0.39661250
 [55]  1.80723321 -0.27847362  0.38053527  0.43212294  0.89939735  1.13950503
 [61]  1.33375016 -1.52240679  0.32985139 -0.78622196  0.22479328  2.10876466
 [67] -1.49255932  0.20436080 -0.21805918  0.26827385  1.34774941  0.34071719
 [73] -0.65609846  0.52110337  1.80100595  0.26206909  0.87108774 -1.44989675
 [79] -1.59261388  0.72282326 -0.61155382 -0.63385947  0.50200374 -1.17473680
 [85] -0.86706941  1.50666279  0.71061590 -0.06820746 -0.86489260  0.43068636
 [91]  1.28713834  0.37346576 -0.50519177 -0.31926249  0.47194597  0.72945749
 [97] -0.16638693 -1.72245562 -0.42257895  0.70162550
> rowMin(tmp2)
  [1]  0.56417504 -1.11001798 -0.22011769  1.19815403  0.76925509  0.31664380
  [7] -1.13775834  0.57247662 -0.75924534  0.80039269 -0.57806719 -0.47078283
 [13]  0.91682680  0.73212216  0.09328969  1.76756340 -1.37921321  0.59467389
 [19] -0.50655313 -0.83206485 -0.49412450 -0.51950600  0.38142585 -0.42819686
 [25]  1.23940206  0.39839167 -0.30356688 -1.47620422 -0.98008051  0.65300433
 [31]  0.97242945  1.18451734  1.69787971  0.46652039 -1.09657486 -0.63725344
 [37] -0.41664626  0.08932743 -1.24724612  0.35600972  1.34799594  0.60696068
 [43]  0.67380273  0.46563954 -0.63530950 -0.40870322  0.33352973 -0.86109420
 [49] -0.63756886  0.68714299  0.11539337  0.88393137  0.89841342  0.39661250
 [55]  1.80723321 -0.27847362  0.38053527  0.43212294  0.89939735  1.13950503
 [61]  1.33375016 -1.52240679  0.32985139 -0.78622196  0.22479328  2.10876466
 [67] -1.49255932  0.20436080 -0.21805918  0.26827385  1.34774941  0.34071719
 [73] -0.65609846  0.52110337  1.80100595  0.26206909  0.87108774 -1.44989675
 [79] -1.59261388  0.72282326 -0.61155382 -0.63385947  0.50200374 -1.17473680
 [85] -0.86706941  1.50666279  0.71061590 -0.06820746 -0.86489260  0.43068636
 [91]  1.28713834  0.37346576 -0.50519177 -0.31926249  0.47194597  0.72945749
 [97] -0.16638693 -1.72245562 -0.42257895  0.70162550
> 
> colMeans(tmp2)
[1] 0.1139423
> colSums(tmp2)
[1] 11.39423
> colVars(tmp2)
[1] 0.7917013
> colSd(tmp2)
[1] 0.889776
> colMax(tmp2)
[1] 2.108765
> colMin(tmp2)
[1] -1.722456
> colMedians(tmp2)
[1] 0.3232476
> colRanges(tmp2)
          [,1]
[1,] -1.722456
[2,]  2.108765
> 
> 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]  3.14313764 -1.97717161  1.96091500  2.33269147 -1.30184907 -0.43136822
 [7] -0.30554173  2.81317502  0.08762252 -0.98902090
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.7358265
[2,] -0.4215861
[3,]  0.3824011
[4,]  0.7899804
[5,]  1.3789948
> 
> rowApply(tmp,sum)
 [1] -0.47016730 -4.50166150  0.69317444 -0.69958127  3.50083558  1.03536887
 [7] -0.01771426  3.14913301  1.06543261  1.57776995
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    3   10    6    8    1    4    9    1    8    10
 [2,]    9    3    9    2   10    8    1    2    1     4
 [3,]    4    1    7   10    8    7   10    6    5     2
 [4,]    5    5   10    5    2    3    5    7   10     8
 [5,]    1    9    8    6    9    5    2    5    2     6
 [6,]   10    4    4    3    4    1    6    3    9     5
 [7,]    2    7    1    7    5    9    3    8    4     9
 [8,]    8    8    2    9    6   10    4    9    7     3
 [9,]    7    6    5    1    3    6    7    4    6     7
[10,]    6    2    3    4    7    2    8   10    3     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -2.87098798 -1.69892554 -2.04443240 -0.00886948 -1.07338721 -0.11676654
 [7] -3.46394078 -0.48782120  0.32368283  1.94483338  2.56318253  3.73479222
[13] -0.64974370 -2.04220376 -1.17313583 -1.86221870 -4.23386864  1.65124933
[19]  0.36601697  1.16815598
> colApply(tmp,quantile)[,1]
             [,1]
[1,] -1.405296270
[2,] -0.794775709
[3,] -0.691631314
[4,] -0.005941072
[5,]  0.026656387
> 
> rowApply(tmp,sum)
[1]  -5.5847543   1.0954893 -10.0894644   3.7099976   0.8943431
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   11    9    7    3    2
[2,]   19    4    2    9   10
[3,]    2   16   19    2    7
[4,]   13   13    1   13   18
[5,]    5    8   12   17    8
> 
> 
> as.matrix(tmp)
             [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -0.005941072  1.0985437 -1.6827054  0.1325826 -1.3154324  0.1252776
[2,]  0.026656387 -0.7623232  0.4950316  0.2408958 -0.2934437  0.1691741
[3,] -0.691631314 -2.0350022  1.0104798 -2.0351392 -0.3299830 -0.2472353
[4,] -0.794775709  0.1126369 -1.3542663  0.4472109  1.2926258  0.3904564
[5,] -1.405296270 -0.1127807 -0.5129721  1.2055805 -0.4271539 -0.5544394
           [,7]       [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -1.0724076 -0.2273948 -0.9015081  1.2043289  0.6353421 -0.4317101
[2,]  0.2815231 -0.3297068 -1.1169587  0.3233856  0.8652880  2.7212512
[3,] -0.8836231 -0.6419693 -1.5385556 -0.4028743 -0.1498128  0.7386445
[4,] -0.3963486  0.3899716  1.3210941  1.6490417 -0.4834940  1.1291435
[5,] -1.3930846  0.3212781  2.5596111 -0.8290486  1.6958592 -0.4225369
          [,13]      [,14]      [,15]      [,16]       [,17]       [,18]
[1,]  0.6466000 -1.3633974 -1.6816890  0.9077241 -2.54771730  0.73852530
[2,]  0.1365025  0.7255611  1.7225030 -1.7105535 -1.54752639 -0.50021802
[3,] -1.6130875 -0.4185657  1.2455137 -0.2678231 -0.44715245 -0.26357939
[4,] -0.2225249 -2.0786345 -0.6919686  0.5813902  0.21859811  1.61550061
[5,]  0.4027663  1.0928327 -1.7674949 -1.3729565  0.08992939  0.06102082
            [,19]      [,20]
[1,] -0.638419682  0.7946442
[2,] -0.554440738  0.2028879
[3,]  0.008228255 -1.1262963
[4,]  0.475353449  0.1089869
[5,]  1.075295683  1.1879333
> 
> 
> 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.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  649  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.16-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.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1       col2     col3     col4      col5       col6       col7
row1 -0.4480019 -0.3367536 1.313258 1.119392 0.8079616 -0.9364835 -0.4302494
          col8      col9     col10    col11     col12    col13      col14
row1 0.7451777 -2.500764 0.7762266 1.397966 0.7702913 1.316764 -0.1620977
          col15     col16      col17    col18     col19    col20
row1 -0.7422938 0.6711705 -0.8349211 1.474523 0.3980224 1.495844
> tmp[,"col10"]
           col10
row1  0.77622656
row2 -0.08899477
row3  0.80998526
row4 -0.65946816
row5  0.46456685
> tmp[c("row1","row5"),]
           col1       col2       col3      col4      col5       col6       col7
row1 -0.4480019 -0.3367536  1.3132576 1.1193918 0.8079616 -0.9364835 -0.4302494
row5 -1.5643873 -0.3118782 -0.1824106 0.0941028 1.2468118  0.7828359  0.1778993
           col8       col9     col10      col11      col12    col13      col14
row1  0.7451777 -2.5007638 0.7762266  1.3979664  0.7702913 1.316764 -0.1620977
row5 -0.2760611  0.4740478 0.4645669 -0.4494201 -0.0593841 1.665395  0.8952196
          col15      col16      col17     col18      col19    col20
row1 -0.7422938  0.6711705 -0.8349211 1.4745231  0.3980224 1.495844
row5  0.5056406 -0.1568010  1.7464113 0.7200847 -0.4211994 1.476947
> tmp[,c("col6","col20")]
           col6       col20
row1 -0.9364835  1.49584435
row2  0.2609351 -0.80505191
row3  0.3137735 -0.07249832
row4  1.4403446 -0.04248177
row5  0.7828359  1.47694709
> tmp[c("row1","row5"),c("col6","col20")]
           col6    col20
row1 -0.9364835 1.495844
row5  0.7828359 1.476947
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.89566 50.10111 51.08203 49.74653 50.04597 104.0253 48.83968 49.89663
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.56106 51.75663 50.29562 50.91124 49.34776 50.41196 49.50692 52.06391
        col17    col18    col19    col20
row1 49.73615 49.62215 50.26385 104.8013
> tmp[,"col10"]
        col10
row1 51.75663
row2 28.29479
row3 29.98220
row4 30.52597
row5 49.95786
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.89566 50.10111 51.08203 49.74653 50.04597 104.0253 48.83968 49.89663
row5 50.44393 50.84507 50.35779 50.55732 49.50599 103.8441 49.32224 50.31865
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.56106 51.75663 50.29562 50.91124 49.34776 50.41196 49.50692 52.06391
row5 51.02158 49.95786 49.81255 47.73667 49.22212 49.13365 49.47704 49.23085
        col17    col18    col19    col20
row1 49.73615 49.62215 50.26385 104.8013
row5 50.55837 49.95886 49.91479 104.3389
> tmp[,c("col6","col20")]
          col6     col20
row1 104.02530 104.80126
row2  76.71049  77.02320
row3  75.14514  74.70135
row4  75.87180  75.48617
row5 103.84413 104.33887
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.0253 104.8013
row5 103.8441 104.3389
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.0253 104.8013
row5 103.8441 104.3389
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -1.4768548
[2,]  1.5424829
[3,] -0.1501905
[4,] -2.0488038
[5,]  0.9450060
> tmp[,c("col17","col7")]
          col17       col7
[1,]  1.3544945  0.4390444
[2,] -0.9716171  1.2080035
[3,] -0.2541014 -0.6020361
[4,]  1.4865233  0.1826354
[5,]  0.8293983 -1.2358400
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,]  0.1105284 -0.88599215
[2,] -0.7803532 -0.82427408
[3,]  0.2642252  0.79861083
[4,]  1.0801875  0.01102349
[5,] -0.4986302 -0.65651693
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] 0.1105284
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,]  0.1105284
[2,] -0.7803532
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]       [,4]       [,5]      [,6]       [,7]
row3  1.0537751  0.3326406 1.9618075  0.2156218 -1.1003958 0.5365710 -0.5288265
row1 -0.4928938 -0.2841769 0.9087803 -0.1323216  0.5743496 0.7827555 -1.0673509
           [,8]      [,9]    [,10]      [,11]      [,12]      [,13]      [,14]
row3 -0.1255684 0.3479782 0.344461  0.9785095 -0.0643898  0.6935757 -0.8145702
row1 -1.0603023 0.3017823 1.302709 -1.0959329  0.3932523 -0.9944418  1.5938283
         [,15]      [,16]      [,17]     [,18]       [,19]      [,20]
row3 0.4221057 -1.1332971  0.5461115 0.8074415 -1.97861057 -0.9081509
row1 0.5423218 -0.4566722 -0.8022886 1.2481565 -0.01819649  0.7231448
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]    [,2]     [,3]      [,4]      [,5]        [,6]     [,7]
row2 -0.9291353 1.01315 1.368872 0.3518444 0.0182941 -0.06523732 -2.40208
          [,8]       [,9]     [,10]
row2 -1.375784 0.07314706 0.3090484
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]       [,2]        [,3]       [,4]     [,5]      [,6]      [,7]
row5 -1.84968 -0.3522318 -0.09343504 -0.4870131 1.464061 -1.427377 -1.991882
          [,8]     [,9]     [,10]     [,11]      [,12]    [,13]      [,14]
row5 -2.348474 0.998809 0.8721311 -1.247786 -0.6711546 1.285721 0.07136395
         [,15]     [,16]      [,17]    [,18]      [,19]     [,20]
row5 0.9250405 0.9298066 -0.3636719 1.376575 -0.9001012 0.1214018
> 
> 
> 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: 0x600002568000>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc641933548"
 [2] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc6278f2b9a"
 [3] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc628779fc0"
 [4] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc645990b01"
 [5] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc642a19259"
 [6] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc67d8f333b"
 [7] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc6446ca6e3"
 [8] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc63940a42d"
 [9] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc642daa3b8"
[10] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc62032a752"
[11] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc65d870901"
[12] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc64c60509f"
[13] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc6474d1de5"
[14] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc617e5c9f5"
[15] "/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests/BM8cc66f2e0014"
> 
> 
> ### 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: 0x600002558180>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x600002558180>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x600002558180>
> rowMedians(tmp)
  [1] -0.090856092 -0.037407662 -0.079572311 -0.044560230  0.655897664
  [6] -0.179731587 -0.060803813 -0.024633865 -0.050059821  0.076924570
 [11]  0.049355572  0.310632519 -0.221235204 -0.233878179  0.164417169
 [16] -0.068164796  0.651531275  0.310964887 -0.309291304  0.257947510
 [21] -0.046052777 -0.419896667  0.064197363  0.114238663 -0.026617434
 [26]  0.412669231 -0.070121149  0.369062220  0.059612172 -0.111910791
 [31] -0.549116744 -0.171531097  0.108299023 -0.673025043 -0.205939807
 [36]  0.202871778 -0.298631223  0.494632626  0.750035295 -0.035288776
 [41] -0.153345421 -0.233057981  0.123293637  0.359624833  0.099114181
 [46] -0.234434749  0.246810019 -0.056709146 -0.356434195  0.566707595
 [51] -0.411424566 -0.245860099  0.140629853  0.028437138 -0.106085596
 [56] -0.012281482  0.295087572 -0.092227950  0.423426208  0.400628863
 [61]  0.164025351  0.274963780  0.101227187  0.052839702  0.603679815
 [66] -0.099727544 -0.192401989  0.136199637  0.092162256  0.175089208
 [71] -0.281109398 -0.181944517 -0.187596597 -0.043391912 -0.107901085
 [76]  0.292274294  0.602956733 -0.211316424  0.122029377 -0.067440881
 [81]  0.287127896  0.099692280  0.014682557  0.106742357 -0.730029076
 [86] -0.557528096  0.045831721 -0.243227601  0.058085308  0.476168972
 [91] -0.058957420 -0.476559895 -0.445294247 -0.750052304  0.086272482
 [96] -0.212589500 -0.153979365 -0.651730707  0.136043495  0.109923787
[101]  0.180335959  0.024406728  0.055592451 -0.511693036  0.123653836
[106] -0.003878486 -0.394220881  0.644714056 -0.119749212  0.150011157
[111] -0.463490059  0.230558348  0.220512567 -0.156407758  0.134260061
[116] -0.495998049 -0.165850468  0.052732518 -0.161896343  0.329020832
[121]  0.183765628  0.059678279  0.015336884  0.007959637  0.027703606
[126] -0.462042039  0.281813750 -0.738029378  0.126338050 -0.048083383
[131] -0.112391840  0.081195894  0.064107707  0.105144069 -0.134279474
[136] -0.274684051  0.037865005  0.545413769 -0.097873312  0.212369703
[141] -0.427639701 -0.137184775 -0.061269334 -0.225975125  0.613584375
[146] -0.035513000 -0.507249556  0.447522361 -0.223107782  0.144542070
[151]  0.630380996  0.209601780 -0.340889413  0.308110285  0.030193442
[156]  0.471471996 -0.069959942 -0.373936516 -0.178740136 -0.030856251
[161]  0.188044949  0.245456492  0.278266129 -0.263728366  0.086702716
[166]  0.055495384 -0.184479998 -0.528530914 -0.025453389  0.112073052
[171]  0.008264349  0.363638095 -0.070117011 -0.306478415 -0.112619653
[176] -0.180013948  0.328912244 -0.039007609 -0.228490305 -0.406665256
[181] -0.560758015 -0.215509907 -0.177059407 -0.449837647  0.553394730
[186]  0.465880314 -0.028897923 -0.108037499  0.104482742 -0.284071417
[191] -0.093632465 -0.247229742 -0.639123911 -0.300467796 -0.345853443
[196] -0.784073104  0.153163461  0.053702452 -0.357345867 -0.326933013
[201]  0.253497413  0.713988137  0.449107679  0.105423925 -0.150615957
[206] -0.429266378 -0.081936409  0.352582521 -0.169105319  0.056608836
[211] -0.216031755 -0.413293027  0.703692738 -0.372542546 -0.285878810
[216]  0.040506390  0.077879604  0.249994247 -0.371187356  0.663335932
[221]  0.089083347  0.482237083 -0.266909888  0.215984359 -0.314364688
[226]  0.126852270 -0.197774452 -0.107726982  0.384976901  0.074802840
> 
> proc.time()
   user  system elapsed 
  2.605  14.133  56.951 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-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: 0x600002210000>
> .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: 0x600002210000>
> .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: 0x600002210000>
> .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: 0x600002210000>
> 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: 0x600002214000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600002214000>
> .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: 0x600002214000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600002214000>
> .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: 0x600002214000>
> 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: 0x60000226c000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x60000226c000>
> .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: 0x60000226c000>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x60000226c000>
> .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: 0x60000226c000>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x60000226c000>
> .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: 0x60000226c000>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x60000226c000>
> .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: 0x60000226c000>
> 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: 0x600002228180>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x600002228180>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600002228180>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600002228180>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilea11543889f21" "BufferedMatrixFilea1154b552752"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFilea11543889f21" "BufferedMatrixFilea1154b552752"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x60000223c2a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x60000223c2a0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x60000223c2a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x60000223c2a0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x60000223c2a0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x60000223c2a0>
> .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: 0x6000022003c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000022003c0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x6000022003c0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x6000022003c0>
> 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: 0x60000223c3c0>
> .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: 0x60000223c3c0>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.304   0.145   1.216 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-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.288   0.078   0.369 

Example timings