Back to Build/check report for BioC 3.17
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

This page was generated on 2023-02-03 02:35:46 -0000 (Fri, 03 Feb 2023).

HostnameOSArch (*)R versionInstalled pkgs
kunpeng1Linux (Ubuntu 22.04.1 LTS)aarch64R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences" 4039
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 kunpeng1


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 228/2164HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.63.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-02-01 03:13:00 -0000 (Wed, 01 Feb 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: master
git_last_commit: e95ad0a
git_last_commit_date: 2022-11-01 14:42:48 -0000 (Tue, 01 Nov 2022)
kunpeng1Linux (Ubuntu 22.04.1 LTS) / aarch64  OK    OK    OK  

Summary

Package: BufferedMatrix
Version: 1.63.0
Command: /home/biocbuild/bbs-3.17-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.17-bioc/R/library --timings BufferedMatrix_1.63.0.tar.gz
StartedAt: 2023-02-02 02:24:28 -0000 (Thu, 02 Feb 2023)
EndedAt: 2023-02-02 02:25:05 -0000 (Thu, 02 Feb 2023)
EllapsedTime: 36.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck’
* using R Under development (unstable) (2023-01-14 r83615)
* using platform: aarch64-unknown-linux-gnu (64-bit)
* R was compiled by
    gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
    GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
* running under: Ubuntu 22.04.1 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.63.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BufferedMatrix’ can be installed ... OK
* used C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ...
  ‘BufferedMatrix.Rnw’... OK
 OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.17-bioc/R/library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
gcc -I"/home/biocbuild/bbs-3.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
doubleBufferedMatrix.c: In function ‘dbm_ReadOnlyMode’:
doubleBufferedMatrix.c:1580:7: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]
 1580 |   if (!(Matrix->readonly) & setting){
      |       ^~~~~~~~~~~~~~~~~~~
At top level:
doubleBufferedMatrix.c:3327:12: warning: ‘sort_double’ defined but not used [-Wunused-function]
 3327 | static int sort_double(const double *a1,const double *a2){
      |            ^~~~~~~~~~~
gcc -I"/home/biocbuild/bbs-3.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/bbs-3.17-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -Wall -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/bbs-3.17-bioc/R/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/bbs-3.17-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.17-bioc/R/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.341   0.033   0.369 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 456993 24.5     979984 52.4   651420 34.8
Vcells 842364  6.5    8388608 64.0  2047783 15.7
> 
> 
> 
> 
> ##
> ## 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] "Thu Feb  2 02:24:50 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Feb  2 02:24:50 2023"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0xaaab130588e0>
> 
> 
> 
> 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] "Thu Feb  2 02:24:50 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Thu Feb  2 02:24:50 2023"
> 
> ColMode(tmp2)
<pointer: 0xaaab130588e0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
             [,1]       [,2]        [,3]       [,4]
[1,] 100.48982124 -0.9481256 -0.87880741 -1.5503242
[2,]   0.09677501  0.4426524  0.05537409 -0.8208891
[3,]   0.20343168  0.1274400  0.80162269  1.0736944
[4,]   0.19789673 -1.5748440 -1.61801065 -0.8466264
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
             [,1]      [,2]       [,3]      [,4]
[1,] 100.48982124 0.9481256 0.87880741 1.5503242
[2,]   0.09677501 0.4426524 0.05537409 0.8208891
[3,]   0.20343168 0.1274400 0.80162269 1.0736944
[4,]   0.19789673 1.5748440 1.61801065 0.8466264
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0244611 0.9737174 0.9374473 1.2451202
[2,]  0.3110868 0.6653212 0.2353170 0.9060293
[3,]  0.4510340 0.3569875 0.8953338 1.0361923
[4,]  0.4448558 1.2549279 1.2720105 0.9201230
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 225.73443 35.68530 35.25328 39.00153
[2,]  28.20764 32.09586 27.40854 34.88118
[3,]  29.71377 28.69731 34.75496 36.43562
[4,]  29.64646 39.12412 39.33812 35.04786
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0xaaab127d7470>
> exp(tmp5)
<pointer: 0xaaab127d7470>
> log(tmp5,2)
<pointer: 0xaaab127d7470>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 469.8366
> Min(tmp5)
[1] 53.5426
> mean(tmp5)
[1] 72.48239
> Sum(tmp5)
[1] 14496.48
> Var(tmp5)
[1] 866.2536
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 89.73515 70.41676 71.65324 69.79096 68.28371 71.88959 71.20496 69.94409
 [9] 71.40129 70.50419
> rowSums(tmp5)
 [1] 1794.703 1408.335 1433.065 1395.819 1365.674 1437.792 1424.099 1398.882
 [9] 1428.026 1410.084
> rowVars(tmp5)
 [1] 8081.75172   80.94908   46.32399  107.36929   56.23693   66.30966
 [7]   53.56954   61.96045   84.50014   74.95552
> rowSd(tmp5)
 [1] 89.898564  8.997170  6.806173 10.361915  7.499128  8.143074  7.319121
 [8]  7.871496  9.192396  8.657685
> rowMax(tmp5)
 [1] 469.83665  88.28352  81.02142  93.91813  83.47941  86.95300  82.23850
 [8]  83.65328  85.70771  88.36011
> rowMin(tmp5)
 [1] 53.88769 57.04729 57.50668 53.99549 57.96552 59.31399 56.54589 57.13180
 [9] 54.96064 53.54260
> 
> colMeans(tmp5)
 [1] 109.50913  70.62900  69.58590  73.12644  74.27823  68.63707  70.45586
 [8]  65.54573  72.43892  70.97443  71.29115  66.09558  73.08440  72.38618
[15]  69.50500  69.65405  70.07792  74.74793  70.20886  67.41610
> colSums(tmp5)
 [1] 1095.0913  706.2900  695.8590  731.2644  742.7823  686.3707  704.5586
 [8]  655.4573  724.3892  709.7443  712.9115  660.9558  730.8440  723.8618
[15]  695.0500  696.5405  700.7792  747.4793  702.0886  674.1610
> colVars(tmp5)
 [1] 16095.32537    56.61838    96.33321    34.26415    88.40203   129.98080
 [7]    43.47485   100.96985   111.69198    42.44700    28.29969    77.16909
[13]    80.10254    77.85347    80.82298    21.24567    79.86084    78.07783
[19]    19.78136    81.18884
> colSd(tmp5)
 [1] 126.867353   7.524518   9.814949   5.853559   9.402236  11.400912
 [7]   6.593546  10.048375  10.568443   6.515136   5.319746   8.784594
[13]   8.950002   8.823461   8.990160   4.609303   8.936490   8.836166
[19]   4.447624   9.010485
> colMax(tmp5)
 [1] 469.83665  81.43174  85.01570  81.17657  88.28352  93.91813  76.98593
 [8]  83.57035  88.36011  77.48780  82.23850  78.55467  85.70771  84.14562
[15]  79.85003  75.51350  81.32155  83.37776  77.40214  83.65328
> colMin(tmp5)
 [1] 58.71051 57.94786 57.04729 62.69424 60.57699 53.91372 58.91030 53.88769
 [9] 57.13180 58.37060 64.34194 53.99549 57.96552 59.44796 53.54260 60.07052
[17] 56.98437 59.31399 62.69923 56.54589
> 
> 
> ### setting a random element to NA and then testing with na.rm=TRUE or na.rm=FALSE (The default)
> 
> 
> which.row <- sample(1:10,1,replace=TRUE)
> which.col  <- sample(1:20,1,replace=TRUE)
> 
> tmp5[which.row,which.col] <- NA
> 
> Max(tmp5)
[1] NA
> Min(tmp5)
[1] NA
> mean(tmp5)
[1] NA
> Sum(tmp5)
[1] NA
> Var(tmp5)
[1] NA
> 
> rowMeans(tmp5)
 [1] 89.73515 70.41676 71.65324 69.79096 68.28371       NA 71.20496 69.94409
 [9] 71.40129 70.50419
> rowSums(tmp5)
 [1] 1794.703 1408.335 1433.065 1395.819 1365.674       NA 1424.099 1398.882
 [9] 1428.026 1410.084
> rowVars(tmp5)
 [1] 8081.75172   80.94908   46.32399  107.36929   56.23693   68.16079
 [7]   53.56954   61.96045   84.50014   74.95552
> rowSd(tmp5)
 [1] 89.898564  8.997170  6.806173 10.361915  7.499128  8.255955  7.319121
 [8]  7.871496  9.192396  8.657685
> rowMax(tmp5)
 [1] 469.83665  88.28352  81.02142  93.91813  83.47941        NA  82.23850
 [8]  83.65328  85.70771  88.36011
> rowMin(tmp5)
 [1] 53.88769 57.04729 57.50668 53.99549 57.96552       NA 56.54589 57.13180
 [9] 54.96064 53.54260
> 
> colMeans(tmp5)
 [1] 109.50913  70.62900  69.58590  73.12644  74.27823  68.63707  70.45586
 [8]  65.54573  72.43892        NA  71.29115  66.09558  73.08440  72.38618
[15]  69.50500  69.65405  70.07792  74.74793  70.20886  67.41610
> colSums(tmp5)
 [1] 1095.0913  706.2900  695.8590  731.2644  742.7823  686.3707  704.5586
 [8]  655.4573  724.3892        NA  712.9115  660.9558  730.8440  723.8618
[15]  695.0500  696.5405  700.7792  747.4793  702.0886  674.1610
> colVars(tmp5)
 [1] 16095.32537    56.61838    96.33321    34.26415    88.40203   129.98080
 [7]    43.47485   100.96985   111.69198          NA    28.29969    77.16909
[13]    80.10254    77.85347    80.82298    21.24567    79.86084    78.07783
[19]    19.78136    81.18884
> colSd(tmp5)
 [1] 126.867353   7.524518   9.814949   5.853559   9.402236  11.400912
 [7]   6.593546  10.048375  10.568443         NA   5.319746   8.784594
[13]   8.950002   8.823461   8.990160   4.609303   8.936490   8.836166
[19]   4.447624   9.010485
> colMax(tmp5)
 [1] 469.83665  81.43174  85.01570  81.17657  88.28352  93.91813  76.98593
 [8]  83.57035  88.36011        NA  82.23850  78.55467  85.70771  84.14562
[15]  79.85003  75.51350  81.32155  83.37776  77.40214  83.65328
> colMin(tmp5)
 [1] 58.71051 57.94786 57.04729 62.69424 60.57699 53.91372 58.91030 53.88769
 [9] 57.13180       NA 64.34194 53.99549 57.96552 59.44796 53.54260 60.07052
[17] 56.98437 59.31399 62.69923 56.54589
> 
> Max(tmp5,na.rm=TRUE)
[1] 469.8366
> Min(tmp5,na.rm=TRUE)
[1] 53.5426
> mean(tmp5,na.rm=TRUE)
[1] 72.45724
> Sum(tmp5,na.rm=TRUE)
[1] 14418.99
> Var(tmp5,na.rm=TRUE)
[1] 870.5014
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.73515 70.41676 71.65324 69.79096 68.28371 71.59495 71.20496 69.94409
 [9] 71.40129 70.50419
> rowSums(tmp5,na.rm=TRUE)
 [1] 1794.703 1408.335 1433.065 1395.819 1365.674 1360.304 1424.099 1398.882
 [9] 1428.026 1410.084
> rowVars(tmp5,na.rm=TRUE)
 [1] 8081.75172   80.94908   46.32399  107.36929   56.23693   68.16079
 [7]   53.56954   61.96045   84.50014   74.95552
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.898564  8.997170  6.806173 10.361915  7.499128  8.255955  7.319121
 [8]  7.871496  9.192396  8.657685
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.83665  88.28352  81.02142  93.91813  83.47941  86.95300  82.23850
 [8]  83.65328  85.70771  88.36011
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.88769 57.04729 57.50668 53.99549 57.96552 59.31399 56.54589 57.13180
 [9] 54.96064 53.54260
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 109.50913  70.62900  69.58590  73.12644  74.27823  68.63707  70.45586
 [8]  65.54573  72.43892  70.25073  71.29115  66.09558  73.08440  72.38618
[15]  69.50500  69.65405  70.07792  74.74793  70.20886  67.41610
> colSums(tmp5,na.rm=TRUE)
 [1] 1095.0913  706.2900  695.8590  731.2644  742.7823  686.3707  704.5586
 [8]  655.4573  724.3892  632.2566  712.9115  660.9558  730.8440  723.8618
[15]  695.0500  696.5405  700.7792  747.4793  702.0886  674.1610
> colVars(tmp5,na.rm=TRUE)
 [1] 16095.32537    56.61838    96.33321    34.26415    88.40203   129.98080
 [7]    43.47485   100.96985   111.69198    41.86067    28.29969    77.16909
[13]    80.10254    77.85347    80.82298    21.24567    79.86084    78.07783
[19]    19.78136    81.18884
> colSd(tmp5,na.rm=TRUE)
 [1] 126.867353   7.524518   9.814949   5.853559   9.402236  11.400912
 [7]   6.593546  10.048375  10.568443   6.469982   5.319746   8.784594
[13]   8.950002   8.823461   8.990160   4.609303   8.936490   8.836166
[19]   4.447624   9.010485
> colMax(tmp5,na.rm=TRUE)
 [1] 469.83665  81.43174  85.01570  81.17657  88.28352  93.91813  76.98593
 [8]  83.57035  88.36011  77.23893  82.23850  78.55467  85.70771  84.14562
[15]  79.85003  75.51350  81.32155  83.37776  77.40214  83.65328
> colMin(tmp5,na.rm=TRUE)
 [1] 58.71051 57.94786 57.04729 62.69424 60.57699 53.91372 58.91030 53.88769
 [9] 57.13180 58.37060 64.34194 53.99549 57.96552 59.44796 53.54260 60.07052
[17] 56.98437 59.31399 62.69923 56.54589
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 89.73515 70.41676 71.65324 69.79096 68.28371      NaN 71.20496 69.94409
 [9] 71.40129 70.50419
> rowSums(tmp5,na.rm=TRUE)
 [1] 1794.703 1408.335 1433.065 1395.819 1365.674    0.000 1424.099 1398.882
 [9] 1428.026 1410.084
> rowVars(tmp5,na.rm=TRUE)
 [1] 8081.75172   80.94908   46.32399  107.36929   56.23693         NA
 [7]   53.56954   61.96045   84.50014   74.95552
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.898564  8.997170  6.806173 10.361915  7.499128        NA  7.319121
 [8]  7.871496  9.192396  8.657685
> rowMax(tmp5,na.rm=TRUE)
 [1] 469.83665  88.28352  81.02142  93.91813  83.47941        NA  82.23850
 [8]  83.65328  85.70771  88.36011
> rowMin(tmp5,na.rm=TRUE)
 [1] 53.88769 57.04729 57.50668 53.99549 57.96552       NA 56.54589 57.13180
 [9] 54.96064 53.54260
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.08389  70.28855  67.87147  73.87804  72.86992  68.81203  70.14045
 [8]  63.54300  73.16355       NaN  71.95609  65.90240  72.72875  73.18319
[15]  68.35555  69.45804  69.77295  76.46281  70.95885  68.28496
> colSums(tmp5,na.rm=TRUE)
 [1] 1017.7550  632.5969  610.8433  664.9024  655.8293  619.3083  631.2641
 [8]  571.8870  658.4720    0.0000  647.6048  593.1216  654.5587  658.6487
[15]  615.1999  625.1223  627.9565  688.1653  638.6296  614.5647
> colVars(tmp5,na.rm=TRUE)
 [1] 17963.47827    62.39170    75.30835    32.19202    77.13982   145.88400
 [7]    47.79006    68.46789   119.74624          NA    26.86301    86.39538
[13]    88.69234    80.43878    76.06199    23.46916    88.79710    54.75334
[19]    15.92618    82.84460
> colSd(tmp5,na.rm=TRUE)
 [1] 134.027901   7.898842   8.678038   5.673801   8.782928  12.078245
 [7]   6.913036   8.274533  10.942863         NA   5.182954   9.294911
[13]   9.417661   8.968767   8.721353   4.844497   9.423222   7.399550
[19]   3.990761   9.101901
> colMax(tmp5,na.rm=TRUE)
 [1] 469.83665  81.43174  81.87713  81.17657  88.28352  93.91813  76.98593
 [8]  80.82173  88.36011      -Inf  82.23850  78.55467  85.70771  84.14562
[15]  79.71547  75.51350  81.32155  83.37776  77.40214  83.65328
> colMin(tmp5,na.rm=TRUE)
 [1] 58.71051 57.94786 57.04729 62.69424 60.57699 53.91372 58.91030 53.88769
 [9] 57.13180      Inf 64.34194 53.99549 57.96552 59.44796 53.54260 60.07052
[17] 56.98437 62.84419 62.69923 56.54589
> 
> 
> 
> 
> 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] 154.2059 110.7498 208.3980 256.8380 235.7269 229.7765 206.6852 162.1313
 [9] 234.7401 104.3516
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 154.2059 110.7498 208.3980 256.8380 235.7269 229.7765 206.6852 162.1313
 [9] 234.7401 104.3516
> 
> 
> 
> 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]  0.000000e+00  1.136868e-13 -5.684342e-14 -5.684342e-14  2.842171e-14
 [6]  2.842171e-14  2.842171e-14 -1.136868e-13 -1.705303e-13  5.684342e-14
[11]  8.526513e-14  0.000000e+00 -2.842171e-14 -5.684342e-14 -2.273737e-13
[16]  5.684342e-14  0.000000e+00  2.273737e-13 -5.684342e-14  0.000000e+00
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## 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)
+ }
7   8 
8   12 
8   1 
2   9 
1   4 
1   1 
9   3 
10   19 
2   2 
5   8 
5   1 
5   2 
1   19 
4   10 
10   11 
1   15 
9   15 
4   18 
9   14 
8   11 
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] 3.303402
> Min(tmp)
[1] -2.148354
> mean(tmp)
[1] 0.1606672
> Sum(tmp)
[1] 16.06672
> Var(tmp)
[1] 0.9196447
> 
> rowMeans(tmp)
[1] 0.1606672
> rowSums(tmp)
[1] 16.06672
> rowVars(tmp)
[1] 0.9196447
> rowSd(tmp)
[1] 0.9589811
> rowMax(tmp)
[1] 3.303402
> rowMin(tmp)
[1] -2.148354
> 
> colMeans(tmp)
  [1] -0.096088439 -0.258219318  0.948193342  0.193085631  0.748235027
  [6]  1.083372633  0.219649407  2.383560110 -0.439661831 -0.575924498
 [11]  2.804416022 -0.938527440  0.547416415  0.166960738 -1.754541695
 [16]  0.008161252  0.700078364  1.184621964  0.840212422  0.436649868
 [21] -0.576323740 -0.251947258  0.287938010  0.554852568  0.211598585
 [26]  0.053511303  0.077541216  0.545564397 -1.572341889 -0.640050922
 [31]  0.960689884 -0.650091297  0.764218031 -0.398211000  0.024657001
 [36] -1.569541947  0.693586347 -0.102203001  0.430268520  0.718167029
 [41] -0.435881156 -2.148353812 -0.102922279 -0.942529947  0.405981120
 [46] -0.010944962 -1.065449395  0.905307148  0.965703986  0.081636278
 [51]  0.140237337 -1.618489132 -0.509562944 -0.236050158 -0.036083750
 [56] -0.734226113 -0.261301257  1.454091013  0.553519877  0.519164745
 [61]  0.432084658 -0.133272686  0.040075481  0.787043258  1.187091507
 [66]  0.746360703  1.065179420 -0.259991409  0.410231098  0.829130760
 [71] -0.646681507 -0.078451176  0.625105549 -2.027880285  0.832254047
 [76]  1.418974817 -0.564309637 -1.295583207 -0.667884677  1.103500149
 [81]  0.898043510  0.246216384 -0.321371563 -1.413518767  1.771675176
 [86]  0.872496075  0.964360244  1.138771425  1.418440592  0.973025041
 [91]  0.049635395  0.386752582  0.089984411  0.406137196 -1.050189763
 [96]  3.303401508 -0.732763264 -1.902729656  0.454666124  0.023333018
> colSums(tmp)
  [1] -0.096088439 -0.258219318  0.948193342  0.193085631  0.748235027
  [6]  1.083372633  0.219649407  2.383560110 -0.439661831 -0.575924498
 [11]  2.804416022 -0.938527440  0.547416415  0.166960738 -1.754541695
 [16]  0.008161252  0.700078364  1.184621964  0.840212422  0.436649868
 [21] -0.576323740 -0.251947258  0.287938010  0.554852568  0.211598585
 [26]  0.053511303  0.077541216  0.545564397 -1.572341889 -0.640050922
 [31]  0.960689884 -0.650091297  0.764218031 -0.398211000  0.024657001
 [36] -1.569541947  0.693586347 -0.102203001  0.430268520  0.718167029
 [41] -0.435881156 -2.148353812 -0.102922279 -0.942529947  0.405981120
 [46] -0.010944962 -1.065449395  0.905307148  0.965703986  0.081636278
 [51]  0.140237337 -1.618489132 -0.509562944 -0.236050158 -0.036083750
 [56] -0.734226113 -0.261301257  1.454091013  0.553519877  0.519164745
 [61]  0.432084658 -0.133272686  0.040075481  0.787043258  1.187091507
 [66]  0.746360703  1.065179420 -0.259991409  0.410231098  0.829130760
 [71] -0.646681507 -0.078451176  0.625105549 -2.027880285  0.832254047
 [76]  1.418974817 -0.564309637 -1.295583207 -0.667884677  1.103500149
 [81]  0.898043510  0.246216384 -0.321371563 -1.413518767  1.771675176
 [86]  0.872496075  0.964360244  1.138771425  1.418440592  0.973025041
 [91]  0.049635395  0.386752582  0.089984411  0.406137196 -1.050189763
 [96]  3.303401508 -0.732763264 -1.902729656  0.454666124  0.023333018
> 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.096088439 -0.258219318  0.948193342  0.193085631  0.748235027
  [6]  1.083372633  0.219649407  2.383560110 -0.439661831 -0.575924498
 [11]  2.804416022 -0.938527440  0.547416415  0.166960738 -1.754541695
 [16]  0.008161252  0.700078364  1.184621964  0.840212422  0.436649868
 [21] -0.576323740 -0.251947258  0.287938010  0.554852568  0.211598585
 [26]  0.053511303  0.077541216  0.545564397 -1.572341889 -0.640050922
 [31]  0.960689884 -0.650091297  0.764218031 -0.398211000  0.024657001
 [36] -1.569541947  0.693586347 -0.102203001  0.430268520  0.718167029
 [41] -0.435881156 -2.148353812 -0.102922279 -0.942529947  0.405981120
 [46] -0.010944962 -1.065449395  0.905307148  0.965703986  0.081636278
 [51]  0.140237337 -1.618489132 -0.509562944 -0.236050158 -0.036083750
 [56] -0.734226113 -0.261301257  1.454091013  0.553519877  0.519164745
 [61]  0.432084658 -0.133272686  0.040075481  0.787043258  1.187091507
 [66]  0.746360703  1.065179420 -0.259991409  0.410231098  0.829130760
 [71] -0.646681507 -0.078451176  0.625105549 -2.027880285  0.832254047
 [76]  1.418974817 -0.564309637 -1.295583207 -0.667884677  1.103500149
 [81]  0.898043510  0.246216384 -0.321371563 -1.413518767  1.771675176
 [86]  0.872496075  0.964360244  1.138771425  1.418440592  0.973025041
 [91]  0.049635395  0.386752582  0.089984411  0.406137196 -1.050189763
 [96]  3.303401508 -0.732763264 -1.902729656  0.454666124  0.023333018
> colMin(tmp)
  [1] -0.096088439 -0.258219318  0.948193342  0.193085631  0.748235027
  [6]  1.083372633  0.219649407  2.383560110 -0.439661831 -0.575924498
 [11]  2.804416022 -0.938527440  0.547416415  0.166960738 -1.754541695
 [16]  0.008161252  0.700078364  1.184621964  0.840212422  0.436649868
 [21] -0.576323740 -0.251947258  0.287938010  0.554852568  0.211598585
 [26]  0.053511303  0.077541216  0.545564397 -1.572341889 -0.640050922
 [31]  0.960689884 -0.650091297  0.764218031 -0.398211000  0.024657001
 [36] -1.569541947  0.693586347 -0.102203001  0.430268520  0.718167029
 [41] -0.435881156 -2.148353812 -0.102922279 -0.942529947  0.405981120
 [46] -0.010944962 -1.065449395  0.905307148  0.965703986  0.081636278
 [51]  0.140237337 -1.618489132 -0.509562944 -0.236050158 -0.036083750
 [56] -0.734226113 -0.261301257  1.454091013  0.553519877  0.519164745
 [61]  0.432084658 -0.133272686  0.040075481  0.787043258  1.187091507
 [66]  0.746360703  1.065179420 -0.259991409  0.410231098  0.829130760
 [71] -0.646681507 -0.078451176  0.625105549 -2.027880285  0.832254047
 [76]  1.418974817 -0.564309637 -1.295583207 -0.667884677  1.103500149
 [81]  0.898043510  0.246216384 -0.321371563 -1.413518767  1.771675176
 [86]  0.872496075  0.964360244  1.138771425  1.418440592  0.973025041
 [91]  0.049635395  0.386752582  0.089984411  0.406137196 -1.050189763
 [96]  3.303401508 -0.732763264 -1.902729656  0.454666124  0.023333018
> colMedians(tmp)
  [1] -0.096088439 -0.258219318  0.948193342  0.193085631  0.748235027
  [6]  1.083372633  0.219649407  2.383560110 -0.439661831 -0.575924498
 [11]  2.804416022 -0.938527440  0.547416415  0.166960738 -1.754541695
 [16]  0.008161252  0.700078364  1.184621964  0.840212422  0.436649868
 [21] -0.576323740 -0.251947258  0.287938010  0.554852568  0.211598585
 [26]  0.053511303  0.077541216  0.545564397 -1.572341889 -0.640050922
 [31]  0.960689884 -0.650091297  0.764218031 -0.398211000  0.024657001
 [36] -1.569541947  0.693586347 -0.102203001  0.430268520  0.718167029
 [41] -0.435881156 -2.148353812 -0.102922279 -0.942529947  0.405981120
 [46] -0.010944962 -1.065449395  0.905307148  0.965703986  0.081636278
 [51]  0.140237337 -1.618489132 -0.509562944 -0.236050158 -0.036083750
 [56] -0.734226113 -0.261301257  1.454091013  0.553519877  0.519164745
 [61]  0.432084658 -0.133272686  0.040075481  0.787043258  1.187091507
 [66]  0.746360703  1.065179420 -0.259991409  0.410231098  0.829130760
 [71] -0.646681507 -0.078451176  0.625105549 -2.027880285  0.832254047
 [76]  1.418974817 -0.564309637 -1.295583207 -0.667884677  1.103500149
 [81]  0.898043510  0.246216384 -0.321371563 -1.413518767  1.771675176
 [86]  0.872496075  0.964360244  1.138771425  1.418440592  0.973025041
 [91]  0.049635395  0.386752582  0.089984411  0.406137196 -1.050189763
 [96]  3.303401508 -0.732763264 -1.902729656  0.454666124  0.023333018
> colRanges(tmp)
            [,1]       [,2]      [,3]      [,4]     [,5]     [,6]      [,7]
[1,] -0.09608844 -0.2582193 0.9481933 0.1930856 0.748235 1.083373 0.2196494
[2,] -0.09608844 -0.2582193 0.9481933 0.1930856 0.748235 1.083373 0.2196494
        [,8]       [,9]      [,10]    [,11]      [,12]     [,13]     [,14]
[1,] 2.38356 -0.4396618 -0.5759245 2.804416 -0.9385274 0.5474164 0.1669607
[2,] 2.38356 -0.4396618 -0.5759245 2.804416 -0.9385274 0.5474164 0.1669607
         [,15]       [,16]     [,17]    [,18]     [,19]     [,20]      [,21]
[1,] -1.754542 0.008161252 0.7000784 1.184622 0.8402124 0.4366499 -0.5763237
[2,] -1.754542 0.008161252 0.7000784 1.184622 0.8402124 0.4366499 -0.5763237
          [,22]    [,23]     [,24]     [,25]     [,26]      [,27]     [,28]
[1,] -0.2519473 0.287938 0.5548526 0.2115986 0.0535113 0.07754122 0.5455644
[2,] -0.2519473 0.287938 0.5548526 0.2115986 0.0535113 0.07754122 0.5455644
         [,29]      [,30]     [,31]      [,32]    [,33]     [,34]    [,35]
[1,] -1.572342 -0.6400509 0.9606899 -0.6500913 0.764218 -0.398211 0.024657
[2,] -1.572342 -0.6400509 0.9606899 -0.6500913 0.764218 -0.398211 0.024657
         [,36]     [,37]     [,38]     [,39]    [,40]      [,41]     [,42]
[1,] -1.569542 0.6935863 -0.102203 0.4302685 0.718167 -0.4358812 -2.148354
[2,] -1.569542 0.6935863 -0.102203 0.4302685 0.718167 -0.4358812 -2.148354
          [,43]      [,44]     [,45]       [,46]     [,47]     [,48]    [,49]
[1,] -0.1029223 -0.9425299 0.4059811 -0.01094496 -1.065449 0.9053071 0.965704
[2,] -0.1029223 -0.9425299 0.4059811 -0.01094496 -1.065449 0.9053071 0.965704
          [,50]     [,51]     [,52]      [,53]      [,54]       [,55]
[1,] 0.08163628 0.1402373 -1.618489 -0.5095629 -0.2360502 -0.03608375
[2,] 0.08163628 0.1402373 -1.618489 -0.5095629 -0.2360502 -0.03608375
          [,56]      [,57]    [,58]     [,59]     [,60]     [,61]      [,62]
[1,] -0.7342261 -0.2613013 1.454091 0.5535199 0.5191647 0.4320847 -0.1332727
[2,] -0.7342261 -0.2613013 1.454091 0.5535199 0.5191647 0.4320847 -0.1332727
          [,63]     [,64]    [,65]     [,66]    [,67]      [,68]     [,69]
[1,] 0.04007548 0.7870433 1.187092 0.7463607 1.065179 -0.2599914 0.4102311
[2,] 0.04007548 0.7870433 1.187092 0.7463607 1.065179 -0.2599914 0.4102311
         [,70]      [,71]       [,72]     [,73]    [,74]    [,75]    [,76]
[1,] 0.8291308 -0.6466815 -0.07845118 0.6251055 -2.02788 0.832254 1.418975
[2,] 0.8291308 -0.6466815 -0.07845118 0.6251055 -2.02788 0.832254 1.418975
          [,77]     [,78]      [,79]  [,80]     [,81]     [,82]      [,83]
[1,] -0.5643096 -1.295583 -0.6678847 1.1035 0.8980435 0.2462164 -0.3213716
[2,] -0.5643096 -1.295583 -0.6678847 1.1035 0.8980435 0.2462164 -0.3213716
         [,84]    [,85]     [,86]     [,87]    [,88]    [,89]    [,90]
[1,] -1.413519 1.771675 0.8724961 0.9643602 1.138771 1.418441 0.973025
[2,] -1.413519 1.771675 0.8724961 0.9643602 1.138771 1.418441 0.973025
          [,91]     [,92]      [,93]     [,94]    [,95]    [,96]      [,97]
[1,] 0.04963539 0.3867526 0.08998441 0.4061372 -1.05019 3.303402 -0.7327633
[2,] 0.04963539 0.3867526 0.08998441 0.4061372 -1.05019 3.303402 -0.7327633
        [,98]     [,99]     [,100]
[1,] -1.90273 0.4546661 0.02333302
[2,] -1.90273 0.4546661 0.02333302
> 
> 
> Max(tmp2)
[1] 2.722079
> Min(tmp2)
[1] -2.799543
> mean(tmp2)
[1] 0.06975382
> Sum(tmp2)
[1] 6.975382
> Var(tmp2)
[1] 1.000402
> 
> rowMeans(tmp2)
  [1]  1.44674351  0.61547087 -1.31579498 -2.18149494  0.37346718 -0.18850927
  [7]  1.29015891  0.28085589  1.03496872  2.57856877 -0.11882046 -0.80851689
 [13] -0.20738473  0.97960515  0.65735997  0.29770551 -0.27091687 -0.37997240
 [19]  0.24278337 -0.08439089  2.13739713  0.28421115  0.57107104  0.40251885
 [25] -0.12838875 -1.25233574  0.48808449  0.34724386  1.26227528  0.17847597
 [31] -0.39158770 -0.88224001 -0.46718949  0.53157474 -0.89262882  1.18848387
 [37] -0.14250015  0.13667188  1.00166577 -0.29915662 -1.31717608  0.47148239
 [43] -0.70393525  0.83816975 -0.31747376  0.77323997  0.42432073  1.83442781
 [49]  0.20855365  1.47763369 -0.40068113  2.72207905 -0.04073581  0.15442503
 [55]  0.79686561  0.01671564 -0.07940422  0.80897382 -0.24248719 -2.19299933
 [61]  0.96040892  0.21042868  0.01143674  0.68149215 -0.60074771  0.51013647
 [67] -1.52579379  0.85551146 -0.03445056 -0.88485895 -0.42818341 -0.37326726
 [73] -1.58565721  0.07753456 -0.94425544 -0.27347266 -0.30699964  0.24580370
 [79]  0.40354643  1.14740945  1.34176091 -0.44731508 -0.80740274  0.44600685
 [85] -2.02187467 -0.58241997 -0.61461095  0.37812340  0.29124578  0.05230961
 [91]  2.11861602  0.74409170 -2.79954278  0.95020846 -1.74614442 -1.37138058
 [97] -1.11572597  1.37701951 -0.24357769 -0.66755451
> rowSums(tmp2)
  [1]  1.44674351  0.61547087 -1.31579498 -2.18149494  0.37346718 -0.18850927
  [7]  1.29015891  0.28085589  1.03496872  2.57856877 -0.11882046 -0.80851689
 [13] -0.20738473  0.97960515  0.65735997  0.29770551 -0.27091687 -0.37997240
 [19]  0.24278337 -0.08439089  2.13739713  0.28421115  0.57107104  0.40251885
 [25] -0.12838875 -1.25233574  0.48808449  0.34724386  1.26227528  0.17847597
 [31] -0.39158770 -0.88224001 -0.46718949  0.53157474 -0.89262882  1.18848387
 [37] -0.14250015  0.13667188  1.00166577 -0.29915662 -1.31717608  0.47148239
 [43] -0.70393525  0.83816975 -0.31747376  0.77323997  0.42432073  1.83442781
 [49]  0.20855365  1.47763369 -0.40068113  2.72207905 -0.04073581  0.15442503
 [55]  0.79686561  0.01671564 -0.07940422  0.80897382 -0.24248719 -2.19299933
 [61]  0.96040892  0.21042868  0.01143674  0.68149215 -0.60074771  0.51013647
 [67] -1.52579379  0.85551146 -0.03445056 -0.88485895 -0.42818341 -0.37326726
 [73] -1.58565721  0.07753456 -0.94425544 -0.27347266 -0.30699964  0.24580370
 [79]  0.40354643  1.14740945  1.34176091 -0.44731508 -0.80740274  0.44600685
 [85] -2.02187467 -0.58241997 -0.61461095  0.37812340  0.29124578  0.05230961
 [91]  2.11861602  0.74409170 -2.79954278  0.95020846 -1.74614442 -1.37138058
 [97] -1.11572597  1.37701951 -0.24357769 -0.66755451
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1]  1.44674351  0.61547087 -1.31579498 -2.18149494  0.37346718 -0.18850927
  [7]  1.29015891  0.28085589  1.03496872  2.57856877 -0.11882046 -0.80851689
 [13] -0.20738473  0.97960515  0.65735997  0.29770551 -0.27091687 -0.37997240
 [19]  0.24278337 -0.08439089  2.13739713  0.28421115  0.57107104  0.40251885
 [25] -0.12838875 -1.25233574  0.48808449  0.34724386  1.26227528  0.17847597
 [31] -0.39158770 -0.88224001 -0.46718949  0.53157474 -0.89262882  1.18848387
 [37] -0.14250015  0.13667188  1.00166577 -0.29915662 -1.31717608  0.47148239
 [43] -0.70393525  0.83816975 -0.31747376  0.77323997  0.42432073  1.83442781
 [49]  0.20855365  1.47763369 -0.40068113  2.72207905 -0.04073581  0.15442503
 [55]  0.79686561  0.01671564 -0.07940422  0.80897382 -0.24248719 -2.19299933
 [61]  0.96040892  0.21042868  0.01143674  0.68149215 -0.60074771  0.51013647
 [67] -1.52579379  0.85551146 -0.03445056 -0.88485895 -0.42818341 -0.37326726
 [73] -1.58565721  0.07753456 -0.94425544 -0.27347266 -0.30699964  0.24580370
 [79]  0.40354643  1.14740945  1.34176091 -0.44731508 -0.80740274  0.44600685
 [85] -2.02187467 -0.58241997 -0.61461095  0.37812340  0.29124578  0.05230961
 [91]  2.11861602  0.74409170 -2.79954278  0.95020846 -1.74614442 -1.37138058
 [97] -1.11572597  1.37701951 -0.24357769 -0.66755451
> rowMin(tmp2)
  [1]  1.44674351  0.61547087 -1.31579498 -2.18149494  0.37346718 -0.18850927
  [7]  1.29015891  0.28085589  1.03496872  2.57856877 -0.11882046 -0.80851689
 [13] -0.20738473  0.97960515  0.65735997  0.29770551 -0.27091687 -0.37997240
 [19]  0.24278337 -0.08439089  2.13739713  0.28421115  0.57107104  0.40251885
 [25] -0.12838875 -1.25233574  0.48808449  0.34724386  1.26227528  0.17847597
 [31] -0.39158770 -0.88224001 -0.46718949  0.53157474 -0.89262882  1.18848387
 [37] -0.14250015  0.13667188  1.00166577 -0.29915662 -1.31717608  0.47148239
 [43] -0.70393525  0.83816975 -0.31747376  0.77323997  0.42432073  1.83442781
 [49]  0.20855365  1.47763369 -0.40068113  2.72207905 -0.04073581  0.15442503
 [55]  0.79686561  0.01671564 -0.07940422  0.80897382 -0.24248719 -2.19299933
 [61]  0.96040892  0.21042868  0.01143674  0.68149215 -0.60074771  0.51013647
 [67] -1.52579379  0.85551146 -0.03445056 -0.88485895 -0.42818341 -0.37326726
 [73] -1.58565721  0.07753456 -0.94425544 -0.27347266 -0.30699964  0.24580370
 [79]  0.40354643  1.14740945  1.34176091 -0.44731508 -0.80740274  0.44600685
 [85] -2.02187467 -0.58241997 -0.61461095  0.37812340  0.29124578  0.05230961
 [91]  2.11861602  0.74409170 -2.79954278  0.95020846 -1.74614442 -1.37138058
 [97] -1.11572597  1.37701951 -0.24357769 -0.66755451
> 
> colMeans(tmp2)
[1] 0.06975382
> colSums(tmp2)
[1] 6.975382
> colVars(tmp2)
[1] 1.000402
> colSd(tmp2)
[1] 1.000201
> colMax(tmp2)
[1] 2.722079
> colMin(tmp2)
[1] -2.799543
> colMedians(tmp2)
[1] 0.1071032
> colRanges(tmp2)
          [,1]
[1,] -2.799543
[2,]  2.722079
> 
> 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] -1.40077549 -0.05529549 -2.04566269  4.15968016 -2.60840118 -3.64162340
 [7]  6.01319579 -1.25618032 -0.39766777  6.44220721
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.4172621
[2,] -0.6328079
[3,] -0.2147219
[4,]  0.4903236
[5,]  1.1751229
> 
> rowApply(tmp,sum)
 [1]  3.0532917  2.7184579 -0.7346749  3.7133817 -1.6076699  0.3589069
 [7] -1.9763859 -2.0820914  0.1819132  1.5843474
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    9    1    9    4    3    8    6    5     8
 [2,]   10    1    4    1    6    6    6    5    4     5
 [3,]    5    7    2    7    9    8    2    4    1     3
 [4,]    3   10    9    5    3    5   10    7    6    10
 [5,]    2    8    6    4    8    1    7    1    8     4
 [6,]    9    2    3    8    1    2    5    2    2     7
 [7,]    8    5    5   10    5    7    3   10    9     6
 [8,]    4    6   10    6    2    4    4    9    7     1
 [9,]    6    3    7    3    7   10    1    3    3     9
[10,]    7    4    8    2   10    9    9    8   10     2
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  2.0681167  1.5576141  1.5780364  0.1813124 -3.8324844 -2.2025399
 [7]  0.6194762 -1.5973425  0.9111506 -1.5071814  3.7494479 -2.5172530
[13]  0.7727297 -1.6800106  5.6819932 -4.0871176  2.9236335  0.3431323
[19]  1.3165322  1.4966884
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.0509548
[2,] -0.2343922
[3,]  0.2661463
[4,]  1.3489072
[5,]  1.7384102
> 
> rowApply(tmp,sum)
[1]  3.378330 -5.603175  5.107154  5.116646 -2.223021
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    1   20    7   12   20
[2,]    4   16   12   16   13
[3,]   20    2   11   15   19
[4,]   16   12    6   10    6
[5,]   11    6    1    2    3
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -1.0509548 -0.8809315  2.0511096  0.9906028  0.4737779 -1.0072235
[2,]  1.7384102  1.0602695 -2.2746363  0.1188237 -1.3420897 -1.3348556
[3,] -0.2343922  0.2813984  0.2076084 -0.2940132 -1.0228168 -0.2181706
[4,]  0.2661463  0.8261358  0.6068081  0.1499874 -0.8399068  0.2312757
[5,]  1.3489072  0.2707418  0.9871465 -0.7840883 -1.1014489  0.1264341
           [,7]       [,8]       [,9]      [,10]       [,11]      [,12]
[1,]  1.2429524 -0.3339980  1.7181981  0.9883469  0.90788658 -0.8103503
[2,] -2.4263625  0.7289964 -1.5560798 -1.4962314 -0.04741285  1.1438214
[3,]  0.8774346 -0.8586761  1.1904012 -0.5806189  0.40134483 -0.8680987
[4,]  1.8494772 -1.8567889  0.1027379 -0.1472727  1.53398922 -0.4075836
[5,] -0.9240255  0.7231241 -0.5441067 -0.2714054  0.95364016 -1.5750419
          [,13]      [,14]      [,15]      [,16]      [,17]      [,18]
[1,] -0.4074187 -0.6417617  1.1417982 -0.4706503  0.7296424 -0.7393765
[2,]  0.3594734 -1.6731950 -0.3969459 -1.0829655  1.4870388 -0.7755333
[3,]  1.0038803  0.1257918  1.3784259 -0.8394904  1.8650149  0.1557127
[4,] -0.8182957  0.4757523  2.7661927 -0.4603660 -0.5907839  1.2552061
[5,]  0.6350904  0.0334020  0.7925223 -1.2336453 -0.5672786  0.4471234
          [,19]      [,20]
[1,] -1.0440509  0.5207316
[2,]  1.6711186  0.4951808
[3,]  1.7094791  0.8269389
[4,] -0.1804778  0.3544128
[5,] -0.8395368 -0.7005756
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  654  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-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.4437929 -0.8340471 0.5958414 0.3740161 -0.4568191 -0.7308775 0.4667878
         col8     col9    col10    col11     col12      col13     col14
row1 0.757698 1.720713 2.051298 1.009776 0.9305928 -0.2797425 -0.379648
         col15     col16     col17      col18      col19     col20
row1 0.4212565 0.4867513 0.4538444 -0.5153636 -0.3945025 0.5326001
> tmp[,"col10"]
          col10
row1  2.0512984
row2 -1.0917480
row3  1.4111805
row4 -1.0221717
row5  0.4600589
> tmp[c("row1","row5"),]
          col1       col2      col3      col4       col5       col6       col7
row1 0.4437929 -0.8340471 0.5958414 0.3740161 -0.4568191 -0.7308775  0.4667878
row5 1.9420941 -0.2552995 0.6705747 0.8435052 -0.3920597  0.1918230 -0.5606784
          col8      col9     col10     col11     col12      col13     col14
row1 0.7576980  1.720713 2.0512984 1.0097755 0.9305928 -0.2797425 -0.379648
row5 0.6664518 -1.190399 0.4600589 0.6062304 0.1312131 -0.4942035  1.399886
         col15      col16      col17      col18      col19      col20
row1 0.4212565  0.4867513 0.45384440 -0.5153636 -0.3945025  0.5326001
row5 0.7019209 -0.8222023 0.03092268  0.0385864  0.2966650 -0.5953723
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.7308775  0.5326001
row2 -0.5300161  0.7956802
row3  0.2668117  1.5056638
row4  2.6815878 -1.7322914
row5  0.1918230 -0.5953723
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.7308775  0.5326001
row5  0.1918230 -0.5953723
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.09574 52.22086 49.09766 49.08469 50.91507 104.9764 50.24491 50.80287
         col9    col10    col11   col12    col13    col14   col15    col16
row1 49.48232 49.52953 50.61235 51.2512 51.05402 51.27168 49.3223 50.71375
       col17    col18    col19    col20
row1 49.7826 49.37506 51.64814 104.8421
> tmp[,"col10"]
        col10
row1 49.52953
row2 29.81190
row3 29.58689
row4 29.28479
row5 48.90526
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.09574 52.22086 49.09766 49.08469 50.91507 104.9764 50.24491 50.80287
row5 49.03801 51.72469 48.65030 50.85505 51.51640 103.4253 48.88574 49.79789
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.48232 49.52953 50.61235 51.25120 51.05402 51.27168 49.32230 50.71375
row5 49.47361 48.90526 49.20920 50.12873 50.25266 49.31511 51.00629 50.54654
        col17    col18    col19    col20
row1 49.78260 49.37506 51.64814 104.8421
row5 50.36347 49.65906 49.47874 104.9624
> tmp[,c("col6","col20")]
          col6     col20
row1 104.97637 104.84208
row2  74.59626  73.84524
row3  75.00682  74.86390
row4  75.08817  74.89169
row5 103.42532 104.96237
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 104.9764 104.8421
row5 103.4253 104.9624
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 104.9764 104.8421
row5 103.4253 104.9624
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.1480941
[2,]  0.6381194
[3,]  0.2463156
[4,] -0.6646814
[5,] -1.2585490
> tmp[,c("col17","col7")]
          col17       col7
[1,] 0.97983539  0.6436529
[2,] 0.27593571 -0.1406612
[3,] 0.89061853  0.6808509
[4,] 0.91614224  0.9645699
[5,] 0.03696265 -2.3633961
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.5071928 -0.2781491
[2,]  0.2649331  1.2094800
[3,]  0.2189485  1.0570730
[4,]  0.6059141  0.8826225
[5,]  0.2693101  0.1306216
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.5071928
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.5071928
[2,]  0.2649331
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
          [,1]       [,2]      [,3]       [,4]      [,5]      [,6]     [,7]
row3 0.1302745  0.1699276 -1.773520  0.9318378 -1.074212 0.1219143 1.742736
row1 0.9325205 -0.1415611  0.313371 -1.1662830 -0.635337 1.0212240 1.162130
           [,8]       [,9]      [,10]      [,11]      [,12]     [,13]
row3 -1.3407435  1.2009206  0.7902544 -0.9620719 -0.5791511 -1.111983
row1 -0.6212547 -0.5511315 -0.5797292 -0.9895808 -1.3679212 -0.662089
          [,14]      [,15]      [,16]      [,17]      [,18]      [,19]
row3  1.5245211 -0.4211358 -0.1206397 -1.4394631 -1.0923490 -0.9533489
row1 -0.7811538 -0.8270427  0.3501125  0.5935838  0.7878519  0.6642354
          [,20]
row3  0.7578958
row1 -0.5526470
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]      [,2]      [,3]     [,4]       [,5]      [,6]       [,7]
row2 -1.58354 -1.587302 0.8006169 1.129481 -0.7940539 -1.737913 -0.3463141
         [,8]      [,9]      [,10]
row2 2.178973 0.2374325 -0.2306959
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
         [,1]       [,2]     [,3]     [,4]     [,5]     [,6]      [,7]
row5 1.293809 -0.3783127 1.172188 2.887342 1.349425 1.301183 0.8936575
          [,8]       [,9]   [,10]     [,11]     [,12]      [,13]      [,14]
row5 0.0696215 0.04403638 0.64251 -0.147032 -2.102639 -0.1033945 -0.9236455
          [,15]      [,16]     [,17]       [,18]      [,19]     [,20]
row5 -0.2589433 0.03546622 -0.786568 -0.02933756 -0.1461366 -2.015892
> 
> 
> 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: 0xaaab13ad9c80>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb8280d1b43"
 [2] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb82f9a9fb2"
 [3] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb832ca3478"
 [4] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb840f3ea60"
 [5] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb8125a1b4d"
 [6] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb84a0c3189"
 [7] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb83c2b30e4"
 [8] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb8694bf8b6"
 [9] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb85b4507a1"
[10] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb896c5397" 
[11] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb8e56979"  
[12] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb81a01027a"
[13] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb87eba323d"
[14] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb878ed52f8"
[15] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM251fb820d27a09"
> 
> 
> ### 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: 0xaaab162b9d20>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xaaab162b9d20>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xaaab162b9d20>
> rowMedians(tmp)
  [1]  0.0718431911  0.4146201657 -0.1973573957  0.5270464541  0.1533624990
  [6]  0.2901448374 -0.1053942694 -0.6897111761  0.2848160398  0.6490782621
 [11]  0.1699697657  0.2001156599 -0.4034783384 -0.4511559173  0.0937670137
 [16] -0.0441462183 -0.6109237587  0.0472666849 -0.0223396924  0.0864030258
 [21]  0.1130143627 -0.3178546357  0.5364237387 -0.0816845193  0.1914965321
 [26] -0.4379076084 -0.0380702501  0.3736706270  0.1150819981  0.0322557075
 [31]  0.5684962886 -0.0506969226  0.3997668803  0.2230197076 -0.2788415549
 [36]  0.4072721300 -0.5243644813  0.1074256797 -0.5208746135  0.3480830597
 [41]  0.0945532250 -0.2183885531 -0.1654286903 -0.2434560119  0.0266417022
 [46] -0.3282669555  0.3155813073 -0.3278897428  0.1293264736 -0.2810486182
 [51]  0.0080108824 -0.3748159415 -0.2215981545 -0.0497789384  0.6884578751
 [56]  0.3778850997 -0.2197906749 -0.2413464228  0.0685901649 -0.3290981364
 [61]  0.2844866100  0.3015972747 -0.0917324022 -0.1291448868  0.4257973868
 [66] -0.5230901730 -0.0522490888 -0.2357222073 -0.3248397350 -0.0694078735
 [71]  0.0840222791  0.0464233733 -0.0113047154  0.3176533737 -0.4428465692
 [76] -0.7343126564  0.2858731715  0.0745044991 -0.3009289765 -0.3335133339
 [81] -0.3631833778  0.1096928955 -0.2893464508 -0.1943524937 -0.0657103754
 [86] -0.1313096179  0.5052531588  0.0738724125 -0.2619298978 -0.2857835215
 [91]  0.1624403087  0.1296154328 -0.0232248714 -0.3423780049 -0.2143433449
 [96]  0.2202491259 -0.1541722382  0.0683209295  0.2988791495 -0.5351427452
[101] -0.4042334355  0.3411694027 -0.2226365537 -0.1600932294 -0.1734703462
[106]  0.0302828149  0.3168812760  0.0291122963  0.2964495907  0.0845025138
[111]  0.2482108411  0.3883335066  0.3026730928  0.5437188449 -0.1971041680
[116]  0.0467560830  0.0438055607 -0.3492565048 -0.1967535876 -0.0968236047
[121] -0.0281133012  0.1701255198 -0.3593209786  0.4789727612  0.1047447633
[126]  0.6393791654  0.0181489349 -0.1301726680 -0.4121363382  0.2625262411
[131] -0.2845225537 -0.5160331165 -0.6097726651 -0.4966435662 -0.0722821364
[136]  0.5201490125  0.2836630462  0.3694949644 -0.0497482739 -0.0877730709
[141] -0.0159416549 -0.0797782960  0.2238866872  0.0007074616  0.1708424395
[146] -0.4677031532  0.0307980794 -0.1804994674  0.1275394683  0.3876741740
[151] -0.3842320403 -0.4777368682 -0.0813327298 -0.1970028427 -0.5079045248
[156] -0.2125129685 -0.0470725095 -0.1093221997 -0.0221804593  0.5457677672
[161] -0.1810904379 -0.1311928340  0.0172222371 -0.1391953910  0.2189432822
[166] -0.2533260330 -0.0740748349 -0.6116236236  0.5541925416 -0.0951737819
[171] -0.3127929547  0.0859226412  0.5586122379 -0.0345195284 -0.1756852912
[176]  0.3335631253 -1.1047729331  0.0156885329  0.0840894009  0.7431156807
[181]  0.1237652861  0.4501425324 -0.2026614495 -0.0842479012 -0.1142148173
[186] -0.1201001574 -0.1513990247  0.4746604550 -0.2181792150  0.2610967715
[191]  0.3779585127  0.0013168371 -0.0302411715 -0.5230205160  0.2575262168
[196] -0.1760074119 -0.2137335176 -0.4839826358  0.0935614194  0.0252532062
[201]  0.0513676765 -0.3989785596 -0.2286851934 -0.4419247929 -0.4606080065
[206]  0.4419510834 -0.1368144439 -0.5054079177 -0.2094074070 -0.3780766669
[211] -0.0881324786  0.4850286649 -0.2833205574  0.8969624609 -0.3711395620
[216] -0.0108427785  0.2305017827  0.4856821242 -0.0322042588 -0.1750849834
[221]  0.2879268469 -0.1778194051  0.4282428392 -0.4509408458 -0.1282030293
[226] -0.5392732027  0.3255665421 -0.2072947659 -0.2018772391  0.4123258758
> 
> proc.time()
   user  system elapsed 
  2.007   1.196   3.330 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0xaaaaf10a48e0>
> .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: 0xaaaaf10a48e0>
> .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: 0xaaaaf10a48e0>
> .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: 0xaaaaf10a48e0>
> 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: 0xaaaaf1865270>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaaf1865270>
> .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: 0xaaaaf1865270>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaaf1865270>
> .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: 0xaaaaf1865270>
> 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: 0xaaaaf1052dc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaaf1052dc0>
> .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: 0xaaaaf1052dc0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaaaf1052dc0>
> .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: 0xaaaaf1052dc0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0xaaaaf1052dc0>
> .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: 0xaaaaf1052dc0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0xaaaaf1052dc0>
> .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: 0xaaaaf1052dc0>
> 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: 0xaaaaf18d0370>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0xaaaaf18d0370>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaaf18d0370>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaaf18d0370>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2521a33f66d779" "BufferedMatrixFile2521a35f68e8a5"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2521a33f66d779" "BufferedMatrixFile2521a35f68e8a5"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaaf3209980>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaaf3209980>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaaaf3209980>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaaaf3209980>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0xaaaaf3209980>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0xaaaaf3209980>
> .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: 0xaaaaf2cdffe0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaaaf2cdffe0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaaaf2cdffe0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0xaaaaf2cdffe0>
> 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: 0xaaaaf3215500>
> .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: 0xaaaaf3215500>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.344   0.036   0.545 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R Under development (unstable) (2023-01-14 r83615) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.323   0.054   0.364 

Example timings