Back to Build/check report for BioC 3.18:   simplified   long
A[B]CDEFGHIJKLMNOPQRSTUVWXYZ

This page was generated on 2023-05-26 06:18:05 -0000 (Fri, 26 May 2023).

HostnameOSArch (*)R versionInstalled pkgs
kunpeng2Linux (openEuler 22.03 LTS-SP1)aarch644.3.0 (2023-04-21) -- "Already Tomorrow" 4254
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

CHECK results for BufferedMatrix on kunpeng2


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.

Note: If "R CMD check" recently failed on the Linux builder over a missing dependency, add the missing dependency to "Suggests" in your DESCRIPTION file. See the Renviron.bioc for details.

raw results

Package 241/2197HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.65.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-05-25 13:29:39 -0000 (Thu, 25 May 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: 5a16207
git_last_commit_date: 2023-04-25 13:44:48 -0000 (Tue, 25 Apr 2023)
kunpeng2Linux (openEuler 22.03 LTS-SP1) / aarch64  OK    OK    OK  

Summary

Package: BufferedMatrix
Version: 1.65.0
Command: /home/biocbuild/R/R-4.3.0/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/R/R-4.3.0/site-library --timings BufferedMatrix_1.65.0.tar.gz
StartedAt: 2023-05-26 04:31:57 -0000 (Fri, 26 May 2023)
EndedAt: 2023-05-26 04:32:25 -0000 (Fri, 26 May 2023)
EllapsedTime: 28.1 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


* using log directory ‘/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck’
* using R version 4.3.0 (2023-04-21)
* using platform: aarch64-unknown-linux-gnu (64-bit)
* R was compiled by
    gcc (GCC) 10.3.1
    GNU Fortran (GCC) 10.3.1
* running under: openEuler 22.03 (LTS-SP1)
* using session charset: UTF-8
* checking for file ‘BufferedMatrix/DESCRIPTION’ ... OK
* this is package ‘BufferedMatrix’ version ‘1.65.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 (GCC) 10.3.1’
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking 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
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files is not available
* checking files in ‘vignettes’ ... OK
* checking examples ... NONE
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘Rcodetesting.R’
  Running ‘c_code_level_tests.R’
  Running ‘objectTesting.R’
  Running ‘rawCalltesting.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ...
  ‘BufferedMatrix.Rnw’... OK
 OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* DONE

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



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/R/R-4.3.0/bin/R CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library ‘/home/biocbuild/R/R-4.3.0/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (GCC) 10.3.1’
gcc -I"/home/biocbuild/R/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/R/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
gcc -I"/home/biocbuild/R/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/R/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c init_package.c -o init_package.o
gcc -shared -L/home/biocbuild/R/R-4.3.0/lib -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -L/home/biocbuild/R/R-4.3.0/lib -lR
installing to /home/biocbuild/R/R-4.3.0/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.3.0 (2023-04-21) -- "Already Tomorrow"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.347   0.033   0.367 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.18-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 457525 24.5     981805 52.5   650817 34.8
Vcells 842766  6.5    8388608 64.0  2061567 15.8
> 
> 
> 
> 
> ##
> ## 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] "Fri May 26 04:32:17 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,] == test.matrix[which.row,])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Fri May 26 04:32:17 2023"
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:10,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> 
> 
> 
> 
> 
> RowMode(tmp2)
<pointer: 0x196358f0>
> 
> 
> 
> 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] "Fri May 26 04:32:18 2023"
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col <- sample(1:20,5,replace=TRUE)
+   if (!all(tmp2[which.row,which.col] == test.matrix[which.row,which.col])){
+     cat("incorrect agreement")
+     break;
+   }
+ }
> date()
[1] "Fri May 26 04:32:18 2023"
> 
> ColMode(tmp2)
<pointer: 0x196358f0>
> 
> 
> 
> ### Now testing assignments
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,1)
+ 
+   new.data <- rnorm(20)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,] <- new.data
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,1)
+   new.data <- rnorm(10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+ 
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.col <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[,which.col] <- new.data
+   test.matrix[,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[,prev.col] == test.matrix[,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.col <- which.col
+ }
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   new.data <- matrix(rnorm(50),5,10)
+   tmp2[which.row,] <- new.data
+   test.matrix[which.row,]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,] == test.matrix[prev.row,])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+ }
> 
> 
> 
> 
> 
> for (rep in 1:nreps){
+   which.row <- sample(1:10,5,replace=TRUE)
+   which.col  <- sample(1:20,5,replace=TRUE)
+   new.data <- matrix(rnorm(25),5,5)
+   tmp2[which.row,which.col] <- new.data
+   test.matrix[which.row,which.col]<- new.data
+   
+   if (rep > 1){
+     if (!all(tmp2[prev.row,prev.col] == test.matrix[prev.row,prev.col])){
+       cat("incorrect agreement")
+       break;
+     }
+   }
+   prev.row <- which.row
+   prev.col <- which.col
+ }
> 
> 
> 
> 
> ###
> ###
> ### testing some more functions
> ###
> 
> 
> 
> ## duplication function
> tmp5 <- duplicate(tmp2)
> 
> # making sure really did copy everything.
> tmp5[1,1] <- tmp5[1,1] +100.00
> 
> if (tmp5[1,1] == tmp2[1,1]){
+   stop("Problem with duplication")
+ }
> 
> 
> 
> 
> ### testing elementwise applying of functions
> 
> tmp5[1:4,1:4]
            [,1]        [,2]       [,3]       [,4]
[1,] 100.9578598  0.35260011  0.6036615 -1.1849839
[2,]   0.1540702  0.46856268 -1.2532865  1.1249543
[3,]   0.6869016 -0.08242389  0.7785572 -0.4412636
[4,]  -0.7170002  1.70478781 -0.3248282 -0.8628410
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]       [,2]      [,3]      [,4]
[1,] 100.9578598 0.35260011 0.6036615 1.1849839
[2,]   0.1540702 0.46856268 1.2532865 1.1249543
[3,]   0.6869016 0.08242389 0.7785572 0.4412636
[4,]   0.7170002 1.70478781 0.3248282 0.8628410
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0477788 0.5938014 0.7769566 1.0885697
[2,]  0.3925177 0.6845164 1.1195028 1.0606386
[3,]  0.8287953 0.2870956 0.8823589 0.6642767
[4,]  0.8467587 1.3056752 0.5699370 0.9288924
> 
> 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.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 226.43565 31.29061 33.37323 37.07068
[2,]  29.07925 32.31373 37.44831 36.73134
[3,]  33.97485 27.95338 34.60215 32.08403
[4,]  34.18459 39.76154 31.02420 35.15176
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x1a0dbd10>
> exp(tmp5)
<pointer: 0x1a0dbd10>
> log(tmp5,2)
<pointer: 0x1a0dbd10>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.2961
> Min(tmp5)
[1] 54.1574
> mean(tmp5)
[1] 73.76048
> Sum(tmp5)
[1] 14752.1
> Var(tmp5)
[1] 872.365
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 91.17288 72.62845 72.34352 71.65155 69.98639 75.50828 72.15646 70.25482
 [9] 71.55977 70.34273
> rowSums(tmp5)
 [1] 1823.458 1452.569 1446.870 1433.031 1399.728 1510.166 1443.129 1405.096
 [9] 1431.195 1406.855
> rowVars(tmp5)
 [1] 8054.68089   61.31192   84.04580   68.33853   50.64156   82.36963
 [7]   74.20173   99.37548   86.36649   97.00336
> rowSd(tmp5)
 [1] 89.747874  7.830193  9.167650  8.266712  7.116288  9.075772  8.614043
 [8]  9.968725  9.293357  9.849028
> rowMax(tmp5)
 [1] 471.29613  83.54028  95.79300  85.54080  83.90409  96.21977  88.83489
 [8]  88.83148  88.86604  85.15135
> rowMin(tmp5)
 [1] 59.66937 55.12079 54.15740 56.11086 58.22033 60.96193 56.65457 55.12553
 [9] 56.63642 55.01011
> 
> colMeans(tmp5)
 [1] 110.40331  70.31149  74.17193  74.94715  70.92310  73.01890  68.44101
 [8]  73.20078  67.16549  72.63331  67.37017  74.59297  72.68648  71.54456
[15]  74.64485  72.18761  72.18366  70.32663  66.86326  77.59303
> colSums(tmp5)
 [1] 1104.0331  703.1149  741.7193  749.4715  709.2310  730.1890  684.4101
 [8]  732.0078  671.6549  726.3331  673.7017  745.9297  726.8648  715.4456
[15]  746.4485  721.8761  721.8366  703.2663  668.6326  775.9303
> colVars(tmp5)
 [1] 16137.10924   130.20007    35.48614    73.95074    87.76056   143.82894
 [7]    35.94308    46.52419   104.84605    98.60792    66.76143    49.65431
[13]    87.53740   137.65270    47.14693    56.01250    72.93286    70.84152
[19]    26.70828    39.97552
> colSd(tmp5)
 [1] 127.031922  11.410525   5.957024   8.599462   9.368061  11.992870
 [7]   5.995255   6.820865  10.239436   9.930152   8.170767   7.046581
[13]   9.356142  11.732549   6.866362   7.484150   8.540074   8.416740
[19]   5.168006   6.322620
> colMax(tmp5)
 [1] 471.29613  83.90409  85.15135  88.86604  88.83489  95.79300  76.88676
 [8]  82.78426  86.36805  84.72372  80.01836  87.46626  88.83148  96.21977
[15]  83.42591  85.54080  81.09220  81.69004  73.81076  84.21556
> colMin(tmp5)
 [1] 60.52464 56.65457 64.57280 58.62541 58.22033 59.89799 59.06671 62.13282
 [9] 56.11086 55.12079 55.01011 64.82640 57.92195 55.12553 64.97160 60.22835
[17] 54.15740 57.03523 56.63642 66.25131
> 
> 
> ### 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] 91.17288 72.62845 72.34352 71.65155 69.98639 75.50828 72.15646 70.25482
 [9]       NA 70.34273
> rowSums(tmp5)
 [1] 1823.458 1452.569 1446.870 1433.031 1399.728 1510.166 1443.129 1405.096
 [9]       NA 1406.855
> rowVars(tmp5)
 [1] 8054.68089   61.31192   84.04580   68.33853   50.64156   82.36963
 [7]   74.20173   99.37548   87.28726   97.00336
> rowSd(tmp5)
 [1] 89.747874  7.830193  9.167650  8.266712  7.116288  9.075772  8.614043
 [8]  9.968725  9.342765  9.849028
> rowMax(tmp5)
 [1] 471.29613  83.54028  95.79300  85.54080  83.90409  96.21977  88.83489
 [8]  88.83148        NA  85.15135
> rowMin(tmp5)
 [1] 59.66937 55.12079 54.15740 56.11086 58.22033 60.96193 56.65457 55.12553
 [9]       NA 55.01011
> 
> colMeans(tmp5)
 [1]       NA 70.31149 74.17193 74.94715 70.92310 73.01890 68.44101 73.20078
 [9] 67.16549 72.63331 67.37017 74.59297 72.68648 71.54456 74.64485 72.18761
[17] 72.18366 70.32663 66.86326 77.59303
> colSums(tmp5)
 [1]       NA 703.1149 741.7193 749.4715 709.2310 730.1890 684.4101 732.0078
 [9] 671.6549 726.3331 673.7017 745.9297 726.8648 715.4456 746.4485 721.8761
[17] 721.8366 703.2663 668.6326 775.9303
> colVars(tmp5)
 [1]        NA 130.20007  35.48614  73.95074  87.76056 143.82894  35.94308
 [8]  46.52419 104.84605  98.60792  66.76143  49.65431  87.53740 137.65270
[15]  47.14693  56.01250  72.93286  70.84152  26.70828  39.97552
> colSd(tmp5)
 [1]        NA 11.410525  5.957024  8.599462  9.368061 11.992870  5.995255
 [8]  6.820865 10.239436  9.930152  8.170767  7.046581  9.356142 11.732549
[15]  6.866362  7.484150  8.540074  8.416740  5.168006  6.322620
> colMax(tmp5)
 [1]       NA 83.90409 85.15135 88.86604 88.83489 95.79300 76.88676 82.78426
 [9] 86.36805 84.72372 80.01836 87.46626 88.83148 96.21977 83.42591 85.54080
[17] 81.09220 81.69004 73.81076 84.21556
> colMin(tmp5)
 [1]       NA 56.65457 64.57280 58.62541 58.22033 59.89799 59.06671 62.13282
 [9] 56.11086 55.12079 55.01011 64.82640 57.92195 55.12553 64.97160 60.22835
[17] 54.15740 57.03523 56.63642 66.25131
> 
> Max(tmp5,na.rm=TRUE)
[1] 471.2961
> Min(tmp5,na.rm=TRUE)
[1] 54.1574
> mean(tmp5,na.rm=TRUE)
[1] 73.73063
> Sum(tmp5,na.rm=TRUE)
[1] 14672.39
> Var(tmp5,na.rm=TRUE)
[1] 876.5917
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.17288 72.62845 72.34352 71.65155 69.98639 75.50828 72.15646 70.25482
 [9] 71.13121 70.34273
> rowSums(tmp5,na.rm=TRUE)
 [1] 1823.458 1452.569 1446.870 1433.031 1399.728 1510.166 1443.129 1405.096
 [9] 1351.493 1406.855
> rowVars(tmp5,na.rm=TRUE)
 [1] 8054.68089   61.31192   84.04580   68.33853   50.64156   82.36963
 [7]   74.20173   99.37548   87.28726   97.00336
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.747874  7.830193  9.167650  8.266712  7.116288  9.075772  8.614043
 [8]  9.968725  9.342765  9.849028
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.29613  83.54028  95.79300  85.54080  83.90409  96.21977  88.83489
 [8]  88.83148  88.86604  85.15135
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.66937 55.12079 54.15740 56.11086 58.22033 60.96193 56.65457 55.12553
 [9] 56.63642 55.01011
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 113.81452  70.31149  74.17193  74.94715  70.92310  73.01890  68.44101
 [8]  73.20078  67.16549  72.63331  67.37017  74.59297  72.68648  71.54456
[15]  74.64485  72.18761  72.18366  70.32663  66.86326  77.59303
> colSums(tmp5,na.rm=TRUE)
 [1] 1024.3307  703.1149  741.7193  749.4715  709.2310  730.1890  684.4101
 [8]  732.0078  671.6549  726.3331  673.7017  745.9297  726.8648  715.4456
[15]  746.4485  721.8761  721.8366  703.2663  668.6326  775.9303
> colVars(tmp5,na.rm=TRUE)
 [1] 18023.33900   130.20007    35.48614    73.95074    87.76056   143.82894
 [7]    35.94308    46.52419   104.84605    98.60792    66.76143    49.65431
[13]    87.53740   137.65270    47.14693    56.01250    72.93286    70.84152
[19]    26.70828    39.97552
> colSd(tmp5,na.rm=TRUE)
 [1] 134.251030  11.410525   5.957024   8.599462   9.368061  11.992870
 [7]   5.995255   6.820865  10.239436   9.930152   8.170767   7.046581
[13]   9.356142  11.732549   6.866362   7.484150   8.540074   8.416740
[19]   5.168006   6.322620
> colMax(tmp5,na.rm=TRUE)
 [1] 471.29613  83.90409  85.15135  88.86604  88.83489  95.79300  76.88676
 [8]  82.78426  86.36805  84.72372  80.01836  87.46626  88.83148  96.21977
[15]  83.42591  85.54080  81.09220  81.69004  73.81076  84.21556
> colMin(tmp5,na.rm=TRUE)
 [1] 60.52464 56.65457 64.57280 58.62541 58.22033 59.89799 59.06671 62.13282
 [9] 56.11086 55.12079 55.01011 64.82640 57.92195 55.12553 64.97160 60.22835
[17] 54.15740 57.03523 56.63642 66.25131
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 91.17288 72.62845 72.34352 71.65155 69.98639 75.50828 72.15646 70.25482
 [9]      NaN 70.34273
> rowSums(tmp5,na.rm=TRUE)
 [1] 1823.458 1452.569 1446.870 1433.031 1399.728 1510.166 1443.129 1405.096
 [9]    0.000 1406.855
> rowVars(tmp5,na.rm=TRUE)
 [1] 8054.68089   61.31192   84.04580   68.33853   50.64156   82.36963
 [7]   74.20173   99.37548         NA   97.00336
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.747874  7.830193  9.167650  8.266712  7.116288  9.075772  8.614043
 [8]  9.968725        NA  9.849028
> rowMax(tmp5,na.rm=TRUE)
 [1] 471.29613  83.54028  95.79300  85.54080  83.90409  96.21977  88.83489
 [8]  88.83148        NA  85.15135
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.66937 55.12079 54.15740 56.11086 58.22033 60.96193 56.65457 55.12553
 [9]       NA 55.01011
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1]      NaN 68.87966 74.81245 73.40061 70.00920 72.54040 68.77884 72.53545
 [9] 66.94946 74.35208 66.64086 74.10043 73.79113 72.78699 75.71966 72.70731
[17] 72.88416 70.46766 67.99957 76.92972
> colSums(tmp5,na.rm=TRUE)
 [1]   0.0000 619.9170 673.3121 660.6055 630.0828 652.8636 619.0095 652.8191
 [9] 602.5451 669.1688 599.7678 666.9039 664.1202 655.0829 681.4769 654.3658
[17] 655.9575 634.2089 611.9962 692.3675
> colVars(tmp5,na.rm=TRUE)
 [1]        NA 123.41124  35.30635  56.28689  89.33446 159.23176  39.15200
 [8]  47.35969 117.42675  77.69926  69.12293  53.13184  84.75180 137.49351
[15]  40.04420  59.97553  76.52908  79.47295  15.52067  40.02270
> colSd(tmp5,na.rm=TRUE)
 [1]        NA 11.109061  5.941915  7.502459  9.451691 12.618707  6.257156
 [8]  6.881838 10.836363  8.814719  8.314020  7.289159  9.206074 11.725763
[15]  6.328049  7.744387  8.748090  8.914760  3.939629  6.326350
> colMax(tmp5,na.rm=TRUE)
 [1]     -Inf 83.90409 85.15135 83.22370 88.83489 95.79300 76.88676 82.78426
 [9] 86.36805 84.72372 80.01836 87.46626 88.83148 96.21977 83.42591 85.54080
[17] 81.09220 81.69004 73.81076 84.21556
> colMin(tmp5,na.rm=TRUE)
 [1]      Inf 56.65457 64.57280 58.62541 58.22033 59.89799 59.06671 62.13282
 [9] 56.11086 55.12079 55.01011 64.82640 57.92195 55.12553 65.57305 60.22835
[17] 54.15740 57.03523 61.33475 66.25131
> 
> 
> 
> 
> 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] 269.1779 261.2229 232.7866 210.7301 159.9585 105.6149 281.9532 261.2307
 [9] 175.8565 306.6314
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 269.1779 261.2229 232.7866 210.7301 159.9585 105.6149 281.9532 261.2307
 [9] 175.8565 306.6314
> 
> 
> 
> 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]  5.684342e-14  1.136868e-13  2.842171e-14 -5.684342e-14 -5.684342e-14
 [6]  2.273737e-13 -5.684342e-14  2.842171e-14  1.705303e-13  0.000000e+00
[11]  1.705303e-13 -1.136868e-13  8.526513e-14 -2.842171e-13  0.000000e+00
[16] -8.526513e-14  2.842171e-14 -5.684342e-14  5.684342e-14  5.684342e-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)
+ }
3   4 
7   7 
6   5 
3   1 
3   7 
9   2 
4   12 
2   8 
8   20 
4   16 
2   4 
7   10 
1   11 
5   20 
2   2 
4   4 
4   10 
8   12 
2   17 
6   4 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.585272
> Min(tmp)
[1] -2.68376
> mean(tmp)
[1] 0.03677457
> Sum(tmp)
[1] 3.677457
> Var(tmp)
[1] 1.074903
> 
> rowMeans(tmp)
[1] 0.03677457
> rowSums(tmp)
[1] 3.677457
> rowVars(tmp)
[1] 1.074903
> rowSd(tmp)
[1] 1.036775
> rowMax(tmp)
[1] 2.585272
> rowMin(tmp)
[1] -2.68376
> 
> colMeans(tmp)
  [1]  0.74694288  0.12792837 -1.85004571  0.29466645  0.49420056 -0.80021140
  [7] -0.86134128 -0.74171523  0.59049705 -0.34618948  0.56698225  0.63181542
 [13] -0.68424939 -0.86608344  0.22821652 -0.13056228 -1.30803261  0.68123350
 [19] -0.23421611  2.42406338  0.07210581 -1.77616153 -2.68376003 -1.29323173
 [25]  0.53054527  0.63143955  0.71908210 -0.56116967 -0.52824671 -1.10174020
 [31]  0.40485440  0.36658319  0.68667316  1.58413995 -1.26569734 -0.16407248
 [37]  1.14602635 -0.32726243 -1.30688394  1.23171215  2.28726420  1.03526230
 [43]  0.45897957  1.54886644 -0.11454566  1.94682135  1.57071964  0.42913340
 [49]  0.69348618  2.22472622  2.31732588 -0.95883257  0.23666413  0.37834184
 [55]  2.58527241  1.04923578  0.13570285  1.33447872 -1.28174117 -0.09017893
 [61]  0.88446551 -0.91351612 -0.76783465 -0.09751510  0.40043521  0.56404886
 [67] -0.13773026 -0.37645899  0.60004452 -0.36192640 -0.82494438 -1.79045472
 [73]  0.15500714  0.39348610  0.97079597 -0.25293939 -1.82975976  0.20701668
 [79] -1.36972965  0.05465955 -0.23498641 -0.49679210  0.65151829  0.44244662
 [85] -1.05993779 -0.27844724 -0.88948539 -1.85151906  0.75631953  0.76389356
 [91] -1.34474350 -1.53965557  0.03033929  0.05101468  0.28250171  0.73370680
 [97] -0.39190249  0.04590855 -0.66915984  0.05346890
> colSums(tmp)
  [1]  0.74694288  0.12792837 -1.85004571  0.29466645  0.49420056 -0.80021140
  [7] -0.86134128 -0.74171523  0.59049705 -0.34618948  0.56698225  0.63181542
 [13] -0.68424939 -0.86608344  0.22821652 -0.13056228 -1.30803261  0.68123350
 [19] -0.23421611  2.42406338  0.07210581 -1.77616153 -2.68376003 -1.29323173
 [25]  0.53054527  0.63143955  0.71908210 -0.56116967 -0.52824671 -1.10174020
 [31]  0.40485440  0.36658319  0.68667316  1.58413995 -1.26569734 -0.16407248
 [37]  1.14602635 -0.32726243 -1.30688394  1.23171215  2.28726420  1.03526230
 [43]  0.45897957  1.54886644 -0.11454566  1.94682135  1.57071964  0.42913340
 [49]  0.69348618  2.22472622  2.31732588 -0.95883257  0.23666413  0.37834184
 [55]  2.58527241  1.04923578  0.13570285  1.33447872 -1.28174117 -0.09017893
 [61]  0.88446551 -0.91351612 -0.76783465 -0.09751510  0.40043521  0.56404886
 [67] -0.13773026 -0.37645899  0.60004452 -0.36192640 -0.82494438 -1.79045472
 [73]  0.15500714  0.39348610  0.97079597 -0.25293939 -1.82975976  0.20701668
 [79] -1.36972965  0.05465955 -0.23498641 -0.49679210  0.65151829  0.44244662
 [85] -1.05993779 -0.27844724 -0.88948539 -1.85151906  0.75631953  0.76389356
 [91] -1.34474350 -1.53965557  0.03033929  0.05101468  0.28250171  0.73370680
 [97] -0.39190249  0.04590855 -0.66915984  0.05346890
> colVars(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colSd(tmp)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> colMax(tmp)
  [1]  0.74694288  0.12792837 -1.85004571  0.29466645  0.49420056 -0.80021140
  [7] -0.86134128 -0.74171523  0.59049705 -0.34618948  0.56698225  0.63181542
 [13] -0.68424939 -0.86608344  0.22821652 -0.13056228 -1.30803261  0.68123350
 [19] -0.23421611  2.42406338  0.07210581 -1.77616153 -2.68376003 -1.29323173
 [25]  0.53054527  0.63143955  0.71908210 -0.56116967 -0.52824671 -1.10174020
 [31]  0.40485440  0.36658319  0.68667316  1.58413995 -1.26569734 -0.16407248
 [37]  1.14602635 -0.32726243 -1.30688394  1.23171215  2.28726420  1.03526230
 [43]  0.45897957  1.54886644 -0.11454566  1.94682135  1.57071964  0.42913340
 [49]  0.69348618  2.22472622  2.31732588 -0.95883257  0.23666413  0.37834184
 [55]  2.58527241  1.04923578  0.13570285  1.33447872 -1.28174117 -0.09017893
 [61]  0.88446551 -0.91351612 -0.76783465 -0.09751510  0.40043521  0.56404886
 [67] -0.13773026 -0.37645899  0.60004452 -0.36192640 -0.82494438 -1.79045472
 [73]  0.15500714  0.39348610  0.97079597 -0.25293939 -1.82975976  0.20701668
 [79] -1.36972965  0.05465955 -0.23498641 -0.49679210  0.65151829  0.44244662
 [85] -1.05993779 -0.27844724 -0.88948539 -1.85151906  0.75631953  0.76389356
 [91] -1.34474350 -1.53965557  0.03033929  0.05101468  0.28250171  0.73370680
 [97] -0.39190249  0.04590855 -0.66915984  0.05346890
> colMin(tmp)
  [1]  0.74694288  0.12792837 -1.85004571  0.29466645  0.49420056 -0.80021140
  [7] -0.86134128 -0.74171523  0.59049705 -0.34618948  0.56698225  0.63181542
 [13] -0.68424939 -0.86608344  0.22821652 -0.13056228 -1.30803261  0.68123350
 [19] -0.23421611  2.42406338  0.07210581 -1.77616153 -2.68376003 -1.29323173
 [25]  0.53054527  0.63143955  0.71908210 -0.56116967 -0.52824671 -1.10174020
 [31]  0.40485440  0.36658319  0.68667316  1.58413995 -1.26569734 -0.16407248
 [37]  1.14602635 -0.32726243 -1.30688394  1.23171215  2.28726420  1.03526230
 [43]  0.45897957  1.54886644 -0.11454566  1.94682135  1.57071964  0.42913340
 [49]  0.69348618  2.22472622  2.31732588 -0.95883257  0.23666413  0.37834184
 [55]  2.58527241  1.04923578  0.13570285  1.33447872 -1.28174117 -0.09017893
 [61]  0.88446551 -0.91351612 -0.76783465 -0.09751510  0.40043521  0.56404886
 [67] -0.13773026 -0.37645899  0.60004452 -0.36192640 -0.82494438 -1.79045472
 [73]  0.15500714  0.39348610  0.97079597 -0.25293939 -1.82975976  0.20701668
 [79] -1.36972965  0.05465955 -0.23498641 -0.49679210  0.65151829  0.44244662
 [85] -1.05993779 -0.27844724 -0.88948539 -1.85151906  0.75631953  0.76389356
 [91] -1.34474350 -1.53965557  0.03033929  0.05101468  0.28250171  0.73370680
 [97] -0.39190249  0.04590855 -0.66915984  0.05346890
> colMedians(tmp)
  [1]  0.74694288  0.12792837 -1.85004571  0.29466645  0.49420056 -0.80021140
  [7] -0.86134128 -0.74171523  0.59049705 -0.34618948  0.56698225  0.63181542
 [13] -0.68424939 -0.86608344  0.22821652 -0.13056228 -1.30803261  0.68123350
 [19] -0.23421611  2.42406338  0.07210581 -1.77616153 -2.68376003 -1.29323173
 [25]  0.53054527  0.63143955  0.71908210 -0.56116967 -0.52824671 -1.10174020
 [31]  0.40485440  0.36658319  0.68667316  1.58413995 -1.26569734 -0.16407248
 [37]  1.14602635 -0.32726243 -1.30688394  1.23171215  2.28726420  1.03526230
 [43]  0.45897957  1.54886644 -0.11454566  1.94682135  1.57071964  0.42913340
 [49]  0.69348618  2.22472622  2.31732588 -0.95883257  0.23666413  0.37834184
 [55]  2.58527241  1.04923578  0.13570285  1.33447872 -1.28174117 -0.09017893
 [61]  0.88446551 -0.91351612 -0.76783465 -0.09751510  0.40043521  0.56404886
 [67] -0.13773026 -0.37645899  0.60004452 -0.36192640 -0.82494438 -1.79045472
 [73]  0.15500714  0.39348610  0.97079597 -0.25293939 -1.82975976  0.20701668
 [79] -1.36972965  0.05465955 -0.23498641 -0.49679210  0.65151829  0.44244662
 [85] -1.05993779 -0.27844724 -0.88948539 -1.85151906  0.75631953  0.76389356
 [91] -1.34474350 -1.53965557  0.03033929  0.05101468  0.28250171  0.73370680
 [97] -0.39190249  0.04590855 -0.66915984  0.05346890
> colRanges(tmp)
          [,1]      [,2]      [,3]      [,4]      [,5]       [,6]       [,7]
[1,] 0.7469429 0.1279284 -1.850046 0.2946664 0.4942006 -0.8002114 -0.8613413
[2,] 0.7469429 0.1279284 -1.850046 0.2946664 0.4942006 -0.8002114 -0.8613413
           [,8]     [,9]      [,10]     [,11]     [,12]      [,13]      [,14]
[1,] -0.7417152 0.590497 -0.3461895 0.5669822 0.6318154 -0.6842494 -0.8660834
[2,] -0.7417152 0.590497 -0.3461895 0.5669822 0.6318154 -0.6842494 -0.8660834
         [,15]      [,16]     [,17]     [,18]      [,19]    [,20]      [,21]
[1,] 0.2282165 -0.1305623 -1.308033 0.6812335 -0.2342161 2.424063 0.07210581
[2,] 0.2282165 -0.1305623 -1.308033 0.6812335 -0.2342161 2.424063 0.07210581
         [,22]    [,23]     [,24]     [,25]     [,26]     [,27]      [,28]
[1,] -1.776162 -2.68376 -1.293232 0.5305453 0.6314395 0.7190821 -0.5611697
[2,] -1.776162 -2.68376 -1.293232 0.5305453 0.6314395 0.7190821 -0.5611697
          [,29]    [,30]     [,31]     [,32]     [,33]   [,34]     [,35]
[1,] -0.5282467 -1.10174 0.4048544 0.3665832 0.6866732 1.58414 -1.265697
[2,] -0.5282467 -1.10174 0.4048544 0.3665832 0.6866732 1.58414 -1.265697
          [,36]    [,37]      [,38]     [,39]    [,40]    [,41]    [,42]
[1,] -0.1640725 1.146026 -0.3272624 -1.306884 1.231712 2.287264 1.035262
[2,] -0.1640725 1.146026 -0.3272624 -1.306884 1.231712 2.287264 1.035262
         [,43]    [,44]      [,45]    [,46]   [,47]     [,48]     [,49]
[1,] 0.4589796 1.548866 -0.1145457 1.946821 1.57072 0.4291334 0.6934862
[2,] 0.4589796 1.548866 -0.1145457 1.946821 1.57072 0.4291334 0.6934862
        [,50]    [,51]      [,52]     [,53]     [,54]    [,55]    [,56]
[1,] 2.224726 2.317326 -0.9588326 0.2366641 0.3783418 2.585272 1.049236
[2,] 2.224726 2.317326 -0.9588326 0.2366641 0.3783418 2.585272 1.049236
         [,57]    [,58]     [,59]       [,60]     [,61]      [,62]      [,63]
[1,] 0.1357029 1.334479 -1.281741 -0.09017893 0.8844655 -0.9135161 -0.7678346
[2,] 0.1357029 1.334479 -1.281741 -0.09017893 0.8844655 -0.9135161 -0.7678346
          [,64]     [,65]     [,66]      [,67]     [,68]     [,69]      [,70]
[1,] -0.0975151 0.4004352 0.5640489 -0.1377303 -0.376459 0.6000445 -0.3619264
[2,] -0.0975151 0.4004352 0.5640489 -0.1377303 -0.376459 0.6000445 -0.3619264
          [,71]     [,72]     [,73]     [,74]    [,75]      [,76]    [,77]
[1,] -0.8249444 -1.790455 0.1550071 0.3934861 0.970796 -0.2529394 -1.82976
[2,] -0.8249444 -1.790455 0.1550071 0.3934861 0.970796 -0.2529394 -1.82976
         [,78]    [,79]      [,80]      [,81]      [,82]     [,83]     [,84]
[1,] 0.2070167 -1.36973 0.05465955 -0.2349864 -0.4967921 0.6515183 0.4424466
[2,] 0.2070167 -1.36973 0.05465955 -0.2349864 -0.4967921 0.6515183 0.4424466
         [,85]      [,86]      [,87]     [,88]     [,89]     [,90]     [,91]
[1,] -1.059938 -0.2784472 -0.8894854 -1.851519 0.7563195 0.7638936 -1.344743
[2,] -1.059938 -0.2784472 -0.8894854 -1.851519 0.7563195 0.7638936 -1.344743
         [,92]      [,93]      [,94]     [,95]     [,96]      [,97]      [,98]
[1,] -1.539656 0.03033929 0.05101468 0.2825017 0.7337068 -0.3919025 0.04590855
[2,] -1.539656 0.03033929 0.05101468 0.2825017 0.7337068 -0.3919025 0.04590855
          [,99]    [,100]
[1,] -0.6691598 0.0534689
[2,] -0.6691598 0.0534689
> 
> 
> Max(tmp2)
[1] 2.613942
> Min(tmp2)
[1] -3.848431
> mean(tmp2)
[1] -0.01567602
> Sum(tmp2)
[1] -1.567602
> Var(tmp2)
[1] 1.311523
> 
> rowMeans(tmp2)
  [1] -0.91502226 -0.03001196  0.45614186  0.31917191 -0.64953829  2.28053187
  [7]  0.38222314  0.62337789 -0.50675261  2.48822576 -0.58176410 -1.26544650
 [13]  0.64954861  0.69755531 -0.49322073  0.86803449 -0.84332845 -1.85270548
 [19]  0.87867920  0.22467369 -0.42198449  0.03519238  0.27832951  0.78536396
 [25]  0.69195883 -0.62475208 -0.11283657  1.21825916 -0.99919944  0.82004522
 [31] -0.27311866 -0.40462121  0.88418209  0.16206469 -1.08208201  2.26103900
 [37] -0.82284377  0.41775289  1.43341400  0.01659056 -0.84255084  2.36311707
 [43]  0.83051360 -1.08484977 -0.48358650 -0.91463612 -0.84526521  0.80206529
 [49]  0.34104732  0.58990807 -0.03578166 -1.41746130 -0.57929621  1.67109450
 [55]  0.08817360 -1.29883091 -1.68211144  2.61394179  0.20010774 -0.63598081
 [61] -1.27927744 -0.47544843 -0.56534608 -0.45954479  0.14173584 -1.02106119
 [67] -0.14987312 -1.39504588 -0.82123093 -0.51444922 -3.84843115 -0.35279693
 [73]  2.07149875 -0.96144348  1.20831828 -1.59815026  0.46311475  1.29353652
 [79]  1.17827853  1.03298676 -0.27455926 -0.68848708 -1.29431908 -0.26921591
 [85]  1.46242408 -0.03333340  2.04361511 -0.87001014 -2.03322474  0.52065630
 [91] -0.19259341 -2.74524898 -0.25001956 -0.35734895  0.90666706 -0.06107430
 [97]  2.03103430 -0.81557491  1.33224299 -0.59934823
> rowSums(tmp2)
  [1] -0.91502226 -0.03001196  0.45614186  0.31917191 -0.64953829  2.28053187
  [7]  0.38222314  0.62337789 -0.50675261  2.48822576 -0.58176410 -1.26544650
 [13]  0.64954861  0.69755531 -0.49322073  0.86803449 -0.84332845 -1.85270548
 [19]  0.87867920  0.22467369 -0.42198449  0.03519238  0.27832951  0.78536396
 [25]  0.69195883 -0.62475208 -0.11283657  1.21825916 -0.99919944  0.82004522
 [31] -0.27311866 -0.40462121  0.88418209  0.16206469 -1.08208201  2.26103900
 [37] -0.82284377  0.41775289  1.43341400  0.01659056 -0.84255084  2.36311707
 [43]  0.83051360 -1.08484977 -0.48358650 -0.91463612 -0.84526521  0.80206529
 [49]  0.34104732  0.58990807 -0.03578166 -1.41746130 -0.57929621  1.67109450
 [55]  0.08817360 -1.29883091 -1.68211144  2.61394179  0.20010774 -0.63598081
 [61] -1.27927744 -0.47544843 -0.56534608 -0.45954479  0.14173584 -1.02106119
 [67] -0.14987312 -1.39504588 -0.82123093 -0.51444922 -3.84843115 -0.35279693
 [73]  2.07149875 -0.96144348  1.20831828 -1.59815026  0.46311475  1.29353652
 [79]  1.17827853  1.03298676 -0.27455926 -0.68848708 -1.29431908 -0.26921591
 [85]  1.46242408 -0.03333340  2.04361511 -0.87001014 -2.03322474  0.52065630
 [91] -0.19259341 -2.74524898 -0.25001956 -0.35734895  0.90666706 -0.06107430
 [97]  2.03103430 -0.81557491  1.33224299 -0.59934823
> rowVars(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowSd(tmp2)
  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> rowMax(tmp2)
  [1] -0.91502226 -0.03001196  0.45614186  0.31917191 -0.64953829  2.28053187
  [7]  0.38222314  0.62337789 -0.50675261  2.48822576 -0.58176410 -1.26544650
 [13]  0.64954861  0.69755531 -0.49322073  0.86803449 -0.84332845 -1.85270548
 [19]  0.87867920  0.22467369 -0.42198449  0.03519238  0.27832951  0.78536396
 [25]  0.69195883 -0.62475208 -0.11283657  1.21825916 -0.99919944  0.82004522
 [31] -0.27311866 -0.40462121  0.88418209  0.16206469 -1.08208201  2.26103900
 [37] -0.82284377  0.41775289  1.43341400  0.01659056 -0.84255084  2.36311707
 [43]  0.83051360 -1.08484977 -0.48358650 -0.91463612 -0.84526521  0.80206529
 [49]  0.34104732  0.58990807 -0.03578166 -1.41746130 -0.57929621  1.67109450
 [55]  0.08817360 -1.29883091 -1.68211144  2.61394179  0.20010774 -0.63598081
 [61] -1.27927744 -0.47544843 -0.56534608 -0.45954479  0.14173584 -1.02106119
 [67] -0.14987312 -1.39504588 -0.82123093 -0.51444922 -3.84843115 -0.35279693
 [73]  2.07149875 -0.96144348  1.20831828 -1.59815026  0.46311475  1.29353652
 [79]  1.17827853  1.03298676 -0.27455926 -0.68848708 -1.29431908 -0.26921591
 [85]  1.46242408 -0.03333340  2.04361511 -0.87001014 -2.03322474  0.52065630
 [91] -0.19259341 -2.74524898 -0.25001956 -0.35734895  0.90666706 -0.06107430
 [97]  2.03103430 -0.81557491  1.33224299 -0.59934823
> rowMin(tmp2)
  [1] -0.91502226 -0.03001196  0.45614186  0.31917191 -0.64953829  2.28053187
  [7]  0.38222314  0.62337789 -0.50675261  2.48822576 -0.58176410 -1.26544650
 [13]  0.64954861  0.69755531 -0.49322073  0.86803449 -0.84332845 -1.85270548
 [19]  0.87867920  0.22467369 -0.42198449  0.03519238  0.27832951  0.78536396
 [25]  0.69195883 -0.62475208 -0.11283657  1.21825916 -0.99919944  0.82004522
 [31] -0.27311866 -0.40462121  0.88418209  0.16206469 -1.08208201  2.26103900
 [37] -0.82284377  0.41775289  1.43341400  0.01659056 -0.84255084  2.36311707
 [43]  0.83051360 -1.08484977 -0.48358650 -0.91463612 -0.84526521  0.80206529
 [49]  0.34104732  0.58990807 -0.03578166 -1.41746130 -0.57929621  1.67109450
 [55]  0.08817360 -1.29883091 -1.68211144  2.61394179  0.20010774 -0.63598081
 [61] -1.27927744 -0.47544843 -0.56534608 -0.45954479  0.14173584 -1.02106119
 [67] -0.14987312 -1.39504588 -0.82123093 -0.51444922 -3.84843115 -0.35279693
 [73]  2.07149875 -0.96144348  1.20831828 -1.59815026  0.46311475  1.29353652
 [79]  1.17827853  1.03298676 -0.27455926 -0.68848708 -1.29431908 -0.26921591
 [85]  1.46242408 -0.03333340  2.04361511 -0.87001014 -2.03322474  0.52065630
 [91] -0.19259341 -2.74524898 -0.25001956 -0.35734895  0.90666706 -0.06107430
 [97]  2.03103430 -0.81557491  1.33224299 -0.59934823
> 
> colMeans(tmp2)
[1] -0.01567602
> colSums(tmp2)
[1] -1.567602
> colVars(tmp2)
[1] 1.311523
> colSd(tmp2)
[1] 1.145217
> colMax(tmp2)
[1] 2.613942
> colMin(tmp2)
[1] -3.848431
> colMedians(tmp2)
[1] -0.1313548
> colRanges(tmp2)
          [,1]
[1,] -3.848431
[2,]  2.613942
> 
> 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]  4.071480 -3.445937  2.435886 -1.882807 -3.920308  4.100237 -4.662032
 [8] -2.530497  3.893324 -4.470531
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.5325179
[2,]  0.2725714
[3,]  0.4615994
[4,]  1.1007106
[5,]  1.6529448
> 
> rowApply(tmp,sum)
 [1] -5.1963495 -5.0906993  0.2357093  2.7110370 -0.8558906 -3.3407838
 [7]  1.0921070  4.2359964  0.3048559 -0.5071660
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   10    4    6    7    9    1    5    9    9     8
 [2,]    8    9    3    2    5    6    8    2    2     2
 [3,]    3   10    9    4   10    2    3    6    8     9
 [4,]    1    1    4   10    2    9    4    7    6    10
 [5,]    9    6    8    6    4    4    2    1    4     7
 [6,]    5    3   10    1    6   10   10    4    7     5
 [7,]    7    5    5    3    3    5    9    3    3     3
 [8,]    2    8    1    9    7    8    1   10    1     1
 [9,]    4    7    7    5    8    7    7    8   10     4
[10,]    6    2    2    8    1    3    6    5    5     6
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.42813495  0.65118604  0.41077406 -1.45972742 -1.65818909 -0.96410359
 [7]  0.04335162 -3.87706095  2.71171726 -4.25863277 -1.96809526 -0.46838655
[13]  0.51341295  1.62022497  1.27643769 -3.44165999  0.45410906 -0.84050140
[19] -0.07065382 -0.69741842
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.2533145
[2,]  0.2524278
[3,]  0.3443354
[4,]  0.4397997
[5,]  2.6448866
> 
> rowApply(tmp,sum)
[1] -1.555596 -1.294340 -4.109949 -3.185381  1.550186
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    7   15   14   12   20
[2,]   12    8   10   11   18
[3,]   14    5   15   10   13
[4,]    1   10   20    7    9
[5,]    9    6    6    5   17
> 
> 
> as.matrix(tmp)
           [,1]       [,2]         [,3]         [,4]        [,5]       [,6]
[1,] -0.2533145  0.3409891  0.431195818 -2.060741405  0.04597634  1.2757872
[2,]  0.4397997 -0.5187207 -0.751619544 -0.193158989 -0.66713733 -1.4989478
[3,]  0.3443354 -0.1905622  0.512943838  1.241155137 -0.85927598 -0.8506039
[4,]  0.2524278  0.1833908  0.005647231 -0.456245005 -0.90375682  0.4648706
[5,]  2.6448866  0.8360890  0.212606716  0.009262838  0.72600470 -0.3552097
           [,7]       [,8]       [,9]       [,10]      [,11]       [,12]
[1,]  0.4818841 -0.5314785  0.4000470 -1.23616649  0.7934007  0.52422852
[2,] -1.1517841  0.2632323  1.1924877 -0.05445442 -1.1407176  0.25770480
[3,] -0.2366103 -1.2769396  1.2192831 -1.85023430  0.1300201 -0.05742915
[4,]  0.7423761 -1.3418677 -0.2265983  0.83333348 -1.4724950 -1.13271229
[5,]  0.2074860 -0.9900075  0.1264978 -1.95111104 -0.2783035 -0.06017843
           [,13]      [,14]      [,15]     [,16]      [,17]      [,18]
[1,]  0.08328211  1.0776302 -0.1508229 -1.063882 -1.8086768 -0.7521469
[2,]  1.14846106 -0.2256762  1.0894845  1.485236  1.0069462 -1.4177704
[3,] -0.41759965  0.6297093  0.8502357 -1.879122  0.3038710  1.1233223
[4,] -0.77254451  1.0229587  0.4431592 -2.574970  0.6896629  1.1749087
[5,]  0.47181395 -0.8843971 -0.9556188  0.591077  0.2623058 -0.9688151
           [,19]      [,20]
[1,]  0.52434816  0.3228635
[2,]  0.08848167 -0.6461871
[3,] -1.19211718 -1.6543307
[4,]  0.30577545 -0.4227030
[5,]  0.20285809  1.7029389
> 
> 
> 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.18-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.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  653  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  565  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
          col1       col2      col3      col4      col5       col6       col7
row1 0.2022011 -0.4196283 -1.324452 0.3498053 -1.364433 -0.2944266 -0.7048299
           col8      col9      col10    col11     col12     col13     col14
row1 -0.5807671 0.4699779 -0.6073746 1.440783 0.4469845 -1.245105 0.4451743
          col15     col16     col17     col18    col19      col20
row1 -0.4715913 -0.414503 0.8191132 0.7158271 -1.56449 -0.7232998
> tmp[,"col10"]
          col10
row1 -0.6073746
row2  1.0831920
row3  1.2433615
row4 -0.1866045
row5 -0.8988872
> tmp[c("row1","row5"),]
           col1       col2       col3        col4      col5       col6
row1  0.2022011 -0.4196283 -1.3244523  0.34980531 -1.364433 -0.2944266
row5 -0.3513620 -1.4977072  0.5696384 -0.08776073 -0.986370 -0.7078986
           col7       col8      col9      col10     col11     col12      col13
row1 -0.7048299 -0.5807671 0.4699779 -0.6073746  1.440783 0.4469845 -1.2451050
row5  1.0694519  0.8949380 0.4767037 -0.8988872 -1.049412 0.7735895 -0.7168564
         col14      col15      col16     col17      col18      col19      col20
row1 0.4451743 -0.4715913 -0.4145030 0.8191132  0.7158271 -1.5644902 -0.7232998
row5 0.9746819 -0.3408397  0.4143501 0.3439602 -1.1154677 -0.5711557 -0.1233527
> tmp[,c("col6","col20")]
            col6      col20
row1 -0.29442663 -0.7232998
row2 -0.08443946  0.4117836
row3  0.03355237 -1.4621062
row4  0.13077766 -1.1249480
row5 -0.70789855 -0.1233527
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.2944266 -0.7232998
row5 -0.7078986 -0.1233527
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4    col5     col6     col7     col8
row1 48.61213 49.08014 48.92578 51.30006 50.3668 105.8113 49.24114 51.63337
         col9    col10    col11   col12    col13    col14    col15    col16
row1 50.43288 50.10133 48.51575 52.1938 49.73473 49.75469 48.47719 48.96598
        col17    col18    col19    col20
row1 50.81182 49.23183 48.01069 106.0407
> tmp[,"col10"]
        col10
row1 50.10133
row2 29.26395
row3 30.04106
row4 28.58115
row5 49.11263
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 48.61213 49.08014 48.92578 51.30006 50.36680 105.8113 49.24114 51.63337
row5 50.77562 49.59217 48.14805 49.23771 47.96469 104.5691 50.64966 49.42112
         col9    col10    col11    col12    col13    col14    col15    col16
row1 50.43288 50.10133 48.51575 52.19380 49.73473 49.75469 48.47719 48.96598
row5 50.16321 49.11263 50.87367 48.93847 48.71356 49.43610 51.13095 47.74367
        col17    col18    col19    col20
row1 50.81182 49.23183 48.01069 106.0407
row5 48.90348 49.84012 49.43273 105.1734
> tmp[,c("col6","col20")]
          col6     col20
row1 105.81132 106.04066
row2  74.43400  74.06526
row3  75.20992  74.69365
row4  74.39716  75.29859
row5 104.56906 105.17343
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 105.8113 106.0407
row5 104.5691 105.1734
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 105.8113 106.0407
row5 104.5691 105.1734
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.1800522
[2,] -0.2186256
[3,]  0.5440310
[4,] -0.6821487
[5,] -0.1105329
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.4595354 -0.6500809
[2,] -0.4821285  1.0403028
[3,]  0.5574091 -0.5017378
[4,]  2.2490041  0.5304524
[5,] -1.5121711  0.8945576
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.4362658 -1.3543836
[2,]  0.4424190 -1.0886251
[3,]  1.2810202 -0.3705239
[4,]  1.0264829 -0.2944952
[5,] -0.3155290 -0.3513422
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.4362658
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.4362658
[2,]  0.4424190
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
            [,1]       [,2]       [,3]      [,4]      [,5]       [,6]      [,7]
row3 -0.04457714  0.4685709 -1.5736002 -1.288842 -2.021426 -1.3096970 0.3326192
row1  1.32705347 -0.2998231  0.6955377  1.771939 -0.672991  0.9237379 0.1159478
           [,8]      [,9]      [,10]      [,11]      [,12]     [,13]     [,14]
row3 -1.4576700 0.3552938  0.2422959 -0.5651596  0.5243954 -0.819838 -1.378442
row1 -0.7939491 0.5696302 -0.3403599  0.5189189 -0.1106406  1.769426 -1.785214
         [,15]     [,16]       [,17]     [,18]      [,19]      [,20]
row3 1.4796483 0.3247022 -0.07918246 0.3136651 -0.6863554 -0.6540297
row1 0.7120769 1.4886550 -0.55870225 0.3531343  0.7946035  0.6689959
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
         [,1]     [,2]       [,3]      [,4]      [,5]        [,6]     [,7]
row2 1.061285 2.075106 0.07391984 -1.158325 0.3479419 0.006737646 1.491778
            [,8]     [,9]     [,10]
row2 -0.07145229 1.439818 0.1151776
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]       [,3]       [,4]       [,5]      [,6]     [,7]
row5 -2.046152 -0.5715456 0.06599553 -0.7947081 -0.3504742 0.1150029 1.119786
          [,8]      [,9]      [,10]     [,11]      [,12]    [,13]     [,14]
row5 -1.392461 0.3394127 -0.5409398 -1.740669 -0.5699016 0.851439 -1.390509
          [,15]      [,16]     [,17]      [,18]      [,19]     [,20]
row5 -0.9965105 -0.8419118 0.1316016 -0.5188519 -0.5342277 -1.234782
> 
> 
> 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: 0x1b414ce0>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a658537b0dbf7"
 [2] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a6585f40cd3c" 
 [3] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a658577ee64d2"
 [4] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a658585038ce" 
 [5] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a6585f25f45"  
 [6] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a65856413e71" 
 [7] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a658546098de6"
 [8] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a65857f04995" 
 [9] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a6585159bd6bf"
[10] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a65854ac03271"
[11] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a6585560effd4"
[12] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a658528305d47"
[13] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a658547382c8e"
[14] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a65852b0a26b7"
[15] "/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests/BM1a658537330672"
> 
> 
> ### 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: 0x196683b0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x196683b0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.18-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x196683b0>
> rowMedians(tmp)
  [1]  0.143692474 -0.028179695  0.158159344  0.465150455 -0.339531501
  [6]  0.154257335 -0.059778634 -0.098244365  0.704742745 -0.377432584
 [11] -0.696752322  0.105462258 -0.209977596 -0.017927724 -0.245000806
 [16] -0.225505086 -0.044374546 -0.198273522  0.479297470  0.137373510
 [21] -0.552271583  0.069188529  0.043014690 -0.182588464 -0.160978467
 [26] -0.088510566  0.354422089  0.854593667 -0.215015630  0.006833995
 [31] -0.005632683 -0.067889497  0.148071544  0.263793981 -0.205510597
 [36] -0.527210144 -0.243062929  0.350508981 -0.317024333  0.161058933
 [41]  0.448172448  0.396196389  0.001478867  0.150797990 -0.112581246
 [46]  0.081376900  0.039740762 -0.165499730  0.291843646 -0.529014346
 [51] -0.428526598  0.139115484  0.205770007  0.559339250 -0.516662882
 [56]  0.212119818 -0.030160899 -0.279166188 -0.138326854  0.424815481
 [61] -0.361125470  0.496240261  0.279541799  0.718827915 -0.016341191
 [66]  0.418518274 -0.659175787  0.411289937 -0.141950675 -0.428004790
 [71]  0.098182764 -0.267743205  0.101365101  0.138580938 -0.840992021
 [76] -0.159739860  0.324883104 -0.211038488  0.100968496 -0.117059376
 [81]  0.446964143 -0.293693759  0.046340291  0.188770858  0.581893015
 [86]  0.440136388  0.435838417 -0.216559487 -0.585335842 -0.284926054
 [91] -0.327117051 -0.339517565  0.100939958  0.272758401  0.117596597
 [96] -0.158725927 -0.390303796  0.524071782 -0.115838842 -0.302346364
[101]  0.450057491 -0.575193672 -0.274498666  0.151496087 -0.170084248
[106] -0.271459332  0.040580641  0.219909814  0.012109843  0.159950256
[111] -0.248517029  0.064918864 -0.259125505  0.503327411 -0.439055562
[116]  0.131623292  0.302311531 -0.341661428 -0.110383487 -0.152705962
[121]  0.165883739 -0.171557580  0.431302554  0.028149199  0.204154342
[126] -0.018248684  0.032785587  0.277212507 -0.427812214  0.152174595
[131]  0.147959518 -0.240628877 -0.023416909  0.255464414  0.088565817
[136]  0.228940768  0.099753566 -0.364707485 -0.393066322 -0.279911223
[141]  0.764042300  0.211322216  0.691416533  0.532614590 -0.307491206
[146]  0.086982872  0.084490713  0.142871855 -0.861634100  0.367883337
[151]  0.045556638 -0.728820678  0.067695485  0.206868116 -0.232778821
[156]  0.313909925  0.011974498  0.136665980 -0.077189048 -0.269757168
[161] -0.567929865  0.236608937  0.102733441 -0.157393871 -0.066937899
[166]  0.099194042 -0.166365382 -0.305909432  0.225103857 -0.034918312
[171]  0.621790852 -0.106894342 -0.040212157 -0.058506010  0.036795445
[176] -0.088151116 -0.068696177 -0.128138374  0.233954957 -0.182028007
[181]  0.229879430 -0.074934247 -0.289213628  0.122915824  0.442392353
[186] -0.137950531 -0.439215318  0.349408977 -0.041389980 -0.023204142
[191] -0.064143254  0.115983129  0.194495812 -0.183577511 -0.126471105
[196] -0.123515212  0.304402871  0.244976405 -0.286097347 -0.407685614
[201] -0.948346439 -0.274706802  0.660085879  0.350015384  0.210288484
[206] -0.307929856  0.556755758 -0.549869243 -0.041931554 -0.155681325
[211] -0.193435235 -0.594989076  0.293912961 -0.223870136  0.212110464
[216]  0.375883310  0.366129316  0.221202804  0.188150475  0.340680251
[221] -0.087054239 -0.255627633  0.056111202  0.453589657 -0.092729761
[226] -0.237521809 -0.258746516  0.522336127  0.335419870  0.113162552
> 
> proc.time()
   user  system elapsed 
  1.997   1.044   3.061 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0x35b738f0>
> .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: 0x35b738f0>
> .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: 0x35b738f0>
> .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: 0x35b738f0>
> 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: 0x3662f550>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3662f550>
> .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: 0x3662f550>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3662f550>
> .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: 0x3662f550>
> 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: 0x37625e00>
> .Call("R_bm_AddColumn",P)
<pointer: 0x37625e00>
> .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: 0x37625e00>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x37625e00>
> .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: 0x37625e00>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x37625e00>
> .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: 0x37625e00>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x37625e00>
> .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: 0x37625e00>
> 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: 0x3636c190>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x3636c190>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3636c190>
> .Call("R_bm_AddColumn",P)
<pointer: 0x3636c190>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1a6631446ad562" "BufferedMatrixFile1a663190330e"  
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile1a6631446ad562" "BufferedMatrixFile1a663190330e"  
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x362bd370>
> .Call("R_bm_AddColumn",P)
<pointer: 0x362bd370>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x362bd370>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x362bd370>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x362bd370>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x362bd370>
> .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: 0x35663430>
> .Call("R_bm_AddColumn",P)
<pointer: 0x35663430>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x35663430>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x35663430>
> 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: 0x37e75e60>
> .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: 0x37e75e60>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.337   0.033   0.358 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.346   0.035   0.367 

Example timings