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

This page was generated on 2024-06-11 15:41 -0400 (Tue, 11 Jun 2024).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 22.04.3 LTS)x86_644.4.0 RC (2024-04-16 r86468) -- "Puppy Cup" 4679
palomino4Windows Server 2022 Datacenterx644.4.0 RC (2024-04-16 r86468 ucrt) -- "Puppy Cup" 4414
merida1macOS 12.7.4 Montereyx86_644.4.0 Patched (2024-04-24 r86482) -- "Puppy Cup" 4441
kjohnson1macOS 13.6.6 Venturaarm644.4.0 Patched (2024-04-24 r86482) -- "Puppy Cup" 4394
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

Package 245/2239HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.69.0  (landing page)
Ben Bolstad
Snapshot Date: 2024-06-09 14:00 -0400 (Sun, 09 Jun 2024)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: d422a05
git_last_commit_date: 2024-04-30 10:16:21 -0400 (Tue, 30 Apr 2024)
nebbiolo2Linux (Ubuntu 22.04.3 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
merida1macOS 12.7.4 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson1macOS 13.6.6 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published


CHECK results for BufferedMatrix on merida1

To the developers/maintainers of the BufferedMatrix package:
- Allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to reflect on this report. See Troubleshooting Build Report for more information.
- Use the following Renviron settings to reproduce errors and warnings.
- If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information.

raw results


Summary

Package: BufferedMatrix
Version: 1.69.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.69.0.tar.gz
StartedAt: 2024-06-10 00:45:08 -0400 (Mon, 10 Jun 2024)
EndedAt: 2024-06-10 00:46:41 -0400 (Mon, 10 Jun 2024)
EllapsedTime: 93.5 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.69.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.4.0 Patched (2024-04-24 r86482)
* using platform: x86_64-apple-darwin20
* R was compiled by
    Apple clang version 14.0.0 (clang-1400.0.29.202)
    GNU Fortran (GCC) 12.2.0
* running under: macOS Monterey 12.7.4
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.69.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.20-bioc/meat/BufferedMatrix.Rcheck/00install.out’ for details.
* used C compiler: ‘Apple clang version 14.0.0 (clang-1400.0.29.202)’
* used SDK: ‘MacOSX11.3.sdk’
* 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 code 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
checkRd: (-1) BufferedMatrix-class.Rd:209: Lost braces; missing escapes or markup?
   209 |     $x^{power}$ elementwise of the matrix
       |        ^
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 ... 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.20-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.4-x86_64/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘Apple clang version 14.0.0 (clang-1400.0.29.202)’
using SDK: ‘MacOSX11.3.sdk’
clang -arch x86_64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/x86_64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -arch x86_64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/x86_64/include    -fPIC  -falign-functions=64 -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 -arch x86_64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/x86_64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -arch x86_64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/x86_64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c init_package.c -o init_package.o
clang -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/x86_64/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.4-x86_64/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.4.0 Patched (2024-04-24 r86482) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin20

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.618   0.225   0.937 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.4.0 Patched (2024-04-24 r86482) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin20

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.20-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 474175 25.4    1035477 55.4         NA   638617 34.2
Vcells 877663  6.7    8388608 64.0      65536  2072283 15.9
> 
> 
> 
> 
> ##
> ## 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 Jun 10 00:45:55 2024"
> 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 Jun 10 00:45:56 2024"
> 
> 
> 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: 0x6000024f8180>
> 
> 
> 
> 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 Jun 10 00:46:04 2024"
> 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 Jun 10 00:46:07 2024"
> 
> ColMode(tmp2)
<pointer: 0x6000024f8180>
> 
> 
> 
> ### 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,] 100.8389333  1.3049467 -0.9034481  0.5966279
[2,]  -0.2744652  0.9477663 -0.3631620  0.6250013
[3,]  -1.6498557 -0.5888024 -1.1076183  0.4452843
[4,]  -1.6113882  1.6138503 -0.1049336 -0.2896765
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 100.8389333 1.3049467 0.9034481 0.5966279
[2,]   0.2744652 0.9477663 0.3631620 0.6250013
[3,]   1.6498557 0.5888024 1.1076183 0.4452843
[4,]   1.6113882 1.6138503 0.1049336 0.2896765
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0418591 1.1423426 0.9504989 0.7724169
[2,]  0.5238943 0.9735329 0.6026292 0.7905702
[3,]  1.2844671 0.7673346 1.0524345 0.6672963
[4,]  1.2694047 1.2703741 0.3239346 0.5382160
> 
> 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.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 226.25752 37.72837 35.40844 33.32080
[2,]  30.51341 35.68310 31.38945 33.53070
[3,]  39.49453 33.26215 36.63196 32.11825
[4,]  39.30543 39.31759 28.34428 30.67184
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x600002494000>
> exp(tmp5)
<pointer: 0x600002494000>
> log(tmp5,2)
<pointer: 0x600002494000>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.9254
> Min(tmp5)
[1] 52.86995
> mean(tmp5)
[1] 72.77393
> Sum(tmp5)
[1] 14554.79
> Var(tmp5)
[1] 871.8694
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.61135 70.79319 72.36947 68.22078 69.74876 71.47307 70.08483 71.23021
 [9] 72.53635 71.67129
> rowSums(tmp5)
 [1] 1792.227 1415.864 1447.389 1364.416 1394.975 1429.461 1401.697 1424.604
 [9] 1450.727 1433.426
> rowVars(tmp5)
 [1] 8121.67592   36.97131   79.43938   62.81673   86.92286   69.83287
 [7]   44.09916   70.67517  134.47321   77.36007
> rowSd(tmp5)
 [1] 90.120341  6.080404  8.912877  7.925701  9.323243  8.356607  6.640720
 [8]  8.406853 11.596258  8.795458
> rowMax(tmp5)
 [1] 470.92539  78.60770  93.01273  81.83441  89.58111  86.09332  87.31986
 [8]  83.73548  91.42694  88.27881
> rowMin(tmp5)
 [1] 53.60563 57.03390 57.63341 54.01424 54.74301 56.77983 58.83917 56.86274
 [9] 55.75503 52.86995
> 
> colMeans(tmp5)
 [1] 112.43660  75.17583  71.04324  71.50684  69.89356  68.97004  68.53615
 [8]  71.89190  70.01973  69.63063  65.78817  73.04290  69.73853  69.73040
[15]  75.57717  72.89384  70.30939  69.04252  72.20268  68.04845
> colSums(tmp5)
 [1] 1124.3660  751.7583  710.4324  715.0684  698.9356  689.7004  685.3615
 [8]  718.9190  700.1973  696.3063  657.8817  730.4290  697.3853  697.3040
[15]  755.7717  728.9384  703.0939  690.4252  722.0268  680.4845
> colVars(tmp5)
 [1] 15963.55490    49.83340   108.26432    60.87217    92.13356    17.97898
 [7]    61.79927    70.27805    55.69559    71.59291    17.87594   107.40852
[13]    48.60102   125.14953    71.25246    34.11180   105.11430   137.28976
[19]    57.51575    65.74313
> colSd(tmp5)
 [1] 126.346962   7.059277  10.405014   7.802062   9.598623   4.240162
 [7]   7.861251   8.383201   7.462948   8.461259   4.227995  10.363808
[13]   6.971443  11.187025   8.441117   5.840531  10.252527  11.717071
[19]   7.583914   8.108214
> colMax(tmp5)
 [1] 470.92539  88.27881  89.58111  86.09332  86.12388  77.88241  78.25333
 [8]  82.90538  82.19372  85.62365  73.23550  93.01273  80.34598  87.31986
[15]  85.83353  83.25945  83.59716  91.42694  80.66967  79.21827
> colMin(tmp5)
 [1] 58.61670 64.61385 56.86274 62.52741 53.60563 63.12568 57.03390 59.31824
 [9] 58.77993 56.77983 59.16173 55.75503 59.79338 54.01424 62.49413 64.02135
[17] 54.86671 52.86995 58.83917 56.91132
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 89.61135 70.79319 72.36947 68.22078 69.74876 71.47307       NA 71.23021
 [9] 72.53635 71.67129
> rowSums(tmp5)
 [1] 1792.227 1415.864 1447.389 1364.416 1394.975 1429.461       NA 1424.604
 [9] 1450.727 1433.426
> rowVars(tmp5)
 [1] 8121.67592   36.97131   79.43938   62.81673   86.92286   69.83287
 [7]   39.15351   70.67517  134.47321   77.36007
> rowSd(tmp5)
 [1] 90.120341  6.080404  8.912877  7.925701  9.323243  8.356607  6.257277
 [8]  8.406853 11.596258  8.795458
> rowMax(tmp5)
 [1] 470.92539  78.60770  93.01273  81.83441  89.58111  86.09332        NA
 [8]  83.73548  91.42694  88.27881
> rowMin(tmp5)
 [1] 53.60563 57.03390 57.63341 54.01424 54.74301 56.77983       NA 56.86274
 [9] 55.75503 52.86995
> 
> colMeans(tmp5)
 [1] 112.43660  75.17583  71.04324  71.50684  69.89356  68.97004  68.53615
 [8]  71.89190  70.01973  69.63063  65.78817  73.04290  69.73853  69.73040
[15]  75.57717  72.89384  70.30939  69.04252        NA  68.04845
> colSums(tmp5)
 [1] 1124.3660  751.7583  710.4324  715.0684  698.9356  689.7004  685.3615
 [8]  718.9190  700.1973  696.3063  657.8817  730.4290  697.3853  697.3040
[15]  755.7717  728.9384  703.0939  690.4252        NA  680.4845
> colVars(tmp5)
 [1] 15963.55490    49.83340   108.26432    60.87217    92.13356    17.97898
 [7]    61.79927    70.27805    55.69559    71.59291    17.87594   107.40852
[13]    48.60102   125.14953    71.25246    34.11180   105.11430   137.28976
[19]          NA    65.74313
> colSd(tmp5)
 [1] 126.346962   7.059277  10.405014   7.802062   9.598623   4.240162
 [7]   7.861251   8.383201   7.462948   8.461259   4.227995  10.363808
[13]   6.971443  11.187025   8.441117   5.840531  10.252527  11.717071
[19]         NA   8.108214
> colMax(tmp5)
 [1] 470.92539  88.27881  89.58111  86.09332  86.12388  77.88241  78.25333
 [8]  82.90538  82.19372  85.62365  73.23550  93.01273  80.34598  87.31986
[15]  85.83353  83.25945  83.59716  91.42694        NA  79.21827
> colMin(tmp5)
 [1] 58.61670 64.61385 56.86274 62.52741 53.60563 63.12568 57.03390 59.31824
 [9] 58.77993 56.77983 59.16173 55.75503 59.79338 54.01424 62.49413 64.02135
[17] 54.86671 52.86995       NA 56.91132
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.9254
> Min(tmp5,na.rm=TRUE)
[1] 52.86995
> mean(tmp5,na.rm=TRUE)
[1] 72.84395
> Sum(tmp5,na.rm=TRUE)
[1] 14495.95
> Var(tmp5,na.rm=TRUE)
[1] 875.2872
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.61135 70.79319 72.36947 68.22078 69.74876 71.47307 70.67670 71.23021
 [9] 72.53635 71.67129
> rowSums(tmp5,na.rm=TRUE)
 [1] 1792.227 1415.864 1447.389 1364.416 1394.975 1429.461 1342.857 1424.604
 [9] 1450.727 1433.426
> rowVars(tmp5,na.rm=TRUE)
 [1] 8121.67592   36.97131   79.43938   62.81673   86.92286   69.83287
 [7]   39.15351   70.67517  134.47321   77.36007
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.120341  6.080404  8.912877  7.925701  9.323243  8.356607  6.257277
 [8]  8.406853 11.596258  8.795458
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.92539  78.60770  93.01273  81.83441  89.58111  86.09332  87.31986
 [8]  83.73548  91.42694  88.27881
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.60563 57.03390 57.63341 54.01424 54.74301 56.77983 63.12568 56.86274
 [9] 55.75503 52.86995
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 112.43660  75.17583  71.04324  71.50684  69.89356  68.97004  68.53615
 [8]  71.89190  70.01973  69.63063  65.78817  73.04290  69.73853  69.73040
[15]  75.57717  72.89384  70.30939  69.04252  73.68751  68.04845
> colSums(tmp5,na.rm=TRUE)
 [1] 1124.3660  751.7583  710.4324  715.0684  698.9356  689.7004  685.3615
 [8]  718.9190  700.1973  696.3063  657.8817  730.4290  697.3853  697.3040
[15]  755.7717  728.9384  703.0939  690.4252  663.1876  680.4845
> colVars(tmp5,na.rm=TRUE)
 [1] 15963.55490    49.83340   108.26432    60.87217    92.13356    17.97898
 [7]    61.79927    70.27805    55.69559    71.59291    17.87594   107.40852
[13]    48.60102   125.14953    71.25246    34.11180   105.11430   137.28976
[19]    39.90199    65.74313
> colSd(tmp5,na.rm=TRUE)
 [1] 126.346962   7.059277  10.405014   7.802062   9.598623   4.240162
 [7]   7.861251   8.383201   7.462948   8.461259   4.227995  10.363808
[13]   6.971443  11.187025   8.441117   5.840531  10.252527  11.717071
[19]   6.316802   8.108214
> colMax(tmp5,na.rm=TRUE)
 [1] 470.92539  88.27881  89.58111  86.09332  86.12388  77.88241  78.25333
 [8]  82.90538  82.19372  85.62365  73.23550  93.01273  80.34598  87.31986
[15]  85.83353  83.25945  83.59716  91.42694  80.66967  79.21827
> colMin(tmp5,na.rm=TRUE)
 [1] 58.61670 64.61385 56.86274 62.52741 53.60563 63.12568 57.03390 59.31824
 [9] 58.77993 56.77983 59.16173 55.75503 59.79338 54.01424 62.49413 64.02135
[17] 54.86671 52.86995 65.21048 56.91132
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.61135 70.79319 72.36947 68.22078 69.74876 71.47307      NaN 71.23021
 [9] 72.53635 71.67129
> rowSums(tmp5,na.rm=TRUE)
 [1] 1792.227 1415.864 1447.389 1364.416 1394.975 1429.461    0.000 1424.604
 [9] 1450.727 1433.426
> rowVars(tmp5,na.rm=TRUE)
 [1] 8121.67592   36.97131   79.43938   62.81673   86.92286   69.83287
 [7]         NA   70.67517  134.47321   77.36007
> rowSd(tmp5,na.rm=TRUE)
 [1] 90.120341  6.080404  8.912877  7.925701  9.323243  8.356607        NA
 [8]  8.406853 11.596258  8.795458
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.92539  78.60770  93.01273  81.83441  89.58111  86.09332        NA
 [8]  83.73548  91.42694  88.27881
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.60563 57.03390 57.63341 54.01424 54.74301 56.77983       NA 56.86274
 [9] 55.75503 52.86995
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 116.16954  76.04443  70.47985  70.61527  70.01919  69.61942  68.31157
 [8]  72.13859  70.48018  69.98583  65.71506  73.20017  69.82180  67.77602
[15]  76.91275  73.63164  70.22734  69.40202       NaN  67.21618
> colSums(tmp5,na.rm=TRUE)
 [1] 1045.5258  684.3999  634.3187  635.5374  630.1727  626.5747  614.8041
 [8]  649.2473  634.3217  629.8725  591.4355  658.8015  628.3962  609.9842
[15]  692.2147  662.6847  632.0461  624.6182    0.0000  604.9456
> colVars(tmp5,na.rm=TRUE)
 [1] 17802.23281    47.57473   118.22654    59.53844   103.47269    15.48238
 [7]    68.95673    78.37818    60.27238    79.12260    20.05029   120.55632
[13]    54.59815    97.82254    60.09148    32.25187   118.17786   152.99695
[19]          NA    66.16844
> colSd(tmp5,na.rm=TRUE)
 [1] 133.425008   6.897444  10.873203   7.716115  10.172153   3.934766
 [7]   8.304019   8.853145   7.763529   8.895089   4.477755  10.979814
[13]   7.389056   9.890528   7.751869   5.679073  10.870964  12.369194
[19]         NA   8.134398
> colMax(tmp5,na.rm=TRUE)
 [1] 470.92539  88.27881  89.58111  86.09332  86.12388  77.88241  78.25333
 [8]  82.90538  82.19372  85.62365  73.23550  93.01273  80.34598  86.67700
[15]  85.83353  83.25945  83.59716  91.42694      -Inf  79.21827
> colMin(tmp5,na.rm=TRUE)
 [1] 58.61670 64.61385 56.86274 62.52741 53.60563 65.67537 57.03390 59.31824
 [9] 58.77993 56.77983 59.16173 55.75503 59.79338 54.01424 62.49413 64.02135
[17] 54.86671 52.86995      Inf 56.91132
> 
> 
> 
> 
> 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] 188.9792 236.4156 390.4972 237.0070 184.0545 150.8797 201.6562 336.4334
 [9] 224.1374 148.3446
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 188.9792 236.4156 390.4972 237.0070 184.0545 150.8797 201.6562 336.4334
 [9] 224.1374 148.3446
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1]  1.136868e-13  2.842171e-14  5.684342e-14 -1.136868e-13  1.136868e-13
 [6]  5.684342e-14  9.947598e-14  5.684342e-14  8.526513e-14  2.273737e-13
[11] -5.684342e-14 -1.136868e-13 -1.136868e-13 -5.684342e-14 -7.105427e-14
[16]  0.000000e+00  0.000000e+00  2.842171e-14 -1.705303e-13  8.526513e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
5   9 
2   7 
2   5 
10   10 
1   19 
7   11 
9   8 
2   7 
6   18 
8   7 
1   16 
7   1 
9   2 
4   16 
9   15 
3   10 
5   18 
3   8 
10   4 
8   3 
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.456419
> Min(tmp)
[1] -3.228956
> mean(tmp)
[1] -0.1236539
> Sum(tmp)
[1] -12.36539
> Var(tmp)
[1] 0.9219144
> 
> rowMeans(tmp)
[1] -0.1236539
> rowSums(tmp)
[1] -12.36539
> rowVars(tmp)
[1] 0.9219144
> rowSd(tmp)
[1] 0.9601638
> rowMax(tmp)
[1] 2.456419
> rowMin(tmp)
[1] -3.228956
> 
> colMeans(tmp)
  [1] -0.507588239 -0.288838419 -3.228955657 -0.930353685 -0.452217616
  [6]  0.012961617  0.666183408  0.200173602  1.079068983  1.224883954
 [11] -0.166368572  0.301602791 -1.361028296  2.456419066  0.732853043
 [16]  0.050396311 -1.071983814  0.133173910 -0.479531772 -0.280303618
 [21]  0.805798186 -2.482558093  0.238658957 -0.283521339 -0.493792804
 [26]  1.104718732 -0.088190257 -1.047780570 -0.776710072  1.381429203
 [31] -2.128846034 -1.311448332 -0.414717670  0.393828167 -1.045702282
 [36]  0.185723123  0.356984784 -0.569623500  0.690896769  1.950015606
 [41] -0.707953463  0.821564208  1.168373338 -1.371937597 -0.550824043
 [46]  0.406354891 -0.893079488 -1.325358362 -0.892517134 -0.397758065
 [51]  1.128217618 -0.307908604 -0.646382430 -0.935756121 -0.037616140
 [56]  0.442166004 -0.405242798 -1.076753495 -0.885966287  1.048421696
 [61]  0.127238393 -0.240280742 -0.662424857  2.118486915  0.261519848
 [66]  0.717485377 -2.443781358  0.748256099 -0.245967898 -0.770091367
 [71]  0.059816174 -0.295956442  0.459315701  1.509303405  0.304331219
 [76] -0.257455788  0.847137007 -0.429461437 -0.462862299  0.486354351
 [81] -0.470057010  1.175643928 -1.487838077  0.311997928  1.019913970
 [86]  0.191292445 -0.689405214  0.553139669  0.514756987 -0.358958793
 [91]  0.009209783 -1.570617415  0.399675568  0.310983806 -1.075252538
 [96] -0.294298322 -0.196018086 -0.241100574 -1.324149811 -0.111027016
> colSums(tmp)
  [1] -0.507588239 -0.288838419 -3.228955657 -0.930353685 -0.452217616
  [6]  0.012961617  0.666183408  0.200173602  1.079068983  1.224883954
 [11] -0.166368572  0.301602791 -1.361028296  2.456419066  0.732853043
 [16]  0.050396311 -1.071983814  0.133173910 -0.479531772 -0.280303618
 [21]  0.805798186 -2.482558093  0.238658957 -0.283521339 -0.493792804
 [26]  1.104718732 -0.088190257 -1.047780570 -0.776710072  1.381429203
 [31] -2.128846034 -1.311448332 -0.414717670  0.393828167 -1.045702282
 [36]  0.185723123  0.356984784 -0.569623500  0.690896769  1.950015606
 [41] -0.707953463  0.821564208  1.168373338 -1.371937597 -0.550824043
 [46]  0.406354891 -0.893079488 -1.325358362 -0.892517134 -0.397758065
 [51]  1.128217618 -0.307908604 -0.646382430 -0.935756121 -0.037616140
 [56]  0.442166004 -0.405242798 -1.076753495 -0.885966287  1.048421696
 [61]  0.127238393 -0.240280742 -0.662424857  2.118486915  0.261519848
 [66]  0.717485377 -2.443781358  0.748256099 -0.245967898 -0.770091367
 [71]  0.059816174 -0.295956442  0.459315701  1.509303405  0.304331219
 [76] -0.257455788  0.847137007 -0.429461437 -0.462862299  0.486354351
 [81] -0.470057010  1.175643928 -1.487838077  0.311997928  1.019913970
 [86]  0.191292445 -0.689405214  0.553139669  0.514756987 -0.358958793
 [91]  0.009209783 -1.570617415  0.399675568  0.310983806 -1.075252538
 [96] -0.294298322 -0.196018086 -0.241100574 -1.324149811 -0.111027016
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1] -0.507588239 -0.288838419 -3.228955657 -0.930353685 -0.452217616
  [6]  0.012961617  0.666183408  0.200173602  1.079068983  1.224883954
 [11] -0.166368572  0.301602791 -1.361028296  2.456419066  0.732853043
 [16]  0.050396311 -1.071983814  0.133173910 -0.479531772 -0.280303618
 [21]  0.805798186 -2.482558093  0.238658957 -0.283521339 -0.493792804
 [26]  1.104718732 -0.088190257 -1.047780570 -0.776710072  1.381429203
 [31] -2.128846034 -1.311448332 -0.414717670  0.393828167 -1.045702282
 [36]  0.185723123  0.356984784 -0.569623500  0.690896769  1.950015606
 [41] -0.707953463  0.821564208  1.168373338 -1.371937597 -0.550824043
 [46]  0.406354891 -0.893079488 -1.325358362 -0.892517134 -0.397758065
 [51]  1.128217618 -0.307908604 -0.646382430 -0.935756121 -0.037616140
 [56]  0.442166004 -0.405242798 -1.076753495 -0.885966287  1.048421696
 [61]  0.127238393 -0.240280742 -0.662424857  2.118486915  0.261519848
 [66]  0.717485377 -2.443781358  0.748256099 -0.245967898 -0.770091367
 [71]  0.059816174 -0.295956442  0.459315701  1.509303405  0.304331219
 [76] -0.257455788  0.847137007 -0.429461437 -0.462862299  0.486354351
 [81] -0.470057010  1.175643928 -1.487838077  0.311997928  1.019913970
 [86]  0.191292445 -0.689405214  0.553139669  0.514756987 -0.358958793
 [91]  0.009209783 -1.570617415  0.399675568  0.310983806 -1.075252538
 [96] -0.294298322 -0.196018086 -0.241100574 -1.324149811 -0.111027016
> colMin(tmp)
  [1] -0.507588239 -0.288838419 -3.228955657 -0.930353685 -0.452217616
  [6]  0.012961617  0.666183408  0.200173602  1.079068983  1.224883954
 [11] -0.166368572  0.301602791 -1.361028296  2.456419066  0.732853043
 [16]  0.050396311 -1.071983814  0.133173910 -0.479531772 -0.280303618
 [21]  0.805798186 -2.482558093  0.238658957 -0.283521339 -0.493792804
 [26]  1.104718732 -0.088190257 -1.047780570 -0.776710072  1.381429203
 [31] -2.128846034 -1.311448332 -0.414717670  0.393828167 -1.045702282
 [36]  0.185723123  0.356984784 -0.569623500  0.690896769  1.950015606
 [41] -0.707953463  0.821564208  1.168373338 -1.371937597 -0.550824043
 [46]  0.406354891 -0.893079488 -1.325358362 -0.892517134 -0.397758065
 [51]  1.128217618 -0.307908604 -0.646382430 -0.935756121 -0.037616140
 [56]  0.442166004 -0.405242798 -1.076753495 -0.885966287  1.048421696
 [61]  0.127238393 -0.240280742 -0.662424857  2.118486915  0.261519848
 [66]  0.717485377 -2.443781358  0.748256099 -0.245967898 -0.770091367
 [71]  0.059816174 -0.295956442  0.459315701  1.509303405  0.304331219
 [76] -0.257455788  0.847137007 -0.429461437 -0.462862299  0.486354351
 [81] -0.470057010  1.175643928 -1.487838077  0.311997928  1.019913970
 [86]  0.191292445 -0.689405214  0.553139669  0.514756987 -0.358958793
 [91]  0.009209783 -1.570617415  0.399675568  0.310983806 -1.075252538
 [96] -0.294298322 -0.196018086 -0.241100574 -1.324149811 -0.111027016
> colMedians(tmp)
  [1] -0.507588239 -0.288838419 -3.228955657 -0.930353685 -0.452217616
  [6]  0.012961617  0.666183408  0.200173602  1.079068983  1.224883954
 [11] -0.166368572  0.301602791 -1.361028296  2.456419066  0.732853043
 [16]  0.050396311 -1.071983814  0.133173910 -0.479531772 -0.280303618
 [21]  0.805798186 -2.482558093  0.238658957 -0.283521339 -0.493792804
 [26]  1.104718732 -0.088190257 -1.047780570 -0.776710072  1.381429203
 [31] -2.128846034 -1.311448332 -0.414717670  0.393828167 -1.045702282
 [36]  0.185723123  0.356984784 -0.569623500  0.690896769  1.950015606
 [41] -0.707953463  0.821564208  1.168373338 -1.371937597 -0.550824043
 [46]  0.406354891 -0.893079488 -1.325358362 -0.892517134 -0.397758065
 [51]  1.128217618 -0.307908604 -0.646382430 -0.935756121 -0.037616140
 [56]  0.442166004 -0.405242798 -1.076753495 -0.885966287  1.048421696
 [61]  0.127238393 -0.240280742 -0.662424857  2.118486915  0.261519848
 [66]  0.717485377 -2.443781358  0.748256099 -0.245967898 -0.770091367
 [71]  0.059816174 -0.295956442  0.459315701  1.509303405  0.304331219
 [76] -0.257455788  0.847137007 -0.429461437 -0.462862299  0.486354351
 [81] -0.470057010  1.175643928 -1.487838077  0.311997928  1.019913970
 [86]  0.191292445 -0.689405214  0.553139669  0.514756987 -0.358958793
 [91]  0.009209783 -1.570617415  0.399675568  0.310983806 -1.075252538
 [96] -0.294298322 -0.196018086 -0.241100574 -1.324149811 -0.111027016
> colRanges(tmp)
           [,1]       [,2]      [,3]       [,4]       [,5]       [,6]      [,7]
[1,] -0.5075882 -0.2888384 -3.228956 -0.9303537 -0.4522176 0.01296162 0.6661834
[2,] -0.5075882 -0.2888384 -3.228956 -0.9303537 -0.4522176 0.01296162 0.6661834
          [,8]     [,9]    [,10]      [,11]     [,12]     [,13]    [,14]
[1,] 0.2001736 1.079069 1.224884 -0.1663686 0.3016028 -1.361028 2.456419
[2,] 0.2001736 1.079069 1.224884 -0.1663686 0.3016028 -1.361028 2.456419
        [,15]      [,16]     [,17]     [,18]      [,19]      [,20]     [,21]
[1,] 0.732853 0.05039631 -1.071984 0.1331739 -0.4795318 -0.2803036 0.8057982
[2,] 0.732853 0.05039631 -1.071984 0.1331739 -0.4795318 -0.2803036 0.8057982
         [,22]    [,23]      [,24]      [,25]    [,26]       [,27]     [,28]
[1,] -2.482558 0.238659 -0.2835213 -0.4937928 1.104719 -0.08819026 -1.047781
[2,] -2.482558 0.238659 -0.2835213 -0.4937928 1.104719 -0.08819026 -1.047781
          [,29]    [,30]     [,31]     [,32]      [,33]     [,34]     [,35]
[1,] -0.7767101 1.381429 -2.128846 -1.311448 -0.4147177 0.3938282 -1.045702
[2,] -0.7767101 1.381429 -2.128846 -1.311448 -0.4147177 0.3938282 -1.045702
         [,36]     [,37]      [,38]     [,39]    [,40]      [,41]     [,42]
[1,] 0.1857231 0.3569848 -0.5696235 0.6908968 1.950016 -0.7079535 0.8215642
[2,] 0.1857231 0.3569848 -0.5696235 0.6908968 1.950016 -0.7079535 0.8215642
        [,43]     [,44]     [,45]     [,46]      [,47]     [,48]      [,49]
[1,] 1.168373 -1.371938 -0.550824 0.4063549 -0.8930795 -1.325358 -0.8925171
[2,] 1.168373 -1.371938 -0.550824 0.4063549 -0.8930795 -1.325358 -0.8925171
          [,50]    [,51]      [,52]      [,53]      [,54]       [,55]    [,56]
[1,] -0.3977581 1.128218 -0.3079086 -0.6463824 -0.9357561 -0.03761614 0.442166
[2,] -0.3977581 1.128218 -0.3079086 -0.6463824 -0.9357561 -0.03761614 0.442166
          [,57]     [,58]      [,59]    [,60]     [,61]      [,62]      [,63]
[1,] -0.4052428 -1.076753 -0.8859663 1.048422 0.1272384 -0.2402807 -0.6624249
[2,] -0.4052428 -1.076753 -0.8859663 1.048422 0.1272384 -0.2402807 -0.6624249
        [,64]     [,65]     [,66]     [,67]     [,68]      [,69]      [,70]
[1,] 2.118487 0.2615198 0.7174854 -2.443781 0.7482561 -0.2459679 -0.7700914
[2,] 2.118487 0.2615198 0.7174854 -2.443781 0.7482561 -0.2459679 -0.7700914
          [,71]      [,72]     [,73]    [,74]     [,75]      [,76]    [,77]
[1,] 0.05981617 -0.2959564 0.4593157 1.509303 0.3043312 -0.2574558 0.847137
[2,] 0.05981617 -0.2959564 0.4593157 1.509303 0.3043312 -0.2574558 0.847137
          [,78]      [,79]     [,80]     [,81]    [,82]     [,83]     [,84]
[1,] -0.4294614 -0.4628623 0.4863544 -0.470057 1.175644 -1.487838 0.3119979
[2,] -0.4294614 -0.4628623 0.4863544 -0.470057 1.175644 -1.487838 0.3119979
        [,85]     [,86]      [,87]     [,88]    [,89]      [,90]       [,91]
[1,] 1.019914 0.1912924 -0.6894052 0.5531397 0.514757 -0.3589588 0.009209783
[2,] 1.019914 0.1912924 -0.6894052 0.5531397 0.514757 -0.3589588 0.009209783
         [,92]     [,93]     [,94]     [,95]      [,96]      [,97]      [,98]
[1,] -1.570617 0.3996756 0.3109838 -1.075253 -0.2942983 -0.1960181 -0.2411006
[2,] -1.570617 0.3996756 0.3109838 -1.075253 -0.2942983 -0.1960181 -0.2411006
        [,99]    [,100]
[1,] -1.32415 -0.111027
[2,] -1.32415 -0.111027
> 
> 
> Max(tmp2)
[1] 4.492871
> Min(tmp2)
[1] -2.194535
> mean(tmp2)
[1] 0.1870774
> Sum(tmp2)
[1] 18.70774
> Var(tmp2)
[1] 1.170312
> 
> rowMeans(tmp2)
  [1] -0.092293025  0.128239418  0.691212866 -0.053015124 -0.024509395
  [6]  0.136977561 -0.514473444 -2.194535055  0.115601499  1.531682876
 [11]  1.305718089  2.115115663  1.433286643  0.169154581  0.845492508
 [16] -0.149526990  0.578251442 -0.669542648 -0.093871941  1.123829389
 [21] -0.343492309 -1.535230243 -1.390171509  0.802044241 -0.015361032
 [26]  0.694589014 -1.660028796 -1.442937086  0.478832999 -0.231353328
 [31] -0.493735088  0.490456864  1.131238938  0.756922710  1.152184292
 [36]  1.084214568  0.433335799  0.371413668 -1.548175962 -0.875809657
 [41]  1.063315153  0.333019851  0.128988315 -1.954522760  0.821222461
 [46]  4.492870833  1.328906303  0.033589347 -1.535395817  0.811210894
 [51]  0.825027557 -0.630728788  1.790218449  1.114649952 -0.512288675
 [56]  0.728780918  0.104052488 -0.760516031  1.371657717 -0.042366465
 [61]  1.516069468  0.210667269  0.120889728  1.110238819 -0.494869060
 [66]  0.426013173  1.835652061  1.544963358  0.309786218 -1.032118933
 [71] -0.825912272 -0.655285728 -0.437501341  1.102919649  0.001897305
 [76]  0.267719004 -0.377319421  0.075288683  0.216733377 -1.581475423
 [81] -1.242873930  1.231845296 -0.539674052  1.529034559 -1.852051456
 [86]  0.429435877  1.537411638  0.347557038 -1.451791925 -0.421280978
 [91]  0.637593950 -0.085121068 -1.505210563 -0.335589897  1.921490629
 [96]  0.987927325  1.107008767  0.287734561 -1.557919260  0.594435162
> rowSums(tmp2)
  [1] -0.092293025  0.128239418  0.691212866 -0.053015124 -0.024509395
  [6]  0.136977561 -0.514473444 -2.194535055  0.115601499  1.531682876
 [11]  1.305718089  2.115115663  1.433286643  0.169154581  0.845492508
 [16] -0.149526990  0.578251442 -0.669542648 -0.093871941  1.123829389
 [21] -0.343492309 -1.535230243 -1.390171509  0.802044241 -0.015361032
 [26]  0.694589014 -1.660028796 -1.442937086  0.478832999 -0.231353328
 [31] -0.493735088  0.490456864  1.131238938  0.756922710  1.152184292
 [36]  1.084214568  0.433335799  0.371413668 -1.548175962 -0.875809657
 [41]  1.063315153  0.333019851  0.128988315 -1.954522760  0.821222461
 [46]  4.492870833  1.328906303  0.033589347 -1.535395817  0.811210894
 [51]  0.825027557 -0.630728788  1.790218449  1.114649952 -0.512288675
 [56]  0.728780918  0.104052488 -0.760516031  1.371657717 -0.042366465
 [61]  1.516069468  0.210667269  0.120889728  1.110238819 -0.494869060
 [66]  0.426013173  1.835652061  1.544963358  0.309786218 -1.032118933
 [71] -0.825912272 -0.655285728 -0.437501341  1.102919649  0.001897305
 [76]  0.267719004 -0.377319421  0.075288683  0.216733377 -1.581475423
 [81] -1.242873930  1.231845296 -0.539674052  1.529034559 -1.852051456
 [86]  0.429435877  1.537411638  0.347557038 -1.451791925 -0.421280978
 [91]  0.637593950 -0.085121068 -1.505210563 -0.335589897  1.921490629
 [96]  0.987927325  1.107008767  0.287734561 -1.557919260  0.594435162
> 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.092293025  0.128239418  0.691212866 -0.053015124 -0.024509395
  [6]  0.136977561 -0.514473444 -2.194535055  0.115601499  1.531682876
 [11]  1.305718089  2.115115663  1.433286643  0.169154581  0.845492508
 [16] -0.149526990  0.578251442 -0.669542648 -0.093871941  1.123829389
 [21] -0.343492309 -1.535230243 -1.390171509  0.802044241 -0.015361032
 [26]  0.694589014 -1.660028796 -1.442937086  0.478832999 -0.231353328
 [31] -0.493735088  0.490456864  1.131238938  0.756922710  1.152184292
 [36]  1.084214568  0.433335799  0.371413668 -1.548175962 -0.875809657
 [41]  1.063315153  0.333019851  0.128988315 -1.954522760  0.821222461
 [46]  4.492870833  1.328906303  0.033589347 -1.535395817  0.811210894
 [51]  0.825027557 -0.630728788  1.790218449  1.114649952 -0.512288675
 [56]  0.728780918  0.104052488 -0.760516031  1.371657717 -0.042366465
 [61]  1.516069468  0.210667269  0.120889728  1.110238819 -0.494869060
 [66]  0.426013173  1.835652061  1.544963358  0.309786218 -1.032118933
 [71] -0.825912272 -0.655285728 -0.437501341  1.102919649  0.001897305
 [76]  0.267719004 -0.377319421  0.075288683  0.216733377 -1.581475423
 [81] -1.242873930  1.231845296 -0.539674052  1.529034559 -1.852051456
 [86]  0.429435877  1.537411638  0.347557038 -1.451791925 -0.421280978
 [91]  0.637593950 -0.085121068 -1.505210563 -0.335589897  1.921490629
 [96]  0.987927325  1.107008767  0.287734561 -1.557919260  0.594435162
> rowMin(tmp2)
  [1] -0.092293025  0.128239418  0.691212866 -0.053015124 -0.024509395
  [6]  0.136977561 -0.514473444 -2.194535055  0.115601499  1.531682876
 [11]  1.305718089  2.115115663  1.433286643  0.169154581  0.845492508
 [16] -0.149526990  0.578251442 -0.669542648 -0.093871941  1.123829389
 [21] -0.343492309 -1.535230243 -1.390171509  0.802044241 -0.015361032
 [26]  0.694589014 -1.660028796 -1.442937086  0.478832999 -0.231353328
 [31] -0.493735088  0.490456864  1.131238938  0.756922710  1.152184292
 [36]  1.084214568  0.433335799  0.371413668 -1.548175962 -0.875809657
 [41]  1.063315153  0.333019851  0.128988315 -1.954522760  0.821222461
 [46]  4.492870833  1.328906303  0.033589347 -1.535395817  0.811210894
 [51]  0.825027557 -0.630728788  1.790218449  1.114649952 -0.512288675
 [56]  0.728780918  0.104052488 -0.760516031  1.371657717 -0.042366465
 [61]  1.516069468  0.210667269  0.120889728  1.110238819 -0.494869060
 [66]  0.426013173  1.835652061  1.544963358  0.309786218 -1.032118933
 [71] -0.825912272 -0.655285728 -0.437501341  1.102919649  0.001897305
 [76]  0.267719004 -0.377319421  0.075288683  0.216733377 -1.581475423
 [81] -1.242873930  1.231845296 -0.539674052  1.529034559 -1.852051456
 [86]  0.429435877  1.537411638  0.347557038 -1.451791925 -0.421280978
 [91]  0.637593950 -0.085121068 -1.505210563 -0.335589897  1.921490629
 [96]  0.987927325  1.107008767  0.287734561 -1.557919260  0.594435162
> 
> colMeans(tmp2)
[1] 0.1870774
> colSums(tmp2)
[1] 18.70774
> colVars(tmp2)
[1] 1.170312
> colSd(tmp2)
[1] 1.08181
> colMax(tmp2)
[1] 4.492871
> colMin(tmp2)
[1] -2.194535
> colMedians(tmp2)
[1] 0.1899109
> colRanges(tmp2)
          [,1]
[1,] -2.194535
[2,]  4.492871
> 
> 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] -0.07499978  5.82461605 -3.92035153 -3.97328048 -3.52318947 -4.66028007
 [7]  3.99151023  2.86630967 -3.09396024 -6.21614226
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -2.03208994
[2,] -0.89977131
[3,]  0.04740239
[4,]  0.73728778
[5,]  2.16778135
> 
> rowApply(tmp,sum)
 [1]  1.1920776 -4.5682964 -0.5967463  0.3021278  1.1859903 -6.6994050
 [7] -4.1423062 -2.2999179  1.7977633  1.0489448
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9   10    2    8    9    3    4    9    1     2
 [2,]    5    9    9   10    6   10   10    8    9     3
 [3,]    7    4    7    2    2    2    8    4   10     1
 [4,]    4    5    5    4    4    8    1    2    5     7
 [5,]    2    8    4    1    7    1    2   10    7     6
 [6,]    1    2    6    5   10    4    6    1    3     8
 [7,]    6    7    8    6    8    6    7    6    8    10
 [8,]   10    6   10    3    5    9    9    5    6     5
 [9,]    3    3    1    9    3    7    5    7    4     4
[10,]    8    1    3    7    1    5    3    3    2     9
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  1.6522943  2.0983631  1.3468109 -0.9793098 -3.8369410  3.2469190
 [7] -0.7330187 -2.3861512  4.5796451  1.4031167  0.8059347  2.9370017
[13]  1.9263049 -1.4942443 -0.0315664 -1.3766364 -3.2889812  3.1007454
[19]  1.0540556 -2.0479304
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.57430219
[2,] -0.55646687
[3,] -0.03322193
[4,]  0.97607164
[5,]  1.84021365
> 
> rowApply(tmp,sum)
[1] -1.0876431  7.4951750  8.1543746 -5.6186598 -0.9668349
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    9   18   18   10    7
[2,]   10   20    8    8    4
[3,]    6    9   14   19   10
[4,]    7    5    1   20    9
[5,]   16   11    3    1    1
> 
> 
> as.matrix(tmp)
            [,1]        [,2]        [,3]        [,4]       [,5]       [,6]
[1,] -0.03322193 -0.03287847 -0.50122283 -0.38067986  0.7093501  1.1263134
[2,]  1.84021365  3.25836552 -0.06480701 -0.47145647  0.1695789  0.9797692
[3,]  0.97607164  0.32190096  0.70873287 -1.43929859 -0.7083994  0.9238198
[4,] -0.55646687 -0.59132104  1.04173588  1.41052190 -2.1891715  0.8908412
[5,] -0.57430219 -0.85770383  0.16237197 -0.09839684 -1.8182992 -0.6738247
           [,7]       [,8]      [,9]       [,10]      [,11]      [,12]
[1,] -0.5364411 -1.6189157 0.3623235  1.32662840 -0.7401573  1.0029477
[2,] -0.5198349 -0.8228595 0.7418512  1.11709808  1.3641109  1.4037560
[3,]  0.7876259  0.7722081 1.3598902  0.42981448 -0.1491212  0.6134469
[4,] -1.0360552 -1.7642037 0.8740215 -0.03961187 -0.6152726  0.6325445
[5,]  0.5716867  1.0476195 1.2415586 -1.43081236  0.9463749 -0.7156934
          [,13]      [,14]       [,15]      [,16]        [,17]      [,18]
[1,] -0.8786711 -1.4971813 -0.37103056  0.1754770  0.001232263  0.7540453
[2,]  1.6209372 -0.2483376  0.08437898 -0.2303474 -0.446380062  1.8789640
[3,]  0.2769996  0.2975231  0.51410628 -0.8301721  0.197028968  0.6478250
[4,]  0.2534521 -0.2274224 -0.96624172 -0.2620077 -1.297753284 -0.6744458
[5,]  0.6535871  0.1811739  0.70722062 -0.2295863 -1.743109123  0.4943569
           [,19]       [,20]
[1,] -0.01791301  0.06235227
[2,] -1.54860965 -2.61121619
[3,]  1.77337406  0.68099793
[4,]  0.05856969 -0.56037286
[5,]  0.78863455  0.38030842
> 
> 
> 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.20-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.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.20-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.4896183 -0.8790605 -1.175628 1.397034 -0.4202635 0.1545347 0.5199965
           col8       col9     col10     col11    col12     col13      col14
row1 0.02091985 -0.2223859 0.7749574 0.6007197 1.658832 0.5744327 0.07259025
          col15       col16     col17     col18      col19     col20
row1 -0.4015349 0.005970227 -0.617502 0.6340031 -0.5300854 -0.527721
> tmp[,"col10"]
          col10
row1  0.7749574
row2  0.7724405
row3 -1.3416773
row4  0.9315019
row5  1.2876967
> tmp[c("row1","row5"),]
           col1       col2      col3      col4       col5      col6        col7
row1 -0.4896183 -0.8790605 -1.175628 1.3970342 -0.4202635 0.1545347  0.51999646
row5 -0.6464672 -1.1493919 -1.247759 0.6626056 -1.4247196 0.8708481 -0.03092428
           col8       col9     col10     col11      col12      col13
row1 0.02091985 -0.2223859 0.7749574 0.6007197  1.6588317  0.5744327
row5 1.59213505  0.8883351 1.2876967 0.2141658 -0.5230476 -0.1304721
           col14      col15        col16     col17      col18      col19
row1  0.07259025 -0.4015349  0.005970227 -0.617502  0.6340031 -0.5300854
row5 -0.84318976 -0.7226069 -0.171898909 -1.813177 -1.3327122  0.4917142
          col20
row1 -0.5277210
row5 -0.7976807
> tmp[,c("col6","col20")]
           col6       col20
row1  0.1545347 -0.52772095
row2 -0.1679961 -0.50711623
row3 -0.7540551  0.03875428
row4 -0.6873689 -1.05900019
row5  0.8708481 -0.79768070
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 0.1545347 -0.5277210
row5 0.8708481 -0.7976807
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1    col2     col3     col4     col5     col6     col7     col8
row1 49.57945 50.0309 49.02187 50.13943 50.45445 104.9846 50.14307 50.90717
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.86163 50.00742 51.24086 50.51035 49.21194 48.38952 49.66837 51.43317
       col17    col18    col19    col20
row1 49.4486 49.45771 48.16456 104.7498
> tmp[,"col10"]
        col10
row1 50.00742
row2 30.10462
row3 30.40488
row4 29.50904
row5 50.48022
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 49.57945 50.03090 49.02187 50.13943 50.45445 104.9846 50.14307 50.90717
row5 49.06868 48.70585 50.80811 52.24120 51.39484 105.1085 49.95010 49.55147
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.86163 50.00742 51.24086 50.51035 49.21194 48.38952 49.66837 51.43317
row5 50.48565 50.48022 49.84222 48.75945 50.06876 49.93002 49.23744 50.70717
        col17    col18    col19    col20
row1 49.44860 49.45771 48.16456 104.7498
row5 49.69479 50.09185 49.97142 102.5641
> tmp[,c("col6","col20")]
          col6     col20
row1 104.98456 104.74983
row2  75.64947  73.59366
row3  76.41617  75.07800
row4  74.50698  76.17133
row5 105.10847 102.56413
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.9846 104.7498
row5 105.1085 102.5641
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.9846 104.7498
row5 105.1085 102.5641
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,]  0.46994208
[2,]  1.41938575
[3,]  0.36521380
[4,]  0.02635691
[5,] -0.83835888
> tmp[,c("col17","col7")]
          col17        col7
[1,]  0.8005866 -2.58164736
[2,]  0.8578732 -0.40742867
[3,] -0.8026626 -0.25583121
[4,] -0.6353352  0.31397076
[5,] -0.4005046 -0.09908679
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6        col20
[1,]  1.4415422 -0.599930225
[2,]  0.6358822  1.125162601
[3,]  1.0819324 -0.747886906
[4,] -1.3109301  0.986941178
[5,] -1.7027489 -0.003815541
> subBufferedMatrix(tmp,1,c("col6"))[,1]
         col1
[1,] 1.441542
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
          col6
[1,] 1.4415422
[2,] 0.6358822
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]         [,2]       [,3]     [,4]       [,5]      [,6]
row3 -1.2028081 -0.004136363 -0.6036437 1.455534  0.4320841 0.9932337
row1 -0.6683476  1.980351670  1.8029987 2.024618 -1.0819853 1.5645170
           [,7]        [,8]      [,9]      [,10]      [,11]      [,12]
row3 -0.8704241 -0.08541919 0.2494105  0.5879719 -0.9683351 -1.3564508
row1 -0.7553837 -0.30998943 0.7535870 -0.6336666 -0.1852523  0.2646976
         [,13]      [,14]      [,15]     [,16]     [,17]      [,18]      [,19]
row3 -1.285506 -1.1560618 -3.0455501  1.520393 -1.507528 -0.3937335  0.5406261
row1  1.279155  0.7812496 -0.5466089 -1.726810 -1.427093 -1.0882556 -0.5430778
          [,20]
row3 0.09852863
row1 0.70691149
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
            [,1]       [,2]     [,3]      [,4]       [,5]     [,6]       [,7]
row2 -0.07735406 -0.5203523 1.476035 -0.957634 -0.8549367 2.031207 0.04219464
          [,8]      [,9]    [,10]
row2 0.9540507 -2.610441 0.082648
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]       [,2]       [,3]     [,4]      [,5]     [,6]    [,7]
row5 1.457369 -0.2476614 -0.8130784 1.135079 -1.424499 1.334388 1.31321
          [,8]      [,9]      [,10]     [,11]     [,12]     [,13]     [,14]
row5 -1.407533 -1.056235 -0.6638857 -0.494914 0.4508127 -1.835634 -1.819729
         [,15]     [,16]     [,17]    [,18]     [,19]      [,20]
row5 0.1095696 0.7152352 -1.700031 1.084577 -1.457387 -0.7808814
> 
> 
> 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: 0x600002494120>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135285e629995"
 [2] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135281b51359c"
 [3] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135287096a2c6"
 [4] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135283198aee9"
 [5] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135281f035c6f"
 [6] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1352815a98b51"
 [7] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135282df97df3"
 [8] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1352856bbf419"
 [9] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135284d96c1cb"
[10] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM13528648d1e38"
[11] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135286cbb221a"
[12] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1352871bc10ba"
[13] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM1352871ee5dab"
[14] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135285847bffc"
[15] "/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests/BM135284e8d66ab"
> 
> 
> ### 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: 0x6000024f00c0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x6000024f00c0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.20-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x6000024f00c0>
> rowMedians(tmp)
  [1] -0.1987916193 -0.1610744336 -0.1798621048  0.3401475664  0.8019427026
  [6]  0.3489249292  0.0973029961  0.1054400879 -0.1655929886 -0.2162701200
 [11]  0.3400543891  0.2210471072  0.1958981977 -0.6637849583 -0.0315903466
 [16]  0.0950307256 -0.1072603945 -0.0399060672  0.2158864991 -0.1596296588
 [21] -0.2011196640  0.2204181850 -0.1800751754  0.5283635630  0.0149484066
 [26]  0.2848907732  0.0073420373  0.3761240865 -0.1419637713 -0.0352568762
 [31]  0.0360392338 -0.1585797503  0.0151039814  0.4169102471  0.0170541439
 [36]  0.3362619108 -0.0599033908 -0.2841662653 -0.2520999217 -0.5290731632
 [41] -0.4649313319 -0.1725893142 -0.0958697574  0.0429134620 -0.1223644036
 [46]  0.3899362731  0.2875092738 -0.1478575274  0.3317641999  0.2289077144
 [51]  0.3631023120 -0.4706374626  0.3217141169 -0.2792999979  0.3325939052
 [56] -0.1982853371 -0.0600942209  0.0084338676  0.2000147822 -0.4450351414
 [61]  0.3894797686  0.2396504890 -0.1003027916  0.1773354446  0.0586909482
 [66] -0.6743460047 -0.3657389538  0.1095988130  0.0394347615 -0.4906570754
 [71]  0.3687152474 -0.7246171376  0.3115217455  0.0667530840  0.1863064879
 [76]  0.2489671934 -0.0606963144 -0.1997268491 -0.0322812257 -0.6266190496
 [81] -0.1713131387 -0.2948370572 -0.3136841036  0.1184018978 -0.0148150304
 [86]  0.1522899582  0.1268885892 -0.1440887570  0.1613965824  0.1517696620
 [91]  0.5117342696 -0.3951125514 -0.2985980601  0.1049672765  0.3328070068
 [96] -0.7560885209  0.0388152357 -0.0002601968 -1.1449450862  0.0835316691
[101]  0.2580552618 -0.5403055919  0.1052157696 -0.8806860074  0.5001968328
[106] -0.0775854271  0.4065583356  0.0056273662 -0.0686534156  0.1287661577
[111]  0.1312753163 -0.7525331449 -0.1869801568  0.5461999894  0.2546610924
[116] -0.0368326694  0.1611705966  0.2669514740 -0.3102567469 -0.0142766388
[121] -0.2561786179 -0.1881793292  0.8170739291  0.2301318809 -0.1070734472
[126] -0.0133015948  0.1078852959  0.5261501287 -0.0338964423  0.0586699670
[131] -0.1113046702  0.0096877919 -0.0064943719 -0.3378705815  0.2533516607
[136] -0.8448179304 -0.2178558345 -0.5857236383 -0.0618146883  0.0024021174
[141]  0.4758708494  0.1731114042 -0.2066404856  0.1311412886  0.0988818517
[146]  0.3190752452  0.2227705217 -0.3914034134  0.1334556244 -0.1975064484
[151]  0.4566607288  0.0481896287  0.0821897502 -0.5397789673  0.2418881294
[156]  0.2299537381 -0.1208250749 -0.0944771756  0.0326642316  0.5425099013
[161] -0.6518501378  0.2133381475 -0.2410527304  0.4565163091  0.3834426354
[166]  0.2076294734  0.2099155909  0.3905053746 -0.3522336009  0.1079507198
[171] -0.4062552664  0.0833810991 -0.3910765472  0.1781408613  0.1640806772
[176] -0.8524695194 -0.2825212276  0.2140161669 -0.3310140178  0.7242424849
[181] -0.3740269064 -0.2668382656 -0.1931737328  0.1484837533  0.0742662028
[186] -0.0470199761 -0.2608931151  0.3390076345 -0.3549947161  0.1446376217
[191]  0.0673954670 -0.3126730178 -0.3220399435 -0.2510880326 -0.0763546727
[196] -0.2657461964 -0.3754211761 -0.2085463454 -0.2321180246 -0.1468455172
[201]  0.3853469895  0.5204008603  0.3218728508  0.3626769100  0.2551386784
[206]  0.0996501026  0.0911166779  0.3049827359 -0.0246695712  0.2671582411
[211]  0.0803567557 -0.4073228103 -0.2537723057 -0.0569128368  0.3004954423
[216]  0.3867824557 -0.1575035358 -0.1716650335 -0.2263194056  0.1527793677
[221] -0.0703647383  0.0696206870  0.8518439360 -0.3097340558 -0.1184098942
[226]  0.7134756843  0.1999818701 -0.3181662204 -0.0307124441 -0.2194067113
> 
> proc.time()
   user  system elapsed 
  5.261  19.310  32.920 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.4.0 Patched (2024-04-24 r86482) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin20

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: 0x600003850300>
> .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: 0x600003850300>
> .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: 0x600003850300>
> .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: 0x600003850300>
> 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: 0x6000038781e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000038781e0>
> .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: 0x6000038781e0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000038781e0>
> .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: 0x6000038781e0>
> 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: 0x6000038783c0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x6000038783c0>
> .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: 0x6000038783c0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x6000038783c0>
> .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: 0x6000038783c0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x6000038783c0>
> .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: 0x6000038783c0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x6000038783c0>
> .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: 0x6000038783c0>
> 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: 0x600003864000>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x600003864000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003864000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003864000>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1488239933884" "BufferedMatrixFile1488270637fa3"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1488239933884" "BufferedMatrixFile1488270637fa3"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003864240>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003864240>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x600003864240>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x600003864240>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x600003864240>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x600003864240>
> .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: 0x600003848000>
> .Call("R_bm_AddColumn",P)
<pointer: 0x600003848000>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x600003848000>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x600003848000>
> 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: 0x600003860000>
> .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: 0x600003860000>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.611   0.224   0.898 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.4.0 Patched (2024-04-24 r86482) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin20

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.614   0.151   0.877 

Example timings