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

This page was generated on 2024-06-14 14:37 -0400 (Fri, 14 Jun 2024).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 22.04.3 LTS)x86_644.4.0 (2024-04-24) -- "Puppy Cup" 4757
palomino3Windows Server 2022 Datacenterx644.4.0 (2024-04-24 ucrt) -- "Puppy Cup" 4491
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

Package 249/2300HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.68.0  (landing page)
Ben Bolstad
Snapshot Date: 2024-06-12 14:00 -0400 (Wed, 12 Jun 2024)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_19
git_last_commit: af6c73d
git_last_commit_date: 2024-04-30 10:16:21 -0400 (Tue, 30 Apr 2024)
nebbiolo1Linux (Ubuntu 22.04.3 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino3Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published


CHECK results for BufferedMatrix on nebbiolo1

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

raw results


Summary

Package: BufferedMatrix
Version: 1.68.0
Command: /home/biocbuild/bbs-3.19-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.19-bioc/R/site-library --timings BufferedMatrix_1.68.0.tar.gz
StartedAt: 2024-06-12 21:12:16 -0400 (Wed, 12 Jun 2024)
EndedAt: 2024-06-12 21:12:40 -0400 (Wed, 12 Jun 2024)
EllapsedTime: 24.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.4.0 (2024-04-24)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
    gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
    GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
* running under: Ubuntu 22.04.4 LTS
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.68.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.4.0-1ubuntu1~22.04) 11.4.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 code files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
checkRd: (-1) BufferedMatrix-class.Rd:209: Lost braces; missing escapes or markup?
   209 |     $x^{power}$ elementwise of the matrix
       |        ^
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

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


Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.19-bioc/R/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
gcc -I"/home/biocbuild/bbs-3.19-bioc/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -Wall -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.19-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.19-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.19-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.19-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.19-bioc/R/lib -lR
installing to /home/biocbuild/bbs-3.19-bioc/R/site-library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.242   0.066   0.298 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.19-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 471778 25.2    1026221 54.9   643431 34.4
Vcells 871899  6.7    8388608 64.0  2046580 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] "Wed Jun 12 21:12:31 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Jun 12 21:12:31 2024"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x56264d086a40>
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   which.col <- sample(1:20,1)
+   if (tmp2[which.row,which.col] != test.matrix[which.row,which.col]){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[,which.col] == test.matrix[,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> date()
[1] "Wed Jun 12 21:12:32 2024"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Wed Jun 12 21:12:32 2024"
> 
> ColMode(tmp2)
<pointer: 0x56264d086a40>
> 
> 
> 
> ### 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.2111151  1.11907516 -0.9368379 -1.6312027
[2,]  -0.9597061  0.92293032  1.5068458 -0.2718627
[3,]  -1.4400319  0.09562305 -0.3621720 -0.9644112
[4,]  -1.9391258 -0.66250934  0.4160625  1.4358107
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.19-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.2111151 1.11907516 0.9368379 1.6312027
[2,]   0.9597061 0.92293032 1.5068458 0.2718627
[3,]   1.4400319 0.09562305 0.3621720 0.9644112
[4,]   1.9391258 0.66250934 0.4160625 1.4358107
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.19-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.0105502 1.0578635 0.9679038 1.2771854
[2,]  0.9796459 0.9606926 1.2275365 0.5214045
[3,]  1.2000133 0.3092298 0.6018073 0.9820444
[4,]  1.3925250 0.8139468 0.6450291 1.1982532
> 
> 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.19-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.31662 36.69771 35.61588 39.40306
[2,]  35.75616 35.52986 38.78221 30.48591
[3,]  38.44016 28.18792 31.38025 35.78486
[4,]  40.86438 33.80198 31.86635 38.41834
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x56264d65ecc0>
> exp(tmp5)
<pointer: 0x56264d65ecc0>
> log(tmp5,2)
<pointer: 0x56264d65ecc0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 468.967
> Min(tmp5)
[1] 52.33427
> mean(tmp5)
[1] 73.66143
> Sum(tmp5)
[1] 14732.29
> Var(tmp5)
[1] 870.1441
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 92.74088 70.88431 70.55779 74.36236 70.72620 73.08544 67.99556 72.75139
 [9] 71.46641 72.04396
> rowSums(tmp5)
 [1] 1854.818 1417.686 1411.156 1487.247 1414.524 1461.709 1359.911 1455.028
 [9] 1429.328 1440.879
> rowVars(tmp5)
 [1] 7933.27833  112.28429   89.10593   70.92909  116.36371   78.19666
 [7]   59.71561   55.64569   99.50963   44.71906
> rowSd(tmp5)
 [1] 89.068953 10.596428  9.439594  8.421941 10.787201  8.842888  7.727587
 [8]  7.459604  9.975451  6.687231
> rowMax(tmp5)
 [1] 468.96702  92.69237  92.27661  87.92907  99.73967  93.09474  81.52153
 [8]  84.03918  89.35775  81.81532
> rowMin(tmp5)
 [1] 55.15300 53.93274 58.66946 59.57293 60.13543 53.50292 52.33427 53.08441
 [9] 57.32861 53.23691
> 
> colMeans(tmp5)
 [1] 111.89155  75.12286  73.82615  73.71149  70.39312  69.04094  76.25323
 [8]  74.62861  69.75387  71.24529  69.20159  66.50553  67.46361  71.96677
[15]  73.36110  71.16322  71.39313  72.16235  70.94748  73.19673
> colSums(tmp5)
 [1] 1118.9155  751.2286  738.2615  737.1149  703.9312  690.4094  762.5323
 [8]  746.2861  697.5387  712.4529  692.0159  665.0553  674.6361  719.6677
[15]  733.6110  711.6322  713.9313  721.6235  709.4748  731.9673
> colVars(tmp5)
 [1] 15836.44294    66.15992    26.60722    50.75129    56.86522    63.31971
 [7]   205.48104    30.92204    53.94305    98.76464    61.80932    71.48340
[13]    32.94604    94.26416   110.20747   136.19430   128.51486    87.26444
[19]    82.13301   103.35156
> colSd(tmp5)
 [1] 125.842930   8.133875   5.158219   7.123994   7.540903   7.957369
 [7]  14.334610   5.560759   7.344593   9.938040   7.861890   8.454786
[13]   5.739864   9.708973  10.497974  11.670232  11.336439   9.341544
[19]   9.062727  10.166197
> colMax(tmp5)
 [1] 468.96702  89.35775  80.72009  85.55435  82.01817  83.36400  99.73967
 [8]  83.56849  83.33183  93.58460  81.35329  80.84752  74.58302  85.49631
[15]  86.67525  89.98078  93.09474  85.30054  91.96819  92.69237
> colMin(tmp5)
 [1] 52.33427 58.66946 65.31387 63.45242 59.28262 57.78021 53.50292 64.09458
 [9] 60.13543 59.69513 58.39924 53.23691 53.93274 53.08441 55.15300 57.07404
[17] 56.76030 56.34518 61.52580 61.97153
> 
> 
> ### 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] 92.74088 70.88431 70.55779       NA 70.72620 73.08544 67.99556 72.75139
 [9] 71.46641 72.04396
> rowSums(tmp5)
 [1] 1854.818 1417.686 1411.156       NA 1414.524 1461.709 1359.911 1455.028
 [9] 1429.328 1440.879
> rowVars(tmp5)
 [1] 7933.27833  112.28429   89.10593   74.85159  116.36371   78.19666
 [7]   59.71561   55.64569   99.50963   44.71906
> rowSd(tmp5)
 [1] 89.068953 10.596428  9.439594  8.651682 10.787201  8.842888  7.727587
 [8]  7.459604  9.975451  6.687231
> rowMax(tmp5)
 [1] 468.96702  92.69237  92.27661        NA  99.73967  93.09474  81.52153
 [8]  84.03918  89.35775  81.81532
> rowMin(tmp5)
 [1] 55.15300 53.93274 58.66946       NA 60.13543 53.50292 52.33427 53.08441
 [9] 57.32861 53.23691
> 
> colMeans(tmp5)
 [1] 111.89155  75.12286  73.82615  73.71149  70.39312  69.04094  76.25323
 [8]  74.62861  69.75387  71.24529  69.20159  66.50553  67.46361  71.96677
[15]  73.36110  71.16322  71.39313  72.16235  70.94748        NA
> colSums(tmp5)
 [1] 1118.9155  751.2286  738.2615  737.1149  703.9312  690.4094  762.5323
 [8]  746.2861  697.5387  712.4529  692.0159  665.0553  674.6361  719.6677
[15]  733.6110  711.6322  713.9313  721.6235  709.4748        NA
> colVars(tmp5)
 [1] 15836.44294    66.15992    26.60722    50.75129    56.86522    63.31971
 [7]   205.48104    30.92204    53.94305    98.76464    61.80932    71.48340
[13]    32.94604    94.26416   110.20747   136.19430   128.51486    87.26444
[19]    82.13301          NA
> colSd(tmp5)
 [1] 125.842930   8.133875   5.158219   7.123994   7.540903   7.957369
 [7]  14.334610   5.560759   7.344593   9.938040   7.861890   8.454786
[13]   5.739864   9.708973  10.497974  11.670232  11.336439   9.341544
[19]   9.062727         NA
> colMax(tmp5)
 [1] 468.96702  89.35775  80.72009  85.55435  82.01817  83.36400  99.73967
 [8]  83.56849  83.33183  93.58460  81.35329  80.84752  74.58302  85.49631
[15]  86.67525  89.98078  93.09474  85.30054  91.96819        NA
> colMin(tmp5)
 [1] 52.33427 58.66946 65.31387 63.45242 59.28262 57.78021 53.50292 64.09458
 [9] 60.13543 59.69513 58.39924 53.23691 53.93274 53.08441 55.15300 57.07404
[17] 56.76030 56.34518 61.52580       NA
> 
> Max(tmp5,na.rm=TRUE)
[1] 468.967
> Min(tmp5,na.rm=TRUE)
[1] 52.33427
> mean(tmp5,na.rm=TRUE)
[1] 73.65512
> Sum(tmp5,na.rm=TRUE)
[1] 14657.37
> Var(tmp5,na.rm=TRUE)
[1] 874.5308
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.74088 70.88431 70.55779 74.33316 70.72620 73.08544 67.99556 72.75139
 [9] 71.46641 72.04396
> rowSums(tmp5,na.rm=TRUE)
 [1] 1854.818 1417.686 1411.156 1412.330 1414.524 1461.709 1359.911 1455.028
 [9] 1429.328 1440.879
> rowVars(tmp5,na.rm=TRUE)
 [1] 7933.27833  112.28429   89.10593   74.85159  116.36371   78.19666
 [7]   59.71561   55.64569   99.50963   44.71906
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.068953 10.596428  9.439594  8.651682 10.787201  8.842888  7.727587
 [8]  7.459604  9.975451  6.687231
> rowMax(tmp5,na.rm=TRUE)
 [1] 468.96702  92.69237  92.27661  87.92907  99.73967  93.09474  81.52153
 [8]  84.03918  89.35775  81.81532
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.15300 53.93274 58.66946 59.57293 60.13543 53.50292 52.33427 53.08441
 [9] 57.32861 53.23691
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 111.89155  75.12286  73.82615  73.71149  70.39312  69.04094  76.25323
 [8]  74.62861  69.75387  71.24529  69.20159  66.50553  67.46361  71.96677
[15]  73.36110  71.16322  71.39313  72.16235  70.94748  73.00557
> colSums(tmp5,na.rm=TRUE)
 [1] 1118.9155  751.2286  738.2615  737.1149  703.9312  690.4094  762.5323
 [8]  746.2861  697.5387  712.4529  692.0159  665.0553  674.6361  719.6677
[15]  733.6110  711.6322  713.9313  721.6235  709.4748  657.0501
> colVars(tmp5,na.rm=TRUE)
 [1] 15836.44294    66.15992    26.60722    50.75129    56.86522    63.31971
 [7]   205.48104    30.92204    53.94305    98.76464    61.80932    71.48340
[13]    32.94604    94.26416   110.20747   136.19430   128.51486    87.26444
[19]    82.13301   115.85942
> colSd(tmp5,na.rm=TRUE)
 [1] 125.842930   8.133875   5.158219   7.123994   7.540903   7.957369
 [7]  14.334610   5.560759   7.344593   9.938040   7.861890   8.454786
[13]   5.739864   9.708973  10.497974  11.670232  11.336439   9.341544
[19]   9.062727  10.763801
> colMax(tmp5,na.rm=TRUE)
 [1] 468.96702  89.35775  80.72009  85.55435  82.01817  83.36400  99.73967
 [8]  83.56849  83.33183  93.58460  81.35329  80.84752  74.58302  85.49631
[15]  86.67525  89.98078  93.09474  85.30054  91.96819  92.69237
> colMin(tmp5,na.rm=TRUE)
 [1] 52.33427 58.66946 65.31387 63.45242 59.28262 57.78021 53.50292 64.09458
 [9] 60.13543 59.69513 58.39924 53.23691 53.93274 53.08441 55.15300 57.07404
[17] 56.76030 56.34518 61.52580 61.97153
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 92.74088 70.88431 70.55779      NaN 70.72620 73.08544 67.99556 72.75139
 [9] 71.46641 72.04396
> rowSums(tmp5,na.rm=TRUE)
 [1] 1854.818 1417.686 1411.156    0.000 1414.524 1461.709 1359.911 1455.028
 [9] 1429.328 1440.879
> rowVars(tmp5,na.rm=TRUE)
 [1] 7933.27833  112.28429   89.10593         NA  116.36371   78.19666
 [7]   59.71561   55.64569   99.50963   44.71906
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.068953 10.596428  9.439594        NA 10.787201  8.842888  7.727587
 [8]  7.459604  9.975451  6.687231
> rowMax(tmp5,na.rm=TRUE)
 [1] 468.96702  92.69237  92.27661        NA  99.73967  93.09474  81.52153
 [8]  84.03918  89.35775  81.81532
> rowMin(tmp5,na.rm=TRUE)
 [1] 55.15300 53.93274 58.66946       NA 60.13543 53.50292 52.33427 53.08441
 [9] 57.32861 53.23691
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 114.87352  75.65269  74.65954  73.01690  71.15227  68.13902  76.08494
 [8]  74.66243  70.79604  70.73657  67.85140  67.27582  67.39026  71.49676
[15]  72.18908  69.30035  71.10969  70.70255  71.57560       NaN
> colSums(tmp5,na.rm=TRUE)
 [1] 1033.8616  680.8743  671.9359  657.1521  640.3704  613.2512  684.7644
 [8]  671.9619  637.1643  636.6291  610.6626  605.4823  606.5123  643.4708
[15]  649.7017  623.7031  639.9872  636.3230  644.1804    0.0000
> colVars(tmp5,na.rm=TRUE)
 [1] 17715.96186    71.27180    22.11956    51.66767    57.48987    62.08324
 [7]   230.84754    34.77442    48.46731   108.19874    49.02663    73.74370
[13]    37.00376   103.56191   108.53009   114.17780   143.67542    74.19860
[19]    87.96112          NA
> colSd(tmp5,na.rm=TRUE)
 [1] 133.101322   8.442263   4.703144   7.188022   7.582207   7.879292
 [7]  15.193668   5.896984   6.961847  10.401862   7.001902   8.587415
[13]   6.083072  10.176537  10.417777  10.685401  11.986468   8.613861
[19]   9.378759         NA
> colMax(tmp5,na.rm=TRUE)
 [1] 468.96702  89.35775  80.72009  85.55435  82.01817  83.36400  99.73967
 [8]  83.56849  83.33183  93.58460  76.29660  80.84752  74.58302  85.49631
[15]  86.67525  89.98078  93.09474  81.81532  91.96819      -Inf
> colMin(tmp5,na.rm=TRUE)
 [1] 52.33427 58.66946 65.31387 63.45242 59.28262 57.78021 53.50292 64.09458
 [9] 60.13543 59.69513 58.39924 53.23691 53.93274 53.08441 55.15300 57.07404
[17] 56.76030 56.34518 61.52580      Inf
> 
> 
> 
> 
> 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] 245.3948 313.9799 282.9187 222.1367 164.8468 148.2679 233.4572 250.6056
 [9] 221.5752 255.5513
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 245.3948 313.9799 282.9187 222.1367 164.8468 148.2679 233.4572 250.6056
 [9] 221.5752 255.5513
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -2.842171e-14  2.842171e-14  0.000000e+00  5.684342e-14  1.136868e-13
 [6]  1.705303e-13 -5.684342e-14  5.684342e-14  5.684342e-14  1.705303e-13
[11]  1.136868e-13 -5.684342e-14 -2.842171e-14  0.000000e+00  1.421085e-14
[16] -8.526513e-14 -5.684342e-14  1.421085e-14 -5.684342e-14  2.842171e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
2   17 
10   15 
6   5 
2   5 
10   13 
3   18 
2   9 
5   6 
8   3 
1   7 
7   19 
4   14 
4   20 
10   17 
8   17 
10   20 
3   2 
10   4 
7   15 
7   16 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.160665
> Min(tmp)
[1] -2.214159
> mean(tmp)
[1] 0.04834552
> Sum(tmp)
[1] 4.834552
> Var(tmp)
[1] 0.803858
> 
> rowMeans(tmp)
[1] 0.04834552
> rowSums(tmp)
[1] 4.834552
> rowVars(tmp)
[1] 0.803858
> rowSd(tmp)
[1] 0.8965813
> rowMax(tmp)
[1] 2.160665
> rowMin(tmp)
[1] -2.214159
> 
> colMeans(tmp)
  [1]  0.69456007  0.53211127 -0.42958460  1.18646670  0.16556833  1.77440345
  [7]  0.61735559  0.51943326  0.47984414  0.97564374 -0.38960207 -1.70278760
 [13] -0.35505819 -1.03996029 -0.05510415 -0.34250110  0.46000383 -0.88579586
 [19] -0.18573937 -0.16066316  0.11400674  1.30419002  0.30576892  0.46018270
 [25]  0.69521716 -0.23630315  0.37387995 -0.98030871 -0.73595978  1.22882632
 [31]  0.89916544  0.68478368  1.09342235  1.27787675 -1.32224214  2.16066473
 [37]  0.80203972  0.42678062 -1.08706894 -0.07257875  1.06558660  0.25859956
 [43] -1.16120770 -0.40641955  0.57425092  1.73936734 -1.40294522  1.12716926
 [49]  0.75601985 -0.49135371 -0.23521368 -1.71515186  0.14490996 -2.21415915
 [55] -0.79877567  0.90702271 -0.75380555  1.22075437 -0.67547669 -0.20286697
 [61] -2.20487117 -0.11726474  0.69350677  0.64452608 -0.33161067  1.22377436
 [67] -0.02834487 -0.18671104 -0.43211753  0.58166931 -0.35826418 -1.63804429
 [73]  0.06508196 -0.77140876  0.55057651  0.45481694 -0.06537184  0.03199642
 [79]  0.28394746 -0.37679511 -0.92011058  0.48689550  0.12663508 -0.17796814
 [85]  0.08411981 -0.01566197  0.99305867  0.81334229 -0.72455846  0.67912082
 [91] -1.17306111 -0.65159164 -0.53891533 -1.51130090  1.98829831  0.20606249
 [97] -1.00181649  0.14358337 -0.17029614  1.19238289
> colSums(tmp)
  [1]  0.69456007  0.53211127 -0.42958460  1.18646670  0.16556833  1.77440345
  [7]  0.61735559  0.51943326  0.47984414  0.97564374 -0.38960207 -1.70278760
 [13] -0.35505819 -1.03996029 -0.05510415 -0.34250110  0.46000383 -0.88579586
 [19] -0.18573937 -0.16066316  0.11400674  1.30419002  0.30576892  0.46018270
 [25]  0.69521716 -0.23630315  0.37387995 -0.98030871 -0.73595978  1.22882632
 [31]  0.89916544  0.68478368  1.09342235  1.27787675 -1.32224214  2.16066473
 [37]  0.80203972  0.42678062 -1.08706894 -0.07257875  1.06558660  0.25859956
 [43] -1.16120770 -0.40641955  0.57425092  1.73936734 -1.40294522  1.12716926
 [49]  0.75601985 -0.49135371 -0.23521368 -1.71515186  0.14490996 -2.21415915
 [55] -0.79877567  0.90702271 -0.75380555  1.22075437 -0.67547669 -0.20286697
 [61] -2.20487117 -0.11726474  0.69350677  0.64452608 -0.33161067  1.22377436
 [67] -0.02834487 -0.18671104 -0.43211753  0.58166931 -0.35826418 -1.63804429
 [73]  0.06508196 -0.77140876  0.55057651  0.45481694 -0.06537184  0.03199642
 [79]  0.28394746 -0.37679511 -0.92011058  0.48689550  0.12663508 -0.17796814
 [85]  0.08411981 -0.01566197  0.99305867  0.81334229 -0.72455846  0.67912082
 [91] -1.17306111 -0.65159164 -0.53891533 -1.51130090  1.98829831  0.20606249
 [97] -1.00181649  0.14358337 -0.17029614  1.19238289
> 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.69456007  0.53211127 -0.42958460  1.18646670  0.16556833  1.77440345
  [7]  0.61735559  0.51943326  0.47984414  0.97564374 -0.38960207 -1.70278760
 [13] -0.35505819 -1.03996029 -0.05510415 -0.34250110  0.46000383 -0.88579586
 [19] -0.18573937 -0.16066316  0.11400674  1.30419002  0.30576892  0.46018270
 [25]  0.69521716 -0.23630315  0.37387995 -0.98030871 -0.73595978  1.22882632
 [31]  0.89916544  0.68478368  1.09342235  1.27787675 -1.32224214  2.16066473
 [37]  0.80203972  0.42678062 -1.08706894 -0.07257875  1.06558660  0.25859956
 [43] -1.16120770 -0.40641955  0.57425092  1.73936734 -1.40294522  1.12716926
 [49]  0.75601985 -0.49135371 -0.23521368 -1.71515186  0.14490996 -2.21415915
 [55] -0.79877567  0.90702271 -0.75380555  1.22075437 -0.67547669 -0.20286697
 [61] -2.20487117 -0.11726474  0.69350677  0.64452608 -0.33161067  1.22377436
 [67] -0.02834487 -0.18671104 -0.43211753  0.58166931 -0.35826418 -1.63804429
 [73]  0.06508196 -0.77140876  0.55057651  0.45481694 -0.06537184  0.03199642
 [79]  0.28394746 -0.37679511 -0.92011058  0.48689550  0.12663508 -0.17796814
 [85]  0.08411981 -0.01566197  0.99305867  0.81334229 -0.72455846  0.67912082
 [91] -1.17306111 -0.65159164 -0.53891533 -1.51130090  1.98829831  0.20606249
 [97] -1.00181649  0.14358337 -0.17029614  1.19238289
> colMin(tmp)
  [1]  0.69456007  0.53211127 -0.42958460  1.18646670  0.16556833  1.77440345
  [7]  0.61735559  0.51943326  0.47984414  0.97564374 -0.38960207 -1.70278760
 [13] -0.35505819 -1.03996029 -0.05510415 -0.34250110  0.46000383 -0.88579586
 [19] -0.18573937 -0.16066316  0.11400674  1.30419002  0.30576892  0.46018270
 [25]  0.69521716 -0.23630315  0.37387995 -0.98030871 -0.73595978  1.22882632
 [31]  0.89916544  0.68478368  1.09342235  1.27787675 -1.32224214  2.16066473
 [37]  0.80203972  0.42678062 -1.08706894 -0.07257875  1.06558660  0.25859956
 [43] -1.16120770 -0.40641955  0.57425092  1.73936734 -1.40294522  1.12716926
 [49]  0.75601985 -0.49135371 -0.23521368 -1.71515186  0.14490996 -2.21415915
 [55] -0.79877567  0.90702271 -0.75380555  1.22075437 -0.67547669 -0.20286697
 [61] -2.20487117 -0.11726474  0.69350677  0.64452608 -0.33161067  1.22377436
 [67] -0.02834487 -0.18671104 -0.43211753  0.58166931 -0.35826418 -1.63804429
 [73]  0.06508196 -0.77140876  0.55057651  0.45481694 -0.06537184  0.03199642
 [79]  0.28394746 -0.37679511 -0.92011058  0.48689550  0.12663508 -0.17796814
 [85]  0.08411981 -0.01566197  0.99305867  0.81334229 -0.72455846  0.67912082
 [91] -1.17306111 -0.65159164 -0.53891533 -1.51130090  1.98829831  0.20606249
 [97] -1.00181649  0.14358337 -0.17029614  1.19238289
> colMedians(tmp)
  [1]  0.69456007  0.53211127 -0.42958460  1.18646670  0.16556833  1.77440345
  [7]  0.61735559  0.51943326  0.47984414  0.97564374 -0.38960207 -1.70278760
 [13] -0.35505819 -1.03996029 -0.05510415 -0.34250110  0.46000383 -0.88579586
 [19] -0.18573937 -0.16066316  0.11400674  1.30419002  0.30576892  0.46018270
 [25]  0.69521716 -0.23630315  0.37387995 -0.98030871 -0.73595978  1.22882632
 [31]  0.89916544  0.68478368  1.09342235  1.27787675 -1.32224214  2.16066473
 [37]  0.80203972  0.42678062 -1.08706894 -0.07257875  1.06558660  0.25859956
 [43] -1.16120770 -0.40641955  0.57425092  1.73936734 -1.40294522  1.12716926
 [49]  0.75601985 -0.49135371 -0.23521368 -1.71515186  0.14490996 -2.21415915
 [55] -0.79877567  0.90702271 -0.75380555  1.22075437 -0.67547669 -0.20286697
 [61] -2.20487117 -0.11726474  0.69350677  0.64452608 -0.33161067  1.22377436
 [67] -0.02834487 -0.18671104 -0.43211753  0.58166931 -0.35826418 -1.63804429
 [73]  0.06508196 -0.77140876  0.55057651  0.45481694 -0.06537184  0.03199642
 [79]  0.28394746 -0.37679511 -0.92011058  0.48689550  0.12663508 -0.17796814
 [85]  0.08411981 -0.01566197  0.99305867  0.81334229 -0.72455846  0.67912082
 [91] -1.17306111 -0.65159164 -0.53891533 -1.51130090  1.98829831  0.20606249
 [97] -1.00181649  0.14358337 -0.17029614  1.19238289
> colRanges(tmp)
          [,1]      [,2]       [,3]     [,4]      [,5]     [,6]      [,7]
[1,] 0.6945601 0.5321113 -0.4295846 1.186467 0.1655683 1.774403 0.6173556
[2,] 0.6945601 0.5321113 -0.4295846 1.186467 0.1655683 1.774403 0.6173556
          [,8]      [,9]     [,10]      [,11]     [,12]      [,13]    [,14]
[1,] 0.5194333 0.4798441 0.9756437 -0.3896021 -1.702788 -0.3550582 -1.03996
[2,] 0.5194333 0.4798441 0.9756437 -0.3896021 -1.702788 -0.3550582 -1.03996
           [,15]      [,16]     [,17]      [,18]      [,19]      [,20]
[1,] -0.05510415 -0.3425011 0.4600038 -0.8857959 -0.1857394 -0.1606632
[2,] -0.05510415 -0.3425011 0.4600038 -0.8857959 -0.1857394 -0.1606632
         [,21]   [,22]     [,23]     [,24]     [,25]      [,26]   [,27]
[1,] 0.1140067 1.30419 0.3057689 0.4601827 0.6952172 -0.2363031 0.37388
[2,] 0.1140067 1.30419 0.3057689 0.4601827 0.6952172 -0.2363031 0.37388
          [,28]      [,29]    [,30]     [,31]     [,32]    [,33]    [,34]
[1,] -0.9803087 -0.7359598 1.228826 0.8991654 0.6847837 1.093422 1.277877
[2,] -0.9803087 -0.7359598 1.228826 0.8991654 0.6847837 1.093422 1.277877
         [,35]    [,36]     [,37]     [,38]     [,39]       [,40]    [,41]
[1,] -1.322242 2.160665 0.8020397 0.4267806 -1.087069 -0.07257875 1.065587
[2,] -1.322242 2.160665 0.8020397 0.4267806 -1.087069 -0.07257875 1.065587
         [,42]     [,43]      [,44]     [,45]    [,46]     [,47]    [,48]
[1,] 0.2585996 -1.161208 -0.4064196 0.5742509 1.739367 -1.402945 1.127169
[2,] 0.2585996 -1.161208 -0.4064196 0.5742509 1.739367 -1.402945 1.127169
         [,49]      [,50]      [,51]     [,52]   [,53]     [,54]      [,55]
[1,] 0.7560198 -0.4913537 -0.2352137 -1.715152 0.14491 -2.214159 -0.7987757
[2,] 0.7560198 -0.4913537 -0.2352137 -1.715152 0.14491 -2.214159 -0.7987757
         [,56]      [,57]    [,58]      [,59]     [,60]     [,61]      [,62]
[1,] 0.9070227 -0.7538055 1.220754 -0.6754767 -0.202867 -2.204871 -0.1172647
[2,] 0.9070227 -0.7538055 1.220754 -0.6754767 -0.202867 -2.204871 -0.1172647
         [,63]     [,64]      [,65]    [,66]       [,67]     [,68]      [,69]
[1,] 0.6935068 0.6445261 -0.3316107 1.223774 -0.02834487 -0.186711 -0.4321175
[2,] 0.6935068 0.6445261 -0.3316107 1.223774 -0.02834487 -0.186711 -0.4321175
         [,70]      [,71]     [,72]      [,73]      [,74]     [,75]     [,76]
[1,] 0.5816693 -0.3582642 -1.638044 0.06508196 -0.7714088 0.5505765 0.4548169
[2,] 0.5816693 -0.3582642 -1.638044 0.06508196 -0.7714088 0.5505765 0.4548169
           [,77]      [,78]     [,79]      [,80]      [,81]     [,82]     [,83]
[1,] -0.06537184 0.03199642 0.2839475 -0.3767951 -0.9201106 0.4868955 0.1266351
[2,] -0.06537184 0.03199642 0.2839475 -0.3767951 -0.9201106 0.4868955 0.1266351
          [,84]      [,85]       [,86]     [,87]     [,88]      [,89]     [,90]
[1,] -0.1779681 0.08411981 -0.01566197 0.9930587 0.8133423 -0.7245585 0.6791208
[2,] -0.1779681 0.08411981 -0.01566197 0.9930587 0.8133423 -0.7245585 0.6791208
         [,91]      [,92]      [,93]     [,94]    [,95]     [,96]     [,97]
[1,] -1.173061 -0.6515916 -0.5389153 -1.511301 1.988298 0.2060625 -1.001816
[2,] -1.173061 -0.6515916 -0.5389153 -1.511301 1.988298 0.2060625 -1.001816
         [,98]      [,99]   [,100]
[1,] 0.1435834 -0.1702961 1.192383
[2,] 0.1435834 -0.1702961 1.192383
> 
> 
> Max(tmp2)
[1] 2.205815
> Min(tmp2)
[1] -2.746182
> mean(tmp2)
[1] -0.01918121
> Sum(tmp2)
[1] -1.918121
> Var(tmp2)
[1] 0.98126
> 
> rowMeans(tmp2)
  [1] -0.22717240 -0.01377005  0.84752733  0.13907351  1.42134476  0.48553081
  [7]  1.02900325  0.36306409  0.01106533 -0.32933456  0.20100200  0.85162201
 [13] -0.89022780 -1.36845269 -0.37913553  2.20581519 -0.31544784 -0.72143683
 [19] -0.40793358  0.12777586  1.34389559  1.49054071  1.02217165 -1.57086928
 [25]  0.66712582 -0.32359163 -1.05057811  1.11986719  0.79254640 -0.66382106
 [31] -0.55842814  0.44686764  1.01897458 -0.49501449  0.70359981 -0.34593519
 [37]  1.25522059  0.66439529 -2.50963209 -0.09458713 -0.64050818 -0.88453531
 [43]  1.02711737 -2.74618187  0.93357203 -1.03997538 -0.51749846 -1.59897798
 [49] -0.84123897  0.18139688 -2.20415990  0.29986662  1.14100036  0.98888359
 [55]  0.92948089 -0.97272276  0.68313891  0.49426992  0.60801696  0.18022782
 [61] -0.27189965 -1.63988328  0.59093400  0.31325555 -0.25005814 -0.19722436
 [67] -0.34546331  0.98752471  0.91065131  0.84897904 -1.03249944  0.28141117
 [73] -0.03282338 -0.60355620 -1.79615677  0.45438249 -0.97248935 -0.94292631
 [79]  0.02558423  1.27985704 -0.45429229  0.18430850 -0.31346300 -0.96672017
 [85]  0.85918229 -0.43072523 -2.16715741  0.19677396  0.82703783  0.35711552
 [91]  1.18439536  1.13839304  0.64220023 -1.67174978 -0.05365167  0.03601319
 [97]  1.05120729  0.52093453 -2.54331622  0.11396002
> rowSums(tmp2)
  [1] -0.22717240 -0.01377005  0.84752733  0.13907351  1.42134476  0.48553081
  [7]  1.02900325  0.36306409  0.01106533 -0.32933456  0.20100200  0.85162201
 [13] -0.89022780 -1.36845269 -0.37913553  2.20581519 -0.31544784 -0.72143683
 [19] -0.40793358  0.12777586  1.34389559  1.49054071  1.02217165 -1.57086928
 [25]  0.66712582 -0.32359163 -1.05057811  1.11986719  0.79254640 -0.66382106
 [31] -0.55842814  0.44686764  1.01897458 -0.49501449  0.70359981 -0.34593519
 [37]  1.25522059  0.66439529 -2.50963209 -0.09458713 -0.64050818 -0.88453531
 [43]  1.02711737 -2.74618187  0.93357203 -1.03997538 -0.51749846 -1.59897798
 [49] -0.84123897  0.18139688 -2.20415990  0.29986662  1.14100036  0.98888359
 [55]  0.92948089 -0.97272276  0.68313891  0.49426992  0.60801696  0.18022782
 [61] -0.27189965 -1.63988328  0.59093400  0.31325555 -0.25005814 -0.19722436
 [67] -0.34546331  0.98752471  0.91065131  0.84897904 -1.03249944  0.28141117
 [73] -0.03282338 -0.60355620 -1.79615677  0.45438249 -0.97248935 -0.94292631
 [79]  0.02558423  1.27985704 -0.45429229  0.18430850 -0.31346300 -0.96672017
 [85]  0.85918229 -0.43072523 -2.16715741  0.19677396  0.82703783  0.35711552
 [91]  1.18439536  1.13839304  0.64220023 -1.67174978 -0.05365167  0.03601319
 [97]  1.05120729  0.52093453 -2.54331622  0.11396002
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.22717240 -0.01377005  0.84752733  0.13907351  1.42134476  0.48553081
  [7]  1.02900325  0.36306409  0.01106533 -0.32933456  0.20100200  0.85162201
 [13] -0.89022780 -1.36845269 -0.37913553  2.20581519 -0.31544784 -0.72143683
 [19] -0.40793358  0.12777586  1.34389559  1.49054071  1.02217165 -1.57086928
 [25]  0.66712582 -0.32359163 -1.05057811  1.11986719  0.79254640 -0.66382106
 [31] -0.55842814  0.44686764  1.01897458 -0.49501449  0.70359981 -0.34593519
 [37]  1.25522059  0.66439529 -2.50963209 -0.09458713 -0.64050818 -0.88453531
 [43]  1.02711737 -2.74618187  0.93357203 -1.03997538 -0.51749846 -1.59897798
 [49] -0.84123897  0.18139688 -2.20415990  0.29986662  1.14100036  0.98888359
 [55]  0.92948089 -0.97272276  0.68313891  0.49426992  0.60801696  0.18022782
 [61] -0.27189965 -1.63988328  0.59093400  0.31325555 -0.25005814 -0.19722436
 [67] -0.34546331  0.98752471  0.91065131  0.84897904 -1.03249944  0.28141117
 [73] -0.03282338 -0.60355620 -1.79615677  0.45438249 -0.97248935 -0.94292631
 [79]  0.02558423  1.27985704 -0.45429229  0.18430850 -0.31346300 -0.96672017
 [85]  0.85918229 -0.43072523 -2.16715741  0.19677396  0.82703783  0.35711552
 [91]  1.18439536  1.13839304  0.64220023 -1.67174978 -0.05365167  0.03601319
 [97]  1.05120729  0.52093453 -2.54331622  0.11396002
> rowMin(tmp2)
  [1] -0.22717240 -0.01377005  0.84752733  0.13907351  1.42134476  0.48553081
  [7]  1.02900325  0.36306409  0.01106533 -0.32933456  0.20100200  0.85162201
 [13] -0.89022780 -1.36845269 -0.37913553  2.20581519 -0.31544784 -0.72143683
 [19] -0.40793358  0.12777586  1.34389559  1.49054071  1.02217165 -1.57086928
 [25]  0.66712582 -0.32359163 -1.05057811  1.11986719  0.79254640 -0.66382106
 [31] -0.55842814  0.44686764  1.01897458 -0.49501449  0.70359981 -0.34593519
 [37]  1.25522059  0.66439529 -2.50963209 -0.09458713 -0.64050818 -0.88453531
 [43]  1.02711737 -2.74618187  0.93357203 -1.03997538 -0.51749846 -1.59897798
 [49] -0.84123897  0.18139688 -2.20415990  0.29986662  1.14100036  0.98888359
 [55]  0.92948089 -0.97272276  0.68313891  0.49426992  0.60801696  0.18022782
 [61] -0.27189965 -1.63988328  0.59093400  0.31325555 -0.25005814 -0.19722436
 [67] -0.34546331  0.98752471  0.91065131  0.84897904 -1.03249944  0.28141117
 [73] -0.03282338 -0.60355620 -1.79615677  0.45438249 -0.97248935 -0.94292631
 [79]  0.02558423  1.27985704 -0.45429229  0.18430850 -0.31346300 -0.96672017
 [85]  0.85918229 -0.43072523 -2.16715741  0.19677396  0.82703783  0.35711552
 [91]  1.18439536  1.13839304  0.64220023 -1.67174978 -0.05365167  0.03601319
 [97]  1.05120729  0.52093453 -2.54331622  0.11396002
> 
> colMeans(tmp2)
[1] -0.01918121
> colSums(tmp2)
[1] -1.918121
> colVars(tmp2)
[1] 0.98126
> colSd(tmp2)
[1] 0.9905857
> colMax(tmp2)
[1] 2.205815
> colMin(tmp2)
[1] -2.746182
> colMedians(tmp2)
[1] 0.1208679
> colRanges(tmp2)
          [,1]
[1,] -2.746182
[2,]  2.205815
> 
> dataset1 <- matrix(dataset1,1,100)
> 
> agree.checks(tmp,dataset1)
> 
> dataset2 <- matrix(dataset2,100,1)
> agree.checks(tmp2,dataset2)
>   
> 
> tmp <- createBufferedMatrix(10,10)
> 
> tmp[1:10,1:10] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.3426932 -0.5418762  0.4782996 -2.6684068 -1.3885786  1.1284381
 [7]  1.8986589 -3.5208368 -1.0323505  4.9116501
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.3711708
[2,] -0.1918287
[3,]  0.6141501
[4,]  0.9261905
[5,]  1.2286044
> 
> rowApply(tmp,sum)
 [1]  1.6200912 -2.9004246 -2.2401757 -0.5927155  5.7619135 -1.8591160
 [7] -2.1875889  3.7204562  2.4382114 -1.1529605
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    2    5    9    8    8    9    5    7    7    10
 [2,]    1    2    8    3    3    8    7   10   10     4
 [3,]    9    8    6    4    4   10    6    2    6     3
 [4,]    5    6    7    5    7    7    1    5    4     1
 [5,]    7    3    4    2    5    2   10    6    3     7
 [6,]    3    4    1   10    9    3    8    9    2     2
 [7,]    8   10    3    7    2    5    4    8    1     8
 [8,]    6    7    5    9    1    1    2    1    5     5
 [9,]    4    1    2    1   10    6    3    3    9     9
[10,]   10    9   10    6    6    4    9    4    8     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -4.3847246  0.6275880  3.3282230 -1.5055523  2.2739646 -2.6810145
 [7]  0.5314789  0.1828965  1.1484144  0.9488509 -5.1329065  2.4482208
[13]  1.8559030  1.7497783 -2.1126610 -0.6304907 -0.8962723 -2.4585903
[19]  2.2412982 -2.1940126
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5555590
[2,] -1.0492570
[3,] -0.8690680
[4,] -0.7063813
[5,] -0.2044594
> 
> rowApply(tmp,sum)
[1]  2.5205262 -0.7899921 -4.9184712  1.3667629 -2.8384339
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    2    7   13    6    3
[2,]   16   10   17   14    4
[3,]   13   16    9   16   19
[4,]   14   13    4    7    1
[5,]    7   15   10   15   20
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]        [,6]
[1,] -1.5555590  0.6686532  0.5285698  0.5708047 -0.2113187 -1.23212238
[2,] -0.7063813 -0.3477692  1.3407450  0.2231069  0.6905868  0.08241919
[3,] -0.2044594  0.7748462 -0.4778919 -0.7990317 -0.4464202 -1.58367768
[4,] -0.8690680  0.4963162  0.7980978 -0.1957030  0.6408276  0.20127744
[5,] -1.0492570 -0.9644583  1.1387023 -1.3047292  1.6002892 -0.14891108
           [,7]        [,8]       [,9]      [,10]       [,11]      [,12]
[1,]  0.9198580  0.84373899 -0.3304535  0.4608019 -1.69045810  0.4233347
[2,] -0.4985216  1.43193503 -1.2269753  0.5712449 -1.51098196  2.2368988
[3,]  0.1626579  0.07004347  1.2366871  0.2928997 -0.37598917 -0.6371940
[4,]  0.4601893 -1.51926048  2.0935532 -1.0535337 -1.52671882  0.8377790
[5,] -0.5127046 -0.64356054 -0.6243971  0.6774380 -0.02875844 -0.4125977
          [,13]      [,14]      [,15]      [,16]      [,17]        [,18]
[1,] -0.1727378  1.2834392  0.1795865 -0.4273339  0.4585302 -0.396137150
[2,]  1.6910203 -1.7586987 -0.8980531  1.3785033 -1.1970256 -0.004819184
[3,] -0.3754719  1.3693717 -0.4967927 -0.8175275 -0.4842432 -2.342666706
[4,] -0.1636702  1.5458168 -1.1731232 -1.5633208  1.4155790  0.178893841
[5,]  0.8767626 -0.6901508  0.2757215  0.7991882 -1.0891127  0.106138936
          [,19]      [,20]
[1,]  1.6021599  0.5971697
[2,] -0.4426998 -1.8445266
[3,]  0.8208388 -0.6044501
[4,]  0.4331700  0.3296608
[5,] -0.1721707 -0.6718664
> 
> 
> 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.19-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.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.19-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.06690736 0.987725 -1.630803 0.2345701 1.642688 0.5957768 -0.4321383
           col8      col9     col10      col11      col12     col13     col14
row1 -0.7923598 -1.475619 0.6821998 0.02011811 0.07664734 0.8272125 0.2744857
         col15     col16    col17    col18     col19      col20
row1 0.2482057 -2.379183 2.219012 -1.17332 0.5999736 -0.7996391
> tmp[,"col10"]
           col10
row1  0.68219985
row2  0.93443942
row3 -2.16453300
row4 -0.07020763
row5  0.63556286
> tmp[c("row1","row5"),]
            col1      col2       col3       col4       col5      col6
row1 -0.06690736 0.9877250 -1.6308029  0.2345701  1.6426881 0.5957768
row5  0.37828897 0.7303399  0.2397252 -0.9296621 -0.1622884 0.8169423
           col7       col8       col9     col10      col11      col12     col13
row1 -0.4321383 -0.7923598 -1.4756186 0.6821998 0.02011811 0.07664734 0.8272125
row5 -0.4411589  1.5317973  0.9467835 0.6355629 0.19525223 0.96491909 1.1559894
          col14     col15      col16      col17      col18      col19
row1  0.2744857 0.2482057 -2.3791834  2.2190124 -1.1733200  0.5999736
row5 -1.1877277 0.1921126  0.0566949 -0.3607825  0.1408807 -0.3329267
          col20
row1 -0.7996391
row5 -0.7328395
> tmp[,c("col6","col20")]
           col6       col20
row1  0.5957768 -0.79963907
row2 -0.6909428  0.18205166
row3  0.3046088  0.83499215
row4 -1.1971656 -0.05900803
row5  0.8169423 -0.73283945
> tmp[c("row1","row5"),c("col6","col20")]
          col6      col20
row1 0.5957768 -0.7996391
row5 0.8169423 -0.7328395
> 
> 
> 
> 
> 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 50.07645 49.76688 49.27152 49.6248 48.1354 106.1169 50.25932 51.9926
         col9    col10    col11    col12   col13   col14    col15    col16
row1 49.88789 47.51894 49.61525 51.72131 49.3988 49.1669 49.32533 50.09426
        col17   col18    col19    col20
row1 49.27721 48.6638 51.84246 103.8783
> tmp[,"col10"]
        col10
row1 47.51894
row2 31.62015
row3 31.26005
row4 29.71460
row5 49.74034
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.07645 49.76688 49.27152 49.62480 48.13540 106.1169 50.25932 51.99260
row5 49.44492 48.62197 48.90192 50.36913 47.60354 104.5907 49.62253 50.94293
         col9    col10    col11    col12    col13    col14    col15    col16
row1 49.88789 47.51894 49.61525 51.72131 49.39880 49.16690 49.32533 50.09426
row5 50.15923 49.74034 50.04188 51.86688 47.89607 49.17934 50.71753 50.18320
        col17    col18    col19    col20
row1 49.27721 48.66380 51.84246 103.8783
row5 49.20951 50.61442 49.06218 106.8586
> tmp[,c("col6","col20")]
          col6     col20
row1 106.11688 103.87831
row2  77.01662  75.42522
row3  74.93772  77.34694
row4  74.77878  73.14213
row5 104.59065 106.85856
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 106.1169 103.8783
row5 104.5907 106.8586
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 106.1169 103.8783
row5 104.5907 106.8586
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
            col13
[1,] -0.766455994
[2,] -2.282834421
[3,]  0.006193766
[4,] -0.547688752
[5,]  0.366368301
> tmp[,c("col17","col7")]
           col17       col7
[1,] -0.33316939  1.8209558
[2,] -0.69625029  0.4114156
[3,] -1.42431663  0.3895957
[4,] -0.05341274  0.2097664
[5,] -0.81886693 -0.4946588
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.5022038 -2.1532237
[2,]  0.7880199 -1.3152374
[3,] -1.3093022 -0.9792540
[4,]  0.2173304  0.4532827
[5,]  1.3803373  0.4562683
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.5022038
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.5022038
[2,]  0.7880199
> 
> 
> 
> 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 -3.1954276 0.7641197  0.7997502 -1.1256970 -0.1989044 -0.9830407 -1.623295
row1  0.7367581 0.4271844 -0.6263938  0.5393967 -0.4867754 -0.2837183  1.486447
         [,8]       [,9]      [,10]     [,11]      [,12]      [,13]      [,14]
row3 0.765207  0.7275225 -1.7643786 0.2523786 -0.5471174 -0.7351623 0.06845916
row1 2.766970 -0.2686857 -0.1794388 0.5398627  0.3409899 -1.2236532 0.40270873
          [,15]     [,16]      [,17]      [,18]      [,19]      [,20]
row3 -0.9049061  1.328876 -0.9874476 -1.7192011  0.2117793 -0.2603964
row1  1.3240526 -1.222290 -0.4351368  0.3490706 -1.5237395  0.4024818
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]      [,2]      [,3]     [,4]     [,5]     [,6]      [,7]
row2 -0.3617999 0.6380901 0.5752787 1.541285 1.761808 1.216951 -1.357863
         [,8]      [,9]      [,10]
row2 0.702911 0.4520654 -0.3681474
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]       [,3]      [,4]     [,5]     [,6]      [,7]
row5 0.9119948 0.7363349 -0.1598844 -1.375255 1.783384 0.696316 0.5377753
          [,8]       [,9]      [,10]    [,11]     [,12]      [,13]     [,14]
row5 0.6286905 -0.3066748 -0.2171766 1.239187 -1.014204 -0.4892248 -1.977608
        [,15]     [,16]     [,17]      [,18]      [,19]    [,20]
row5 1.498832 0.8749337 0.2766525 0.06378598 -0.2636055 2.126493
> 
> 
> 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: 0x56264bee3be0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c3136b9f1" 
 [2] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c37d855c04"
 [3] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c35a7add4d"
 [4] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c31ee1b47" 
 [5] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c31e20091b"
 [6] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c34d80a2a2"
 [7] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c34816c7c6"
 [8] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c3369fa34" 
 [9] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c3103d830f"
[10] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c3e723ee0" 
[11] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c3282e0cad"
[12] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c34e855fff"
[13] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c35c28ca12"
[14] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c357ee8336"
[15] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM2193c3141c74b1"
> 
> 
> ### 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: 0x56264d23ea90>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x56264d23ea90>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x56264d23ea90>
> rowMedians(tmp)
  [1]  0.119331042 -0.239380233  0.095319509 -0.060741046  0.072300912
  [6] -0.081858986  0.547287205 -0.076580186 -0.373731235 -0.129074632
 [11]  0.248541370 -0.095712475 -0.029092617  0.184962242 -0.047342481
 [16] -0.086073770  0.319663481 -0.016190919  0.277456920  0.114227921
 [21] -0.342770113  1.259857303  0.313135764  0.581030843 -0.144806336
 [26]  0.545035887 -0.460403465 -0.021964018 -0.257637016  0.204011446
 [31]  0.109967447  0.122911810 -0.126502331 -0.415172009 -0.311413642
 [36] -0.002460268 -0.019661868  0.651482441  0.141197279 -0.295443381
 [41]  0.485049447  0.333513878  0.152963942 -0.143643602 -0.206120095
 [46]  0.250007175  0.152312470 -0.002712064 -0.018875932 -0.150492191
 [51]  0.100973487 -0.566551672  0.701259155  0.443727976 -0.061648973
 [56] -0.281818067 -0.274832083  0.411541301  0.082844273  0.078914775
 [61]  0.008221574 -0.038901892  0.135462102 -0.174628323  0.069161512
 [66]  0.642094698 -0.203468227 -0.230657535  0.692712415  0.052103349
 [71]  0.287119976 -0.210973510  0.189187523  0.072199028 -0.339356451
 [76] -0.147500777  0.526825334  0.110061230 -0.149514706  0.059944230
 [81]  0.635946355 -0.112312537  0.436061770 -0.436860227 -0.245201009
 [86]  0.445181685  0.038427139 -0.148144848 -0.022531593  0.010614616
 [91]  0.214565255 -0.490144103 -0.102147017  0.399778771  0.123687229
 [96] -0.111209548  0.330970274 -0.089378271 -0.131333970  0.002252879
[101] -0.039082932 -0.135211635 -0.679144765  0.486344278  0.287623264
[106] -0.121985273  0.239459459  0.213437728  0.179944108  0.027031238
[111]  0.188487250 -0.048181493  0.055037779  0.267827637  0.403075441
[116]  0.252899252 -0.223919125  0.185174721  0.289561707 -0.281366715
[121] -0.343579942 -0.166937505 -0.636140257 -0.030839863 -0.266519702
[126] -0.041558146 -0.036166662  0.093560094  0.214385588  0.426390141
[131] -0.458508745 -0.359369421  0.305261660 -0.378313263  0.046961182
[136] -0.052847480 -0.234502463 -0.416299896  0.311412639  0.611459560
[141]  0.502523273  0.057305275 -0.571688720 -0.016480208 -0.232063628
[146]  0.294418054 -0.060588246  0.325292763 -0.215306481 -0.346119716
[151] -0.151387599  0.071071854 -0.606436707 -0.436294128 -0.244752960
[156] -0.167350909  0.075881376  0.451851444 -0.471039563 -0.847108672
[161]  0.547208383  0.056907368  0.487641043 -0.425080697 -0.130023236
[166] -0.355600939  0.120347071 -0.228610680  0.502019461  0.352282121
[171] -0.300071359  0.100319854 -0.836419973  0.357767763  0.314832277
[176]  0.218753736 -0.128335325  0.266129274 -0.113976791 -0.030422178
[181]  0.322669149 -0.108480626 -0.047012007 -0.088076368  0.256478006
[186]  0.426376094  0.190392343 -0.128038075  0.453170454  0.448834215
[191] -0.270637153 -0.459364029 -0.202072113 -0.462068198 -0.045091933
[196]  0.177375009  0.052959295  0.430404003 -0.512129242  0.238348145
[201]  0.109915956  0.051317084  0.005084460  0.235220008  0.376881954
[206] -0.017617164  0.107281745  0.332358404 -0.186257794 -0.103553528
[211] -0.025156240  0.385424036 -0.525016125 -0.011184453  0.123079829
[216]  0.409436600 -0.229160935  0.443743455  0.267193853 -0.447611789
[221] -0.150198758  0.024235976  0.307346775 -0.460373386  0.105818162
[226]  0.164073081  0.359073338 -0.280474710 -0.467809249  0.239087641
> 
> proc.time()
   user  system elapsed 
  1.376   1.513   2.903 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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: 0x558f625791a0>
> .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: 0x558f625791a0>
> .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: 0x558f625791a0>
> .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: 0x558f625791a0>
> 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: 0x558f61f4f440>
> .Call("R_bm_AddColumn",P)
<pointer: 0x558f61f4f440>
> .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: 0x558f61f4f440>
> .Call("R_bm_AddColumn",P)
<pointer: 0x558f61f4f440>
> .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: 0x558f61f4f440>
> 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: 0x558f62389670>
> .Call("R_bm_AddColumn",P)
<pointer: 0x558f62389670>
> .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: 0x558f62389670>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x558f62389670>
> .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: 0x558f62389670>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x558f62389670>
> .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: 0x558f62389670>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x558f62389670>
> .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: 0x558f62389670>
> 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: 0x558f63126390>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x558f63126390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x558f63126390>
> .Call("R_bm_AddColumn",P)
<pointer: 0x558f63126390>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2197845100b4fd" "BufferedMatrixFile2197846f2931fa"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2197845100b4fd" "BufferedMatrixFile2197846f2931fa"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x558f632c6f50>
> .Call("R_bm_AddColumn",P)
<pointer: 0x558f632c6f50>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x558f632c6f50>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x558f632c6f50>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x558f632c6f50>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x558f632c6f50>
> .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: 0x558f632d1cb0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x558f632d1cb0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x558f632d1cb0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x558f632d1cb0>
> 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: 0x558f632d2570>
> .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: 0x558f632d2570>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.253   0.057   0.300 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.4.0 (2024-04-24) -- "Puppy Cup"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.259   0.039   0.286 

Example timings