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

This page was generated on 2024-07-03 10:18 -0400 (Wed, 03 Jul 2024).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo1Linux (Ubuntu 22.04.3 LTS)x86_644.4.0 (2024-04-24) -- "Puppy Cup" 4757
palomino7Windows Server 2022 Datacenterx644.4.1 (2024-06-14 ucrt) -- "Race for Your Life" 4480
merida1macOS 12.7.4 Montereyx86_644.4.0 (2024-04-24) -- "Puppy Cup" 4511
kjohnson1macOS 13.6.6 Venturaarm644.4.0 (2024-04-24) -- "Puppy Cup" 4469
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-30 14:00 -0400 (Sun, 30 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
palomino7Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  
merida1macOS 12.7.4 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published
kjohnson1macOS 13.6.6 Ventura / arm64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published


CHECK results for BufferedMatrix on 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-30 21:14:46 -0400 (Sun, 30 Jun 2024)
EndedAt: 2024-06-30 21:15:10 -0400 (Sun, 30 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.248   0.056   0.293 

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] "Sun Jun 30 21:15:01 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] "Sun Jun 30 21:15:01 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: 0x5595eb9a9440>
> 
> 
> 
> 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] "Sun Jun 30 21:15:02 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] "Sun Jun 30 21:15:02 2024"
> 
> ColMode(tmp2)
<pointer: 0x5595eb9a9440>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
          [,1]       [,2]        [,3]       [,4]
[1,] 99.163838  0.3804326  0.14920215  1.2418156
[2,]  1.539730 -0.3096129  0.19805145  0.6521751
[3,] -1.181386 -1.2909690  0.08562591  1.1394486
[4,] -1.346457  2.2630236 -0.41136688 -1.3438113
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]      [,2]       [,3]      [,4]
[1,] 99.163838 0.3804326 0.14920215 1.2418156
[2,]  1.539730 0.3096129 0.19805145 0.6521751
[3,]  1.181386 1.2909690 0.08562591 1.1394486
[4,]  1.346457 2.2630236 0.41136688 1.3438113
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
         [,1]      [,2]      [,3]      [,4]
[1,] 9.958104 0.6167922 0.3862669 1.1143678
[2,] 1.240858 0.5564287 0.4450297 0.8075736
[3,] 1.086916 1.1362081 0.2926190 1.0674496
[4,] 1.160369 1.5043349 0.6413789 1.1592287
> 
> 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 :  1.9  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 223.74488 31.54835 29.01187 37.38549
[2,]  38.94831 30.87390 29.64835 33.72791
[3,]  37.05054 37.65305 28.01182 36.81394
[4,]  37.95015 42.30637 31.82516 37.93610
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x5595eb51b3b0>
> exp(tmp5)
<pointer: 0x5595eb51b3b0>
> log(tmp5,2)
<pointer: 0x5595eb51b3b0>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 465.6957
> Min(tmp5)
[1] 54.33714
> mean(tmp5)
[1] 72.88778
> Sum(tmp5)
[1] 14577.56
> Var(tmp5)
[1] 846.759
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.43319 71.43744 70.05452 72.05092 70.19677 69.92816 71.38696 72.16493
 [9] 71.85982 69.36510
> rowSums(tmp5)
 [1] 1808.664 1428.749 1401.090 1441.018 1403.935 1398.563 1427.739 1443.299
 [9] 1437.196 1387.302
> rowVars(tmp5)
 [1] 7860.04141   88.26349   53.66108   72.93377   46.30640  104.82039
 [7]   66.04688   68.51801   61.79417   76.91692
> rowSd(tmp5)
 [1] 88.656875  9.394865  7.325372  8.540127  6.804881 10.238183  8.126923
 [8]  8.277561  7.860927  8.770229
> rowMax(tmp5)
 [1] 465.69565  93.38212  78.91290  88.05517  87.38248  90.85023  87.01757
 [8]  85.42943  84.23229  86.75168
> rowMin(tmp5)
 [1] 57.38162 59.01002 56.00296 56.85133 58.50042 54.33714 61.60718 60.10253
 [9] 54.77520 55.46916
> 
> colMeans(tmp5)
 [1] 117.45257  73.86909  67.85127  73.41631  66.67944  62.77425  70.27163
 [8]  74.04619  75.71165  68.89794  65.53652  69.66098  70.72016  71.02171
[15]  71.40011  72.56117  73.53628  75.03390  68.25247  69.06201
> colSums(tmp5)
 [1] 1174.5257  738.6909  678.5127  734.1631  666.7944  627.7425  702.7163
 [8]  740.4619  757.1165  688.9794  655.3652  696.6098  707.2016  710.2171
[15]  714.0011  725.6117  735.3628  750.3390  682.5247  690.6201
> colVars(tmp5)
 [1] 14990.22544    88.23451    76.93644    78.54017    22.41558    28.48736
 [7]    73.85410    41.03888    94.38899    72.01855    36.75495    34.06159
[13]    61.88908    26.66599    75.01747   105.49804    54.52355    78.95119
[19]    90.68904    35.21467
> colSd(tmp5)
 [1] 122.434576   9.393323   8.771342   8.862289   4.734510   5.337355
 [7]   8.593841   6.406159   9.715400   8.486374   6.062586   5.836231
[13]   7.866962   5.163913   8.661262  10.271224   7.384006   8.885448
[19]   9.523079   5.934195
> colMax(tmp5)
 [1] 465.69565  88.05517  84.23229  90.85023  73.42849  72.51879  82.68585
 [8]  82.51100  93.38212  86.04185  76.22089  80.39093  81.13283  77.36340
[15]  86.75168  85.42943  88.50197  87.01757  83.83693  81.85715
> colMin(tmp5)
 [1] 73.69074 60.55079 58.30293 60.70791 60.56069 55.46916 56.85133 63.39078
 [9] 61.01332 62.21191 58.46570 59.21163 54.77520 59.53692 59.58384 54.33714
[17] 65.62892 59.30411 55.73541 62.38365
> 
> 
> ### 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] 90.43319       NA 70.05452 72.05092 70.19677 69.92816 71.38696 72.16493
 [9] 71.85982 69.36510
> rowSums(tmp5)
 [1] 1808.664       NA 1401.090 1441.018 1403.935 1398.563 1427.739 1443.299
 [9] 1437.196 1387.302
> rowVars(tmp5)
 [1] 7860.04141   88.69710   53.66108   72.93377   46.30640  104.82039
 [7]   66.04688   68.51801   61.79417   76.91692
> rowSd(tmp5)
 [1] 88.656875  9.417914  7.325372  8.540127  6.804881 10.238183  8.126923
 [8]  8.277561  7.860927  8.770229
> rowMax(tmp5)
 [1] 465.69565        NA  78.91290  88.05517  87.38248  90.85023  87.01757
 [8]  85.42943  84.23229  86.75168
> rowMin(tmp5)
 [1] 57.38162       NA 56.00296 56.85133 58.50042 54.33714 61.60718 60.10253
 [9] 54.77520 55.46916
> 
> colMeans(tmp5)
 [1] 117.45257  73.86909  67.85127  73.41631  66.67944  62.77425  70.27163
 [8]  74.04619  75.71165  68.89794  65.53652  69.66098  70.72016  71.02171
[15]        NA  72.56117  73.53628  75.03390  68.25247  69.06201
> colSums(tmp5)
 [1] 1174.5257  738.6909  678.5127  734.1631  666.7944  627.7425  702.7163
 [8]  740.4619  757.1165  688.9794  655.3652  696.6098  707.2016  710.2171
[15]        NA  725.6117  735.3628  750.3390  682.5247  690.6201
> colVars(tmp5)
 [1] 14990.22544    88.23451    76.93644    78.54017    22.41558    28.48736
 [7]    73.85410    41.03888    94.38899    72.01855    36.75495    34.06159
[13]    61.88908    26.66599          NA   105.49804    54.52355    78.95119
[19]    90.68904    35.21467
> colSd(tmp5)
 [1] 122.434576   9.393323   8.771342   8.862289   4.734510   5.337355
 [7]   8.593841   6.406159   9.715400   8.486374   6.062586   5.836231
[13]   7.866962   5.163913         NA  10.271224   7.384006   8.885448
[19]   9.523079   5.934195
> colMax(tmp5)
 [1] 465.69565  88.05517  84.23229  90.85023  73.42849  72.51879  82.68585
 [8]  82.51100  93.38212  86.04185  76.22089  80.39093  81.13283  77.36340
[15]        NA  85.42943  88.50197  87.01757  83.83693  81.85715
> colMin(tmp5)
 [1] 73.69074 60.55079 58.30293 60.70791 60.56069 55.46916 56.85133 63.39078
 [9] 61.01332 62.21191 58.46570 59.21163 54.77520 59.53692       NA 54.33714
[17] 65.62892 59.30411 55.73541 62.38365
> 
> Max(tmp5,na.rm=TRUE)
[1] 465.6957
> Min(tmp5,na.rm=TRUE)
[1] 54.33714
> mean(tmp5,na.rm=TRUE)
[1] 72.85114
> Sum(tmp5,na.rm=TRUE)
[1] 14497.38
> Var(tmp5,na.rm=TRUE)
[1] 850.7656
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.43319 70.97730 70.05452 72.05092 70.19677 69.92816 71.38696 72.16493
 [9] 71.85982 69.36510
> rowSums(tmp5,na.rm=TRUE)
 [1] 1808.664 1348.569 1401.090 1441.018 1403.935 1398.563 1427.739 1443.299
 [9] 1437.196 1387.302
> rowVars(tmp5,na.rm=TRUE)
 [1] 7860.04141   88.69710   53.66108   72.93377   46.30640  104.82039
 [7]   66.04688   68.51801   61.79417   76.91692
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.656875  9.417914  7.325372  8.540127  6.804881 10.238183  8.126923
 [8]  8.277561  7.860927  8.770229
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.69565  93.38212  78.91290  88.05517  87.38248  90.85023  87.01757
 [8]  85.42943  84.23229  86.75168
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.38162 59.01002 56.00296 56.85133 58.50042 54.33714 61.60718 60.10253
 [9] 54.77520 55.46916
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 117.45257  73.86909  67.85127  73.41631  66.67944  62.77425  70.27163
 [8]  74.04619  75.71165  68.89794  65.53652  69.66098  70.72016  71.02171
[15]  70.42455  72.56117  73.53628  75.03390  68.25247  69.06201
> colSums(tmp5,na.rm=TRUE)
 [1] 1174.5257  738.6909  678.5127  734.1631  666.7944  627.7425  702.7163
 [8]  740.4619  757.1165  688.9794  655.3652  696.6098  707.2016  710.2171
[15]  633.8209  725.6117  735.3628  750.3390  682.5247  690.6201
> colVars(tmp5,na.rm=TRUE)
 [1] 14990.22544    88.23451    76.93644    78.54017    22.41558    28.48736
 [7]    73.85410    41.03888    94.38899    72.01855    36.75495    34.06159
[13]    61.88908    26.66599    73.68774   105.49804    54.52355    78.95119
[19]    90.68904    35.21467
> colSd(tmp5,na.rm=TRUE)
 [1] 122.434576   9.393323   8.771342   8.862289   4.734510   5.337355
 [7]   8.593841   6.406159   9.715400   8.486374   6.062586   5.836231
[13]   7.866962   5.163913   8.584157  10.271224   7.384006   8.885448
[19]   9.523079   5.934195
> colMax(tmp5,na.rm=TRUE)
 [1] 465.69565  88.05517  84.23229  90.85023  73.42849  72.51879  82.68585
 [8]  82.51100  93.38212  86.04185  76.22089  80.39093  81.13283  77.36340
[15]  86.75168  85.42943  88.50197  87.01757  83.83693  81.85715
> colMin(tmp5,na.rm=TRUE)
 [1] 73.69074 60.55079 58.30293 60.70791 60.56069 55.46916 56.85133 63.39078
 [9] 61.01332 62.21191 58.46570 59.21163 54.77520 59.53692 59.58384 54.33714
[17] 65.62892 59.30411 55.73541 62.38365
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.43319      NaN 70.05452 72.05092 70.19677 69.92816 71.38696 72.16493
 [9] 71.85982 69.36510
> rowSums(tmp5,na.rm=TRUE)
 [1] 1808.664    0.000 1401.090 1441.018 1403.935 1398.563 1427.739 1443.299
 [9] 1437.196 1387.302
> rowVars(tmp5,na.rm=TRUE)
 [1] 7860.04141         NA   53.66108   72.93377   46.30640  104.82039
 [7]   66.04688   68.51801   61.79417   76.91692
> rowSd(tmp5,na.rm=TRUE)
 [1] 88.656875        NA  7.325372  8.540127  6.804881 10.238183  8.126923
 [8]  8.277561  7.860927  8.770229
> rowMax(tmp5,na.rm=TRUE)
 [1] 465.69565        NA  78.91290  88.05517  87.38248  90.85023  87.01757
 [8]  85.42943  84.23229  86.75168
> rowMin(tmp5,na.rm=TRUE)
 [1] 57.38162       NA 56.00296 56.85133 58.50042 54.33714 61.60718 60.10253
 [9] 54.77520 55.46916
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 121.49554  74.93677  68.53372  73.77366  66.14651  62.93722  68.89227
 [8]  73.64994  73.74826  69.64083  66.26169  69.81677  71.12115  71.49083
[15]       NaN  73.26685  73.77438  74.41195  69.01540  67.64032
> colSums(tmp5,na.rm=TRUE)
 [1] 1093.4599  674.4309  616.8035  663.9629  595.3186  566.4349  620.0304
 [8]  662.8494  663.7344  626.7675  596.3552  628.3509  640.0903  643.4175
[15]    0.0000  659.4017  663.9695  669.7076  621.1386  608.7629
> colVars(tmp5,na.rm=TRUE)
 [1] 16680.11530    86.43951    81.31384    86.92113    22.02233    31.74951
 [7]    61.68128    44.40230    62.82019    74.81212    35.43332    38.04622
[13]    67.81637    27.52334          NA   113.08290    60.70117    84.46837
[19]    95.47704    16.87822
> colSd(tmp5,na.rm=TRUE)
 [1] 129.151521   9.297285   9.017419   9.323150   4.692796   5.634671
 [7]   7.853743   6.663505   7.925919   8.649400   5.952589   6.168162
[13]   8.235069   5.246270         NA  10.634044   7.791096   9.190668
[19]   9.771235   4.108311
> colMax(tmp5,na.rm=TRUE)
 [1] 465.69565  88.05517  84.23229  90.85023  73.42849  72.51879  80.78400
 [8]  82.51100  84.65975  86.04185  76.22089  80.39093  81.13283  77.36340
[15]      -Inf  85.42943  88.50197  87.01757  83.83693  74.30666
> colMin(tmp5,na.rm=TRUE)
 [1] 73.69074 60.55079 58.30293 60.70791 60.56069 55.46916 56.85133 63.39078
 [9] 61.01332 62.31672 58.46570 59.21163 54.77520 59.53692      Inf 54.33714
[17] 65.62892 59.30411 55.73541 62.38365
> 
> 
> 
> 
> 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] 179.4518 109.0552 219.9164 187.7403 277.8258 224.1523 171.1520 216.8638
 [9] 151.7684 218.8988
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 179.4518 109.0552 219.9164 187.7403 277.8258 224.1523 171.1520 216.8638
 [9] 151.7684 218.8988
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -1.421085e-14 -2.842171e-14 -5.684342e-14 -5.684342e-14 -1.136868e-13
 [6]  5.684342e-14  5.684342e-14  5.684342e-14 -1.705303e-13 -1.136868e-13
[11]  1.136868e-13  1.136868e-13 -1.136868e-13 -1.136868e-13 -2.842171e-14
[16]  5.684342e-14 -8.526513e-14  2.273737e-13  1.705303e-13  4.973799e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
4   12 
9   18 
8   20 
4   10 
4   13 
1   1 
9   8 
8   15 
5   16 
10   9 
7   16 
5   17 
9   2 
6   14 
1   3 
6   9 
1   1 
10   10 
9   4 
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] 3.166586
> Min(tmp)
[1] -2.182434
> mean(tmp)
[1] 0.1120749
> Sum(tmp)
[1] 11.20749
> Var(tmp)
[1] 1.129961
> 
> rowMeans(tmp)
[1] 0.1120749
> rowSums(tmp)
[1] 11.20749
> rowVars(tmp)
[1] 1.129961
> rowSd(tmp)
[1] 1.062996
> rowMax(tmp)
[1] 3.166586
> rowMin(tmp)
[1] -2.182434
> 
> colMeans(tmp)
  [1]  1.03992254  3.16658620 -0.26189376 -0.68306440  0.95964764 -0.69915181
  [7] -0.51954455  0.45833938 -0.11969831  1.24485619  1.47014413  0.46391159
 [13]  0.73560543 -0.78658468  0.57308733  0.36237421 -1.00856861 -0.74910938
 [19] -1.93042655 -0.66930054 -1.18880915  1.76240324 -0.59291539 -1.15059139
 [25] -1.41213622  0.53069495 -0.23819409 -0.70836277  0.39196362 -0.55690697
 [31]  1.52960783 -1.36607001  0.07243179 -0.29105247 -0.23203821  2.47281515
 [37]  1.70256713  0.74154396  0.42439400  1.00040871 -0.67846006 -1.50053948
 [43] -0.24908791 -0.93742565  1.51511393 -0.62570105 -0.86202723 -0.30142133
 [49]  0.77948839 -0.20896927 -0.44832142 -1.01124828 -1.23770260  0.54177228
 [55]  0.69265777  0.14978555 -0.69756255  0.58102244  0.32661377 -0.68173152
 [61]  1.17760344  0.73513594 -1.41430722  1.54887173  0.85247544 -2.18243439
 [67]  1.78873997 -0.04774794 -0.33613882  1.73927458  0.64607127  0.04973618
 [73]  1.48918208 -0.45675166  1.61584865  1.23847329  0.34400414  0.90307138
 [79]  0.22384703 -0.72330793  0.55978104  0.18605584 -0.61274872 -0.37885339
 [85] -0.89007228  2.78376535  1.11020756 -2.15134855 -1.76658360  0.03207923
 [91]  1.43103774 -0.18854134  0.01770751  0.87463302  0.27667087  0.02107801
 [97] -0.64653531 -1.15773589  1.00205728  0.42804516
> colSums(tmp)
  [1]  1.03992254  3.16658620 -0.26189376 -0.68306440  0.95964764 -0.69915181
  [7] -0.51954455  0.45833938 -0.11969831  1.24485619  1.47014413  0.46391159
 [13]  0.73560543 -0.78658468  0.57308733  0.36237421 -1.00856861 -0.74910938
 [19] -1.93042655 -0.66930054 -1.18880915  1.76240324 -0.59291539 -1.15059139
 [25] -1.41213622  0.53069495 -0.23819409 -0.70836277  0.39196362 -0.55690697
 [31]  1.52960783 -1.36607001  0.07243179 -0.29105247 -0.23203821  2.47281515
 [37]  1.70256713  0.74154396  0.42439400  1.00040871 -0.67846006 -1.50053948
 [43] -0.24908791 -0.93742565  1.51511393 -0.62570105 -0.86202723 -0.30142133
 [49]  0.77948839 -0.20896927 -0.44832142 -1.01124828 -1.23770260  0.54177228
 [55]  0.69265777  0.14978555 -0.69756255  0.58102244  0.32661377 -0.68173152
 [61]  1.17760344  0.73513594 -1.41430722  1.54887173  0.85247544 -2.18243439
 [67]  1.78873997 -0.04774794 -0.33613882  1.73927458  0.64607127  0.04973618
 [73]  1.48918208 -0.45675166  1.61584865  1.23847329  0.34400414  0.90307138
 [79]  0.22384703 -0.72330793  0.55978104  0.18605584 -0.61274872 -0.37885339
 [85] -0.89007228  2.78376535  1.11020756 -2.15134855 -1.76658360  0.03207923
 [91]  1.43103774 -0.18854134  0.01770751  0.87463302  0.27667087  0.02107801
 [97] -0.64653531 -1.15773589  1.00205728  0.42804516
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  1.03992254  3.16658620 -0.26189376 -0.68306440  0.95964764 -0.69915181
  [7] -0.51954455  0.45833938 -0.11969831  1.24485619  1.47014413  0.46391159
 [13]  0.73560543 -0.78658468  0.57308733  0.36237421 -1.00856861 -0.74910938
 [19] -1.93042655 -0.66930054 -1.18880915  1.76240324 -0.59291539 -1.15059139
 [25] -1.41213622  0.53069495 -0.23819409 -0.70836277  0.39196362 -0.55690697
 [31]  1.52960783 -1.36607001  0.07243179 -0.29105247 -0.23203821  2.47281515
 [37]  1.70256713  0.74154396  0.42439400  1.00040871 -0.67846006 -1.50053948
 [43] -0.24908791 -0.93742565  1.51511393 -0.62570105 -0.86202723 -0.30142133
 [49]  0.77948839 -0.20896927 -0.44832142 -1.01124828 -1.23770260  0.54177228
 [55]  0.69265777  0.14978555 -0.69756255  0.58102244  0.32661377 -0.68173152
 [61]  1.17760344  0.73513594 -1.41430722  1.54887173  0.85247544 -2.18243439
 [67]  1.78873997 -0.04774794 -0.33613882  1.73927458  0.64607127  0.04973618
 [73]  1.48918208 -0.45675166  1.61584865  1.23847329  0.34400414  0.90307138
 [79]  0.22384703 -0.72330793  0.55978104  0.18605584 -0.61274872 -0.37885339
 [85] -0.89007228  2.78376535  1.11020756 -2.15134855 -1.76658360  0.03207923
 [91]  1.43103774 -0.18854134  0.01770751  0.87463302  0.27667087  0.02107801
 [97] -0.64653531 -1.15773589  1.00205728  0.42804516
> colMin(tmp)
  [1]  1.03992254  3.16658620 -0.26189376 -0.68306440  0.95964764 -0.69915181
  [7] -0.51954455  0.45833938 -0.11969831  1.24485619  1.47014413  0.46391159
 [13]  0.73560543 -0.78658468  0.57308733  0.36237421 -1.00856861 -0.74910938
 [19] -1.93042655 -0.66930054 -1.18880915  1.76240324 -0.59291539 -1.15059139
 [25] -1.41213622  0.53069495 -0.23819409 -0.70836277  0.39196362 -0.55690697
 [31]  1.52960783 -1.36607001  0.07243179 -0.29105247 -0.23203821  2.47281515
 [37]  1.70256713  0.74154396  0.42439400  1.00040871 -0.67846006 -1.50053948
 [43] -0.24908791 -0.93742565  1.51511393 -0.62570105 -0.86202723 -0.30142133
 [49]  0.77948839 -0.20896927 -0.44832142 -1.01124828 -1.23770260  0.54177228
 [55]  0.69265777  0.14978555 -0.69756255  0.58102244  0.32661377 -0.68173152
 [61]  1.17760344  0.73513594 -1.41430722  1.54887173  0.85247544 -2.18243439
 [67]  1.78873997 -0.04774794 -0.33613882  1.73927458  0.64607127  0.04973618
 [73]  1.48918208 -0.45675166  1.61584865  1.23847329  0.34400414  0.90307138
 [79]  0.22384703 -0.72330793  0.55978104  0.18605584 -0.61274872 -0.37885339
 [85] -0.89007228  2.78376535  1.11020756 -2.15134855 -1.76658360  0.03207923
 [91]  1.43103774 -0.18854134  0.01770751  0.87463302  0.27667087  0.02107801
 [97] -0.64653531 -1.15773589  1.00205728  0.42804516
> colMedians(tmp)
  [1]  1.03992254  3.16658620 -0.26189376 -0.68306440  0.95964764 -0.69915181
  [7] -0.51954455  0.45833938 -0.11969831  1.24485619  1.47014413  0.46391159
 [13]  0.73560543 -0.78658468  0.57308733  0.36237421 -1.00856861 -0.74910938
 [19] -1.93042655 -0.66930054 -1.18880915  1.76240324 -0.59291539 -1.15059139
 [25] -1.41213622  0.53069495 -0.23819409 -0.70836277  0.39196362 -0.55690697
 [31]  1.52960783 -1.36607001  0.07243179 -0.29105247 -0.23203821  2.47281515
 [37]  1.70256713  0.74154396  0.42439400  1.00040871 -0.67846006 -1.50053948
 [43] -0.24908791 -0.93742565  1.51511393 -0.62570105 -0.86202723 -0.30142133
 [49]  0.77948839 -0.20896927 -0.44832142 -1.01124828 -1.23770260  0.54177228
 [55]  0.69265777  0.14978555 -0.69756255  0.58102244  0.32661377 -0.68173152
 [61]  1.17760344  0.73513594 -1.41430722  1.54887173  0.85247544 -2.18243439
 [67]  1.78873997 -0.04774794 -0.33613882  1.73927458  0.64607127  0.04973618
 [73]  1.48918208 -0.45675166  1.61584865  1.23847329  0.34400414  0.90307138
 [79]  0.22384703 -0.72330793  0.55978104  0.18605584 -0.61274872 -0.37885339
 [85] -0.89007228  2.78376535  1.11020756 -2.15134855 -1.76658360  0.03207923
 [91]  1.43103774 -0.18854134  0.01770751  0.87463302  0.27667087  0.02107801
 [97] -0.64653531 -1.15773589  1.00205728  0.42804516
> colRanges(tmp)
         [,1]     [,2]       [,3]       [,4]      [,5]       [,6]       [,7]
[1,] 1.039923 3.166586 -0.2618938 -0.6830644 0.9596476 -0.6991518 -0.5195445
[2,] 1.039923 3.166586 -0.2618938 -0.6830644 0.9596476 -0.6991518 -0.5195445
          [,8]       [,9]    [,10]    [,11]     [,12]     [,13]      [,14]
[1,] 0.4583394 -0.1196983 1.244856 1.470144 0.4639116 0.7356054 -0.7865847
[2,] 0.4583394 -0.1196983 1.244856 1.470144 0.4639116 0.7356054 -0.7865847
         [,15]     [,16]     [,17]      [,18]     [,19]      [,20]     [,21]
[1,] 0.5730873 0.3623742 -1.008569 -0.7491094 -1.930427 -0.6693005 -1.188809
[2,] 0.5730873 0.3623742 -1.008569 -0.7491094 -1.930427 -0.6693005 -1.188809
        [,22]      [,23]     [,24]     [,25]     [,26]      [,27]      [,28]
[1,] 1.762403 -0.5929154 -1.150591 -1.412136 0.5306949 -0.2381941 -0.7083628
[2,] 1.762403 -0.5929154 -1.150591 -1.412136 0.5306949 -0.2381941 -0.7083628
         [,29]     [,30]    [,31]    [,32]      [,33]      [,34]      [,35]
[1,] 0.3919636 -0.556907 1.529608 -1.36607 0.07243179 -0.2910525 -0.2320382
[2,] 0.3919636 -0.556907 1.529608 -1.36607 0.07243179 -0.2910525 -0.2320382
        [,36]    [,37]    [,38]    [,39]    [,40]      [,41]     [,42]
[1,] 2.472815 1.702567 0.741544 0.424394 1.000409 -0.6784601 -1.500539
[2,] 2.472815 1.702567 0.741544 0.424394 1.000409 -0.6784601 -1.500539
          [,43]      [,44]    [,45]     [,46]      [,47]      [,48]     [,49]
[1,] -0.2490879 -0.9374256 1.515114 -0.625701 -0.8620272 -0.3014213 0.7794884
[2,] -0.2490879 -0.9374256 1.515114 -0.625701 -0.8620272 -0.3014213 0.7794884
          [,50]      [,51]     [,52]     [,53]     [,54]     [,55]     [,56]
[1,] -0.2089693 -0.4483214 -1.011248 -1.237703 0.5417723 0.6926578 0.1497855
[2,] -0.2089693 -0.4483214 -1.011248 -1.237703 0.5417723 0.6926578 0.1497855
          [,57]     [,58]     [,59]      [,60]    [,61]     [,62]     [,63]
[1,] -0.6975626 0.5810224 0.3266138 -0.6817315 1.177603 0.7351359 -1.414307
[2,] -0.6975626 0.5810224 0.3266138 -0.6817315 1.177603 0.7351359 -1.414307
        [,64]     [,65]     [,66]   [,67]       [,68]      [,69]    [,70]
[1,] 1.548872 0.8524754 -2.182434 1.78874 -0.04774794 -0.3361388 1.739275
[2,] 1.548872 0.8524754 -2.182434 1.78874 -0.04774794 -0.3361388 1.739275
         [,71]      [,72]    [,73]      [,74]    [,75]    [,76]     [,77]
[1,] 0.6460713 0.04973618 1.489182 -0.4567517 1.615849 1.238473 0.3440041
[2,] 0.6460713 0.04973618 1.489182 -0.4567517 1.615849 1.238473 0.3440041
         [,78]    [,79]      [,80]    [,81]     [,82]      [,83]      [,84]
[1,] 0.9030714 0.223847 -0.7233079 0.559781 0.1860558 -0.6127487 -0.3788534
[2,] 0.9030714 0.223847 -0.7233079 0.559781 0.1860558 -0.6127487 -0.3788534
          [,85]    [,86]    [,87]     [,88]     [,89]      [,90]    [,91]
[1,] -0.8900723 2.783765 1.110208 -2.151349 -1.766584 0.03207923 1.431038
[2,] -0.8900723 2.783765 1.110208 -2.151349 -1.766584 0.03207923 1.431038
          [,92]      [,93]    [,94]     [,95]      [,96]      [,97]     [,98]
[1,] -0.1885413 0.01770751 0.874633 0.2766709 0.02107801 -0.6465353 -1.157736
[2,] -0.1885413 0.01770751 0.874633 0.2766709 0.02107801 -0.6465353 -1.157736
        [,99]    [,100]
[1,] 1.002057 0.4280452
[2,] 1.002057 0.4280452
> 
> 
> Max(tmp2)
[1] 2.614194
> Min(tmp2)
[1] -2.216346
> mean(tmp2)
[1] 0.01112429
> Sum(tmp2)
[1] 1.112429
> Var(tmp2)
[1] 1.117293
> 
> rowMeans(tmp2)
  [1]  1.33423871 -0.60806152 -0.24190754 -1.26992647  0.68992993  2.50837005
  [7] -0.85891902 -0.07787267 -1.40897628  1.75067726 -0.40570483 -0.64679902
 [13]  0.69431154 -1.45009593  0.89421999 -0.32452574 -2.21634563 -0.53591177
 [19]  0.77158140 -0.41607048  0.19799787 -0.30933251 -0.01076331  0.29746599
 [25]  1.48591751  0.98724329  0.87352248 -0.09449257  2.11388494  2.09941578
 [31] -0.09732302 -2.02033955 -0.71117874 -0.62085964  0.02363708 -1.72962009
 [37] -1.36693093 -0.69884931 -0.90211825 -1.83367550  0.41358043 -0.00194581
 [43] -0.06200746  0.29389856 -0.93932628 -0.37160338  0.77514256 -0.16494340
 [49] -1.27501896  0.52446429  0.93588984  0.18863562  0.45508489 -0.09042090
 [55]  1.48528957 -1.08654139  1.75801977 -0.85550379 -0.36635951 -1.45846419
 [61] -0.47532312 -1.32509153  1.39429251 -0.23701862  0.59393675  1.00557028
 [67]  1.82204538  0.44537084 -0.47251490  0.15079212 -0.82219427 -0.36005755
 [73]  1.74963440 -0.53422099  1.35420155 -0.82135090 -0.77079407 -0.92584448
 [79]  0.24781216 -0.22306915 -0.19965111 -1.41786541 -0.07546642 -0.66881044
 [85]  0.96956553 -0.06905846 -0.03149163  1.41037894  0.98026750 -1.84781473
 [91] -0.03444782 -0.05270418 -1.90110634  1.20730556  1.06704920 -0.36232142
 [97]  2.61419384  0.87891079 -0.21619521  1.04183062
> rowSums(tmp2)
  [1]  1.33423871 -0.60806152 -0.24190754 -1.26992647  0.68992993  2.50837005
  [7] -0.85891902 -0.07787267 -1.40897628  1.75067726 -0.40570483 -0.64679902
 [13]  0.69431154 -1.45009593  0.89421999 -0.32452574 -2.21634563 -0.53591177
 [19]  0.77158140 -0.41607048  0.19799787 -0.30933251 -0.01076331  0.29746599
 [25]  1.48591751  0.98724329  0.87352248 -0.09449257  2.11388494  2.09941578
 [31] -0.09732302 -2.02033955 -0.71117874 -0.62085964  0.02363708 -1.72962009
 [37] -1.36693093 -0.69884931 -0.90211825 -1.83367550  0.41358043 -0.00194581
 [43] -0.06200746  0.29389856 -0.93932628 -0.37160338  0.77514256 -0.16494340
 [49] -1.27501896  0.52446429  0.93588984  0.18863562  0.45508489 -0.09042090
 [55]  1.48528957 -1.08654139  1.75801977 -0.85550379 -0.36635951 -1.45846419
 [61] -0.47532312 -1.32509153  1.39429251 -0.23701862  0.59393675  1.00557028
 [67]  1.82204538  0.44537084 -0.47251490  0.15079212 -0.82219427 -0.36005755
 [73]  1.74963440 -0.53422099  1.35420155 -0.82135090 -0.77079407 -0.92584448
 [79]  0.24781216 -0.22306915 -0.19965111 -1.41786541 -0.07546642 -0.66881044
 [85]  0.96956553 -0.06905846 -0.03149163  1.41037894  0.98026750 -1.84781473
 [91] -0.03444782 -0.05270418 -1.90110634  1.20730556  1.06704920 -0.36232142
 [97]  2.61419384  0.87891079 -0.21619521  1.04183062
> 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.33423871 -0.60806152 -0.24190754 -1.26992647  0.68992993  2.50837005
  [7] -0.85891902 -0.07787267 -1.40897628  1.75067726 -0.40570483 -0.64679902
 [13]  0.69431154 -1.45009593  0.89421999 -0.32452574 -2.21634563 -0.53591177
 [19]  0.77158140 -0.41607048  0.19799787 -0.30933251 -0.01076331  0.29746599
 [25]  1.48591751  0.98724329  0.87352248 -0.09449257  2.11388494  2.09941578
 [31] -0.09732302 -2.02033955 -0.71117874 -0.62085964  0.02363708 -1.72962009
 [37] -1.36693093 -0.69884931 -0.90211825 -1.83367550  0.41358043 -0.00194581
 [43] -0.06200746  0.29389856 -0.93932628 -0.37160338  0.77514256 -0.16494340
 [49] -1.27501896  0.52446429  0.93588984  0.18863562  0.45508489 -0.09042090
 [55]  1.48528957 -1.08654139  1.75801977 -0.85550379 -0.36635951 -1.45846419
 [61] -0.47532312 -1.32509153  1.39429251 -0.23701862  0.59393675  1.00557028
 [67]  1.82204538  0.44537084 -0.47251490  0.15079212 -0.82219427 -0.36005755
 [73]  1.74963440 -0.53422099  1.35420155 -0.82135090 -0.77079407 -0.92584448
 [79]  0.24781216 -0.22306915 -0.19965111 -1.41786541 -0.07546642 -0.66881044
 [85]  0.96956553 -0.06905846 -0.03149163  1.41037894  0.98026750 -1.84781473
 [91] -0.03444782 -0.05270418 -1.90110634  1.20730556  1.06704920 -0.36232142
 [97]  2.61419384  0.87891079 -0.21619521  1.04183062
> rowMin(tmp2)
  [1]  1.33423871 -0.60806152 -0.24190754 -1.26992647  0.68992993  2.50837005
  [7] -0.85891902 -0.07787267 -1.40897628  1.75067726 -0.40570483 -0.64679902
 [13]  0.69431154 -1.45009593  0.89421999 -0.32452574 -2.21634563 -0.53591177
 [19]  0.77158140 -0.41607048  0.19799787 -0.30933251 -0.01076331  0.29746599
 [25]  1.48591751  0.98724329  0.87352248 -0.09449257  2.11388494  2.09941578
 [31] -0.09732302 -2.02033955 -0.71117874 -0.62085964  0.02363708 -1.72962009
 [37] -1.36693093 -0.69884931 -0.90211825 -1.83367550  0.41358043 -0.00194581
 [43] -0.06200746  0.29389856 -0.93932628 -0.37160338  0.77514256 -0.16494340
 [49] -1.27501896  0.52446429  0.93588984  0.18863562  0.45508489 -0.09042090
 [55]  1.48528957 -1.08654139  1.75801977 -0.85550379 -0.36635951 -1.45846419
 [61] -0.47532312 -1.32509153  1.39429251 -0.23701862  0.59393675  1.00557028
 [67]  1.82204538  0.44537084 -0.47251490  0.15079212 -0.82219427 -0.36005755
 [73]  1.74963440 -0.53422099  1.35420155 -0.82135090 -0.77079407 -0.92584448
 [79]  0.24781216 -0.22306915 -0.19965111 -1.41786541 -0.07546642 -0.66881044
 [85]  0.96956553 -0.06905846 -0.03149163  1.41037894  0.98026750 -1.84781473
 [91] -0.03444782 -0.05270418 -1.90110634  1.20730556  1.06704920 -0.36232142
 [97]  2.61419384  0.87891079 -0.21619521  1.04183062
> 
> colMeans(tmp2)
[1] 0.01112429
> colSums(tmp2)
[1] 1.112429
> colVars(tmp2)
[1] 1.117293
> colSd(tmp2)
[1] 1.057021
> colMax(tmp2)
[1] 2.614194
> colMin(tmp2)
[1] -2.216346
> colMedians(tmp2)
[1] -0.08414679
> colRanges(tmp2)
          [,1]
[1,] -2.216346
[2,]  2.614194
> 
> 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.9039550  1.5827621 -1.0308292  0.6171919 -6.9381820 -1.3383680
 [7]  1.6469427  2.1231015  3.0107039  5.1881822
> colApply(tmp,quantile)[,1]
            [,1]
[1,] -0.83897641
[2,] -0.09067582
[3,]  0.51269177
[4,]  1.04933026
[5,]  1.28150505
> 
> rowApply(tmp,sum)
 [1] -5.3912481 -5.6170870  4.2985182 -3.5532744  3.1971151  4.0954442
 [7]  0.3424129  0.4100136  5.2174571  5.7661087
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    5    8    7    7    4    6    2   10    5     9
 [2,]    9    3    1    5    9    9    5    2    4    10
 [3,]    4    5    5    9    2    7    9    8    1     5
 [4,]    3    6    3    6    7   10    7    4    9     4
 [5,]    1    2    4    2    1    2    6    9    2     7
 [6,]    2   10    8    3    8    1    1    1    6     2
 [7,]    6    1    9    4    6    4    8    5    8     1
 [8,]    7    9   10    1    5    3    3    6    3     8
 [9,]   10    7    2   10    3    5   10    7    7     3
[10,]    8    4    6    8   10    8    4    3   10     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1] -1.6860304  3.1857840  6.2604204  1.4701641 -0.9493246 -0.7068901
 [7]  0.6897480  1.3463428  2.7102883 -5.9622101 -2.1000266 -0.7897821
[13]  2.4548314  2.3967899 -2.8459640 -1.6404908 -1.3386685 -1.2233244
[19]  4.3008936  1.8651763
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -2.1240554
[2,] -0.4434626
[3,] -0.2251875
[4,]  0.4652428
[5,]  0.6414322
> 
> rowApply(tmp,sum)
[1] -2.9198480 -0.7234648 14.1466618 -2.9126695 -0.1529524
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   11   14    8    2    7
[2,]    6   20   20   14    5
[3,]   14   12    7   18   20
[4,]    7    6   19   20    2
[5,]    8   19   15    1    9
> 
> 
> as.matrix(tmp)
           [,1]       [,2]      [,3]       [,4]        [,5]       [,6]
[1,] -0.2251875 -0.6438061 0.5955780 -0.5229134 -0.47781695 -1.0476118
[2,]  0.4652428  1.5270378 0.1878451 -0.5236805  1.36910012  0.5465290
[3,]  0.6414322  2.6063801 0.5300865  2.1595693  1.27971901  0.7514126
[4,] -2.1240554  0.2840063 1.8799699  2.0092491 -3.03881303 -1.5717160
[5,] -0.4434626 -0.5878342 3.0669409 -1.6520604 -0.08151379  0.6144961
            [,7]       [,8]        [,9]      [,10]       [,11]      [,12]
[1,] -1.50853555 -1.6899931  1.18147606 -1.6414542 -0.13337080 -0.9489256
[2,] -0.15244312  0.8372957 -0.19016925 -1.6147469  0.21046265 -0.2637342
[3,]  0.74638013  0.9550317  1.72980863 -0.8925012 -1.07249305  1.5100302
[4,]  1.64861082  1.5618740 -0.08502711 -0.9488100 -1.06862629 -1.9476551
[5,] -0.04426431 -0.3178654  0.07420001 -0.8646979 -0.03599916  0.8605026
          [,13]      [,14]       [,15]      [,16]       [,17]       [,18]
[1,]  0.6420993 -0.4352809  0.60303676  0.2526766 -0.44589828  0.74769634
[2,] -0.8597452 -0.2051678 -0.56946267 -0.4699796 -0.70672479 -1.75755104
[3,]  1.2334686  0.9523711  0.04237644 -0.8519901 -0.54595817 -0.33777663
[4,]  1.9922689  1.1383655 -1.00954774 -1.4100076 -0.09945938  0.11188710
[5,] -0.5532601  0.9465021 -1.91236674  0.8388100  0.45937211  0.01241983
           [,19]      [,20]
[1,]  1.35405779  1.4243254
[2,]  0.61586656  0.8305607
[3,]  1.97204798  0.7372666
[4,] -0.09465967 -0.1405239
[5,]  0.45358099 -0.9864526
> 
> 
> 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 :  649  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 :  562  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 1.352387 -1.285214 -1.0255 0.7774224 1.422982 0.2873948 -0.06538262
          col8       col9      col10     col11      col12     col13     col14
row1 0.2315229 -0.8059219 -0.4255199 -1.214289 -0.8021182 0.3519962 0.3665567
        col15     col16      col17    col18      col19      col20
row1 1.329538 -0.392241 -0.3000654 2.324857 -0.6324762 -0.5623199
> tmp[,"col10"]
          col10
row1 -0.4255199
row2  0.3197457
row3 -0.3661404
row4  1.0855719
row5  0.1941767
> tmp[c("row1","row5"),]
          col1      col2      col3       col4       col5       col6        col7
row1 1.3523871 -1.285214 -1.025500  0.7774224  1.4229820  0.2873948 -0.06538262
row5 0.9640521 -1.434047 -1.428971 -1.5687300 -0.6625947 -0.6796229 -1.88563660
           col8       col9      col10      col11      col12        col13
row1  0.2315229 -0.8059219 -0.4255199 -1.2142886 -0.8021182  0.351996208
row5 -1.0784123 -0.9914189  0.1941767  0.3840308 -0.4519998 -0.003782324
         col14    col15      col16      col17     col18      col19      col20
row1 0.3665567 1.329538 -0.3922410 -0.3000654 2.3248568 -0.6324762 -0.5623199
row5 0.7649208 1.246266 -0.5509307  1.6404836 0.3253398 -1.9249298 -1.2505019
> tmp[,c("col6","col20")]
           col6       col20
row1  0.2873948 -0.56231988
row2 -1.8742281  0.01069453
row3  1.8149439  0.30589559
row4  0.3947849 -0.23069433
row5 -0.6796229 -1.25050188
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1  0.2873948 -0.5623199
row5 -0.6796229 -1.2505019
> 
> 
> 
> 
> 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 47.14527 49.10325 48.5169 49.48334 49.41115 103.4731 49.0904 49.62408
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.74387 51.06314 49.71222 50.18114 50.61809 48.94088 49.25627 49.82276
        col17    col18    col19    col20
row1 48.81464 50.79244 51.42541 106.7198
> tmp[,"col10"]
        col10
row1 51.06314
row2 29.59771
row3 27.85788
row4 28.11916
row5 48.77920
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 47.14527 49.10325 48.51690 49.48334 49.41115 103.4731 49.09040 49.62408
row5 50.43399 50.15318 49.75408 49.57924 50.17970 104.8031 50.15603 50.01019
         col9    col10    col11    col12    col13    col14    col15    col16
row1 51.74387 51.06314 49.71222 50.18114 50.61809 48.94088 49.25627 49.82276
row5 48.36577 48.77920 49.57564 50.99919 49.85296 51.21940 50.81897 50.60288
        col17    col18    col19    col20
row1 48.81464 50.79244 51.42541 106.7198
row5 49.35788 48.75599 49.60094 105.1516
> tmp[,c("col6","col20")]
          col6     col20
row1 103.47309 106.71983
row2  74.38829  75.76363
row3  76.42225  75.64073
row4  73.39273  74.96253
row5 104.80305 105.15157
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.4731 106.7198
row5 104.8031 105.1516
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.4731 106.7198
row5 104.8031 105.1516
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
           col13
[1,] -0.31650621
[2,] -0.45113587
[3,]  0.02666887
[4,]  0.13992946
[5,] -0.31883743
> tmp[,c("col17","col7")]
          col17        col7
[1,]  0.2339539  0.48127236
[2,] -0.3691267 -1.17765887
[3,]  0.4869384  0.89788382
[4,] -1.8184467  0.77076719
[5,]  0.3269474 -0.03579649
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
            col6      col20
[1,] -0.61553050  1.2380101
[2,] -0.69245787 -0.9669001
[3,]  0.09949476  1.4104035
[4,] -0.49323500  1.5778529
[5,]  1.09481519 -0.2191506
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.6155305
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.6155305
[2,] -0.6924579
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]      [,4]       [,5]        [,6]
row3 -0.8844112 -0.2189609 0.4858766 -1.407028 -0.5098321 0.004142428
row1  0.5278562  2.6282767 1.3238210  0.405696 -0.5064323 0.427975936
           [,7]       [,8]        [,9]      [,10]    [,11]      [,12]
row3 -1.4015700 -0.2417318  0.08884298  0.1342196 1.472583 -0.9062211
row1 -0.3349247  0.6078603 -1.05652459 -0.8461964 1.204166  1.0552855
          [,13]       [,14]      [,15]      [,16]      [,17]    [,18]     [,19]
row3 -0.8333328 -0.81382292 -0.7931499 -0.6709457  0.3178080 0.741238 1.5498898
row1 -1.4130203  0.07109675  0.4094348  1.8837928 -0.6318484 1.537706 0.5282688
         [,20]
row3  1.146293
row1 -1.191791
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]     [,2]       [,3]      [,4]       [,5]        [,6]       [,7]
row2 -1.602032 1.378159 -0.6791207 0.2008812 -0.8214072 -0.08761712 -0.6806939
          [,8]      [,9]     [,10]
row2 -0.718004 0.6154309 0.1159651
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]      [,3]     [,4]      [,5]      [,6]        [,7]
row5 0.4166801 0.1810667 0.5568765 1.991018 0.6235063 -1.719466 0.003198847
           [,8]       [,9]    [,10]     [,11]     [,12]      [,13]     [,14]
row5 -0.1750754 0.02371091 1.395727 0.1227965 0.9829741 -0.5172037 -1.612272
         [,15]     [,16]      [,17]     [,18]    [,19]       [,20]
row5 0.7921775 0.8896501 -0.6860877 0.1945879 1.160724 -0.03861185
> 
> 
> 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: 0x5595ec01c860>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469335ef4262a"
 [2] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469331b3a1c01"
 [3] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469334942a932"
 [4] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469333a25ef13"
 [5] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469331d23f26d"
 [6] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM46933294ea906"
 [7] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469332fa1f312"
 [8] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM46933382aff00"
 [9] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469335c124a5c"
[10] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469332e2476fc"
[11] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469334f3eae1f"
[12] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469334f69613f"
[13] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM4693363104e1e"
[14] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM46933704dcf81"
[15] "/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests/BM469337e2155fa"
> 
> 
> ### 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: 0x5595ecd0b590>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x5595ecd0b590>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.19-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x5595ecd0b590>
> rowMedians(tmp)
  [1]  0.079925492 -0.087512488  0.129234071 -0.095848603  0.279233797
  [6] -0.118758420  0.489144636 -0.358702886 -0.104395712 -0.059162497
 [11] -0.021113056  0.264646781  0.167291750  0.410465594  0.240689393
 [16] -0.318753096  0.079649589  0.080009741  0.063100739  0.177973710
 [21]  0.068425249  0.905721857  0.594909802  0.231210044  0.180705023
 [26] -0.078399556 -0.243302327  0.061503112  0.044816375  0.116032466
 [31]  0.075247889 -0.010788994  0.199416857 -0.531170482 -0.229571538
 [36]  0.216846169  0.244280756  0.222835578 -0.327297428 -0.237311083
 [41]  0.041983360 -0.299995883  0.150046540  0.109100919 -0.162962562
 [46] -0.333994682 -0.324088426 -0.367254152  0.195308815 -0.089574049
 [51]  0.103990985 -0.385586600 -0.078631016  0.884261850 -0.660896110
 [56] -0.079425979  0.059205182 -0.228039440  0.015194630 -0.639175498
 [61] -0.376876730  0.076498437  0.013929667 -0.181755661  0.055426801
 [66] -0.235155653  0.344882755  0.275855353  0.749745194 -0.298749596
 [71]  0.108998943  0.207556181  0.288746921  0.424040069  0.996854362
 [76] -0.201685883 -0.552913143 -0.781986017 -0.960995323 -0.281311335
 [81] -0.513436052  0.150806385 -0.107813562  0.295175876 -0.109992086
 [86] -0.216223666 -0.241523559  0.122837760 -0.219305535 -0.191693346
 [91]  0.101414341 -0.032037683 -0.156811393  0.219207660 -0.805994696
 [96] -0.021045540  0.020761146  0.358857791  0.387183584 -0.131239289
[101]  0.592810966  0.117013765 -0.744125447  0.514733895  0.326830420
[106]  0.010878870 -0.449893682 -0.319100399  0.514966295 -0.056536977
[111] -0.057587664 -1.018675334  0.259036058 -0.421005876 -0.115916728
[116]  0.114291761 -0.039130417  0.393425755 -0.282339973 -0.277207355
[121] -0.046137134 -0.321290913 -0.009291802 -0.060696020  0.174557822
[126] -0.046475318 -0.200040398 -0.465265654 -0.013009738 -0.278542552
[131] -0.146669174  0.075448221 -0.184608673 -0.024172580 -0.280752915
[136]  0.158373427  0.252342089  0.430674271  0.239387887 -0.340510782
[141]  0.254372756  0.101345654 -0.251718688  0.494762199 -0.554947107
[146]  0.254702407 -0.028759080  0.544868224 -0.505424585  0.051579639
[151]  0.491949733  0.138442711 -0.296711511 -0.170670191 -0.141475298
[156] -0.310932451 -0.096580154  0.428720003 -0.093387849  0.241614671
[161]  0.023458879  0.313010348  0.204598748  0.008316728  0.239034573
[166]  0.182113047 -0.863274017  0.073008621 -0.200039379 -0.138615311
[171]  0.959055076  0.264839368  0.076886191  0.390412704 -0.058385850
[176]  0.001878313  0.009161822  0.023894866 -0.198560897  0.100391890
[181]  0.227372589 -0.329211481 -0.213494165 -0.401061463  0.578074853
[186]  0.158479722 -0.042034311 -0.007301361 -0.459911642  0.218879591
[191]  0.281520232  0.449934070 -0.247626680 -0.029892166 -0.457750026
[196]  0.588127080  0.598155902 -0.282075013 -0.503279480 -0.590132876
[201] -0.134640098 -0.006014258  0.149255069 -0.496009851  0.154671534
[206] -0.475461675  0.533866157 -0.282361170  0.351500028 -0.308709251
[211] -0.238688100  0.257171539 -0.038089325  0.303408351 -0.183549159
[216] -0.363469606  0.329229375  0.366471887 -0.052836355  0.091249885
[221] -0.417559680 -0.148848486 -0.037108448  0.191443723 -0.080462727
[226] -0.151792047  0.039596883  0.423482199 -0.119717833 -0.124934013
> 
> proc.time()
   user  system elapsed 
  1.368   1.608   2.987 

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: 0x5620c3605b80>
> .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: 0x5620c3605b80>
> .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: 0x5620c3605b80>
> .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: 0x5620c3605b80>
> 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: 0x5620c2c7b290>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5620c2c7b290>
> .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: 0x5620c2c7b290>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5620c2c7b290>
> .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: 0x5620c2c7b290>
> 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: 0x5620c3a3a1a0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5620c3a3a1a0>
> .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: 0x5620c3a3a1a0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5620c3a3a1a0>
> .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: 0x5620c3a3a1a0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x5620c3a3a1a0>
> .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: 0x5620c3a3a1a0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x5620c3a3a1a0>
> .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: 0x5620c3a3a1a0>
> 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: 0x5620c3410440>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x5620c3410440>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5620c3410440>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5620c3410440>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile46b905c17939f" "BufferedMatrixFile46b906c88a6b5"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile46b905c17939f" "BufferedMatrixFile46b906c88a6b5"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x5620c3841aa0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5620c3841aa0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5620c3841aa0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x5620c3841aa0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x5620c3841aa0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x5620c3841aa0>
> .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: 0x5620c3b18fc0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x5620c3b18fc0>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x5620c3b18fc0>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x5620c3b18fc0>
> 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: 0x5620c4785770>
> .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: 0x5620c4785770>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.266   0.042   0.297 

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.256   0.048   0.294 

Example timings