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

This page was generated on 2023-04-12 11:05:27 -0400 (Wed, 12 Apr 2023).

HostnameOSArch (*)R versionInstalled pkgs
nebbiolo2Linux (Ubuntu 20.04.5 LTS)x86_644.2.3 (2023-03-15) -- "Shortstop Beagle" 4502
palomino4Windows Server 2022 Datacenterx644.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle" 4282
lconwaymacOS 12.5.1 Montereyx86_644.2.3 (2023-03-15) -- "Shortstop Beagle" 4310
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 palomino4


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

raw results

Package 232/2183HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.62.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-04-10 14:00:05 -0400 (Mon, 10 Apr 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: RELEASE_3_16
git_last_commit: fce9086
git_last_commit_date: 2022-11-01 10:42:48 -0400 (Tue, 01 Nov 2022)
nebbiolo2Linux (Ubuntu 20.04.5 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version is already published
palomino4Windows Server 2022 Datacenter / x64  OK    OK    OK    OK  UNNEEDED, same version is already published
lconwaymacOS 12.5.1 Monterey / x86_64  OK    OK    WARNINGS    OK  UNNEEDED, same version is already published

Summary

Package: BufferedMatrix
Version: 1.62.0
Command: F:\biocbuild\bbs-3.16-bioc\R\bin\R.exe CMD check --no-multiarch --install=check:BufferedMatrix.install-out.txt --library=F:\biocbuild\bbs-3.16-bioc\R\library --no-vignettes --timings BufferedMatrix_1.62.0.tar.gz
StartedAt: 2023-04-10 23:33:20 -0400 (Mon, 10 Apr 2023)
EndedAt: 2023-04-10 23:35:02 -0400 (Mon, 10 Apr 2023)
EllapsedTime: 101.5 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   F:\biocbuild\bbs-3.16-bioc\R\bin\R.exe CMD check --no-multiarch --install=check:BufferedMatrix.install-out.txt --library=F:\biocbuild\bbs-3.16-bioc\R\library --no-vignettes --timings BufferedMatrix_1.62.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory 'F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck'
* using R version 4.2.3 (2023-03-15 ucrt)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: UTF-8
* using option '--no-vignettes'
* checking for file 'BufferedMatrix/DESCRIPTION' ... OK
* this is package 'BufferedMatrix' version '1.62.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 whether package 'BufferedMatrix' can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking 'build' directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... NOTE
prepare_Rd: createBufferedMatrix.Rd:26: Dropping empty section \keyword
prepare_Rd: createBufferedMatrix.Rd:17-18: Dropping empty section \details
prepare_Rd: createBufferedMatrix.Rd:15-16: Dropping empty section \value
prepare_Rd: createBufferedMatrix.Rd:19-20: Dropping empty section \references
prepare_Rd: createBufferedMatrix.Rd:21-22: Dropping empty section \seealso
prepare_Rd: createBufferedMatrix.Rd:23-24: Dropping empty section \examples
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... NOTE
Note: information on .o files for x64 is not available
File 'F:/biocbuild/bbs-3.16-bioc/R/library/BufferedMatrix/libs/x64/BufferedMatrix.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)

Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console, nor use Fortran I/O
nor system RNGs. The detected symbols are linked into the code but
might come from libraries and not actually be called.

See 'Writing portable packages' in the 'Writing R Extensions' manual.
* checking sizes of PDF files under 'inst/doc' ... OK
* checking files in 'vignettes' ... OK
* checking examples ... NONE
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
  Running 'Rcodetesting.R'
  Running 'c_code_level_tests.R'
  Running 'objectTesting.R'
  Running 'rawCalltesting.R'
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in 'inst/doc' ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 2 NOTEs
See
  'F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/00check.log'
for details.



Installation output

BufferedMatrix.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   F:\biocbuild\bbs-3.16-bioc\R\bin\R.exe CMD INSTALL BufferedMatrix
###
##############################################################################
##############################################################################


* installing to library 'F:/biocbuild/bbs-3.16-bioc/R/library'
* installing *source* package 'BufferedMatrix' ...
** using staged installation
** libs
gcc  -I"F:/biocbuild/bbs-3.16-bioc/R/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc  -I"F:/biocbuild/bbs-3.16-bioc/R/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -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"F:/biocbuild/bbs-3.16-bioc/R/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc  -I"F:/biocbuild/bbs-3.16-bioc/R/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c init_package.c -o init_package.o
gcc -shared -s -static-libgcc -o BufferedMatrix.dll tmp.def RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -LF:/biocbuild/bbs-3.16-bioc/R/bin/x64 -lR
installing to F:/biocbuild/bbs-3.16-bioc/R/library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs/x64
** 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
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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.28    0.26    0.70 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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] "F:/biocbuild/bbs-3.16-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 440029 23.6     946741 50.6   620968 33.2
Vcells 764301  5.9    8388608 64.0  1694585 13.0
> 
> 
> 
> 
> ##
> ## 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] "Mon Apr 10 23:33:47 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] "Mon Apr 10 23:33:47 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: 0x000002b65e719250>
> 
> 
> 
> 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] "Mon Apr 10 23:33:59 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] "Mon Apr 10 23:34:04 2023"
> 
> ColMode(tmp2)
<pointer: 0x000002b65e719250>
> 
> 
> 
> ### 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.65277985  1.24865038  0.1478467 -0.4722071
[2,]   1.05146562 -1.37148942  1.0854372 -1.5186906
[3,]  -0.04246878 -1.25095917  3.0546731 -0.4622302
[4,]   1.42703936  0.09114619 -1.4196224  0.1061665
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.16-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,] 100.65277985 1.24865038 0.1478467 0.4722071
[2,]   1.05146562 1.37148942 1.0854372 1.5186906
[3,]   0.04246878 1.25095917 3.0546731 0.4622302
[4,]   1.42703936 0.09114619 1.4196224 0.1061665
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.16-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,] 10.0325859 1.1174303 0.3845084 0.6871732
[2,]  1.0254100 1.1711061 1.0418432 1.2323516
[3,]  0.2060796 1.1184629 1.7477623 0.6798752
[4,]  1.1945875 0.3019043 1.1914791 0.3258321
> 
> 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:    F:/biocbuild/bbs-3.16-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,] 225.97864 37.42295 28.99293 32.34394
[2,]  36.30557 38.08255 36.50387 38.84221
[3,]  27.10326 37.43559 45.53230 32.26098
[4,]  38.37291 28.11019 38.33441 28.36449
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0x000002b65e719090>
> exp(tmp5)
<pointer: 0x000002b65e719090>
> log(tmp5,2)
<pointer: 0x000002b65e719090>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 470.3449
> Min(tmp5)
[1] 53.29476
> mean(tmp5)
[1] 73.42829
> Sum(tmp5)
[1] 14685.66
> Var(tmp5)
[1] 875.8294
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 90.67320 72.70923 72.39501 69.03914 71.26570 69.57655 70.45355 73.55934
 [9] 74.35543 70.25576
> rowSums(tmp5)
 [1] 1813.464 1454.185 1447.900 1380.783 1425.314 1391.531 1409.071 1471.187
 [9] 1487.109 1405.115
> rowVars(tmp5)
 [1] 8044.19353   63.54388  127.11628   98.96742   83.08290   83.28446
 [7]   99.89692   51.92702   76.49225   68.29810
> rowSd(tmp5)
 [1] 89.689428  7.971442 11.274586  9.948237  9.114982  9.126032  9.994845
 [8]  7.206041  8.745985  8.264267
> rowMax(tmp5)
 [1] 470.34493  91.71127  94.76951  88.78223  89.25954  87.67579  88.92632
 [8]  84.37564  89.91336  84.26712
> rowMin(tmp5)
 [1] 60.34499 59.86397 56.41189 55.66048 54.26619 56.11643 53.29476 54.55008
 [9] 62.24729 54.76839
> 
> colMeans(tmp5)
 [1] 115.96080  73.48210  71.78915  67.95831  70.15903  73.06293  69.88076
 [8]  73.94270  68.28434  70.62668  70.90487  72.07293  77.58314  63.74720
[15]  69.93366  71.46046  72.07728  71.40009  70.04136  74.19802
> colSums(tmp5)
 [1] 1159.6080  734.8210  717.8915  679.5831  701.5903  730.6293  698.8076
 [8]  739.4270  682.8434  706.2668  709.0487  720.7293  775.8314  637.4720
[15]  699.3366  714.6046  720.7728  714.0009  700.4136  741.9802
> colVars(tmp5)
 [1] 15583.47086    61.87640   135.33836    86.04088    46.74019    53.05444
 [7]    51.11996   101.98119   120.81014   112.25854    93.96615    41.56701
[13]    82.58741    29.50827    85.68902    88.09516    84.19554   109.48181
[19]    65.94836    50.85019
> colSd(tmp5)
 [1] 124.833773   7.866155  11.633501   9.275822   6.836680   7.283848
 [7]   7.149822  10.098574  10.991367  10.595213   9.693614   6.447248
[13]   9.087762   5.432152   9.256836   9.385902   9.175813  10.463355
[19]   8.120859   7.130932
> colMax(tmp5)
 [1] 470.34493  84.26712  94.76951  83.32864  81.72277  84.37564  80.86726
 [8]  83.61714  89.02490  89.91336  88.56322  81.55844  91.71127  73.43190
[15]  83.17360  91.04287  88.78223  93.55331  86.31289  85.40859
> colMin(tmp5)
 [1] 56.41189 58.50768 53.29476 54.33123 60.13108 62.14335 59.16625 54.76839
 [9] 54.55008 55.82751 57.35981 59.86430 62.24729 54.26619 56.11643 62.50222
[17] 61.49149 62.88553 61.35417 59.14908
> 
> 
> ### 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.67320 72.70923 72.39501 69.03914 71.26570 69.57655 70.45355       NA
 [9] 74.35543 70.25576
> rowSums(tmp5)
 [1] 1813.464 1454.185 1447.900 1380.783 1425.314 1391.531 1409.071       NA
 [9] 1487.109 1405.115
> rowVars(tmp5)
 [1] 8044.19353   63.54388  127.11628   98.96742   83.08290   83.28446
 [7]   99.89692   49.40636   76.49225   68.29810
> rowSd(tmp5)
 [1] 89.689428  7.971442 11.274586  9.948237  9.114982  9.126032  9.994845
 [8]  7.028966  8.745985  8.264267
> rowMax(tmp5)
 [1] 470.34493  91.71127  94.76951  88.78223  89.25954  87.67579  88.92632
 [8]        NA  89.91336  84.26712
> rowMin(tmp5)
 [1] 60.34499 59.86397 56.41189 55.66048 54.26619 56.11643 53.29476       NA
 [9] 62.24729 54.76839
> 
> colMeans(tmp5)
 [1] 115.96080  73.48210  71.78915  67.95831  70.15903  73.06293  69.88076
 [8]  73.94270  68.28434  70.62668  70.90487  72.07293  77.58314  63.74720
[15]        NA  71.46046  72.07728  71.40009  70.04136  74.19802
> colSums(tmp5)
 [1] 1159.6080  734.8210  717.8915  679.5831  701.5903  730.6293  698.8076
 [8]  739.4270  682.8434  706.2668  709.0487  720.7293  775.8314  637.4720
[15]        NA  714.6046  720.7728  714.0009  700.4136  741.9802
> colVars(tmp5)
 [1] 15583.47086    61.87640   135.33836    86.04088    46.74019    53.05444
 [7]    51.11996   101.98119   120.81014   112.25854    93.96615    41.56701
[13]    82.58741    29.50827          NA    88.09516    84.19554   109.48181
[19]    65.94836    50.85019
> colSd(tmp5)
 [1] 124.833773   7.866155  11.633501   9.275822   6.836680   7.283848
 [7]   7.149822  10.098574  10.991367  10.595213   9.693614   6.447248
[13]   9.087762   5.432152         NA   9.385902   9.175813  10.463355
[19]   8.120859   7.130932
> colMax(tmp5)
 [1] 470.34493  84.26712  94.76951  83.32864  81.72277  84.37564  80.86726
 [8]  83.61714  89.02490  89.91336  88.56322  81.55844  91.71127  73.43190
[15]        NA  91.04287  88.78223  93.55331  86.31289  85.40859
> colMin(tmp5)
 [1] 56.41189 58.50768 53.29476 54.33123 60.13108 62.14335 59.16625 54.76839
 [9] 54.55008 55.82751 57.35981 59.86430 62.24729 54.26619       NA 62.50222
[17] 61.49149 62.88553 61.35417 59.14908
> 
> Max(tmp5,na.rm=TRUE)
[1] 470.3449
> Min(tmp5,na.rm=TRUE)
[1] 53.29476
> mean(tmp5,na.rm=TRUE)
[1] 73.37932
> Sum(tmp5,na.rm=TRUE)
[1] 14602.48
> Var(tmp5,na.rm=TRUE)
[1] 879.7707
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.67320 72.70923 72.39501 69.03914 71.26570 69.57655 70.45355 73.05333
 [9] 74.35543 70.25576
> rowSums(tmp5,na.rm=TRUE)
 [1] 1813.464 1454.185 1447.900 1380.783 1425.314 1391.531 1409.071 1388.013
 [9] 1487.109 1405.115
> rowVars(tmp5,na.rm=TRUE)
 [1] 8044.19353   63.54388  127.11628   98.96742   83.08290   83.28446
 [7]   99.89692   49.40636   76.49225   68.29810
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.689428  7.971442 11.274586  9.948237  9.114982  9.126032  9.994845
 [8]  7.028966  8.745985  8.264267
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.34493  91.71127  94.76951  88.78223  89.25954  87.67579  88.92632
 [8]  84.37564  89.91336  84.26712
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.34499 59.86397 56.41189 55.66048 54.26619 56.11643 53.29476 54.55008
 [9] 62.24729 54.76839
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 115.96080  73.48210  71.78915  67.95831  70.15903  73.06293  69.88076
 [8]  73.94270  68.28434  70.62668  70.90487  72.07293  77.58314  63.74720
[15]  68.46256  71.46046  72.07728  71.40009  70.04136  74.19802
> colSums(tmp5,na.rm=TRUE)
 [1] 1159.6080  734.8210  717.8915  679.5831  701.5903  730.6293  698.8076
 [8]  739.4270  682.8434  706.2668  709.0487  720.7293  775.8314  637.4720
[15]  616.1630  714.6046  720.7728  714.0009  700.4136  741.9802
> colVars(tmp5,na.rm=TRUE)
 [1] 15583.47086    61.87640   135.33836    86.04088    46.74019    53.05444
 [7]    51.11996   101.98119   120.81014   112.25854    93.96615    41.56701
[13]    82.58741    29.50827    72.05349    88.09516    84.19554   109.48181
[19]    65.94836    50.85019
> colSd(tmp5,na.rm=TRUE)
 [1] 124.833773   7.866155  11.633501   9.275822   6.836680   7.283848
 [7]   7.149822  10.098574  10.991367  10.595213   9.693614   6.447248
[13]   9.087762   5.432152   8.488433   9.385902   9.175813  10.463355
[19]   8.120859   7.130932
> colMax(tmp5,na.rm=TRUE)
 [1] 470.34493  84.26712  94.76951  83.32864  81.72277  84.37564  80.86726
 [8]  83.61714  89.02490  89.91336  88.56322  81.55844  91.71127  73.43190
[15]  78.11853  91.04287  88.78223  93.55331  86.31289  85.40859
> colMin(tmp5,na.rm=TRUE)
 [1] 56.41189 58.50768 53.29476 54.33123 60.13108 62.14335 59.16625 54.76839
 [9] 54.55008 55.82751 57.35981 59.86430 62.24729 54.26619 56.11643 62.50222
[17] 61.49149 62.88553 61.35417 59.14908
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1] 90.67320 72.70923 72.39501 69.03914 71.26570 69.57655 70.45355      NaN
 [9] 74.35543 70.25576
> rowSums(tmp5,na.rm=TRUE)
 [1] 1813.464 1454.185 1447.900 1380.783 1425.314 1391.531 1409.071    0.000
 [9] 1487.109 1405.115
> rowVars(tmp5,na.rm=TRUE)
 [1] 8044.19353   63.54388  127.11628   98.96742   83.08290   83.28446
 [7]   99.89692         NA   76.49225   68.29810
> rowSd(tmp5,na.rm=TRUE)
 [1] 89.689428  7.971442 11.274586  9.948237  9.114982  9.126032  9.994845
 [8]        NA  8.745985  8.264267
> rowMax(tmp5,na.rm=TRUE)
 [1] 470.34493  91.71127  94.76951  88.78223  89.25954  87.67579  88.92632
 [8]        NA  89.91336  84.26712
> rowMin(tmp5,na.rm=TRUE)
 [1] 60.34499 59.86397 56.41189 55.66048 54.26619 56.11643 53.29476       NA
 [9] 62.24729 54.76839
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1] 120.12983  73.38032  71.16786  66.25049  70.10994  71.80596  69.50847
 [8]  73.85017  69.81037  70.81803  71.26465  71.01898  78.64269  62.67113
[15]       NaN  71.68330  72.00874  72.23314  69.48481  73.97315
> colSums(tmp5,na.rm=TRUE)
 [1] 1081.1685  660.4229  640.5108  596.2544  630.9894  646.2537  625.5762
 [8]  664.6515  628.2933  637.3622  641.3818  639.1709  707.7842  564.0401
[15]    0.0000  645.1497  648.0787  650.0983  625.3633  665.7583
> colVars(tmp5,na.rm=TRUE)
 [1] 17335.87004    69.49442   147.91315    63.98389    52.55560    41.91162
 [7]    55.95068   114.63251   109.71280   125.87896   104.25570    34.26636
[13]    80.28112    20.16996          NA    98.54842    94.66715   115.35972
[19]    70.70721    56.63755
> colSd(tmp5,na.rm=TRUE)
 [1] 131.665751   8.336331  12.161955   7.998993   7.249524   6.473918
 [7]   7.480019  10.706657  10.474388  11.219579  10.210568   5.853747
[13]   8.959973   4.491098         NA   9.927155   9.729704  10.740564
[19]   8.408758   7.525793
> colMax(tmp5,na.rm=TRUE)
 [1] 470.34493  84.26712  94.76951  80.84496  81.72277  79.74856  80.86726
 [8]  83.61714  89.02490  89.91336  88.56322  77.58731  91.71127  67.39480
[15]      -Inf  91.04287  88.78223  93.55331  86.31289  85.40859
> colMin(tmp5,na.rm=TRUE)
 [1] 56.41189 58.50768 53.29476 54.33123 60.13108 62.14335 59.16625 54.76839
 [9] 55.66048 55.82751 57.35981 59.86430 62.24729 54.26619      Inf 62.50222
[17] 61.49149 62.88553 61.35417 59.14908
> 
> 
> 
> 
> 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] 112.6841 233.1177 173.8788 212.5892 130.2877 332.6040 200.3115 189.9965
 [9] 206.4064 292.1363
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 112.6841 233.1177 173.8788 212.5892 130.2877 332.6040 200.3115 189.9965
 [9] 206.4064 292.1363
> 
> 
> 
> 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-13  5.684342e-14 -1.136868e-13  5.684342e-14  2.842171e-14
 [6]  8.526513e-14  1.136868e-13  1.136868e-13 -8.526513e-14  8.526513e-14
[11] -2.273737e-13  5.684342e-14  1.136868e-13 -1.421085e-13  0.000000e+00
[16] -2.842171e-14  1.136868e-13  2.842171e-14  2.842171e-14 -1.136868e-13
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
3   19 
10   18 
4   10 
6   1 
7   16 
1   7 
9   7 
1   7 
5   20 
2   8 
1   19 
7   5 
9   7 
6   18 
1   14 
6   13 
8   8 
3   9 
9   7 
9   15 
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] 1.553101
> Min(tmp)
[1] -2.519899
> mean(tmp)
[1] -0.1256883
> Sum(tmp)
[1] -12.56883
> Var(tmp)
[1] 0.8747437
> 
> rowMeans(tmp)
[1] -0.1256883
> rowSums(tmp)
[1] -12.56883
> rowVars(tmp)
[1] 0.8747437
> rowSd(tmp)
[1] 0.9352773
> rowMax(tmp)
[1] 1.553101
> rowMin(tmp)
[1] -2.519899
> 
> colMeans(tmp)
  [1]  0.36533150  0.09606835 -1.19993481  0.54513445  1.24953868 -2.22884576
  [7]  0.79047025 -1.54151841  0.74727111  0.23628532 -0.86196602 -0.40401031
 [13]  0.27912996  0.97853767  1.29510530 -1.78367727  0.79566387 -0.33215396
 [19]  0.97252922  1.03916799 -0.42127592  1.00393160 -0.07120814 -1.28999178
 [25] -1.36659710  0.18841876 -1.77962347  1.31339534 -0.62239333 -0.90372563
 [31]  0.22028903 -0.68336023 -1.49808783  0.33951757  0.44506656  0.65517220
 [37]  0.34927434 -0.41294299 -0.26716591  0.08566548  0.14210109  0.25300704
 [43] -1.01690564  0.77798010  0.21705722 -0.90197572  0.67393295 -1.38564720
 [49]  0.22524204 -1.05939230 -0.13462977  1.02731836  0.04855145  0.92250508
 [55] -0.57306508  0.34611075  0.35014905 -1.68645498 -0.38688556 -0.74500720
 [61] -0.71234984  0.22796665 -1.49991918  0.53308607 -0.51864912 -2.51989903
 [67] -1.07809246  0.22172624 -0.41862776  0.13502938 -0.45570094 -1.79707442
 [73] -0.11319502 -0.85161210 -0.27032443  1.21511559  0.16459494  0.30499720
 [79]  0.71130715  1.51775855  1.55310091  1.23614932 -1.26378623 -0.80090286
 [85]  1.07808403 -0.17562388 -0.66158462  0.38675000  0.42638025  0.39801360
 [91] -0.09446267  0.07192228 -1.72140737 -1.47318111  1.04320456  0.64196210
 [97]  0.98558490 -0.30211098 -0.14000652 -1.96952875
> colSums(tmp)
  [1]  0.36533150  0.09606835 -1.19993481  0.54513445  1.24953868 -2.22884576
  [7]  0.79047025 -1.54151841  0.74727111  0.23628532 -0.86196602 -0.40401031
 [13]  0.27912996  0.97853767  1.29510530 -1.78367727  0.79566387 -0.33215396
 [19]  0.97252922  1.03916799 -0.42127592  1.00393160 -0.07120814 -1.28999178
 [25] -1.36659710  0.18841876 -1.77962347  1.31339534 -0.62239333 -0.90372563
 [31]  0.22028903 -0.68336023 -1.49808783  0.33951757  0.44506656  0.65517220
 [37]  0.34927434 -0.41294299 -0.26716591  0.08566548  0.14210109  0.25300704
 [43] -1.01690564  0.77798010  0.21705722 -0.90197572  0.67393295 -1.38564720
 [49]  0.22524204 -1.05939230 -0.13462977  1.02731836  0.04855145  0.92250508
 [55] -0.57306508  0.34611075  0.35014905 -1.68645498 -0.38688556 -0.74500720
 [61] -0.71234984  0.22796665 -1.49991918  0.53308607 -0.51864912 -2.51989903
 [67] -1.07809246  0.22172624 -0.41862776  0.13502938 -0.45570094 -1.79707442
 [73] -0.11319502 -0.85161210 -0.27032443  1.21511559  0.16459494  0.30499720
 [79]  0.71130715  1.51775855  1.55310091  1.23614932 -1.26378623 -0.80090286
 [85]  1.07808403 -0.17562388 -0.66158462  0.38675000  0.42638025  0.39801360
 [91] -0.09446267  0.07192228 -1.72140737 -1.47318111  1.04320456  0.64196210
 [97]  0.98558490 -0.30211098 -0.14000652 -1.96952875
> 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.36533150  0.09606835 -1.19993481  0.54513445  1.24953868 -2.22884576
  [7]  0.79047025 -1.54151841  0.74727111  0.23628532 -0.86196602 -0.40401031
 [13]  0.27912996  0.97853767  1.29510530 -1.78367727  0.79566387 -0.33215396
 [19]  0.97252922  1.03916799 -0.42127592  1.00393160 -0.07120814 -1.28999178
 [25] -1.36659710  0.18841876 -1.77962347  1.31339534 -0.62239333 -0.90372563
 [31]  0.22028903 -0.68336023 -1.49808783  0.33951757  0.44506656  0.65517220
 [37]  0.34927434 -0.41294299 -0.26716591  0.08566548  0.14210109  0.25300704
 [43] -1.01690564  0.77798010  0.21705722 -0.90197572  0.67393295 -1.38564720
 [49]  0.22524204 -1.05939230 -0.13462977  1.02731836  0.04855145  0.92250508
 [55] -0.57306508  0.34611075  0.35014905 -1.68645498 -0.38688556 -0.74500720
 [61] -0.71234984  0.22796665 -1.49991918  0.53308607 -0.51864912 -2.51989903
 [67] -1.07809246  0.22172624 -0.41862776  0.13502938 -0.45570094 -1.79707442
 [73] -0.11319502 -0.85161210 -0.27032443  1.21511559  0.16459494  0.30499720
 [79]  0.71130715  1.51775855  1.55310091  1.23614932 -1.26378623 -0.80090286
 [85]  1.07808403 -0.17562388 -0.66158462  0.38675000  0.42638025  0.39801360
 [91] -0.09446267  0.07192228 -1.72140737 -1.47318111  1.04320456  0.64196210
 [97]  0.98558490 -0.30211098 -0.14000652 -1.96952875
> colMin(tmp)
  [1]  0.36533150  0.09606835 -1.19993481  0.54513445  1.24953868 -2.22884576
  [7]  0.79047025 -1.54151841  0.74727111  0.23628532 -0.86196602 -0.40401031
 [13]  0.27912996  0.97853767  1.29510530 -1.78367727  0.79566387 -0.33215396
 [19]  0.97252922  1.03916799 -0.42127592  1.00393160 -0.07120814 -1.28999178
 [25] -1.36659710  0.18841876 -1.77962347  1.31339534 -0.62239333 -0.90372563
 [31]  0.22028903 -0.68336023 -1.49808783  0.33951757  0.44506656  0.65517220
 [37]  0.34927434 -0.41294299 -0.26716591  0.08566548  0.14210109  0.25300704
 [43] -1.01690564  0.77798010  0.21705722 -0.90197572  0.67393295 -1.38564720
 [49]  0.22524204 -1.05939230 -0.13462977  1.02731836  0.04855145  0.92250508
 [55] -0.57306508  0.34611075  0.35014905 -1.68645498 -0.38688556 -0.74500720
 [61] -0.71234984  0.22796665 -1.49991918  0.53308607 -0.51864912 -2.51989903
 [67] -1.07809246  0.22172624 -0.41862776  0.13502938 -0.45570094 -1.79707442
 [73] -0.11319502 -0.85161210 -0.27032443  1.21511559  0.16459494  0.30499720
 [79]  0.71130715  1.51775855  1.55310091  1.23614932 -1.26378623 -0.80090286
 [85]  1.07808403 -0.17562388 -0.66158462  0.38675000  0.42638025  0.39801360
 [91] -0.09446267  0.07192228 -1.72140737 -1.47318111  1.04320456  0.64196210
 [97]  0.98558490 -0.30211098 -0.14000652 -1.96952875
> colMedians(tmp)
  [1]  0.36533150  0.09606835 -1.19993481  0.54513445  1.24953868 -2.22884576
  [7]  0.79047025 -1.54151841  0.74727111  0.23628532 -0.86196602 -0.40401031
 [13]  0.27912996  0.97853767  1.29510530 -1.78367727  0.79566387 -0.33215396
 [19]  0.97252922  1.03916799 -0.42127592  1.00393160 -0.07120814 -1.28999178
 [25] -1.36659710  0.18841876 -1.77962347  1.31339534 -0.62239333 -0.90372563
 [31]  0.22028903 -0.68336023 -1.49808783  0.33951757  0.44506656  0.65517220
 [37]  0.34927434 -0.41294299 -0.26716591  0.08566548  0.14210109  0.25300704
 [43] -1.01690564  0.77798010  0.21705722 -0.90197572  0.67393295 -1.38564720
 [49]  0.22524204 -1.05939230 -0.13462977  1.02731836  0.04855145  0.92250508
 [55] -0.57306508  0.34611075  0.35014905 -1.68645498 -0.38688556 -0.74500720
 [61] -0.71234984  0.22796665 -1.49991918  0.53308607 -0.51864912 -2.51989903
 [67] -1.07809246  0.22172624 -0.41862776  0.13502938 -0.45570094 -1.79707442
 [73] -0.11319502 -0.85161210 -0.27032443  1.21511559  0.16459494  0.30499720
 [79]  0.71130715  1.51775855  1.55310091  1.23614932 -1.26378623 -0.80090286
 [85]  1.07808403 -0.17562388 -0.66158462  0.38675000  0.42638025  0.39801360
 [91] -0.09446267  0.07192228 -1.72140737 -1.47318111  1.04320456  0.64196210
 [97]  0.98558490 -0.30211098 -0.14000652 -1.96952875
> colRanges(tmp)
          [,1]       [,2]      [,3]      [,4]     [,5]      [,6]      [,7]
[1,] 0.3653315 0.09606835 -1.199935 0.5451344 1.249539 -2.228846 0.7904702
[2,] 0.3653315 0.09606835 -1.199935 0.5451344 1.249539 -2.228846 0.7904702
          [,8]      [,9]     [,10]     [,11]      [,12]   [,13]     [,14]
[1,] -1.541518 0.7472711 0.2362853 -0.861966 -0.4040103 0.27913 0.9785377
[2,] -1.541518 0.7472711 0.2362853 -0.861966 -0.4040103 0.27913 0.9785377
        [,15]     [,16]     [,17]     [,18]     [,19]    [,20]      [,21]
[1,] 1.295105 -1.783677 0.7956639 -0.332154 0.9725292 1.039168 -0.4212759
[2,] 1.295105 -1.783677 0.7956639 -0.332154 0.9725292 1.039168 -0.4212759
        [,22]       [,23]     [,24]     [,25]     [,26]     [,27]    [,28]
[1,] 1.003932 -0.07120814 -1.289992 -1.366597 0.1884188 -1.779623 1.313395
[2,] 1.003932 -0.07120814 -1.289992 -1.366597 0.1884188 -1.779623 1.313395
          [,29]      [,30]    [,31]      [,32]     [,33]     [,34]     [,35]
[1,] -0.6223933 -0.9037256 0.220289 -0.6833602 -1.498088 0.3395176 0.4450666
[2,] -0.6223933 -0.9037256 0.220289 -0.6833602 -1.498088 0.3395176 0.4450666
         [,36]     [,37]     [,38]      [,39]      [,40]     [,41]    [,42]
[1,] 0.6551722 0.3492743 -0.412943 -0.2671659 0.08566548 0.1421011 0.253007
[2,] 0.6551722 0.3492743 -0.412943 -0.2671659 0.08566548 0.1421011 0.253007
         [,43]     [,44]     [,45]      [,46]     [,47]     [,48]    [,49]
[1,] -1.016906 0.7779801 0.2170572 -0.9019757 0.6739329 -1.385647 0.225242
[2,] -1.016906 0.7779801 0.2170572 -0.9019757 0.6739329 -1.385647 0.225242
         [,50]      [,51]    [,52]      [,53]     [,54]      [,55]     [,56]
[1,] -1.059392 -0.1346298 1.027318 0.04855145 0.9225051 -0.5730651 0.3461107
[2,] -1.059392 -0.1346298 1.027318 0.04855145 0.9225051 -0.5730651 0.3461107
         [,57]     [,58]      [,59]      [,60]      [,61]     [,62]     [,63]
[1,] 0.3501491 -1.686455 -0.3868856 -0.7450072 -0.7123498 0.2279666 -1.499919
[2,] 0.3501491 -1.686455 -0.3868856 -0.7450072 -0.7123498 0.2279666 -1.499919
         [,64]      [,65]     [,66]     [,67]     [,68]      [,69]     [,70]
[1,] 0.5330861 -0.5186491 -2.519899 -1.078092 0.2217262 -0.4186278 0.1350294
[2,] 0.5330861 -0.5186491 -2.519899 -1.078092 0.2217262 -0.4186278 0.1350294
          [,71]     [,72]     [,73]      [,74]      [,75]    [,76]     [,77]
[1,] -0.4557009 -1.797074 -0.113195 -0.8516121 -0.2703244 1.215116 0.1645949
[2,] -0.4557009 -1.797074 -0.113195 -0.8516121 -0.2703244 1.215116 0.1645949
         [,78]     [,79]    [,80]    [,81]    [,82]     [,83]      [,84]
[1,] 0.3049972 0.7113072 1.517759 1.553101 1.236149 -1.263786 -0.8009029
[2,] 0.3049972 0.7113072 1.517759 1.553101 1.236149 -1.263786 -0.8009029
        [,85]      [,86]      [,87]   [,88]     [,89]     [,90]       [,91]
[1,] 1.078084 -0.1756239 -0.6615846 0.38675 0.4263803 0.3980136 -0.09446267
[2,] 1.078084 -0.1756239 -0.6615846 0.38675 0.4263803 0.3980136 -0.09446267
          [,92]     [,93]     [,94]    [,95]     [,96]     [,97]     [,98]
[1,] 0.07192228 -1.721407 -1.473181 1.043205 0.6419621 0.9855849 -0.302111
[2,] 0.07192228 -1.721407 -1.473181 1.043205 0.6419621 0.9855849 -0.302111
          [,99]    [,100]
[1,] -0.1400065 -1.969529
[2,] -0.1400065 -1.969529
> 
> 
> Max(tmp2)
[1] 2.802377
> Min(tmp2)
[1] -2.34141
> mean(tmp2)
[1] -0.04032177
> Sum(tmp2)
[1] -4.032177
> Var(tmp2)
[1] 0.830513
> 
> rowMeans(tmp2)
  [1] -0.17952836 -1.11640238 -0.49174094  1.23540712  0.08210073 -0.57180443
  [7]  0.10793968 -0.44909324 -2.34141009  0.98270492  1.54170008 -0.90823731
 [13]  1.48900470 -0.95233636  0.54243649 -0.05222727 -0.83141267 -0.51385131
 [19] -0.78699581 -1.80112234  1.08591961  0.04362514  0.14298916 -0.73108558
 [25]  0.13508237 -0.65379002 -0.63476886  0.84941816  0.46507428 -0.85265514
 [31] -1.28007680 -0.42721784 -0.03500034 -1.84994350  0.14330394  0.67374839
 [37]  1.74889007 -1.28940755 -1.02446348  0.38267277  1.19116710 -0.44050986
 [43]  0.45742452  1.07801708  0.11552473  0.43077419  0.94588309 -0.40014336
 [49] -0.36349241  0.43092343  0.21234116 -0.33732163 -0.24699842 -0.20087869
 [55]  1.57923805 -0.84623970 -1.28592407 -1.15147864  0.09227707 -0.80490045
 [61]  1.19487847 -0.73526526  0.21121826 -0.76803311 -0.42121188  0.83947706
 [67] -2.01656551  0.23677205 -0.19508889 -0.31913718  0.78815756  0.44979993
 [73]  0.59336965  1.41936550 -0.32040991  0.40988062  0.37484837  1.50122430
 [79] -0.23569424 -0.45991669  0.77242896 -1.22750919 -0.24071634  0.47277550
 [85] -0.99803708  0.02496479 -0.80165237 -0.62277937 -0.63189713 -0.32735045
 [91] -1.14730583  2.80237679  0.74340228 -0.38868047  0.24387587 -0.01721434
 [97] -0.72825204  1.17950446  0.37665765  1.60243333
> rowSums(tmp2)
  [1] -0.17952836 -1.11640238 -0.49174094  1.23540712  0.08210073 -0.57180443
  [7]  0.10793968 -0.44909324 -2.34141009  0.98270492  1.54170008 -0.90823731
 [13]  1.48900470 -0.95233636  0.54243649 -0.05222727 -0.83141267 -0.51385131
 [19] -0.78699581 -1.80112234  1.08591961  0.04362514  0.14298916 -0.73108558
 [25]  0.13508237 -0.65379002 -0.63476886  0.84941816  0.46507428 -0.85265514
 [31] -1.28007680 -0.42721784 -0.03500034 -1.84994350  0.14330394  0.67374839
 [37]  1.74889007 -1.28940755 -1.02446348  0.38267277  1.19116710 -0.44050986
 [43]  0.45742452  1.07801708  0.11552473  0.43077419  0.94588309 -0.40014336
 [49] -0.36349241  0.43092343  0.21234116 -0.33732163 -0.24699842 -0.20087869
 [55]  1.57923805 -0.84623970 -1.28592407 -1.15147864  0.09227707 -0.80490045
 [61]  1.19487847 -0.73526526  0.21121826 -0.76803311 -0.42121188  0.83947706
 [67] -2.01656551  0.23677205 -0.19508889 -0.31913718  0.78815756  0.44979993
 [73]  0.59336965  1.41936550 -0.32040991  0.40988062  0.37484837  1.50122430
 [79] -0.23569424 -0.45991669  0.77242896 -1.22750919 -0.24071634  0.47277550
 [85] -0.99803708  0.02496479 -0.80165237 -0.62277937 -0.63189713 -0.32735045
 [91] -1.14730583  2.80237679  0.74340228 -0.38868047  0.24387587 -0.01721434
 [97] -0.72825204  1.17950446  0.37665765  1.60243333
> 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.17952836 -1.11640238 -0.49174094  1.23540712  0.08210073 -0.57180443
  [7]  0.10793968 -0.44909324 -2.34141009  0.98270492  1.54170008 -0.90823731
 [13]  1.48900470 -0.95233636  0.54243649 -0.05222727 -0.83141267 -0.51385131
 [19] -0.78699581 -1.80112234  1.08591961  0.04362514  0.14298916 -0.73108558
 [25]  0.13508237 -0.65379002 -0.63476886  0.84941816  0.46507428 -0.85265514
 [31] -1.28007680 -0.42721784 -0.03500034 -1.84994350  0.14330394  0.67374839
 [37]  1.74889007 -1.28940755 -1.02446348  0.38267277  1.19116710 -0.44050986
 [43]  0.45742452  1.07801708  0.11552473  0.43077419  0.94588309 -0.40014336
 [49] -0.36349241  0.43092343  0.21234116 -0.33732163 -0.24699842 -0.20087869
 [55]  1.57923805 -0.84623970 -1.28592407 -1.15147864  0.09227707 -0.80490045
 [61]  1.19487847 -0.73526526  0.21121826 -0.76803311 -0.42121188  0.83947706
 [67] -2.01656551  0.23677205 -0.19508889 -0.31913718  0.78815756  0.44979993
 [73]  0.59336965  1.41936550 -0.32040991  0.40988062  0.37484837  1.50122430
 [79] -0.23569424 -0.45991669  0.77242896 -1.22750919 -0.24071634  0.47277550
 [85] -0.99803708  0.02496479 -0.80165237 -0.62277937 -0.63189713 -0.32735045
 [91] -1.14730583  2.80237679  0.74340228 -0.38868047  0.24387587 -0.01721434
 [97] -0.72825204  1.17950446  0.37665765  1.60243333
> rowMin(tmp2)
  [1] -0.17952836 -1.11640238 -0.49174094  1.23540712  0.08210073 -0.57180443
  [7]  0.10793968 -0.44909324 -2.34141009  0.98270492  1.54170008 -0.90823731
 [13]  1.48900470 -0.95233636  0.54243649 -0.05222727 -0.83141267 -0.51385131
 [19] -0.78699581 -1.80112234  1.08591961  0.04362514  0.14298916 -0.73108558
 [25]  0.13508237 -0.65379002 -0.63476886  0.84941816  0.46507428 -0.85265514
 [31] -1.28007680 -0.42721784 -0.03500034 -1.84994350  0.14330394  0.67374839
 [37]  1.74889007 -1.28940755 -1.02446348  0.38267277  1.19116710 -0.44050986
 [43]  0.45742452  1.07801708  0.11552473  0.43077419  0.94588309 -0.40014336
 [49] -0.36349241  0.43092343  0.21234116 -0.33732163 -0.24699842 -0.20087869
 [55]  1.57923805 -0.84623970 -1.28592407 -1.15147864  0.09227707 -0.80490045
 [61]  1.19487847 -0.73526526  0.21121826 -0.76803311 -0.42121188  0.83947706
 [67] -2.01656551  0.23677205 -0.19508889 -0.31913718  0.78815756  0.44979993
 [73]  0.59336965  1.41936550 -0.32040991  0.40988062  0.37484837  1.50122430
 [79] -0.23569424 -0.45991669  0.77242896 -1.22750919 -0.24071634  0.47277550
 [85] -0.99803708  0.02496479 -0.80165237 -0.62277937 -0.63189713 -0.32735045
 [91] -1.14730583  2.80237679  0.74340228 -0.38868047  0.24387587 -0.01721434
 [97] -0.72825204  1.17950446  0.37665765  1.60243333
> 
> colMeans(tmp2)
[1] -0.04032177
> colSums(tmp2)
[1] -4.032177
> colVars(tmp2)
[1] 0.830513
> colSd(tmp2)
[1] 0.9113249
> colMax(tmp2)
[1] 2.802377
> colMin(tmp2)
[1] -2.34141
> colMedians(tmp2)
[1] -0.1158778
> colRanges(tmp2)
          [,1]
[1,] -2.341410
[2,]  2.802377
> 
> 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]  6.2233052  0.6924593  3.2140393  2.7365518 -4.2118723  0.7584869
 [7] -2.4862670  2.9756189  4.4254597  3.0620522
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -0.3748969
[2,]  0.1624247
[3,]  0.6904306
[4,]  0.9905044
[5,]  1.6185002
> 
> rowApply(tmp,sum)
 [1]  3.2706946  1.6351021 -1.1303807 -0.6847062 -0.1523820  5.8778075
 [7]  1.7881120  2.7133940  0.6513800  3.4208127
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    7    3   10    8   10    8    7    4    2     5
 [2,]   10    7    4    1    1   10   10    9    3     3
 [3,]    4   10    7    4    2    9    2    6    7     7
 [4,]    5    9    2    5    6    1    6    7    9     9
 [5,]    9    2    1    2    5    2    1   10    5     1
 [6,]    3    1    3   10    8    4    8    1    6    10
 [7,]    1    4    6    3    4    5    3    5    1     4
 [8,]    8    6    8    7    7    3    5    3   10     6
 [9,]    6    8    9    6    9    6    9    2    4     2
[10,]    2    5    5    9    3    7    4    8    8     8
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  0.63180879 -1.84697236 -1.28303479 -1.48304722 -1.93399476  2.66555268
 [7] -3.08286949  1.67982499 -1.25976535  0.94208841 -0.03645901  2.17585671
[13]  2.23685101  1.90237654 -1.14449917 -0.38718526 -2.16645561  2.20321527
[19] -2.32291570  0.34638815
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.0718775
[2,] -0.7119119
[3,] -0.3746352
[4,]  0.7456229
[5,]  2.0446105
> 
> rowApply(tmp,sum)
[1]  -1.5439476   4.5969309   0.7411168 -14.2235137   8.2661774
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]    9   20    1   18    5
[2,]   13   13    3    9    1
[3,]    1    8    8   16   12
[4,]   10    3    6   20    2
[5,]    6    1    4   12   20
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,] -0.3746352  0.2877083 -1.7725449 -0.3661541 -0.5367827  1.0469119
[2,]  2.0446105  0.7142365  0.1249577 -0.9567729 -2.4255057 -0.9830097
[3,] -1.0718775 -1.0052734 -0.6046657 -0.8128535 -0.9588739  0.4345780
[4,]  0.7456229 -0.9826272  0.1843827  1.4228877 -0.3170122  1.1030958
[5,] -0.7119119 -0.8610166  0.7848354 -0.7701544  2.3041797  1.0639767
           [,7]       [,8]       [,9]        [,10]      [,11]      [,12]
[1,] -0.6406222 -0.5116615  0.5665528 -0.009824738  0.8884656  1.8282089
[2,]  0.7184213  1.9824527  0.2298012  0.852336079 -0.4064371  1.0555312
[3,] -0.6581728  1.4974867 -0.8142007  0.293296354 -1.0422627 -0.2038767
[4,] -2.3467381 -2.4234881 -2.3786981 -0.294789008 -0.8953275 -1.6332303
[5,] -0.1557576  1.1350352  1.1367795  0.101069720  1.4191027  1.1292237
          [,13]      [,14]      [,15]       [,16]       [,17]      [,18]
[1,]  1.1788615 -1.4413007 -0.3786644  0.39548506 -1.39060672  0.8453897
[2,] -0.2587568  0.2647278  0.8834458  0.93481746  0.24980049 -0.5232002
[3,]  1.4856483  1.1653577 -0.2443056 -0.34851523  0.03358266  2.4007826
[4,] -1.1119932  0.2557160 -1.6584398 -1.39926288 -1.59345722 -0.3032949
[5,]  0.9430912  1.6578756  0.2534648  0.03029033  0.53422518 -0.2164620
          [,19]      [,20]
[1,] -1.4076290  0.2488946
[2,] -0.1980597  0.2935343
[3,]  0.7851842  0.4100782
[4,] -0.7527170  0.1558567
[5,] -0.7496942 -0.7619756
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.8  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  623  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  542  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.8  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.8577084 -1.149068 -0.4016308 1.183488 -1.565828 -0.7680995 -0.4042412
          col8     col9     col10     col11    col12     col13    col14
row1 0.7674258 1.247638 0.1345481 -1.771707 0.117229 0.8575099 1.604652
         col15     col16      col17      col18      col19      col20
row1 -1.230808 0.9077947 -0.4636223 -0.3561376 -0.4649234 0.08783763
> tmp[,"col10"]
          col10
row1  0.1345481
row2  1.3247105
row3 -0.5869439
row4 -0.3432638
row5  0.9686535
> tmp[c("row1","row5"),]
           col1       col2       col3      col4       col5       col6
row1 -0.8577084 -1.1490679 -0.4016308  1.183488 -1.5658283 -0.7680995
row5  0.3183139  0.4351196 -0.6824127 -0.675012 -0.7421802  0.7468039
           col7      col8        col9     col10      col11      col12     col13
row1 -0.4042412 0.7674258  1.24763830 0.1345481 -1.7717070  0.1172290 0.8575099
row5  1.9316427 0.1712366 -0.07134408 0.9686535  0.9696099 -0.1904305 0.7000987
         col14      col15     col16      col17      col18      col19      col20
row1 1.6046524 -1.2308084 0.9077947 -0.4636223 -0.3561376 -0.4649234 0.08783763
row5 0.2285823  0.1435318 0.2857757  1.6916764  0.6591104 -0.6193645 1.67405286
> tmp[,c("col6","col20")]
           col6      col20
row1 -0.7680995 0.08783763
row2  0.2897231 1.97627938
row3 -0.1023447 0.98784831
row4  1.1818909 2.32463072
row5  0.7468039 1.67405286
> tmp[c("row1","row5"),c("col6","col20")]
           col6      col20
row1 -0.7680995 0.08783763
row5  0.7468039 1.67405286
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1    col2     col3     col4   col5     col6     col7     col8
row1 51.55693 49.8973 49.94787 48.86999 47.783 103.6053 49.52253 50.45138
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.64127 50.46423 49.82884 48.86844 47.80997 50.59108 48.87138 49.59049
        col17    col18    col19    col20
row1 50.47687 49.71016 50.48129 103.4626
> tmp[,"col10"]
        col10
row1 50.46423
row2 29.67006
row3 29.42473
row4 30.22538
row5 50.56818
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 51.55693 49.89730 49.94787 48.86999 47.78300 103.6053 49.52253 50.45138
row5 49.60910 49.65688 49.49166 48.35377 47.72557 104.0715 48.98448 49.26316
         col9    col10    col11    col12    col13    col14    col15    col16
row1 48.64127 50.46423 49.82884 48.86844 47.80997 50.59108 48.87138 49.59049
row5 49.58831 50.56818 49.24809 48.71537 49.59482 49.62060 50.71303 50.34759
        col17    col18    col19    col20
row1 50.47687 49.71016 50.48129 103.4626
row5 50.62977 50.03281 50.39010 102.6673
> tmp[,c("col6","col20")]
          col6     col20
row1 103.60530 103.46256
row2  75.87705  74.89093
row3  75.71444  75.23555
row4  74.30908  74.64224
row5 104.07147 102.66733
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.6053 103.4626
row5 104.0715 102.6673
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.6053 103.4626
row5 104.0715 102.6673
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,] -1.5795412
[2,] -0.4257341
[3,]  0.9820994
[4,]  1.4454660
[5,]  0.8963624
> tmp[,c("col17","col7")]
          col17        col7
[1,]  1.0076463 -1.34101461
[2,]  0.9168269  1.33918650
[3,]  0.5211252 -1.09654745
[4,]  0.1992567 -0.09918181
[5,] -0.3510156 -1.74182478
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6       col20
[1,] -1.3529159 -0.97337150
[2,] -0.3634385 -0.07385865
[3,] -0.1562904  1.24370758
[4,]  0.3283764 -0.64141574
[5,]  0.9716667  0.72101996
> subBufferedMatrix(tmp,1,c("col6"))[,1]
          col1
[1,] -1.352916
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -1.3529159
[2,] -0.3634385
> 
> 
> 
> 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 -1.6006115  0.9469616 -0.02553887  0.49919328 -0.91513512 1.210094
row1 -0.5620362 -0.1906575  0.85066405 -0.03200967  0.08872176 2.533810
         [,7]      [,8]      [,9]      [,10]     [,11]     [,12]      [,13]
row3 0.110946 1.2416720 -1.164792 -0.8914024  1.584141 0.4255152 -0.7532941
row1 2.556557 0.1732662  1.222233 -1.2582894 -1.470887 0.5639462  0.6969583
          [,14]      [,15]      [,16]      [,17]     [,18]       [,19]
row3 -0.2162315 -0.9725242 -1.0690340 -0.1130944 -1.447551 -0.09644627
row1 -0.7155467  1.1246003 -0.0235932  2.1517228 -1.448148 -0.36227822
          [,20]
row3 -0.7575704
row1 -0.9981915
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
          [,1]       [,2]       [,3]       [,4]     [,5]      [,6]     [,7]
row2 0.3321148 -0.8934874 -0.2407638 -0.6837726 0.725233 -1.035444 1.129034
           [,8]       [,9]     [,10]
row2 -0.0228975 -0.4370907 -1.330279
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]       [,2]       [,3]     [,4]     [,5]     [,6]        [,7]
row5 0.4738306 -0.6389424 -0.7689216 -1.03222 1.242364 1.556523 -0.03316153
          [,8]     [,9]    [,10]     [,11]    [,12]     [,13]    [,14]
row5 0.6824613 0.322185 0.414015 -1.201154 1.058479 0.9349919 0.537581
         [,15]      [,16]     [,17]    [,18]     [,19]     [,20]
row5 -1.090297 -0.1506841 0.1828073 1.222024 0.8268671 -2.083496
> 
> 
> 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: 0x000002b65e718d10>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM45885b476c0" 
 [2] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM45883922660c"
 [3] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458859285e"  
 [4] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458865cb337f"
 [5] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458819cd7ca5"
 [6] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458848e81c62"
 [7] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM45885ea91f34"
 [8] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM4588d29176d" 
 [9] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458872897b8d"
[10] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458873607449"
[11] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458839787fc7"
[12] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM45881893be7" 
[13] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458877df7784"
[14] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458823086b16"
[15] "F:/biocbuild/bbs-3.16-bioc/meat/BufferedMatrix.Rcheck/tests\\BM458814f13b23"
> 
> 
> ### 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: 0x000002b65f0b8610>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0x000002b65f0b8610>
Warning message:
In dir.create(new.directory) :
  'F:\biocbuild\bbs-3.16-bioc\meat\BufferedMatrix.Rcheck\tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0x000002b65f0b8610>
> rowMedians(tmp)
  [1]  0.186716633 -0.432662072  0.082111710 -0.393633811  0.719972932
  [6] -0.152614882  0.118027768  0.394687333 -0.095698638 -0.027300620
 [11]  0.346425325  0.491187680 -0.208843702  0.289144557  0.294939562
 [16]  0.061315642  0.067180982  0.227359773  0.364067627 -0.161834133
 [21]  0.249769519 -0.340081321  0.465756673  0.344807164  0.206001963
 [26]  0.164947791  0.427474522  0.458699097 -0.181099342 -0.011131533
 [31]  0.408813835 -0.173440080  0.024681164 -0.017263127 -0.174213415
 [36]  0.175629537 -0.204610684 -0.488786290 -0.075785172 -0.239100126
 [41]  0.134430095 -0.067400966  0.225964006 -0.216801573  0.026502536
 [46] -0.237884857  0.023154905 -0.159878610  0.202655516 -0.947300146
 [51]  0.299061374  0.093769698  0.431847684  0.049607782 -0.185387663
 [56]  0.444721230 -0.683572877 -0.382966772  0.066384630 -0.011365977
 [61] -0.221128361 -0.551714278 -0.338184745  0.244622583 -0.138862735
 [66]  0.251971620  0.317321110  0.009706375  0.338764523 -0.308766329
 [71] -0.032427566  0.156985235  0.166901965  0.100616955 -0.134019443
 [76]  0.384091799  0.372037558 -0.240965012 -0.598092871 -0.116886414
 [81]  0.105116434 -0.263504690 -0.280218957 -0.416384157 -0.214351888
 [86] -0.232129532 -0.203623342 -0.356711133 -0.026813355 -0.606547664
 [91]  0.572352930  0.610197139  0.591024842 -0.356608885 -0.217926605
 [96] -0.275897901 -0.331707918 -0.028147837 -0.129162289 -0.539138794
[101]  0.360850637 -0.136550171 -0.541739186  0.118086773 -0.055127473
[106] -0.123562046 -0.292617560 -0.324432120 -0.315322737  0.312492497
[111] -0.302436492  0.182358180  0.001814461 -0.114710200  0.574223654
[116]  0.559376226  0.606195641 -0.172582494 -0.230917938 -0.284310075
[121] -0.187140428 -0.067772706 -0.235608046  0.052995165  0.084951947
[126] -0.652381907  0.344648117 -0.492152594 -0.042671802 -0.002457292
[131]  0.568122326  0.651211290 -0.622482356  0.244052667 -0.574007297
[136] -0.610982398  0.171799025  0.606986840 -0.285826791  0.247209064
[141]  0.314357124 -0.294517328 -0.115172369 -0.168032755  0.070259866
[146]  0.001788988 -0.069731717 -0.095868460 -0.275947823  0.510737088
[151]  0.112369917  0.012878542 -0.021303415 -0.583096932  0.107827536
[156]  0.331725556 -0.414795827 -0.206440081  0.379167639 -0.029451439
[161]  0.969925814 -0.011975397 -0.095682497  0.033284950  0.351075717
[166]  0.081107876  0.330432303  0.067535157  0.631980241  0.052530057
[171] -0.445960700 -0.233436452  0.308609359 -0.008515433  0.303303506
[176] -0.495443135 -0.394095706 -0.250719165  0.061251595  0.056109864
[181]  0.215613758  0.102872417 -0.191692394  0.223866935  0.343586976
[186] -0.236896158  0.270532688 -0.349167792  0.353917109 -0.452107047
[191] -0.515463820  0.270868339  0.068296922 -0.418318871 -0.419437018
[196]  0.541877331  0.317448117  0.332600665  0.109783590 -0.157714894
[201]  0.573094463 -0.046020350  0.111865752 -0.603203209 -0.315847112
[206] -0.013799459  0.198894015 -0.062309920 -0.356660514  0.266594770
[211]  0.159953603 -0.197660493 -0.257822211  0.392052145  0.388811028
[216]  0.242017139  0.291424425  0.027125624 -0.079231387  0.101303826
[221]  0.275272751  0.072792220  0.177014378 -0.009645201 -0.188494042
[226]  0.276762400  0.327097006  0.349772710  0.171684298 -0.527685808
> 
> proc.time()
   user  system elapsed 
   3.78   18.43   66.54 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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: 0x0000024f55a5b360>
> .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: 0x0000024f55a5b360>
> .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: 0x0000024f55a5b360>
> .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: 0x0000024f55a5b360>
> 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: 0x0000024f55a5b3d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000024f55a5b3d0>
> .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: 0x0000024f55a5b3d0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000024f55a5b3d0>
> .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: 0x0000024f55a5b3d0>
> 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: 0x0000024f55a5b4b0>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000024f55a5b4b0>
> .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: 0x0000024f55a5b4b0>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000024f55a5b4b0>
> .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: 0x0000024f55a5b4b0>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0x0000024f55a5b4b0>
> .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: 0x0000024f55a5b4b0>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0x0000024f55a5b4b0>
> .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: 0x0000024f55a5b4b0>
> 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: 0x0000024f55a5b520>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0x0000024f55a5b520>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000024f55a5b520>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000024f55a5b520>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3f943db37c4" "BufferedMatrixFile3f943e99c88"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile3f943db37c4" "BufferedMatrixFile3f943e99c88"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000024f55a5af70>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000024f55a5af70>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000024f55a5af70>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0x0000024f55a5af70>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0x0000024f55a5af70>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0x0000024f55a5af70>
> .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: 0x0000024f55a5aa30>
> .Call("R_bm_AddColumn",P)
<pointer: 0x0000024f55a5aa30>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0x0000024f55a5aa30>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0x0000024f55a5aa30>
> 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: 0x0000024f55a5b600>
> .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: 0x0000024f55a5b600>
> rm(P)
> 
> proc.time()
   user  system elapsed 
   0.25    0.35    0.76 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


R version 4.2.3 (2023-03-15 ucrt) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (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.37    0.03    0.39 

Example timings