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

This page was generated on 2022-10-19 13:22:39 -0400 (Wed, 19 Oct 2022).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 20.04.5 LTS)x86_644.2.1 (2022-06-23) -- "Funny-Looking Kid" 4386
palomino3Windows Server 2022 Datacenterx644.2.1 (2022-06-23 ucrt) -- "Funny-Looking Kid" 4138
merida1macOS 10.14.6 Mojavex86_644.2.1 (2022-06-23) -- "Funny-Looking Kid" 4205
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

CHECK results for BufferedMatrix on merida1


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

raw results

Package 229/2140HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.60.0  (landing page)
Ben Bolstad
Snapshot Date: 2022-10-18 13:55:19 -0400 (Tue, 18 Oct 2022)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_15
git_last_commit: 3bff61b
git_last_commit_date: 2022-04-26 10:59:13 -0400 (Tue, 26 Apr 2022)
nebbiolo1Linux (Ubuntu 20.04.5 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino3Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
merida1macOS 10.14.6 Mojave / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published

Summary

Package: BufferedMatrix
Version: 1.60.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.60.0.tar.gz
StartedAt: 2022-10-19 00:03:15 -0400 (Wed, 19 Oct 2022)
EndedAt: 2022-10-19 00:04:11 -0400 (Wed, 19 Oct 2022)
EllapsedTime: 55.9 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.60.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.2.1 (2022-06-23)
* using platform: x86_64-apple-darwin17.0 (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.60.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.15-bioc/meat/BufferedMatrix.Rcheck/00install.out’ for details.
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking sizes of PDF files under ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 1 WARNING, 2 NOTEs
See
  ‘/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/00check.log’
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c:1580:7: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  if (!(Matrix->readonly) & setting){
      ^                   ~
doubleBufferedMatrix.c:1580:7: note: add parentheses after the '!' to evaluate the bitwise operator first
  if (!(Matrix->readonly) & setting){
      ^
       (                           )
doubleBufferedMatrix.c:1580:7: note: add parentheses around left hand side expression to silence this warning
  if (!(Matrix->readonly) & setting){
      ^
      (                  )
doubleBufferedMatrix.c:3327:12: warning: unused function 'sort_double' [-Wunused-function]
static int sort_double(const double *a1,const double *a2){
           ^
2 warnings generated.
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c init_package.c -o init_package.o
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.2/Resources/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix", "BufferedMatrix", .libPaths());.C("dbm_c_tester",integer(1))

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

Adding Additional Column
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
0.000000 1.000000 2.000000 3.000000 4.000000 0.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 0.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 0.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 0.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 0.000000 

Reassigning values
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 3
Buffer Cols: 3
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Activating Row Buffer
In row mode: 1
1.000000 6.000000 11.000000 16.000000 21.000000 26.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 27.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 28.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 29.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 30.000000 

Squaring Last Column
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
5.000000 10.000000 15.000000 20.000000 25.000000 900.000000 

Square rooting Last Row, then turing off Row Buffer
In row mode: 0
Checking on value that should be not be in column buffer2.236068 
1.000000 6.000000 11.000000 16.000000 21.000000 676.000000 
2.000000 7.000000 12.000000 17.000000 22.000000 729.000000 
3.000000 8.000000 13.000000 18.000000 23.000000 784.000000 
4.000000 9.000000 14.000000 19.000000 24.000000 841.000000 
2.236068 3.162278 3.872983 4.472136 5.000000 30.000000 

Single Indexing. Assign each value its square
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Resizing Buffers Smaller
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
1.000000 36.000000 121.000000 256.000000 441.000000 676.000000 
4.000000 49.000000 144.000000 289.000000 484.000000 729.000000 
9.000000 64.000000 169.000000 324.000000 529.000000 784.000000 
16.000000 81.000000 196.000000 361.000000 576.000000 841.000000 
25.000000 100.000000 225.000000 400.000000 625.000000 900.000000 

Activating Row Mode.
Resizing Buffers
Checking dimensions
Rows: 5
Cols: 6
Buffer Rows: 1
Buffer Cols: 1
Activating ReadOnly Mode.
The results of assignment is: 0
Printing matrix reversed.
900.000000 625.000000 400.000000 225.000000 100.000000 25.000000 
841.000000 576.000000 361.000000 196.000000 81.000000 16.000000 
784.000000 529.000000 324.000000 169.000000 64.000000 9.000000 
729.000000 484.000000 289.000000 144.000000 49.000000 -30.000000 
676.000000 441.000000 256.000000 121.000000 -20.000000 -10.000000 

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.555   0.132   0.664 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/Users/biocbuild/bbs-3.15-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 448552 24.0     969261 51.8         NA   624631 33.4
Vcells 811752  6.2    8388608 64.0      65536  1889589 14.5
> 
> 
> 
> 
> ##
> ## checking reads
> ##
> 
> tmp2 <- createBufferedMatrix(10,20)
> 
> test.sample <- rnorm(10*20)
> 
> tmp2[1:10,1:20] <- test.sample
> 
> test.matrix <- matrix(test.sample,10,20)
> 
> ## testing reads
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Oct 19 00:03:45 2022"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Oct 19 00:03:45 2022"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x7f9106c087f0>
> 
> 
> 
> 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] "Wed Oct 19 00:03:49 2022"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Oct 19 00:03:50 2022"
> 
> ColMode(tmp2)
<pointer: 0x7f9106c087f0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
           [,1]      [,2]       [,3]       [,4]
[1,] 99.3746377 0.2247440 -0.7066117 -0.8232293
[2,] -1.7419447 0.4426740  0.3271461  0.1820249
[3,]  0.9612718 0.5107692 -0.1093216 -0.8156746
[4,] -0.3999078 0.6381163  0.9646326 -0.7324200
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 99.3746377 0.2247440 0.7066117 0.8232293
[2,]  1.7419447 0.4426740 0.3271461 0.1820249
[3,]  0.9612718 0.5107692 0.1093216 0.8156746
[4,]  0.3999078 0.6381163 0.9646326 0.7324200
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]      [,3]      [,4]
[1,] 9.9686828 0.4740717 0.8406020 0.9073198
[2,] 1.3198275 0.6653375 0.5719669 0.4266438
[3,] 0.9804447 0.7146812 0.3306382 0.9031471
[4,] 0.6323827 0.7988218 0.9821571 0.8558154
> 
> 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.15-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 224.06147 29.96546 34.11263 34.89643
[2,]  39.94022 32.09605 31.04682 29.44846
[3,]  35.76572 32.65758 28.41570 34.84715
[4,]  31.72373 33.62633 35.78620 34.29057
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x7f90c6d00600>
> exp(tmp5)
<pointer: 0x7f90c6d00600>
> log(tmp5,2)
<pointer: 0x7f90c6d00600>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 466.3546
> Min(tmp5)
[1] 53.8876
> mean(tmp5)
[1] 71.70937
> Sum(tmp5)
[1] 14341.87
> Var(tmp5)
[1] 849.5834
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 88.92097 69.29699 68.16872 70.15417 71.98987 72.77109 69.47680 69.63825
 [9] 68.14528 68.53159
> rowSums(tmp5)
 [1] 1778.419 1385.940 1363.374 1403.083 1439.797 1455.422 1389.536 1392.765
 [9] 1362.906 1370.632
> rowVars(tmp5)
 [1] 7930.44282  114.15440   48.42900   47.86896   54.65635   82.21537
 [7]   60.56028   61.11889   77.10850   52.98294
> rowSd(tmp5)
 [1] 89.053034 10.684306  6.959095  6.918740  7.392993  9.067269  7.782048
 [8]  7.817857  8.781145  7.278938
> rowMax(tmp5)
 [1] 466.35459  95.91512  82.10674  83.97533  88.68770  89.94876  83.23848
 [8]  81.54990  84.46629  83.01726
> rowMin(tmp5)
 [1] 58.52994 53.88760 55.71009 57.72583 60.73041 57.25591 57.57194 55.60824
 [9] 54.35094 57.18217
> 
> colMeans(tmp5)
 [1] 113.64430  66.80394  69.16791  68.07237  68.14734  65.88456  70.87714
 [8]  72.10183  67.16553  75.22085  75.50403  68.95980  67.42101  65.61939
[15]  71.67263  70.72797  69.75059  65.58424  70.22393  71.63809
> colSums(tmp5)
 [1] 1136.4430  668.0394  691.6791  680.7237  681.4734  658.8456  708.7714
 [8]  721.0183  671.6553  752.2085  755.0403  689.5980  674.2101  656.1939
[15]  716.7263  707.2797  697.5059  655.8424  702.2393  716.3809
> colVars(tmp5)
 [1] 15395.779241    44.084333    59.473689    41.532595    96.164787
 [6]     9.219842   101.641370    57.285126   115.057976    49.031798
[11]    95.004206    46.279146    18.922793    39.157496    49.945289
[16]   113.085480    92.671261    23.992345    54.354087    55.110604
> colSd(tmp5)
 [1] 124.079729   6.639603   7.711919   6.444579   9.806365   3.036419
 [7]  10.081734   7.568694  10.726508   7.002271   9.747010   6.802878
[13]   4.350034   6.257595   7.067198  10.634166   9.626591   4.898198
[19]   7.372522   7.423652
> colMax(tmp5)
 [1] 466.35459  78.78538  84.21658  80.91982  85.12953  69.40199  89.94876
 [8]  83.17347  83.97533  82.84464  95.91512  81.63705  75.35361  74.98158
[15]  85.84414  88.68770  83.17629  71.77038  85.16882  82.51441
> colMin(tmp5)
 [1] 65.28527 58.08503 57.81232 59.83907 55.05591 60.83621 55.60824 54.35094
 [9] 53.88760 62.83522 62.68431 61.44221 62.99701 57.72583 61.99565 57.18217
[17] 55.95254 55.95521 62.27308 58.40131
> 
> 
> ### 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] 88.92097 69.29699 68.16872       NA 71.98987 72.77109 69.47680 69.63825
 [9] 68.14528 68.53159
> rowSums(tmp5)
 [1] 1778.419 1385.940 1363.374       NA 1439.797 1455.422 1389.536 1392.765
 [9] 1362.906 1370.632
> rowVars(tmp5)
 [1] 7930.44282  114.15440   48.42900   46.08985   54.65635   82.21537
 [7]   60.56028   61.11889   77.10850   52.98294
> rowSd(tmp5)
 [1] 89.053034 10.684306  6.959095  6.788951  7.392993  9.067269  7.782048
 [8]  7.817857  8.781145  7.278938
> rowMax(tmp5)
 [1] 466.35459  95.91512  82.10674        NA  88.68770  89.94876  83.23848
 [8]  81.54990  84.46629  83.01726
> rowMin(tmp5)
 [1] 58.52994 53.88760 55.71009       NA 60.73041 57.25591 57.57194 55.60824
 [9] 54.35094 57.18217
> 
> colMeans(tmp5)
 [1] 113.64430  66.80394  69.16791  68.07237  68.14734  65.88456  70.87714
 [8]  72.10183  67.16553  75.22085  75.50403        NA  67.42101  65.61939
[15]  71.67263  70.72797  69.75059  65.58424  70.22393  71.63809
> colSums(tmp5)
 [1] 1136.4430  668.0394  691.6791  680.7237  681.4734  658.8456  708.7714
 [8]  721.0183  671.6553  752.2085  755.0403        NA  674.2101  656.1939
[15]  716.7263  707.2797  697.5059  655.8424  702.2393  716.3809
> colVars(tmp5)
 [1] 15395.779241    44.084333    59.473689    41.532595    96.164787
 [6]     9.219842   101.641370    57.285126   115.057976    49.031798
[11]    95.004206           NA    18.922793    39.157496    49.945289
[16]   113.085480    92.671261    23.992345    54.354087    55.110604
> colSd(tmp5)
 [1] 124.079729   6.639603   7.711919   6.444579   9.806365   3.036419
 [7]  10.081734   7.568694  10.726508   7.002271   9.747010         NA
[13]   4.350034   6.257595   7.067198  10.634166   9.626591   4.898198
[19]   7.372522   7.423652
> colMax(tmp5)
 [1] 466.35459  78.78538  84.21658  80.91982  85.12953  69.40199  89.94876
 [8]  83.17347  83.97533  82.84464  95.91512        NA  75.35361  74.98158
[15]  85.84414  88.68770  83.17629  71.77038  85.16882  82.51441
> colMin(tmp5)
 [1] 65.28527 58.08503 57.81232 59.83907 55.05591 60.83621 55.60824 54.35094
 [9] 53.88760 62.83522 62.68431       NA 62.99701 57.72583 61.99565 57.18217
[17] 55.95254 55.95521 62.27308 58.40131
> 
> Max(tmp5,na.rm=TRUE)
[1] 466.3546
> Min(tmp5,na.rm=TRUE)
[1] 53.8876
> mean(tmp5,na.rm=TRUE)
[1] 71.76097
> Sum(tmp5,na.rm=TRUE)
[1] 14280.43
> Var(tmp5,na.rm=TRUE)
[1] 853.3392
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.92097 69.29699 68.16872 70.61270 71.98987 72.77109 69.47680 69.63825
 [9] 68.14528 68.53159
> rowSums(tmp5,na.rm=TRUE)
 [1] 1778.419 1385.940 1363.374 1341.641 1439.797 1455.422 1389.536 1392.765
 [9] 1362.906 1370.632
> rowVars(tmp5,na.rm=TRUE)
 [1] 7930.44282  114.15440   48.42900   46.08985   54.65635   82.21537
 [7]   60.56028   61.11889   77.10850   52.98294
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.053034 10.684306  6.959095  6.788951  7.392993  9.067269  7.782048
 [8]  7.817857  8.781145  7.278938
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.35459  95.91512  82.10674  83.97533  88.68770  89.94876  83.23848
 [8]  81.54990  84.46629  83.01726
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.52994 53.88760 55.71009 57.72583 60.73041 57.25591 57.57194 55.60824
 [9] 54.35094 57.18217
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.64430  66.80394  69.16791  68.07237  68.14734  65.88456  70.87714
 [8]  72.10183  67.16553  75.22085  75.50403  69.79509  67.42101  65.61939
[15]  71.67263  70.72797  69.75059  65.58424  70.22393  71.63809
> colSums(tmp5,na.rm=TRUE)
 [1] 1136.4430  668.0394  691.6791  680.7237  681.4734  658.8456  708.7714
 [8]  721.0183  671.6553  752.2085  755.0403  628.1558  674.2101  656.1939
[15]  716.7263  707.2797  697.5059  655.8424  702.2393  716.3809
> colVars(tmp5,na.rm=TRUE)
 [1] 15395.779241    44.084333    59.473689    41.532595    96.164787
 [6]     9.219842   101.641370    57.285126   115.057976    49.031798
[11]    95.004206    44.214853    18.922793    39.157496    49.945289
[16]   113.085480    92.671261    23.992345    54.354087    55.110604
> colSd(tmp5,na.rm=TRUE)
 [1] 124.079729   6.639603   7.711919   6.444579   9.806365   3.036419
 [7]  10.081734   7.568694  10.726508   7.002271   9.747010   6.649425
[13]   4.350034   6.257595   7.067198  10.634166   9.626591   4.898198
[19]   7.372522   7.423652
> colMax(tmp5,na.rm=TRUE)
 [1] 466.35459  78.78538  84.21658  80.91982  85.12953  69.40199  89.94876
 [8]  83.17347  83.97533  82.84464  95.91512  81.63705  75.35361  74.98158
[15]  85.84414  88.68770  83.17629  71.77038  85.16882  82.51441
> colMin(tmp5,na.rm=TRUE)
 [1] 65.28527 58.08503 57.81232 59.83907 55.05591 60.83621 55.60824 54.35094
 [9] 53.88760 62.83522 62.68431 62.22792 62.99701 57.72583 61.99565 57.18217
[17] 55.95254 55.95521 62.27308 58.40131
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 88.92097 69.29699 68.16872      NaN 71.98987 72.77109 69.47680 69.63825
 [9] 68.14528 68.53159
> rowSums(tmp5,na.rm=TRUE)
 [1] 1778.419 1385.940 1363.374    0.000 1439.797 1455.422 1389.536 1392.765
 [9] 1362.906 1370.632
> rowVars(tmp5,na.rm=TRUE)
 [1] 7930.44282  114.15440   48.42900         NA   54.65635   82.21537
 [7]   60.56028   61.11889   77.10850   52.98294
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.053034 10.684306  6.959095        NA  7.392993  9.067269  7.782048
 [8]  7.817857  8.781145  7.278938
> rowMax(tmp5,na.rm=TRUE)
 [1] 466.35459  95.91512  82.10674        NA  88.68770  89.94876  83.23848
 [8]  81.54990  84.46629  83.01726
> rowMin(tmp5,na.rm=TRUE)
 [1] 58.52994 53.88760 55.71009       NA 60.73041 57.25591 57.57194 55.60824
 [9] 54.35094 57.18217
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 118.93491  66.45007  68.57720  67.70582  68.04833  65.55076  71.84033
 [8]  72.13337  65.29777  74.79390  76.51364       NaN  66.74101  66.49645
[15]  71.14619  70.68960  68.25885  65.48636  70.86877  72.31505
> colSums(tmp5,na.rm=TRUE)
 [1] 1070.4142  598.0506  617.1948  609.3524  612.4350  589.9568  646.5630
 [8]  649.2003  587.6799  673.1451  688.6228    0.0000  600.6691  598.4681
[15]  640.3157  636.2064  614.3296  589.3773  637.8189  650.8355
> colVars(tmp5,na.rm=TRUE)
 [1] 17005.35777    48.18607    62.98235    45.21262   108.07510     9.11879
 [7]   103.90949    64.43458    90.19446    53.11001    95.41246          NA
[13]    16.08612    35.39824    53.07061   127.20460    79.22055    26.88361
[19]    56.47041    56.84385
> colSd(tmp5,na.rm=TRUE)
 [1] 130.404593   6.941619   7.936142   6.724033  10.395918   3.019733
 [7]  10.193600   8.027115   9.497076   7.287662   9.767930         NA
[13]   4.010751   5.949642   7.284958  11.278502   8.900593   5.184941
[19]   7.514679   7.539486
> colMax(tmp5,na.rm=TRUE)
 [1] 466.35459  78.78538  84.21658  80.91982  85.12953  69.40199  89.94876
 [8]  83.17347  81.54990  82.84464  95.91512      -Inf  75.35361  74.98158
[15]  85.84414  88.68770  83.01726  71.77038  85.16882  82.51441
> colMin(tmp5,na.rm=TRUE)
 [1] 65.28527 58.08503 57.81232 59.83907 55.05591 60.83621 55.60824 54.35094
 [9] 53.88760 62.83522 62.68431      Inf 62.99701 57.85172 61.99565 57.18217
[17] 55.95254 55.95521 62.27308 58.40131
> 
> 
> 
> 
> 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] 116.9665 134.5317 248.1996 313.5150 285.9426 217.6210 324.7667 231.5634
 [9] 228.4337 210.3505
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 116.9665 134.5317 248.1996 313.5150 285.9426 217.6210 324.7667 231.5634
 [9] 228.4337 210.3505
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -2.273737e-13  1.705303e-13  5.684342e-14  0.000000e+00 -4.263256e-14
 [6]  0.000000e+00  1.421085e-13  0.000000e+00  1.705303e-13  0.000000e+00
[11] -2.842171e-14  2.273737e-13 -2.842171e-13 -1.563194e-13  0.000000e+00
[16]  1.421085e-13  1.136868e-13  1.136868e-13  5.684342e-14 -1.421085e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## 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)
+ }
2   6 
9   13 
1   11 
6   5 
2   20 
5   11 
7   16 
7   3 
1   10 
4   3 
6   13 
10   13 
5   18 
10   14 
3   6 
4   13 
6   2 
3   8 
9   16 
7   1 
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.591624
> Min(tmp)
[1] -2.198961
> mean(tmp)
[1] 0.05173353
> Sum(tmp)
[1] 5.173353
> Var(tmp)
[1] 0.9322703
> 
> rowMeans(tmp)
[1] 0.05173353
> rowSums(tmp)
[1] 5.173353
> rowVars(tmp)
[1] 0.9322703
> rowSd(tmp)
[1] 0.9655414
> rowMax(tmp)
[1] 2.591624
> rowMin(tmp)
[1] -2.198961
> 
> colMeans(tmp)
  [1] -0.9291834717 -0.6380497344  0.7521251498 -0.3810700550  0.3515285432
  [6]  0.5961799467  0.4396872418  0.2911073709  0.3361616935  1.3215189871
 [11] -0.8525350229  1.0414658164  0.2496211502 -0.3755182921  0.9465267900
 [16] -1.0415486797  0.0505358935  0.1749020575  0.1464667018 -0.1787303901
 [21]  0.7665079092 -0.4388666629 -0.2454511754  0.1206135642 -0.8260962012
 [26]  0.5971578477 -0.3736894061  0.4012469975 -1.0648526585 -0.9529267910
 [31] -0.1577802767 -0.5128446790  0.0803002798  0.1356905108 -0.9881969849
 [36] -1.9865873298  1.3185692338 -0.5425513264 -0.5417256547  0.4610674013
 [41] -1.1848288996 -0.3388016892  1.4412226411  0.6777624605 -0.9634090489
 [46] -1.1092975942  1.5877387574 -0.2373675824 -1.2529619413  0.0909306859
 [51]  1.5174329701  2.5916235025 -1.1838600369  0.9031846542  0.0196444455
 [56] -0.1462692644  0.4871655973  0.5070610566 -0.1190944644  1.1923812817
 [61]  0.5374490537 -1.7686526253 -0.0001482986 -0.0574711019 -1.9953868903
 [66] -0.7513712930 -0.0402963949  2.2383608817  2.5127770736 -0.0301855937
 [71]  0.4288832539  2.1416763932  0.1770814462 -0.7672589812  1.2430786549
 [76]  0.3744255763 -0.7659333090 -0.9453555484  0.3574916615 -0.1282812082
 [81]  0.5834249356 -1.2126447551 -1.0148049136  0.5105184923  0.1246815948
 [86] -0.5110193981  2.1792805831 -0.2832316171  0.0652666105 -0.4947857066
 [91] -2.1989605095  1.4805879795 -0.4382241522  1.3679599383  0.4572725405
 [96] -0.0863314516 -0.2604178199 -0.3601833736  1.2961524825 -0.8231050253
> colSums(tmp)
  [1] -0.9291834717 -0.6380497344  0.7521251498 -0.3810700550  0.3515285432
  [6]  0.5961799467  0.4396872418  0.2911073709  0.3361616935  1.3215189871
 [11] -0.8525350229  1.0414658164  0.2496211502 -0.3755182921  0.9465267900
 [16] -1.0415486797  0.0505358935  0.1749020575  0.1464667018 -0.1787303901
 [21]  0.7665079092 -0.4388666629 -0.2454511754  0.1206135642 -0.8260962012
 [26]  0.5971578477 -0.3736894061  0.4012469975 -1.0648526585 -0.9529267910
 [31] -0.1577802767 -0.5128446790  0.0803002798  0.1356905108 -0.9881969849
 [36] -1.9865873298  1.3185692338 -0.5425513264 -0.5417256547  0.4610674013
 [41] -1.1848288996 -0.3388016892  1.4412226411  0.6777624605 -0.9634090489
 [46] -1.1092975942  1.5877387574 -0.2373675824 -1.2529619413  0.0909306859
 [51]  1.5174329701  2.5916235025 -1.1838600369  0.9031846542  0.0196444455
 [56] -0.1462692644  0.4871655973  0.5070610566 -0.1190944644  1.1923812817
 [61]  0.5374490537 -1.7686526253 -0.0001482986 -0.0574711019 -1.9953868903
 [66] -0.7513712930 -0.0402963949  2.2383608817  2.5127770736 -0.0301855937
 [71]  0.4288832539  2.1416763932  0.1770814462 -0.7672589812  1.2430786549
 [76]  0.3744255763 -0.7659333090 -0.9453555484  0.3574916615 -0.1282812082
 [81]  0.5834249356 -1.2126447551 -1.0148049136  0.5105184923  0.1246815948
 [86] -0.5110193981  2.1792805831 -0.2832316171  0.0652666105 -0.4947857066
 [91] -2.1989605095  1.4805879795 -0.4382241522  1.3679599383  0.4572725405
 [96] -0.0863314516 -0.2604178199 -0.3601833736  1.2961524825 -0.8231050253
> 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.9291834717 -0.6380497344  0.7521251498 -0.3810700550  0.3515285432
  [6]  0.5961799467  0.4396872418  0.2911073709  0.3361616935  1.3215189871
 [11] -0.8525350229  1.0414658164  0.2496211502 -0.3755182921  0.9465267900
 [16] -1.0415486797  0.0505358935  0.1749020575  0.1464667018 -0.1787303901
 [21]  0.7665079092 -0.4388666629 -0.2454511754  0.1206135642 -0.8260962012
 [26]  0.5971578477 -0.3736894061  0.4012469975 -1.0648526585 -0.9529267910
 [31] -0.1577802767 -0.5128446790  0.0803002798  0.1356905108 -0.9881969849
 [36] -1.9865873298  1.3185692338 -0.5425513264 -0.5417256547  0.4610674013
 [41] -1.1848288996 -0.3388016892  1.4412226411  0.6777624605 -0.9634090489
 [46] -1.1092975942  1.5877387574 -0.2373675824 -1.2529619413  0.0909306859
 [51]  1.5174329701  2.5916235025 -1.1838600369  0.9031846542  0.0196444455
 [56] -0.1462692644  0.4871655973  0.5070610566 -0.1190944644  1.1923812817
 [61]  0.5374490537 -1.7686526253 -0.0001482986 -0.0574711019 -1.9953868903
 [66] -0.7513712930 -0.0402963949  2.2383608817  2.5127770736 -0.0301855937
 [71]  0.4288832539  2.1416763932  0.1770814462 -0.7672589812  1.2430786549
 [76]  0.3744255763 -0.7659333090 -0.9453555484  0.3574916615 -0.1282812082
 [81]  0.5834249356 -1.2126447551 -1.0148049136  0.5105184923  0.1246815948
 [86] -0.5110193981  2.1792805831 -0.2832316171  0.0652666105 -0.4947857066
 [91] -2.1989605095  1.4805879795 -0.4382241522  1.3679599383  0.4572725405
 [96] -0.0863314516 -0.2604178199 -0.3601833736  1.2961524825 -0.8231050253
> colMin(tmp)
  [1] -0.9291834717 -0.6380497344  0.7521251498 -0.3810700550  0.3515285432
  [6]  0.5961799467  0.4396872418  0.2911073709  0.3361616935  1.3215189871
 [11] -0.8525350229  1.0414658164  0.2496211502 -0.3755182921  0.9465267900
 [16] -1.0415486797  0.0505358935  0.1749020575  0.1464667018 -0.1787303901
 [21]  0.7665079092 -0.4388666629 -0.2454511754  0.1206135642 -0.8260962012
 [26]  0.5971578477 -0.3736894061  0.4012469975 -1.0648526585 -0.9529267910
 [31] -0.1577802767 -0.5128446790  0.0803002798  0.1356905108 -0.9881969849
 [36] -1.9865873298  1.3185692338 -0.5425513264 -0.5417256547  0.4610674013
 [41] -1.1848288996 -0.3388016892  1.4412226411  0.6777624605 -0.9634090489
 [46] -1.1092975942  1.5877387574 -0.2373675824 -1.2529619413  0.0909306859
 [51]  1.5174329701  2.5916235025 -1.1838600369  0.9031846542  0.0196444455
 [56] -0.1462692644  0.4871655973  0.5070610566 -0.1190944644  1.1923812817
 [61]  0.5374490537 -1.7686526253 -0.0001482986 -0.0574711019 -1.9953868903
 [66] -0.7513712930 -0.0402963949  2.2383608817  2.5127770736 -0.0301855937
 [71]  0.4288832539  2.1416763932  0.1770814462 -0.7672589812  1.2430786549
 [76]  0.3744255763 -0.7659333090 -0.9453555484  0.3574916615 -0.1282812082
 [81]  0.5834249356 -1.2126447551 -1.0148049136  0.5105184923  0.1246815948
 [86] -0.5110193981  2.1792805831 -0.2832316171  0.0652666105 -0.4947857066
 [91] -2.1989605095  1.4805879795 -0.4382241522  1.3679599383  0.4572725405
 [96] -0.0863314516 -0.2604178199 -0.3601833736  1.2961524825 -0.8231050253
> colMedians(tmp)
  [1] -0.9291834717 -0.6380497344  0.7521251498 -0.3810700550  0.3515285432
  [6]  0.5961799467  0.4396872418  0.2911073709  0.3361616935  1.3215189871
 [11] -0.8525350229  1.0414658164  0.2496211502 -0.3755182921  0.9465267900
 [16] -1.0415486797  0.0505358935  0.1749020575  0.1464667018 -0.1787303901
 [21]  0.7665079092 -0.4388666629 -0.2454511754  0.1206135642 -0.8260962012
 [26]  0.5971578477 -0.3736894061  0.4012469975 -1.0648526585 -0.9529267910
 [31] -0.1577802767 -0.5128446790  0.0803002798  0.1356905108 -0.9881969849
 [36] -1.9865873298  1.3185692338 -0.5425513264 -0.5417256547  0.4610674013
 [41] -1.1848288996 -0.3388016892  1.4412226411  0.6777624605 -0.9634090489
 [46] -1.1092975942  1.5877387574 -0.2373675824 -1.2529619413  0.0909306859
 [51]  1.5174329701  2.5916235025 -1.1838600369  0.9031846542  0.0196444455
 [56] -0.1462692644  0.4871655973  0.5070610566 -0.1190944644  1.1923812817
 [61]  0.5374490537 -1.7686526253 -0.0001482986 -0.0574711019 -1.9953868903
 [66] -0.7513712930 -0.0402963949  2.2383608817  2.5127770736 -0.0301855937
 [71]  0.4288832539  2.1416763932  0.1770814462 -0.7672589812  1.2430786549
 [76]  0.3744255763 -0.7659333090 -0.9453555484  0.3574916615 -0.1282812082
 [81]  0.5834249356 -1.2126447551 -1.0148049136  0.5105184923  0.1246815948
 [86] -0.5110193981  2.1792805831 -0.2832316171  0.0652666105 -0.4947857066
 [91] -2.1989605095  1.4805879795 -0.4382241522  1.3679599383  0.4572725405
 [96] -0.0863314516 -0.2604178199 -0.3601833736  1.2961524825 -0.8231050253
> colRanges(tmp)
           [,1]       [,2]      [,3]       [,4]      [,5]      [,6]      [,7]
[1,] -0.9291835 -0.6380497 0.7521251 -0.3810701 0.3515285 0.5961799 0.4396872
[2,] -0.9291835 -0.6380497 0.7521251 -0.3810701 0.3515285 0.5961799 0.4396872
          [,8]      [,9]    [,10]     [,11]    [,12]     [,13]      [,14]
[1,] 0.2911074 0.3361617 1.321519 -0.852535 1.041466 0.2496212 -0.3755183
[2,] 0.2911074 0.3361617 1.321519 -0.852535 1.041466 0.2496212 -0.3755183
         [,15]     [,16]      [,17]     [,18]     [,19]      [,20]     [,21]
[1,] 0.9465268 -1.041549 0.05053589 0.1749021 0.1464667 -0.1787304 0.7665079
[2,] 0.9465268 -1.041549 0.05053589 0.1749021 0.1464667 -0.1787304 0.7665079
          [,22]      [,23]     [,24]      [,25]     [,26]      [,27]    [,28]
[1,] -0.4388667 -0.2454512 0.1206136 -0.8260962 0.5971578 -0.3736894 0.401247
[2,] -0.4388667 -0.2454512 0.1206136 -0.8260962 0.5971578 -0.3736894 0.401247
         [,29]      [,30]      [,31]      [,32]      [,33]     [,34]     [,35]
[1,] -1.064853 -0.9529268 -0.1577803 -0.5128447 0.08030028 0.1356905 -0.988197
[2,] -1.064853 -0.9529268 -0.1577803 -0.5128447 0.08030028 0.1356905 -0.988197
         [,36]    [,37]      [,38]      [,39]     [,40]     [,41]      [,42]
[1,] -1.986587 1.318569 -0.5425513 -0.5417257 0.4610674 -1.184829 -0.3388017
[2,] -1.986587 1.318569 -0.5425513 -0.5417257 0.4610674 -1.184829 -0.3388017
        [,43]     [,44]     [,45]     [,46]    [,47]      [,48]     [,49]
[1,] 1.441223 0.6777625 -0.963409 -1.109298 1.587739 -0.2373676 -1.252962
[2,] 1.441223 0.6777625 -0.963409 -1.109298 1.587739 -0.2373676 -1.252962
          [,50]    [,51]    [,52]    [,53]     [,54]      [,55]      [,56]
[1,] 0.09093069 1.517433 2.591624 -1.18386 0.9031847 0.01964445 -0.1462693
[2,] 0.09093069 1.517433 2.591624 -1.18386 0.9031847 0.01964445 -0.1462693
         [,57]     [,58]      [,59]    [,60]     [,61]     [,62]         [,63]
[1,] 0.4871656 0.5070611 -0.1190945 1.192381 0.5374491 -1.768653 -0.0001482986
[2,] 0.4871656 0.5070611 -0.1190945 1.192381 0.5374491 -1.768653 -0.0001482986
          [,64]     [,65]      [,66]       [,67]    [,68]    [,69]       [,70]
[1,] -0.0574711 -1.995387 -0.7513713 -0.04029639 2.238361 2.512777 -0.03018559
[2,] -0.0574711 -1.995387 -0.7513713 -0.04029639 2.238361 2.512777 -0.03018559
         [,71]    [,72]     [,73]     [,74]    [,75]     [,76]      [,77]
[1,] 0.4288833 2.141676 0.1770814 -0.767259 1.243079 0.3744256 -0.7659333
[2,] 0.4288833 2.141676 0.1770814 -0.767259 1.243079 0.3744256 -0.7659333
          [,78]     [,79]      [,80]     [,81]     [,82]     [,83]     [,84]
[1,] -0.9453555 0.3574917 -0.1282812 0.5834249 -1.212645 -1.014805 0.5105185
[2,] -0.9453555 0.3574917 -0.1282812 0.5834249 -1.212645 -1.014805 0.5105185
         [,85]      [,86]    [,87]      [,88]      [,89]      [,90]     [,91]
[1,] 0.1246816 -0.5110194 2.179281 -0.2832316 0.06526661 -0.4947857 -2.198961
[2,] 0.1246816 -0.5110194 2.179281 -0.2832316 0.06526661 -0.4947857 -2.198961
        [,92]      [,93]   [,94]     [,95]       [,96]      [,97]      [,98]
[1,] 1.480588 -0.4382242 1.36796 0.4572725 -0.08633145 -0.2604178 -0.3601834
[2,] 1.480588 -0.4382242 1.36796 0.4572725 -0.08633145 -0.2604178 -0.3601834
        [,99]    [,100]
[1,] 1.296152 -0.823105
[2,] 1.296152 -0.823105
> 
> 
> Max(tmp2)
[1] 2.520865
> Min(tmp2)
[1] -2.18053
> mean(tmp2)
[1] 0.02507307
> Sum(tmp2)
[1] 2.507307
> Var(tmp2)
[1] 0.9079281
> 
> rowMeans(tmp2)
  [1] -0.369755056  2.030788013 -0.675712972 -0.337595168  0.660982237
  [6]  0.078522844 -0.713722027 -0.565587163  1.366472707  0.235685830
 [11] -1.841457085 -1.430644948 -2.180529835 -0.738240235  0.367437790
 [16]  0.424008464  1.365652362  1.945895864  1.477411902  0.105180994
 [21] -1.222209718 -0.147789385  1.732020955 -0.222419739 -1.104208786
 [26] -0.307571994 -0.409890910  0.760866900 -0.566581264  1.080915142
 [31]  2.520864558 -0.592257854 -1.240233812  0.150373597  0.590372985
 [36] -0.507235068 -0.579007657  0.562477100 -0.194602521 -0.930039464
 [41] -0.051630149  0.275849767 -2.155224494  0.715192770 -0.844705684
 [46]  0.985382622  1.220484928  2.133920783  0.482627119 -0.185829136
 [51] -1.247918054  0.674880088 -0.105093092 -0.405493848 -0.008343138
 [56]  1.128148418 -1.344801017 -0.561874919 -1.232034400  0.275160481
 [61] -0.501269493 -0.344266246  0.972069346 -0.366069987 -0.080295313
 [66] -0.943445440  0.773001099  0.038856882  1.343078410 -1.004367717
 [71]  0.791072314 -0.698313087  0.561340345 -0.646569472  0.070170404
 [76] -0.648317832 -0.901591570 -0.840518412  1.080478733 -0.130577372
 [81] -0.117420532  1.361444028  0.439899509 -1.564600872  0.386860040
 [86]  0.786307817 -1.027146795  0.240677322  0.596683533 -0.959392124
 [91]  0.431419935  0.603097885  0.100382447 -0.247698633 -0.950163035
 [96]  1.175969130 -0.184119897  1.269009856  1.016943202  0.297352306
> rowSums(tmp2)
  [1] -0.369755056  2.030788013 -0.675712972 -0.337595168  0.660982237
  [6]  0.078522844 -0.713722027 -0.565587163  1.366472707  0.235685830
 [11] -1.841457085 -1.430644948 -2.180529835 -0.738240235  0.367437790
 [16]  0.424008464  1.365652362  1.945895864  1.477411902  0.105180994
 [21] -1.222209718 -0.147789385  1.732020955 -0.222419739 -1.104208786
 [26] -0.307571994 -0.409890910  0.760866900 -0.566581264  1.080915142
 [31]  2.520864558 -0.592257854 -1.240233812  0.150373597  0.590372985
 [36] -0.507235068 -0.579007657  0.562477100 -0.194602521 -0.930039464
 [41] -0.051630149  0.275849767 -2.155224494  0.715192770 -0.844705684
 [46]  0.985382622  1.220484928  2.133920783  0.482627119 -0.185829136
 [51] -1.247918054  0.674880088 -0.105093092 -0.405493848 -0.008343138
 [56]  1.128148418 -1.344801017 -0.561874919 -1.232034400  0.275160481
 [61] -0.501269493 -0.344266246  0.972069346 -0.366069987 -0.080295313
 [66] -0.943445440  0.773001099  0.038856882  1.343078410 -1.004367717
 [71]  0.791072314 -0.698313087  0.561340345 -0.646569472  0.070170404
 [76] -0.648317832 -0.901591570 -0.840518412  1.080478733 -0.130577372
 [81] -0.117420532  1.361444028  0.439899509 -1.564600872  0.386860040
 [86]  0.786307817 -1.027146795  0.240677322  0.596683533 -0.959392124
 [91]  0.431419935  0.603097885  0.100382447 -0.247698633 -0.950163035
 [96]  1.175969130 -0.184119897  1.269009856  1.016943202  0.297352306
> 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.369755056  2.030788013 -0.675712972 -0.337595168  0.660982237
  [6]  0.078522844 -0.713722027 -0.565587163  1.366472707  0.235685830
 [11] -1.841457085 -1.430644948 -2.180529835 -0.738240235  0.367437790
 [16]  0.424008464  1.365652362  1.945895864  1.477411902  0.105180994
 [21] -1.222209718 -0.147789385  1.732020955 -0.222419739 -1.104208786
 [26] -0.307571994 -0.409890910  0.760866900 -0.566581264  1.080915142
 [31]  2.520864558 -0.592257854 -1.240233812  0.150373597  0.590372985
 [36] -0.507235068 -0.579007657  0.562477100 -0.194602521 -0.930039464
 [41] -0.051630149  0.275849767 -2.155224494  0.715192770 -0.844705684
 [46]  0.985382622  1.220484928  2.133920783  0.482627119 -0.185829136
 [51] -1.247918054  0.674880088 -0.105093092 -0.405493848 -0.008343138
 [56]  1.128148418 -1.344801017 -0.561874919 -1.232034400  0.275160481
 [61] -0.501269493 -0.344266246  0.972069346 -0.366069987 -0.080295313
 [66] -0.943445440  0.773001099  0.038856882  1.343078410 -1.004367717
 [71]  0.791072314 -0.698313087  0.561340345 -0.646569472  0.070170404
 [76] -0.648317832 -0.901591570 -0.840518412  1.080478733 -0.130577372
 [81] -0.117420532  1.361444028  0.439899509 -1.564600872  0.386860040
 [86]  0.786307817 -1.027146795  0.240677322  0.596683533 -0.959392124
 [91]  0.431419935  0.603097885  0.100382447 -0.247698633 -0.950163035
 [96]  1.175969130 -0.184119897  1.269009856  1.016943202  0.297352306
> rowMin(tmp2)
  [1] -0.369755056  2.030788013 -0.675712972 -0.337595168  0.660982237
  [6]  0.078522844 -0.713722027 -0.565587163  1.366472707  0.235685830
 [11] -1.841457085 -1.430644948 -2.180529835 -0.738240235  0.367437790
 [16]  0.424008464  1.365652362  1.945895864  1.477411902  0.105180994
 [21] -1.222209718 -0.147789385  1.732020955 -0.222419739 -1.104208786
 [26] -0.307571994 -0.409890910  0.760866900 -0.566581264  1.080915142
 [31]  2.520864558 -0.592257854 -1.240233812  0.150373597  0.590372985
 [36] -0.507235068 -0.579007657  0.562477100 -0.194602521 -0.930039464
 [41] -0.051630149  0.275849767 -2.155224494  0.715192770 -0.844705684
 [46]  0.985382622  1.220484928  2.133920783  0.482627119 -0.185829136
 [51] -1.247918054  0.674880088 -0.105093092 -0.405493848 -0.008343138
 [56]  1.128148418 -1.344801017 -0.561874919 -1.232034400  0.275160481
 [61] -0.501269493 -0.344266246  0.972069346 -0.366069987 -0.080295313
 [66] -0.943445440  0.773001099  0.038856882  1.343078410 -1.004367717
 [71]  0.791072314 -0.698313087  0.561340345 -0.646569472  0.070170404
 [76] -0.648317832 -0.901591570 -0.840518412  1.080478733 -0.130577372
 [81] -0.117420532  1.361444028  0.439899509 -1.564600872  0.386860040
 [86]  0.786307817 -1.027146795  0.240677322  0.596683533 -0.959392124
 [91]  0.431419935  0.603097885  0.100382447 -0.247698633 -0.950163035
 [96]  1.175969130 -0.184119897  1.269009856  1.016943202  0.297352306
> 
> colMeans(tmp2)
[1] 0.02507307
> colSums(tmp2)
[1] 2.507307
> colVars(tmp2)
[1] 0.9079281
> colSd(tmp2)
[1] 0.9528526
> colMax(tmp2)
[1] 2.520865
> colMin(tmp2)
[1] -2.18053
> colMedians(tmp2)
[1] -0.06596273
> colRanges(tmp2)
          [,1]
[1,] -2.180530
[2,]  2.520865
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.14749288 -1.34656949  2.00121700 -2.73987756  2.05064545 -1.25940734
 [7]  5.35553939 -0.03061802 -2.99727495  5.37928939
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.3579794
[2,] -0.7717826
[3,]  0.8951563
[4,]  1.2296653
[5,]  1.5239657
> 
> rowApply(tmp,sum)
 [1] -1.422708  2.595031  2.555050 -1.771179  2.869401 -1.561250 -1.025874
 [8]  4.738919 -1.947010  4.530056
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    5    8    9    1    9    2    3    9   10     6
 [2,]    2    2    3    3   10    3    5    8    8     9
 [3,]    6    9    2    9    2    6    8    4    5     5
 [4,]    4    3    8    5    7    1    4    6    3     3
 [5,]    7    6    7    8    6    5    6    2    7     7
 [6,]   10    5   10    2    1    4    1   10    1     2
 [7,]    8    4    6    7    4    9   10    5    4    10
 [8,]    9    7    1    4    5    8    7    1    2     4
 [9,]    3    1    4    6    3    7    9    3    6     8
[10,]    1   10    5   10    8   10    2    7    9     1
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -5.57738421 -0.09564100  2.07884755  0.53604685  0.45363458  2.26663888
 [7]  2.51090698 -3.12335291  0.75776452 -0.85852298 -0.67008078 -1.28709257
[13] -1.13731005 -4.61898574  2.78322229  5.00451960 -0.03092591 -1.96190100
[19]  2.75155680 -1.14257015
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -3.2304797
[2,] -1.1268545
[3,] -0.8124555
[4,] -0.7569395
[5,]  0.3493449
> 
> rowApply(tmp,sum)
[1] -1.0208739  5.9646959 -2.9648353 -2.3492388 -0.9903771
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    2    6   15    6
[2,]   12   14   15    5    7
[3,]   11   17   12    8   12
[4,]    3    3    7   20   15
[5,]    9   12   17    6   11
> 
> 
> as.matrix(tmp)
           [,1]       [,2]        [,3]       [,4]        [,5]       [,6]
[1,] -3.2304797  0.1389086  0.04733421 -0.8815402 -0.07939436 -1.3789317
[2,] -1.1268545  0.8995811  1.88359153 -0.9849243  0.17443322  2.3713811
[3,] -0.7569395  0.4113117  0.15069000 -0.6571798  0.80652458  0.5028879
[4,]  0.3493449 -0.9217063 -0.41646882  2.3221444 -0.81078131 -0.3579625
[5,] -0.8124555 -0.6237362  0.41370062  0.7375467  0.36285245  1.1292640
            [,7]        [,8]       [,9]      [,10]      [,11]      [,12]
[1,] -0.01630436 -0.58958706  0.8810058 -0.5215737  1.3281848  0.6546732
[2,]  1.28432550 -0.08897662 -1.7305035 -0.6992882 -0.1595672 -0.5367176
[3,] -1.36808277 -0.31217162  1.5192577  0.3185236  0.1838139 -0.6176628
[4,]  0.95865272 -0.07288170 -0.2299337 -0.3999208 -1.0854029 -1.6170964
[5,]  1.65231589 -2.05973591  0.3179382  0.4437362 -0.9371094  0.8297110
           [,13]      [,14]      [,15]      [,16]       [,17]       [,18]
[1,] -0.68199331  0.4316671  1.7023505  1.7360634 -0.22948721 -0.76376802
[2,]  2.21465867 -0.3902119  0.9595887  2.0050681  0.05769638  0.09339521
[3,] -1.74393296 -0.8523428  1.0592352 -1.1041286 -1.41276785 -0.07258827
[4,]  0.06081724 -0.6354700  0.7916009  0.3302776  0.88473970 -1.29754513
[5,] -0.98685969 -3.1726281 -1.7295530  2.0372390  0.66889307  0.07860521
          [,19]      [,20]
[1,]  0.1868437  0.2451543
[2,]  0.6769578 -0.9389377
[3,]  1.4875779 -0.5068608
[4,]  0.7457270 -0.9473738
[5,] -0.3455495  1.0054478
> 
> 
> 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.15-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.15-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  648  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  563  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /Users/biocbuild/bbs-3.15-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.8640816 0.4001838 0.9119491 1.123368 0.289121 1.31404 -1.426124
          col8       col9     col10      col11     col12      col13    col14
row1 0.0529195 -0.7197557 -1.537205 0.06384409 0.2058025 -0.6477287 1.484229
       col15      col16      col17     col18     col19      col20
row1 -1.0056 -0.7082226 -0.7986263 0.1393362 0.7437141 -0.6284528
> tmp[,"col10"]
          col10
row1 -1.5372055
row2 -0.2030892
row3  0.8997229
row4 -0.8292730
row5  0.6089370
> tmp[c("row1","row5"),]
           col1      col2      col3      col4       col5       col6       col7
row1  0.8640816 0.4001838 0.9119491 1.1233683  0.2891210  1.3140402 -1.4261245
row5 -1.3075215 0.3073932 0.3532231 0.4648911 -0.4112323 -0.9328007 -0.2584498
          col8       col9     col10      col11     col12      col13     col14
row1 0.0529195 -0.7197557 -1.537205 0.06384409 0.2058025 -0.6477287 1.4842291
row5 0.1953849 -0.0839440  0.608937 1.85702376 0.2846413 -0.4994180 0.1698849
          col15      col16      col17       col18     col19      col20
row1 -1.0056000 -0.7082226 -0.7986263  0.13933617 0.7437141 -0.6284528
row5 -0.8472107  0.1392922 -0.1738054 -0.01264897 1.4254247  1.0124664
> tmp[,c("col6","col20")]
            col6      col20
row1  1.31404022 -0.6284528
row2 -0.09825848  0.2867177
row3  0.73497182  1.3533279
row4 -0.21243289 -1.5762116
row5 -0.93280074  1.0124664
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  1.3140402 -0.6284528
row5 -0.9328007  1.0124664
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
        col1     col2     col3     col4     col5     col6     col7     col8
row1 48.4613 50.25185 48.56407 50.27813 49.24073 105.3572 50.62027 50.49066
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.28517 49.53186 49.84861 51.26276 49.89632 50.64104 49.16665 49.59451
        col17    col18   col19    col20
row1 51.16377 48.81161 47.5785 105.6071
> tmp[,"col10"]
        col10
row1 49.53186
row2 30.62074
row3 30.28187
row4 30.74882
row5 48.85461
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.46130 50.25185 48.56407 50.27813 49.24073 105.3572 50.62027 50.49066
row5 48.48291 51.04469 48.64812 50.90979 50.39240 104.1379 50.31120 49.58952
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.28517 49.53186 49.84861 51.26276 49.89632 50.64104 49.16665 49.59451
row5 52.27742 48.85461 48.92007 50.52961 51.21096 50.85261 51.75797 50.56182
        col17    col18   col19    col20
row1 51.16377 48.81161 47.5785 105.6071
row5 50.37889 48.55420 50.0186 105.8266
> tmp[,c("col6","col20")]
          col6     col20
row1 105.35723 105.60712
row2  74.64374  74.76559
row3  73.80459  74.05980
row4  76.32165  74.63149
row5 104.13786 105.82664
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.3572 105.6071
row5 104.1379 105.8266
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.3572 105.6071
row5 104.1379 105.8266
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -0.4744810
[2,]  0.1802154
[3,] -0.9484525
[4,]  0.5624270
[5,] -1.2589747
> tmp[,c("col17","col7")]
          col17        col7
[1,]  1.0683675  0.25336046
[2,] -0.4879747 -0.03385409
[3,] -0.1060812  1.41027925
[4,] -0.8502086 -0.97022922
[5,] -0.4142644 -0.98149619
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6     col20
[1,] -0.23442023 -0.655471
[2,] -0.13214016  1.088533
[3,] -1.39436816  1.232372
[4,] -0.06458078  1.341078
[5,]  0.57303791  0.991986
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.2344202
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.2344202
[2,] -0.1321402
> 
> 
> 
> 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 0.2229629 -1.2408420 -0.5605786  0.01180227 -0.1367228 -0.8332769
row1 1.6065149 -0.5624159 -1.4149421 -0.01018690  0.4496385 -1.5891341
           [,7]      [,8]        [,9]      [,10]      [,11]     [,12]
row3  0.8725546 0.7763533  0.29934911 -0.7401074 -1.3357646 0.9738867
row1 -0.4420013 1.0839652 -0.03870084 -0.8822743 -0.4261581 2.4271094
          [,13]      [,14]      [,15]      [,16]      [,17]     [,18]     [,19]
row3 -0.9154632 -0.3239722 -0.0142818  1.0435840 -0.6215165 0.4620619 0.9992475
row1 -0.7088694 -0.3974923 -0.3482853 -0.8707748 -2.9681481 1.7493467 1.3989264
          [,20]
row3 -0.8234644
row1 -1.3165006
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]      [,2]      [,3]      [,4]      [,5]       [,6]      [,7]
row2 -0.828448 0.9536818 -2.290768 0.1633661 0.3649942 -0.3081976 -0.477634
          [,8]      [,9]      [,10]
row2 0.5287619 0.2320961 -0.6864145
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]      [,3]      [,4]     [,5]     [,6]      [,7]
row5 0.5107183 -0.4873935 -1.876081 -1.025006 1.275908 1.554008 -2.720587
          [,8]       [,9]      [,10]      [,11]     [,12]    [,13]     [,14]
row5 0.2885285 -0.1340868 -0.5129465 -0.2935757 0.2804225 1.091927 0.9393809
         [,15]     [,16]      [,17]     [,18]     [,19]     [,20]
row5 0.4119479 0.7032064 -0.5812854 0.8835267 0.1803495 0.8934668
> 
> 
> 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: 0x7f9086c0b860>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad96535f9d7d"
 [2] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad962a5ca44e"
 [3] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad962827129c"
 [4] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad961d36d45c"
 [5] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad967aaff2ff"
 [6] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad96357a8246"
 [7] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad967dfedd17"
 [8] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad96676551a0"
 [9] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad962cd21468"
[10] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad961439ced5"
[11] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad965f3a0c52"
[12] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad965bff0c55"
[13] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad964582cfa2"
[14] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad96f0db855" 
[15] "/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests/BMad964dc0dc2b"
> 
> 
> ### 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: 0x7f90a6f298b0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x7f90a6f298b0>
Warning message:
In dir.create(new.directory) :
  '/Users/biocbuild/bbs-3.15-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x7f90a6f298b0>
> rowMedians(tmp)
  [1] -0.427698092 -0.301724088  0.336698501  0.390690856  0.434351506
  [6] -0.143409636 -0.091075477 -0.525191852 -0.002412178  0.349019302
 [11] -0.206954288  0.044420646  0.516092554 -0.403213648 -0.160079063
 [16] -0.130113956  0.272920946  0.316891386  0.149908193  0.164438368
 [21] -0.481131444 -0.450274265 -0.618061440 -0.233507531  0.449305462
 [26] -0.516054215 -0.549509441 -0.238042563  0.298223066  0.322171420
 [31]  0.516418915 -0.130377812 -0.013910247  0.233888549  0.178182831
 [36] -0.131954055  0.090297471 -0.234576289  0.304070465 -0.454297300
 [41]  0.369552446 -0.400995819  0.602814026  0.292296556  0.530027842
 [46]  0.069784056 -0.094431077  0.141001189 -0.007602955 -0.290492778
 [51]  0.026076492  0.237072021 -0.250614077 -0.458304958 -0.032387984
 [56]  0.534926461  0.295146232 -0.350397796 -0.309361889  0.346187703
 [61]  0.464342232 -0.112750007 -0.133334422 -0.034729542 -0.117160584
 [66]  0.169003988 -0.024236546  0.441937133  0.118166712  0.111509196
 [71] -0.180966206 -0.007287372  0.063368805  0.281784575 -0.143046404
 [76] -0.208766688 -0.131824427  0.001542179  0.093054164  0.714996224
 [81]  0.410712847 -0.211688290  0.612218578 -0.029511567 -0.014738037
 [86]  0.621870287  0.242415886  0.210288555  0.468973880 -0.475771622
 [91] -0.168591786 -0.049544092 -0.629699030  0.799822362  0.005332679
 [96]  0.304703260 -0.091383637 -0.210853164 -0.316013403  0.559860615
[101]  0.029452155  0.394805723  0.429798375  0.368632766  0.354702789
[106] -0.178719445  0.122792043  0.549834115 -0.246836243 -0.622231098
[111] -0.028795858  0.310452527  0.035569228  0.004400015  0.056332523
[116] -0.067749042  0.141109812  0.364031019 -0.226969238 -0.056846927
[121] -0.262343399 -0.403030249  0.486536470 -0.153654243 -0.376645685
[126]  0.074716897  0.343826516 -0.311239648  0.034554063 -0.608312622
[131]  0.444848074 -0.178435057 -0.301795931 -0.182859437 -0.068920387
[136]  0.074537042  0.117942123 -0.302459459  0.507657129 -0.391762832
[141] -0.194165592  0.067756955  0.474115547 -0.459126702 -0.023652982
[146]  0.341231683  0.146396169 -0.282570259  0.768302230  0.759154212
[151] -0.337607697  0.222147496  0.161295748  0.034653342 -0.628705282
[156]  0.191773911  0.329480008  0.420554038  0.263052166  0.053640649
[161] -0.610039667  0.035908764  0.032615039 -0.175140821  0.042149527
[166] -0.016950937 -0.385001653 -0.456436308  0.255585220 -0.027193317
[171] -0.349225643  0.141468756  0.089583681  0.542318737 -0.050115109
[176] -0.360192184 -0.279784707  0.687187105  0.076290552  0.542081131
[181] -0.084390007  0.129564290  0.468504251  0.823369051  0.545390392
[186]  0.078120474  0.152766828 -0.628497358 -0.327601542 -0.356107253
[191]  0.036088477  0.353557002  0.111131616  0.067474834 -0.548907479
[196] -0.174537102 -0.126631775  0.043173634  0.685978669  0.032034664
[201]  0.155292071 -0.397400845  0.030520878  0.574388277 -0.085389732
[206]  0.488915087 -0.330375964 -0.008965820 -0.245052934  0.598847300
[211] -0.132874931  0.066472977 -0.265494847 -0.104388748  0.401187471
[216] -0.191610958  0.259153248 -0.028343671 -0.107779062 -0.627339570
[221]  0.304005906  0.128053811  0.293612256 -0.235345554  0.161917946
[226]  0.375216452 -0.130773009 -0.239251381  0.131886907 -0.174132746
> 
> proc.time()
   user  system elapsed 
  4.232  11.974  16.465 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> prefix <- "dbmtest"
> directory <- getwd()
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_Test_C",P)
RBufferedMatrix
Checking dimensions
Rows: 5
Cols: 5
Buffer Rows: 1
Buffer Cols: 1

Assigning Values
0.000000 1.000000 2.000000 3.000000 4.000000 
1.000000 2.000000 3.000000 4.000000 5.000000 
2.000000 3.000000 4.000000 5.000000 6.000000 
3.000000 4.000000 5.000000 6.000000 7.000000 
4.000000 5.000000 6.000000 7.000000 8.000000 

<pointer: 0x7fce16f0f220>
> .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: 0x7fce16f0f220>
> .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: 0x7fce16f0f220>
> .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: 0x7fce16f0f220>
> 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: 0x7fce20900270>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fce20900270>
> .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: 0x7fce20900270>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fce20900270>
> .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: 0x7fce20900270>
> 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: 0x7fce20910f20>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fce20910f20>
> .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: 0x7fce20910f20>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fce20910f20>
> .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: 0x7fce20910f20>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x7fce20910f20>
> .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: 0x7fce20910f20>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x7fce20910f20>
> .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: 0x7fce20910f20>
> 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: 0x7fcda6d02bc0>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x7fcda6d02bc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fcda6d02bc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fcda6d02bc0>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFileaf0c26fff7c3" "BufferedMatrixFileaf0c6ee33735"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFileaf0c26fff7c3" "BufferedMatrixFileaf0c6ee33735"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fcda6d00150>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fcda6d00150>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fcda6d00150>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x7fcda6d00150>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x7fcda6d00150>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x7fcda6d00150>
> .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: 0x7fcda6d1dd10>
> .Call("R_bm_AddColumn",P)
<pointer: 0x7fcda6d1dd10>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x7fcda6d1dd10>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x7fcda6d1dd10>
> 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: 0x7fcda6d1da70>
> .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: 0x7fcda6d1da70>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.562   0.138   0.676 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BufferedMatrix);library.dynam("BufferedMatrix","BufferedMatrix", .libPaths());

Attaching package: 'BufferedMatrix'

The following objects are masked from 'package:base':

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.551   0.091   0.619 

Example timings