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

This page was generated on 2023-05-10 10:04:27 -0000 (Wed, 10 May 2023).

HostnameOSArch (*)R versionInstalled pkgs
kunpeng1Linux (Ubuntu 22.04.1 LTS)aarch64R Under development (unstable) (2023-03-12 r83975) -- "Unsuffered Consequences" 6211
Click on any hostname to see more info about the system (e.g. compilers)      (*) as reported by 'uname -p', except on Windows and Mac OS X

CHECK results for BufferedMatrix on kunpeng1


To the developers/maintainers of the BufferedMatrix package:
- Allow up to 24 hours (and sometimes 48 hours) for your latest push to git@git.bioconductor.org:packages/BufferedMatrix.git to reflect on this report. See Troubleshooting Build Report for more information.

- Use the following Renviron settings to reproduce errors and warnings.

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

raw results

Package 241/2194HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
BufferedMatrix 1.65.0  (landing page)
Ben Bolstad
Snapshot Date: 2023-05-08 19:11:19 -0000 (Mon, 08 May 2023)
git_url: https://git.bioconductor.org/packages/BufferedMatrix
git_branch: devel
git_last_commit: 5a16207
git_last_commit_date: 2023-04-25 13:44:48 -0000 (Tue, 25 Apr 2023)
kunpeng1Linux (Ubuntu 22.04.1 LTS) / aarch64  OK    OK    OK  

Summary

Package: BufferedMatrix
Version: 1.65.0
Command: /home/biocbuild/bbs-3.17-bioc/R/bin/R CMD check --install=check:BufferedMatrix.install-out.txt --library=/home/biocbuild/bbs-3.17-bioc/R/site-library --timings BufferedMatrix_1.65.0.tar.gz
StartedAt: 2023-05-09 10:31:50 -0000 (Tue, 09 May 2023)
EndedAt: 2023-05-09 10:32:18 -0000 (Tue, 09 May 2023)
EllapsedTime: 28.0 seconds
RetCode: 0
Status:   OK  
CheckDir: BufferedMatrix.Rcheck
Warnings: 0

Command output

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


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

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



Installation output

BufferedMatrix.Rcheck/00install.out

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


* installing to library ‘/home/biocbuild/bbs-3.17-bioc/R-devel_2023-03-12_r83975-bin/site-library’
* installing *source* package ‘BufferedMatrix’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
gcc -I"/home/biocbuild/bbs-3.17-bioc/R-devel_2023-03-12_r83975-bin/lib/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c RBufferedMatrix.c -o RBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.17-bioc/R-devel_2023-03-12_r83975-bin/lib/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c doubleBufferedMatrix.c -o doubleBufferedMatrix.o
gcc -I"/home/biocbuild/bbs-3.17-bioc/R-devel_2023-03-12_r83975-bin/lib/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c doubleBufferedMatrix_C_tests.c -o doubleBufferedMatrix_C_tests.o
gcc -I"/home/biocbuild/bbs-3.17-bioc/R-devel_2023-03-12_r83975-bin/lib/R/include" -DNDEBUG   -I/usr/local/include    -fPIC  -g -O2  -c init_package.c -o init_package.o
gcc -shared -L/usr/local/lib -o BufferedMatrix.so RBufferedMatrix.o doubleBufferedMatrix.o doubleBufferedMatrix_C_tests.o init_package.o
installing to /home/biocbuild/bbs-3.17-bioc/R-devel_2023-03-12_r83975-bin/site-library/00LOCK-BufferedMatrix/00new/BufferedMatrix/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Creating a new generic function for ‘rowMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘rowSums’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colMeans’ in package ‘BufferedMatrix’
Creating a new generic function for ‘colSums’ in package ‘BufferedMatrix’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘BufferedMatrix’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘BufferedMatrix’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (BufferedMatrix)

Tests output

BufferedMatrix.Rcheck/tests/c_code_level_tests.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

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

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

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

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

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

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

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

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

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

[[1]]
[1] 0

> 
> proc.time()
   user  system elapsed 
  0.334   0.047   0.361 

BufferedMatrix.Rcheck/tests/objectTesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> 
> ### this is used to control how many repetitions in something below
> ### higher values result in more checks.
> nreps <-100 ##20000
> 
> 
> ## test creation and some simple assignments and subsetting operations
> 
> ## first on single elements
> tmp <- createBufferedMatrix(1000,10)
> 
> tmp[10,5]
[1] 0
> tmp[10,5] <- 10
> tmp[10,5]
[1] 10
> tmp[10,5] <- 12.445
> tmp[10,5]
[1] 12.445
> 
> 
> 
> ## now testing accessing multiple elements
> tmp2 <- createBufferedMatrix(10,20)
> 
> 
> tmp2[3,1] <- 51.34
> tmp2[9,2] <- 9.87654
> tmp2[,1:2]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[,-(3:20)]
       [,1]    [,2]
 [1,]  0.00 0.00000
 [2,]  0.00 0.00000
 [3,] 51.34 0.00000
 [4,]  0.00 0.00000
 [5,]  0.00 0.00000
 [6,]  0.00 0.00000
 [7,]  0.00 0.00000
 [8,]  0.00 0.00000
 [9,]  0.00 9.87654
[10,]  0.00 0.00000
> tmp2[3,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] 51.34    0    0    0    0    0    0    0    0     0     0     0     0
     [,14] [,15] [,16] [,17] [,18] [,19] [,20]
[1,]     0     0     0     0     0     0     0
> tmp2[-3,]
      [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]    0 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]    0 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19] [,20]
 [1,]     0     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0     0
> tmp2[2,1:3]
     [,1] [,2] [,3]
[1,]    0    0    0
> tmp2[3:9,1:3]
      [,1]    [,2] [,3]
[1,] 51.34 0.00000    0
[2,]  0.00 0.00000    0
[3,]  0.00 0.00000    0
[4,]  0.00 0.00000    0
[5,]  0.00 0.00000    0
[6,]  0.00 0.00000    0
[7,]  0.00 9.87654    0
> tmp2[-4,-4]
       [,1]    [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [2,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [3,] 51.34 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [4,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [5,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [6,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [7,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
 [8,]  0.00 9.87654    0    0    0    0    0    0    0     0     0     0     0
 [9,]  0.00 0.00000    0    0    0    0    0    0    0     0     0     0     0
      [,14] [,15] [,16] [,17] [,18] [,19]
 [1,]     0     0     0     0     0     0
 [2,]     0     0     0     0     0     0
 [3,]     0     0     0     0     0     0
 [4,]     0     0     0     0     0     0
 [5,]     0     0     0     0     0     0
 [6,]     0     0     0     0     0     0
 [7,]     0     0     0     0     0     0
 [8,]     0     0     0     0     0     0
 [9,]     0     0     0     0     0     0
> 
> ## now testing accessing/assigning multiple elements
> tmp3 <- createBufferedMatrix(10,10)
> 
> for (i in 1:10){
+   for (j in 1:10){
+     tmp3[i,j] <- (j-1)*10 + i
+   }
+ }
> 
> tmp3[2:4,2:4]
     [,1] [,2] [,3]
[1,]   12   22   32
[2,]   13   23   33
[3,]   14   24   34
> tmp3[c(-10),c(2:4,2:4,10,1,2,1:10,10:1)]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]   11   21   31   11   21   31   91    1   11     1    11    21    31
 [2,]   12   22   32   12   22   32   92    2   12     2    12    22    32
 [3,]   13   23   33   13   23   33   93    3   13     3    13    23    33
 [4,]   14   24   34   14   24   34   94    4   14     4    14    24    34
 [5,]   15   25   35   15   25   35   95    5   15     5    15    25    35
 [6,]   16   26   36   16   26   36   96    6   16     6    16    26    36
 [7,]   17   27   37   17   27   37   97    7   17     7    17    27    37
 [8,]   18   28   38   18   28   38   98    8   18     8    18    28    38
 [9,]   19   29   39   19   29   39   99    9   19     9    19    29    39
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]    41    51    61    71    81    91    91    81    71    61    51    41
 [2,]    42    52    62    72    82    92    92    82    72    62    52    42
 [3,]    43    53    63    73    83    93    93    83    73    63    53    43
 [4,]    44    54    64    74    84    94    94    84    74    64    54    44
 [5,]    45    55    65    75    85    95    95    85    75    65    55    45
 [6,]    46    56    66    76    86    96    96    86    76    66    56    46
 [7,]    47    57    67    77    87    97    97    87    77    67    57    47
 [8,]    48    58    68    78    88    98    98    88    78    68    58    48
 [9,]    49    59    69    79    89    99    99    89    79    69    59    49
      [,26] [,27] [,28] [,29]
 [1,]    31    21    11     1
 [2,]    32    22    12     2
 [3,]    33    23    13     3
 [4,]    34    24    14     4
 [5,]    35    25    15     5
 [6,]    36    26    16     6
 [7,]    37    27    17     7
 [8,]    38    28    18     8
 [9,]    39    29    19     9
> tmp3[-c(1:5),-c(6:10)]
     [,1] [,2] [,3] [,4] [,5]
[1,]    6   16   26   36   46
[2,]    7   17   27   37   47
[3,]    8   18   28   38   48
[4,]    9   19   29   39   49
[5,]   10   20   30   40   50
> 
> ## assignment of whole columns
> tmp3[,1] <- c(1:10*100.0)
> tmp3[,1:2] <- tmp3[,1:2]*100
> tmp3[,1:2] <- tmp3[,2:1]
> tmp3[,1:2]
      [,1]  [,2]
 [1,] 1100 1e+04
 [2,] 1200 2e+04
 [3,] 1300 3e+04
 [4,] 1400 4e+04
 [5,] 1500 5e+04
 [6,] 1600 6e+04
 [7,] 1700 7e+04
 [8,] 1800 8e+04
 [9,] 1900 9e+04
[10,] 2000 1e+05
> 
> 
> tmp3[,-1] <- tmp3[,1:9]
> tmp3[,1:10]
      [,1] [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,] 1100 1100 1e+04   21   31   41   51   61   71    81
 [2,] 1200 1200 2e+04   22   32   42   52   62   72    82
 [3,] 1300 1300 3e+04   23   33   43   53   63   73    83
 [4,] 1400 1400 4e+04   24   34   44   54   64   74    84
 [5,] 1500 1500 5e+04   25   35   45   55   65   75    85
 [6,] 1600 1600 6e+04   26   36   46   56   66   76    86
 [7,] 1700 1700 7e+04   27   37   47   57   67   77    87
 [8,] 1800 1800 8e+04   28   38   48   58   68   78    88
 [9,] 1900 1900 9e+04   29   39   49   59   69   79    89
[10,] 2000 2000 1e+05   30   40   50   60   70   80    90
> 
> tmp3[,1:2] <- rep(1,10)
> tmp3[,1:2] <- rep(1,20)
> tmp3[,1:2] <- matrix(c(1:5),1,5)
> 
> tmp3[,-c(1:8)] <- matrix(c(1:5),1,5)
> 
> tmp3[1,] <- 1:10
> tmp3[1,]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    2    3    4    5    6    7    8    9    10
> tmp3[-1,] <- c(1,2)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    2    1    2    1    2    1    2    1    2     1
[10,]    1    2    1    2    1    2    1    2    1     2
> tmp3[-c(1:8),] <- matrix(c(1:5),1,5)
> tmp3[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    2    3    4    5    6    7    8    9    10
 [2,]    1    2    1    2    1    2    1    2    1     2
 [3,]    2    1    2    1    2    1    2    1    2     1
 [4,]    1    2    1    2    1    2    1    2    1     2
 [5,]    2    1    2    1    2    1    2    1    2     1
 [6,]    1    2    1    2    1    2    1    2    1     2
 [7,]    2    1    2    1    2    1    2    1    2     1
 [8,]    1    2    1    2    1    2    1    2    1     2
 [9,]    1    3    5    2    4    1    3    5    2     4
[10,]    2    4    1    3    5    2    4    1    3     5
> 
> 
> tmp3[1:2,1:2] <- 5555.04
> tmp3[-(1:2),1:2] <- 1234.56789
> 
> 
> 
> ## testing accessors for the directory and prefix
> directory(tmp3)
[1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests"
> prefix(tmp3)
[1] "BM"
> 
> ## testing if we can remove these objects
> rm(tmp, tmp2, tmp3)
> gc()
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 457390 24.5     981220 52.5   651217 34.8
Vcells 843020  6.5    8388608 64.0  2041566 15.6
> 
> 
> 
> 
> ##
> ## 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] "Tue May  9 10:32:05 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] "Tue May  9 10:32:05 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: 0xaaaae3f3c9b0>
> 
> 
> 
> 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] "Tue May  9 10:32:06 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] "Tue May  9 10:32:06 2023"
> 
> ColMode(tmp2)
<pointer: 0xaaaae3f3c9b0>
> 
> 
> 
> ### 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.9699936  1.0458899  0.4596473  0.4402260
[2,]   0.3629608 -0.4853476  1.0211165 -0.6541274
[3,]   0.1766809 -0.7178593 -1.0493027 -0.4488738
[4,]  -0.5018227  0.1977034 -0.3744030  0.1540594
> ewApply(tmp5,abs)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
            [,1]      [,2]      [,3]      [,4]
[1,] 100.9699936 1.0458899 0.4596473 0.4402260
[2,]   0.3629608 0.4853476 1.0211165 0.6541274
[3,]   0.1766809 0.7178593 1.0493027 0.4488738
[4,]   0.5018227 0.1977034 0.3744030 0.1540594
> ewApply(tmp5,sqrt)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
           [,1]      [,2]      [,3]      [,4]
[1,] 10.0483826 1.0226876 0.6779729 0.6634953
[2,]  0.6024623 0.6966689 1.0105031 0.8087814
[3,]  0.4203342 0.8472658 1.0243548 0.6699805
[4,]  0.7083944 0.4446385 0.6118848 0.3925041
> 
> my.function <- function(x,power){
+   (x+5)^power
+ }
> 
> ewApply(tmp5,my.function,power=2)
BufferedMatrix object
Matrix size:  10 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  2  Kilobytes.
Disk usage :  1.6  Kilobytes.
> tmp5[1:4,1:4]
          [,1]     [,2]     [,3]     [,4]
[1,] 226.45382 36.27277 32.23938 32.07518
[2,]  31.38758 32.45204 36.12615 33.74194
[3,]  29.38002 34.19052 36.29285 32.14868
[4,]  32.58577 29.64409 31.49325 29.07910
> 
> 
> 
> ## testing functions that elementwise transform the matrix
> sqrt(tmp5)
<pointer: 0xaaaae343b390>
> exp(tmp5)
<pointer: 0xaaaae343b390>
> log(tmp5,2)
<pointer: 0xaaaae343b390>
> pow(tmp5,2)
> 
> 
> 
> 
> 
> ## testing functions that apply to entire matrix
> Max(tmp5)
[1] 471.334
> Min(tmp5)
[1] 53.62501
> mean(tmp5)
[1] 72.20892
> Sum(tmp5)
[1] 14441.78
> Var(tmp5)
[1] 867.3151
> 
> 
> ## testing functions applied to rows or columns
> 
> rowMeans(tmp5)
 [1] 86.77076 67.88732 68.72181 71.71379 68.26947 71.36572 71.91262 72.70402
 [9] 70.77387 71.96983
> rowSums(tmp5)
 [1] 1735.415 1357.746 1374.436 1434.276 1365.389 1427.314 1438.252 1454.080
 [9] 1415.477 1439.397
> rowVars(tmp5)
 [1] 8220.84211   57.61951   73.89457   46.18187   91.05711   90.40505
 [7]   45.44934   55.35007   67.90583   59.69168
> rowSd(tmp5)
 [1] 90.668860  7.590752  8.596195  6.795725  9.542385  9.508157  6.741613
 [8]  7.439763  8.240499  7.726039
> rowMax(tmp5)
 [1] 471.33396  86.87905  86.26161  79.83530  83.39698  88.51805  81.30065
 [8]  84.41890  82.11834  87.56099
> rowMin(tmp5)
 [1] 59.05334 57.26576 54.09243 60.52434 53.94668 54.93771 53.62501 60.54762
 [9] 56.74148 60.57987
> 
> colMeans(tmp5)
 [1] 105.71640  72.68454  67.14074  71.24347  67.43756  68.91468  73.60553
 [8]  69.05647  69.24072  68.80018  70.55089  69.12067  71.86689  73.99697
[15]  76.06327  72.38103  67.52259  69.27393  70.43098  69.13094
> colSums(tmp5)
 [1] 1057.1640  726.8454  671.4074  712.4347  674.3756  689.1468  736.0553
 [8]  690.5647  692.4072  688.0018  705.5089  691.2067  718.6689  739.9697
[15]  760.6327  723.8103  675.2259  692.7393  704.3098  691.3094
> colVars(tmp5)
 [1] 16542.77943    54.57240    42.54428    41.84331    61.30695    97.96779
 [7]    78.12736    32.83616    62.81738    76.31915    62.59976    53.59922
[13]    80.01656    79.55369    74.05205    66.55897    43.27967    92.75427
[19]    31.87851    69.41782
> colSd(tmp5)
 [1] 128.618737   7.387313   6.522598   6.468641   7.829876   9.897868
 [7]   8.838968   5.730285   7.925742   8.736083   7.912001   7.321149
[13]   8.945198   8.919287   8.605350   8.158368   6.578729   9.630902
[19]   5.646106   8.331736
> colMax(tmp5)
 [1] 471.33396  84.41890  75.53881  80.27934  77.99568  87.56099  88.51805
 [8]  76.59057  81.50598  80.60397  82.11834  82.92470  86.26161  82.85303
[15]  87.41263  86.87905  74.86484  85.75540  78.54699  80.65554
> colMin(tmp5)
 [1] 53.94668 61.70029 56.74148 60.52434 54.09243 56.95732 60.74141 60.85343
 [9] 59.07179 56.30583 59.05334 59.05411 59.05896 57.96757 62.00684 57.29571
[17] 54.93771 57.44485 62.47583 53.62501
> 
> 
> ### 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]       NA 67.88732 68.72181 71.71379 68.26947 71.36572 71.91262 72.70402
 [9] 70.77387 71.96983
> rowSums(tmp5)
 [1]       NA 1357.746 1374.436 1434.276 1365.389 1427.314 1438.252 1454.080
 [9] 1415.477 1439.397
> rowVars(tmp5)
 [1] 29.08489 57.61951 73.89457 46.18187 91.05711 90.40505 45.44934 55.35007
 [9] 67.90583 59.69168
> rowSd(tmp5)
 [1] 5.393041 7.590752 8.596195 6.795725 9.542385 9.508157 6.741613 7.439763
 [9] 8.240499 7.726039
> rowMax(tmp5)
 [1]       NA 86.87905 86.26161 79.83530 83.39698 88.51805 81.30065 84.41890
 [9] 82.11834 87.56099
> rowMin(tmp5)
 [1]       NA 57.26576 54.09243 60.52434 53.94668 54.93771 53.62501 60.54762
 [9] 56.74148 60.57987
> 
> colMeans(tmp5)
 [1]       NA 72.68454 67.14074 71.24347 67.43756 68.91468 73.60553 69.05647
 [9] 69.24072 68.80018 70.55089 69.12067 71.86689 73.99697 76.06327 72.38103
[17] 67.52259 69.27393 70.43098 69.13094
> colSums(tmp5)
 [1]       NA 726.8454 671.4074 712.4347 674.3756 689.1468 736.0553 690.5647
 [9] 692.4072 688.0018 705.5089 691.2067 718.6689 739.9697 760.6327 723.8103
[17] 675.2259 692.7393 704.3098 691.3094
> colVars(tmp5)
 [1]       NA 54.57240 42.54428 41.84331 61.30695 97.96779 78.12736 32.83616
 [9] 62.81738 76.31915 62.59976 53.59922 80.01656 79.55369 74.05205 66.55897
[17] 43.27967 92.75427 31.87851 69.41782
> colSd(tmp5)
 [1]       NA 7.387313 6.522598 6.468641 7.829876 9.897868 8.838968 5.730285
 [9] 7.925742 8.736083 7.912001 7.321149 8.945198 8.919287 8.605350 8.158368
[17] 6.578729 9.630902 5.646106 8.331736
> colMax(tmp5)
 [1]       NA 84.41890 75.53881 80.27934 77.99568 87.56099 88.51805 76.59057
 [9] 81.50598 80.60397 82.11834 82.92470 86.26161 82.85303 87.41263 86.87905
[17] 74.86484 85.75540 78.54699 80.65554
> colMin(tmp5)
 [1]       NA 61.70029 56.74148 60.52434 54.09243 56.95732 60.74141 60.85343
 [9] 59.07179 56.30583 59.05334 59.05411 59.05896 57.96757 62.00684 57.29571
[17] 54.93771 57.44485 62.47583 53.62501
> 
> Max(tmp5,na.rm=TRUE)
[1] 88.51805
> Min(tmp5,na.rm=TRUE)
[1] 53.62501
> mean(tmp5,na.rm=TRUE)
[1] 70.20327
> Sum(tmp5,na.rm=TRUE)
[1] 13970.45
> Var(tmp5,na.rm=TRUE)
[1] 63.10309
> 
> rowMeans(tmp5,na.rm=TRUE)
 [1] 66.53060 67.88732 68.72181 71.71379 68.26947 71.36572 71.91262 72.70402
 [9] 70.77387 71.96983
> rowSums(tmp5,na.rm=TRUE)
 [1] 1264.081 1357.746 1374.436 1434.276 1365.389 1427.314 1438.252 1454.080
 [9] 1415.477 1439.397
> rowVars(tmp5,na.rm=TRUE)
 [1] 29.08489 57.61951 73.89457 46.18187 91.05711 90.40505 45.44934 55.35007
 [9] 67.90583 59.69168
> rowSd(tmp5,na.rm=TRUE)
 [1] 5.393041 7.590752 8.596195 6.795725 9.542385 9.508157 6.741613 7.439763
 [9] 8.240499 7.726039
> rowMax(tmp5,na.rm=TRUE)
 [1] 75.49701 86.87905 86.26161 79.83530 83.39698 88.51805 81.30065 84.41890
 [9] 82.11834 87.56099
> rowMin(tmp5,na.rm=TRUE)
 [1] 59.05334 57.26576 54.09243 60.52434 53.94668 54.93771 53.62501 60.54762
 [9] 56.74148 60.57987
> 
> colMeans(tmp5,na.rm=TRUE)
 [1] 65.09222 72.68454 67.14074 71.24347 67.43756 68.91468 73.60553 69.05647
 [9] 69.24072 68.80018 70.55089 69.12067 71.86689 73.99697 76.06327 72.38103
[17] 67.52259 69.27393 70.43098 69.13094
> colSums(tmp5,na.rm=TRUE)
 [1] 585.8300 726.8454 671.4074 712.4347 674.3756 689.1468 736.0553 690.5647
 [9] 692.4072 688.0018 705.5089 691.2067 718.6689 739.9697 760.6327 723.8103
[17] 675.2259 692.7393 704.3098 691.3094
> colVars(tmp5,na.rm=TRUE)
 [1] 44.48798 54.57240 42.54428 41.84331 61.30695 97.96779 78.12736 32.83616
 [9] 62.81738 76.31915 62.59976 53.59922 80.01656 79.55369 74.05205 66.55897
[17] 43.27967 92.75427 31.87851 69.41782
> colSd(tmp5,na.rm=TRUE)
 [1] 6.669931 7.387313 6.522598 6.468641 7.829876 9.897868 8.838968 5.730285
 [9] 7.925742 8.736083 7.912001 7.321149 8.945198 8.919287 8.605350 8.158368
[17] 6.578729 9.630902 5.646106 8.331736
> colMax(tmp5,na.rm=TRUE)
 [1] 77.59072 84.41890 75.53881 80.27934 77.99568 87.56099 88.51805 76.59057
 [9] 81.50598 80.60397 82.11834 82.92470 86.26161 82.85303 87.41263 86.87905
[17] 74.86484 85.75540 78.54699 80.65554
> colMin(tmp5,na.rm=TRUE)
 [1] 53.94668 61.70029 56.74148 60.52434 54.09243 56.95732 60.74141 60.85343
 [9] 59.07179 56.30583 59.05334 59.05411 59.05896 57.96757 62.00684 57.29571
[17] 54.93771 57.44485 62.47583 53.62501
> 
> # now set an entire row to NA
> 
> tmp5[which.row,] <- NA
> rowMeans(tmp5,na.rm=TRUE)
 [1]      NaN 67.88732 68.72181 71.71379 68.26947 71.36572 71.91262 72.70402
 [9] 70.77387 71.96983
> rowSums(tmp5,na.rm=TRUE)
 [1]    0.000 1357.746 1374.436 1434.276 1365.389 1427.314 1438.252 1454.080
 [9] 1415.477 1439.397
> rowVars(tmp5,na.rm=TRUE)
 [1]       NA 57.61951 73.89457 46.18187 91.05711 90.40505 45.44934 55.35007
 [9] 67.90583 59.69168
> rowSd(tmp5,na.rm=TRUE)
 [1]       NA 7.590752 8.596195 6.795725 9.542385 9.508157 6.741613 7.439763
 [9] 8.240499 7.726039
> rowMax(tmp5,na.rm=TRUE)
 [1]       NA 86.87905 86.26161 79.83530 83.39698 88.51805 81.30065 84.41890
 [9] 82.11834 87.56099
> rowMin(tmp5,na.rm=TRUE)
 [1]       NA 57.26576 54.09243 60.52434 53.94668 54.93771 53.62501 60.54762
 [9] 56.74148 60.57987
> 
> 
> # now set an entire col to NA
> 
> 
> tmp5[,which.col] <- NA
> colMeans(tmp5,na.rm=TRUE)
 [1]      NaN 72.37205 67.14504 71.74160 67.16477 68.82313 74.43143 69.96792
 [9] 70.37060 69.72519 71.82840 69.68971 71.52055 74.74420 76.83461 72.17416
[17] 68.34993 68.91001 71.10874 69.82451
> colSums(tmp5,na.rm=TRUE)
 [1]   0.0000 651.3484 604.3054 645.6744 604.4830 619.4081 669.8829 629.7113
 [9] 633.3354 627.5267 646.4556 627.2074 643.6849 672.6978 691.5115 649.5675
[17] 615.1494 620.1901 639.9787 628.4206
> colVars(tmp5,na.rm=TRUE)
 [1]        NA  60.29534  47.86211  44.28220  68.13319 110.11947  80.21946
 [8]  27.59486  56.30744  76.23300  52.06449  56.65626  88.66916  83.21635
[15]  76.61526  74.39741  40.98904 102.85863  30.69546  72.68333
> colSd(tmp5,na.rm=TRUE)
 [1]        NA  7.765008  6.918245  6.654488  8.254283 10.493783  8.956532
 [8]  5.253081  7.503828  8.731151  7.215572  7.527035  9.416431  9.122300
[15]  8.753014  8.625393  6.402268 10.141924  5.540348  8.525452
> colMax(tmp5,na.rm=TRUE)
 [1]     -Inf 84.41890 75.53881 80.27934 77.99568 87.56099 88.51805 76.59057
 [9] 81.50598 80.60397 82.11834 82.92470 86.26161 82.85303 87.41263 86.87905
[17] 74.86484 85.75540 78.54699 80.65554
> colMin(tmp5,na.rm=TRUE)
 [1]      Inf 61.70029 56.74148 60.52434 54.09243 56.95732 60.74141 63.15413
 [9] 61.28280 56.30583 61.72339 59.05411 59.05896 57.96757 62.00684 57.29571
[17] 54.93771 57.44485 62.47583 53.62501
> 
> 
> 
> 
> 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] 355.5917 368.1874 184.5059 237.1489 113.0802 124.6527 327.7818 110.8000
 [9] 287.9438 174.0502
> apply(copymatrix,1,var,na.rm=TRUE)
 [1] 355.5917 368.1874 184.5059 237.1489 113.0802 124.6527 327.7818 110.8000
 [9] 287.9438 174.0502
> 
> 
> 
> copymatrix <- matrix(rnorm(200,150,15),10,20)
> 
> tmp5[1:10,1:20] <- copymatrix
> which.row <- 1
> which.col  <- 3
> cat(which.row," ",which.col,"\n")
1   3 
> tmp5[which.row,which.col] <- NA
> copymatrix[which.row,which.col] <- NA
> 
> colVars(tmp5,na.rm=TRUE)-apply(copymatrix,2,var,na.rm=TRUE)
 [1] -2.842171e-14 -1.421085e-13 -2.842171e-14 -8.526513e-14  1.705303e-13
 [6]  0.000000e+00  5.684342e-14  2.273737e-13  1.705303e-13 -1.136868e-13
[11]  0.000000e+00 -4.263256e-14  5.684342e-14 -8.526513e-14  2.842171e-14
[16] -1.136868e-13 -5.684342e-14 -2.842171e-14  2.842171e-14 -8.526513e-14
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ## making sure these things agree
> ##
> ## first when there is no NA
> 
> 
> 
> agree.checks <- function(buff.matrix,r.matrix,err.tol=1e-10){
+ 
+   if (Max(buff.matrix,na.rm=TRUE) != max(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Max")
+   }
+   
+ 
+   if (Min(buff.matrix,na.rm=TRUE) != min(r.matrix,na.rm=TRUE)){
+     stop("No agreement in Min")
+   }
+ 
+ 
+   if (abs(Sum(buff.matrix,na.rm=TRUE)- sum(r.matrix,na.rm=TRUE)) > err.tol){
+ 
+     cat(Sum(buff.matrix,na.rm=TRUE),"\n")
+     cat(sum(r.matrix,na.rm=TRUE),"\n")
+     cat(Sum(buff.matrix,na.rm=TRUE) - sum(r.matrix,na.rm=TRUE),"\n")
+     
+     stop("No agreement in Sum")
+   }
+   
+   if (abs(mean(buff.matrix,na.rm=TRUE) - mean(r.matrix,na.rm=TRUE)) > err.tol){
+     stop("No agreement in mean")
+   }
+   
+   
+   if(abs(Var(buff.matrix,na.rm=TRUE) - var(as.vector(r.matrix),na.rm=TRUE)) > err.tol){
+     stop("No agreement in Var")
+   }
+   
+   
+ 
+   if(any(abs(rowMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,mean,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowMeans")
+   }
+   
+   
+   if(any(abs(colMeans(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,mean,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colMeans")
+   }
+   
+   
+   if(any(abs(rowSums(buff.matrix,na.rm=TRUE)  -  apply(r.matrix,1,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in rowSums")
+   }
+   
+   
+   if(any(abs(colSums(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,sum,na.rm=TRUE))> err.tol,na.rm=TRUE)){
+     stop("No agreement in colSums")
+   }
+   
+   ### this is to get around the fact that R doesn't like to compute NA on an entire vector of NA when 
+   ### computing variance
+   my.Var <- function(x,na.rm=FALSE){
+    if (all(is.na(x))){
+      return(NA)
+    } else {
+      var(x,na.rm=na.rm)
+    }
+ 
+   }
+   
+   if(any(abs(rowVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+   
+   
+   if(any(abs(colVars(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,my.Var,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in rowVars")
+   }
+ 
+ 
+   if(any(abs(rowMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+ 
+   if(any(abs(colMax(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,max,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMax")
+   }
+   
+   
+   
+   if(any(abs(rowMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,1,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+   
+ 
+   if(any(abs(colMin(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,min,na.rm=TRUE))  > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMin")
+   }
+ 
+   if(any(abs(colMedians(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,median,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colMedian")
+   }
+ 
+   if(any(abs(colRanges(buff.matrix,na.rm=TRUE) - apply(r.matrix,2,range,na.rm=TRUE)) > err.tol,na.rm=TRUE)){
+     stop("No agreement in colRanges")
+   }
+ 
+ 
+   
+ }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> for (rep in 1:20){
+   copymatrix <- matrix(rnorm(200,150,15),10,20)
+   
+   tmp5[1:10,1:20] <- copymatrix
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ## now lets assign some NA values and check agreement
+ 
+   which.row <- sample(1:10,1,replace=TRUE)
+   which.col  <- sample(1:20,1,replace=TRUE)
+   
+   cat(which.row," ",which.col,"\n")
+   
+   tmp5[which.row,which.col] <- NA
+   copymatrix[which.row,which.col] <- NA
+   
+   agree.checks(tmp5,copymatrix)
+ 
+   ## make an entire row NA
+   tmp5[which.row,] <- NA
+   copymatrix[which.row,] <- NA
+ 
+ 
+   agree.checks(tmp5,copymatrix)
+   
+   ### also make an entire col NA
+   tmp5[,which.col] <- NA
+   copymatrix[,which.col] <- NA
+ 
+   agree.checks(tmp5,copymatrix)
+ 
+   ### now make 1 element non NA with NA in the rest of row and column
+ 
+   tmp5[which.row,which.col] <- rnorm(1,150,15)
+   copymatrix[which.row,which.col] <- tmp5[which.row,which.col]
+ 
+   agree.checks(tmp5,copymatrix)
+ }
1   10 
10   19 
10   10 
2   20 
2   4 
5   4 
1   8 
1   6 
7   20 
4   16 
5   13 
9   15 
7   1 
9   5 
9   6 
8   16 
10   20 
7   16 
10   11 
10   11 
There were 50 or more warnings (use warnings() to see the first 50)
> 
> 
> ### now test 1 by n and n by 1 matrix
> 
> 
> err.tol <- 1e-12
> 
> rm(tmp5)
> 
> dataset1 <- rnorm(100)
> dataset2 <- rnorm(100)
> 
> tmp <- createBufferedMatrix(1,100)
> tmp[1,] <- dataset1
> 
> tmp2 <- createBufferedMatrix(100,1)
> tmp2[,1] <- dataset2
> 
> 
> 
> 
> 
> Max(tmp)
[1] 2.417376
> Min(tmp)
[1] -2.660976
> mean(tmp)
[1] 0.01289299
> Sum(tmp)
[1] 1.289299
> Var(tmp)
[1] 1.115033
> 
> rowMeans(tmp)
[1] 0.01289299
> rowSums(tmp)
[1] 1.289299
> rowVars(tmp)
[1] 1.115033
> rowSd(tmp)
[1] 1.055951
> rowMax(tmp)
[1] 2.417376
> rowMin(tmp)
[1] -2.660976
> 
> colMeans(tmp)
  [1]  0.0001716555 -1.1123469974  0.9955289074  0.8061189466 -0.2140858461
  [6] -1.7037060945  0.8335659989  1.6348803694 -1.7402864630 -1.0421178350
 [11] -0.2392219035  0.4963073812  0.6680026374  0.0491062914  0.2733146342
 [16]  1.6862833945 -2.6609762158  0.1839354897 -0.8658712726  0.1275455735
 [21]  0.9934897139 -0.5927182330 -0.2328934128 -0.8842722657  0.1364097354
 [26] -0.1025201952  1.2560290281 -0.5222068252 -1.0123585474 -0.0721353399
 [31]  1.9002531536  1.3243677189 -1.4760974557  0.0911169943 -1.8647294775
 [36] -0.0333755485 -0.6740405235 -0.3327681908  0.9025403852  2.4173761535
 [41]  0.4144889256 -0.0939542703  1.0468274250  0.5202244408  0.5353516187
 [46]  0.3678962542 -1.7236125420 -0.5853778480 -0.9593908498 -0.7995454732
 [51]  1.6543019709  1.6374073798  0.6422688997 -1.1285159250 -1.3677386282
 [56] -1.3215128180  0.2951557421 -0.4795361333  1.2394329782  0.1447285387
 [61]  0.9781803037  1.1885596948  0.4455660281 -0.2623740158  1.0162168535
 [66]  0.6299390588  0.3669093694  1.8617633738  0.1086311632 -0.8019194856
 [71] -0.8704316551  1.6259982486  0.3660692252 -0.1037310782 -1.9581659616
 [76]  1.2236212754  0.3400716072 -0.9649726244  0.0381478267 -1.4445827746
 [81] -0.9481165699  0.5273831440 -0.8094826115 -2.2627695388 -1.5671455483
 [86]  0.4467984998 -0.0079306311 -0.6259032108  1.3432303340 -0.2322955360
 [91]  0.4478114296  2.0797112013 -1.3346023614 -0.7751367073 -0.1407204898
 [96]  1.0034385887 -0.7977931595 -0.2088650485  1.1852664987  0.7464088524
> colSums(tmp)
  [1]  0.0001716555 -1.1123469974  0.9955289074  0.8061189466 -0.2140858461
  [6] -1.7037060945  0.8335659989  1.6348803694 -1.7402864630 -1.0421178350
 [11] -0.2392219035  0.4963073812  0.6680026374  0.0491062914  0.2733146342
 [16]  1.6862833945 -2.6609762158  0.1839354897 -0.8658712726  0.1275455735
 [21]  0.9934897139 -0.5927182330 -0.2328934128 -0.8842722657  0.1364097354
 [26] -0.1025201952  1.2560290281 -0.5222068252 -1.0123585474 -0.0721353399
 [31]  1.9002531536  1.3243677189 -1.4760974557  0.0911169943 -1.8647294775
 [36] -0.0333755485 -0.6740405235 -0.3327681908  0.9025403852  2.4173761535
 [41]  0.4144889256 -0.0939542703  1.0468274250  0.5202244408  0.5353516187
 [46]  0.3678962542 -1.7236125420 -0.5853778480 -0.9593908498 -0.7995454732
 [51]  1.6543019709  1.6374073798  0.6422688997 -1.1285159250 -1.3677386282
 [56] -1.3215128180  0.2951557421 -0.4795361333  1.2394329782  0.1447285387
 [61]  0.9781803037  1.1885596948  0.4455660281 -0.2623740158  1.0162168535
 [66]  0.6299390588  0.3669093694  1.8617633738  0.1086311632 -0.8019194856
 [71] -0.8704316551  1.6259982486  0.3660692252 -0.1037310782 -1.9581659616
 [76]  1.2236212754  0.3400716072 -0.9649726244  0.0381478267 -1.4445827746
 [81] -0.9481165699  0.5273831440 -0.8094826115 -2.2627695388 -1.5671455483
 [86]  0.4467984998 -0.0079306311 -0.6259032108  1.3432303340 -0.2322955360
 [91]  0.4478114296  2.0797112013 -1.3346023614 -0.7751367073 -0.1407204898
 [96]  1.0034385887 -0.7977931595 -0.2088650485  1.1852664987  0.7464088524
> 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.0001716555 -1.1123469974  0.9955289074  0.8061189466 -0.2140858461
  [6] -1.7037060945  0.8335659989  1.6348803694 -1.7402864630 -1.0421178350
 [11] -0.2392219035  0.4963073812  0.6680026374  0.0491062914  0.2733146342
 [16]  1.6862833945 -2.6609762158  0.1839354897 -0.8658712726  0.1275455735
 [21]  0.9934897139 -0.5927182330 -0.2328934128 -0.8842722657  0.1364097354
 [26] -0.1025201952  1.2560290281 -0.5222068252 -1.0123585474 -0.0721353399
 [31]  1.9002531536  1.3243677189 -1.4760974557  0.0911169943 -1.8647294775
 [36] -0.0333755485 -0.6740405235 -0.3327681908  0.9025403852  2.4173761535
 [41]  0.4144889256 -0.0939542703  1.0468274250  0.5202244408  0.5353516187
 [46]  0.3678962542 -1.7236125420 -0.5853778480 -0.9593908498 -0.7995454732
 [51]  1.6543019709  1.6374073798  0.6422688997 -1.1285159250 -1.3677386282
 [56] -1.3215128180  0.2951557421 -0.4795361333  1.2394329782  0.1447285387
 [61]  0.9781803037  1.1885596948  0.4455660281 -0.2623740158  1.0162168535
 [66]  0.6299390588  0.3669093694  1.8617633738  0.1086311632 -0.8019194856
 [71] -0.8704316551  1.6259982486  0.3660692252 -0.1037310782 -1.9581659616
 [76]  1.2236212754  0.3400716072 -0.9649726244  0.0381478267 -1.4445827746
 [81] -0.9481165699  0.5273831440 -0.8094826115 -2.2627695388 -1.5671455483
 [86]  0.4467984998 -0.0079306311 -0.6259032108  1.3432303340 -0.2322955360
 [91]  0.4478114296  2.0797112013 -1.3346023614 -0.7751367073 -0.1407204898
 [96]  1.0034385887 -0.7977931595 -0.2088650485  1.1852664987  0.7464088524
> colMin(tmp)
  [1]  0.0001716555 -1.1123469974  0.9955289074  0.8061189466 -0.2140858461
  [6] -1.7037060945  0.8335659989  1.6348803694 -1.7402864630 -1.0421178350
 [11] -0.2392219035  0.4963073812  0.6680026374  0.0491062914  0.2733146342
 [16]  1.6862833945 -2.6609762158  0.1839354897 -0.8658712726  0.1275455735
 [21]  0.9934897139 -0.5927182330 -0.2328934128 -0.8842722657  0.1364097354
 [26] -0.1025201952  1.2560290281 -0.5222068252 -1.0123585474 -0.0721353399
 [31]  1.9002531536  1.3243677189 -1.4760974557  0.0911169943 -1.8647294775
 [36] -0.0333755485 -0.6740405235 -0.3327681908  0.9025403852  2.4173761535
 [41]  0.4144889256 -0.0939542703  1.0468274250  0.5202244408  0.5353516187
 [46]  0.3678962542 -1.7236125420 -0.5853778480 -0.9593908498 -0.7995454732
 [51]  1.6543019709  1.6374073798  0.6422688997 -1.1285159250 -1.3677386282
 [56] -1.3215128180  0.2951557421 -0.4795361333  1.2394329782  0.1447285387
 [61]  0.9781803037  1.1885596948  0.4455660281 -0.2623740158  1.0162168535
 [66]  0.6299390588  0.3669093694  1.8617633738  0.1086311632 -0.8019194856
 [71] -0.8704316551  1.6259982486  0.3660692252 -0.1037310782 -1.9581659616
 [76]  1.2236212754  0.3400716072 -0.9649726244  0.0381478267 -1.4445827746
 [81] -0.9481165699  0.5273831440 -0.8094826115 -2.2627695388 -1.5671455483
 [86]  0.4467984998 -0.0079306311 -0.6259032108  1.3432303340 -0.2322955360
 [91]  0.4478114296  2.0797112013 -1.3346023614 -0.7751367073 -0.1407204898
 [96]  1.0034385887 -0.7977931595 -0.2088650485  1.1852664987  0.7464088524
> colMedians(tmp)
  [1]  0.0001716555 -1.1123469974  0.9955289074  0.8061189466 -0.2140858461
  [6] -1.7037060945  0.8335659989  1.6348803694 -1.7402864630 -1.0421178350
 [11] -0.2392219035  0.4963073812  0.6680026374  0.0491062914  0.2733146342
 [16]  1.6862833945 -2.6609762158  0.1839354897 -0.8658712726  0.1275455735
 [21]  0.9934897139 -0.5927182330 -0.2328934128 -0.8842722657  0.1364097354
 [26] -0.1025201952  1.2560290281 -0.5222068252 -1.0123585474 -0.0721353399
 [31]  1.9002531536  1.3243677189 -1.4760974557  0.0911169943 -1.8647294775
 [36] -0.0333755485 -0.6740405235 -0.3327681908  0.9025403852  2.4173761535
 [41]  0.4144889256 -0.0939542703  1.0468274250  0.5202244408  0.5353516187
 [46]  0.3678962542 -1.7236125420 -0.5853778480 -0.9593908498 -0.7995454732
 [51]  1.6543019709  1.6374073798  0.6422688997 -1.1285159250 -1.3677386282
 [56] -1.3215128180  0.2951557421 -0.4795361333  1.2394329782  0.1447285387
 [61]  0.9781803037  1.1885596948  0.4455660281 -0.2623740158  1.0162168535
 [66]  0.6299390588  0.3669093694  1.8617633738  0.1086311632 -0.8019194856
 [71] -0.8704316551  1.6259982486  0.3660692252 -0.1037310782 -1.9581659616
 [76]  1.2236212754  0.3400716072 -0.9649726244  0.0381478267 -1.4445827746
 [81] -0.9481165699  0.5273831440 -0.8094826115 -2.2627695388 -1.5671455483
 [86]  0.4467984998 -0.0079306311 -0.6259032108  1.3432303340 -0.2322955360
 [91]  0.4478114296  2.0797112013 -1.3346023614 -0.7751367073 -0.1407204898
 [96]  1.0034385887 -0.7977931595 -0.2088650485  1.1852664987  0.7464088524
> colRanges(tmp)
             [,1]      [,2]      [,3]      [,4]       [,5]      [,6]     [,7]
[1,] 0.0001716555 -1.112347 0.9955289 0.8061189 -0.2140858 -1.703706 0.833566
[2,] 0.0001716555 -1.112347 0.9955289 0.8061189 -0.2140858 -1.703706 0.833566
        [,8]      [,9]     [,10]      [,11]     [,12]     [,13]      [,14]
[1,] 1.63488 -1.740286 -1.042118 -0.2392219 0.4963074 0.6680026 0.04910629
[2,] 1.63488 -1.740286 -1.042118 -0.2392219 0.4963074 0.6680026 0.04910629
         [,15]    [,16]     [,17]     [,18]      [,19]     [,20]     [,21]
[1,] 0.2733146 1.686283 -2.660976 0.1839355 -0.8658713 0.1275456 0.9934897
[2,] 0.2733146 1.686283 -2.660976 0.1839355 -0.8658713 0.1275456 0.9934897
          [,22]      [,23]      [,24]     [,25]      [,26]    [,27]      [,28]
[1,] -0.5927182 -0.2328934 -0.8842723 0.1364097 -0.1025202 1.256029 -0.5222068
[2,] -0.5927182 -0.2328934 -0.8842723 0.1364097 -0.1025202 1.256029 -0.5222068
         [,29]       [,30]    [,31]    [,32]     [,33]      [,34]     [,35]
[1,] -1.012359 -0.07213534 1.900253 1.324368 -1.476097 0.09111699 -1.864729
[2,] -1.012359 -0.07213534 1.900253 1.324368 -1.476097 0.09111699 -1.864729
           [,36]      [,37]      [,38]     [,39]    [,40]     [,41]       [,42]
[1,] -0.03337555 -0.6740405 -0.3327682 0.9025404 2.417376 0.4144889 -0.09395427
[2,] -0.03337555 -0.6740405 -0.3327682 0.9025404 2.417376 0.4144889 -0.09395427
        [,43]     [,44]     [,45]     [,46]     [,47]      [,48]      [,49]
[1,] 1.046827 0.5202244 0.5353516 0.3678963 -1.723613 -0.5853778 -0.9593908
[2,] 1.046827 0.5202244 0.5353516 0.3678963 -1.723613 -0.5853778 -0.9593908
          [,50]    [,51]    [,52]     [,53]     [,54]     [,55]     [,56]
[1,] -0.7995455 1.654302 1.637407 0.6422689 -1.128516 -1.367739 -1.321513
[2,] -0.7995455 1.654302 1.637407 0.6422689 -1.128516 -1.367739 -1.321513
         [,57]      [,58]    [,59]     [,60]     [,61]   [,62]    [,63]
[1,] 0.2951557 -0.4795361 1.239433 0.1447285 0.9781803 1.18856 0.445566
[2,] 0.2951557 -0.4795361 1.239433 0.1447285 0.9781803 1.18856 0.445566
         [,64]    [,65]     [,66]     [,67]    [,68]     [,69]      [,70]
[1,] -0.262374 1.016217 0.6299391 0.3669094 1.861763 0.1086312 -0.8019195
[2,] -0.262374 1.016217 0.6299391 0.3669094 1.861763 0.1086312 -0.8019195
          [,71]    [,72]     [,73]      [,74]     [,75]    [,76]     [,77]
[1,] -0.8704317 1.625998 0.3660692 -0.1037311 -1.958166 1.223621 0.3400716
[2,] -0.8704317 1.625998 0.3660692 -0.1037311 -1.958166 1.223621 0.3400716
          [,78]      [,79]     [,80]      [,81]     [,82]      [,83]    [,84]
[1,] -0.9649726 0.03814783 -1.444583 -0.9481166 0.5273831 -0.8094826 -2.26277
[2,] -0.9649726 0.03814783 -1.444583 -0.9481166 0.5273831 -0.8094826 -2.26277
         [,85]     [,86]        [,87]      [,88]   [,89]      [,90]     [,91]
[1,] -1.567146 0.4467985 -0.007930631 -0.6259032 1.34323 -0.2322955 0.4478114
[2,] -1.567146 0.4467985 -0.007930631 -0.6259032 1.34323 -0.2322955 0.4478114
        [,92]     [,93]      [,94]      [,95]    [,96]      [,97]     [,98]
[1,] 2.079711 -1.334602 -0.7751367 -0.1407205 1.003439 -0.7977932 -0.208865
[2,] 2.079711 -1.334602 -0.7751367 -0.1407205 1.003439 -0.7977932 -0.208865
        [,99]    [,100]
[1,] 1.185266 0.7464089
[2,] 1.185266 0.7464089
> 
> 
> Max(tmp2)
[1] 1.452787
> Min(tmp2)
[1] -2.427384
> mean(tmp2)
[1] -0.09632259
> Sum(tmp2)
[1] -9.632259
> Var(tmp2)
[1] 0.668848
> 
> rowMeans(tmp2)
  [1] -0.286609266  0.893641421  0.781593061 -0.632480966  0.004358217
  [6] -1.486201955  0.790555941 -0.653392212  0.586120737 -1.142147104
 [11] -0.010686000  0.427629840  0.107780126 -0.734968832 -0.021970960
 [16] -1.094139019  0.117177975 -1.294543170  0.202981108 -1.415608583
 [21]  1.394461175 -0.774614221 -0.002175833 -0.046189318 -0.317027046
 [26] -0.192455061  0.287434139  0.339410323  0.025077494 -0.991494423
 [31] -0.137649140  0.140405482 -1.028861142 -0.908425141 -0.444082982
 [36] -0.022962047  1.303664029  1.086950574  0.250300305 -0.420089297
 [41]  0.093664987 -1.119064547 -0.554138053  0.775753794 -0.453211263
 [46] -0.152518671  0.006981694  1.004992638 -0.192256665  0.901661568
 [51]  0.115813043  0.384813019 -0.420913184  0.745737171 -0.567180670
 [56]  0.275609674 -0.090810997 -0.594167238  0.431173545  0.122783314
 [61]  0.637398682  0.644591894  0.788517441 -0.570086889  0.402385740
 [66]  1.137693337  0.446753717 -0.292658499  0.704575010  0.569189699
 [71] -0.572748274 -0.675354807 -0.658970239 -0.977253804 -1.906038360
 [76]  0.324012191  0.088028000 -0.585613672 -0.598197030  1.096846486
 [81] -0.815816033  1.442913291  1.452786733 -2.427383766 -0.582995551
 [86]  0.352082030 -0.794835776 -0.726878106 -2.266981121 -0.018086655
 [91]  0.357398461  0.194075046 -0.639583776 -0.153967397  1.193836006
 [96]  1.297008496 -0.840360618 -0.077293053 -2.295659545  0.318920706
> rowSums(tmp2)
  [1] -0.286609266  0.893641421  0.781593061 -0.632480966  0.004358217
  [6] -1.486201955  0.790555941 -0.653392212  0.586120737 -1.142147104
 [11] -0.010686000  0.427629840  0.107780126 -0.734968832 -0.021970960
 [16] -1.094139019  0.117177975 -1.294543170  0.202981108 -1.415608583
 [21]  1.394461175 -0.774614221 -0.002175833 -0.046189318 -0.317027046
 [26] -0.192455061  0.287434139  0.339410323  0.025077494 -0.991494423
 [31] -0.137649140  0.140405482 -1.028861142 -0.908425141 -0.444082982
 [36] -0.022962047  1.303664029  1.086950574  0.250300305 -0.420089297
 [41]  0.093664987 -1.119064547 -0.554138053  0.775753794 -0.453211263
 [46] -0.152518671  0.006981694  1.004992638 -0.192256665  0.901661568
 [51]  0.115813043  0.384813019 -0.420913184  0.745737171 -0.567180670
 [56]  0.275609674 -0.090810997 -0.594167238  0.431173545  0.122783314
 [61]  0.637398682  0.644591894  0.788517441 -0.570086889  0.402385740
 [66]  1.137693337  0.446753717 -0.292658499  0.704575010  0.569189699
 [71] -0.572748274 -0.675354807 -0.658970239 -0.977253804 -1.906038360
 [76]  0.324012191  0.088028000 -0.585613672 -0.598197030  1.096846486
 [81] -0.815816033  1.442913291  1.452786733 -2.427383766 -0.582995551
 [86]  0.352082030 -0.794835776 -0.726878106 -2.266981121 -0.018086655
 [91]  0.357398461  0.194075046 -0.639583776 -0.153967397  1.193836006
 [96]  1.297008496 -0.840360618 -0.077293053 -2.295659545  0.318920706
> 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.286609266  0.893641421  0.781593061 -0.632480966  0.004358217
  [6] -1.486201955  0.790555941 -0.653392212  0.586120737 -1.142147104
 [11] -0.010686000  0.427629840  0.107780126 -0.734968832 -0.021970960
 [16] -1.094139019  0.117177975 -1.294543170  0.202981108 -1.415608583
 [21]  1.394461175 -0.774614221 -0.002175833 -0.046189318 -0.317027046
 [26] -0.192455061  0.287434139  0.339410323  0.025077494 -0.991494423
 [31] -0.137649140  0.140405482 -1.028861142 -0.908425141 -0.444082982
 [36] -0.022962047  1.303664029  1.086950574  0.250300305 -0.420089297
 [41]  0.093664987 -1.119064547 -0.554138053  0.775753794 -0.453211263
 [46] -0.152518671  0.006981694  1.004992638 -0.192256665  0.901661568
 [51]  0.115813043  0.384813019 -0.420913184  0.745737171 -0.567180670
 [56]  0.275609674 -0.090810997 -0.594167238  0.431173545  0.122783314
 [61]  0.637398682  0.644591894  0.788517441 -0.570086889  0.402385740
 [66]  1.137693337  0.446753717 -0.292658499  0.704575010  0.569189699
 [71] -0.572748274 -0.675354807 -0.658970239 -0.977253804 -1.906038360
 [76]  0.324012191  0.088028000 -0.585613672 -0.598197030  1.096846486
 [81] -0.815816033  1.442913291  1.452786733 -2.427383766 -0.582995551
 [86]  0.352082030 -0.794835776 -0.726878106 -2.266981121 -0.018086655
 [91]  0.357398461  0.194075046 -0.639583776 -0.153967397  1.193836006
 [96]  1.297008496 -0.840360618 -0.077293053 -2.295659545  0.318920706
> rowMin(tmp2)
  [1] -0.286609266  0.893641421  0.781593061 -0.632480966  0.004358217
  [6] -1.486201955  0.790555941 -0.653392212  0.586120737 -1.142147104
 [11] -0.010686000  0.427629840  0.107780126 -0.734968832 -0.021970960
 [16] -1.094139019  0.117177975 -1.294543170  0.202981108 -1.415608583
 [21]  1.394461175 -0.774614221 -0.002175833 -0.046189318 -0.317027046
 [26] -0.192455061  0.287434139  0.339410323  0.025077494 -0.991494423
 [31] -0.137649140  0.140405482 -1.028861142 -0.908425141 -0.444082982
 [36] -0.022962047  1.303664029  1.086950574  0.250300305 -0.420089297
 [41]  0.093664987 -1.119064547 -0.554138053  0.775753794 -0.453211263
 [46] -0.152518671  0.006981694  1.004992638 -0.192256665  0.901661568
 [51]  0.115813043  0.384813019 -0.420913184  0.745737171 -0.567180670
 [56]  0.275609674 -0.090810997 -0.594167238  0.431173545  0.122783314
 [61]  0.637398682  0.644591894  0.788517441 -0.570086889  0.402385740
 [66]  1.137693337  0.446753717 -0.292658499  0.704575010  0.569189699
 [71] -0.572748274 -0.675354807 -0.658970239 -0.977253804 -1.906038360
 [76]  0.324012191  0.088028000 -0.585613672 -0.598197030  1.096846486
 [81] -0.815816033  1.442913291  1.452786733 -2.427383766 -0.582995551
 [86]  0.352082030 -0.794835776 -0.726878106 -2.266981121 -0.018086655
 [91]  0.357398461  0.194075046 -0.639583776 -0.153967397  1.193836006
 [96]  1.297008496 -0.840360618 -0.077293053 -2.295659545  0.318920706
> 
> colMeans(tmp2)
[1] -0.09632259
> colSums(tmp2)
[1] -9.632259
> colVars(tmp2)
[1] 0.668848
> colSd(tmp2)
[1] 0.8178313
> colMax(tmp2)
[1] 1.452787
> colMin(tmp2)
[1] -2.427384
> colMedians(tmp2)
[1] -0.02002881
> colRanges(tmp2)
          [,1]
[1,] -2.427384
[2,]  1.452787
> 
> 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.385317 -1.696232 -2.310919 -4.011976 -2.247620 -3.450515 -0.693716
 [8] -6.135904  2.092086  2.281296
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.8284573
[2,] -1.3947364
[3,] -0.6740742
[4,]  0.1211678
[5,]  0.7115466
> 
> rowApply(tmp,sum)
 [1] -3.56600167 -0.86139832 -0.05943374 -1.65776248 -1.12840364 -3.68702703
 [7] -2.50010624 -7.98762228 -1.04439544 -0.06666667
> rowApply(tmp,rank)[1:10,]
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    9    9    2    1    6    7    4    2    1     1
 [2,]    3    4    6    7    1   10    6    8    8     2
 [3,]    1    7   10   10    2    8    5    3    2     5
 [4,]    6    2    4    3    4    4    9    1    9     9
 [5,]    2    5    3    8    9    3   10    4   10     4
 [6,]   10    1    5    4    3    2    2    9    5    10
 [7,]    4    8    1    9   10    6    1    5    7     8
 [8,]    7    3    8    2    5    1    7    6    4     3
 [9,]    8    6    9    6    7    5    8   10    3     6
[10,]    5   10    7    5    8    9    3    7    6     7
> 
> tmp <- createBufferedMatrix(5,20)
> 
> tmp[1:5,1:20] <- rnorm(100)
> colApply(tmp,sum)
 [1]  3.6150041  1.7815654 -0.8118442  0.7895632  1.5834559 -1.8888294
 [7]  0.7416911 -0.7453709  2.0126971 -0.1473605  3.3432904  0.2496900
[13]  0.6701101  2.6959502 -2.2069993 -0.3484369 -0.7988308 -0.4058365
[19]  1.3243147 -1.6648340
> colApply(tmp,quantile)[,1]
           [,1]
[1,] -1.3113097
[2,]  0.2696706
[3,]  1.0176353
[4,]  1.3014074
[5,]  2.3376005
> 
> rowApply(tmp,sum)
[1]  0.8360593 -3.1403324  2.9510819  2.0286662  7.1135145
> rowApply(tmp,rank)[1:5,]
     [,1] [,2] [,3] [,4] [,5]
[1,]   18    2   12   17   20
[2,]    6   11   17   12   16
[3,]   11    3   11   10    6
[4,]    4   19    9    4   18
[5,]   14    7    1   18   19
> 
> 
> as.matrix(tmp)
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,]  1.3014074 -0.6733231  0.1298872 -0.8152776  0.4309196 -0.6745277
[2,] -1.3113097 -0.1295307 -1.1698484  1.0795168 -0.4606284 -0.2501262
[3,]  0.2696706  1.2243708  0.2128456  0.1173323 -1.5214103  0.6289059
[4,]  1.0176353  0.3622436  0.1398777 -0.8420695  1.2357125 -2.1743540
[5,]  2.3376005  0.9978048 -0.1246064  1.2500612  1.8988624  0.5812726
            [,7]       [,8]       [,9]       [,10]     [,11]       [,12]
[1,]  1.26828623 -2.3060254 -0.5100878  1.89448853 0.3959881  1.79799107
[2,] -0.15460889 -0.6565967  0.7200599  0.03860633 0.1415730 -0.17570150
[3,] -0.30838676  0.1549385  1.1819318 -1.04271389 1.3338086 -0.95181768
[4,] -0.13635279  2.5445896 -0.5304637 -1.75769095 0.8077817 -0.43293021
[5,]  0.07275334 -0.4822769  1.1512569  0.71994951 0.6641390  0.01214828
          [,13]      [,14]       [,15]      [,16]      [,17]       [,18]
[1,]  0.2353178  0.7108521 -1.10452148 -0.5250638  0.5272281 -0.15133533
[2,] -1.5589261  1.4076350 -0.01811991 -0.8567436  0.3962269 -0.03373229
[3,]  1.3578967 -0.9357836 -0.46669233 -0.7126596 -0.5065963  1.44788332
[4,]  0.4893358  0.6269640  0.14023108  1.4414695  0.6551668 -0.70146335
[5,]  0.1464859  0.8862827 -0.75789668  0.3045606 -1.8708563 -0.96718881
          [,19]       [,20]
[1,] -0.1558516 -0.94029289
[2,]  0.8108802 -0.95895805
[3,]  0.8402969  0.62726125
[4,] -0.8684605  0.01144354
[5,]  0.6974498 -0.40428786
> 
> 
> is.BufferedMatrix(tmp)
[1] TRUE
> 
> as.BufferedMatrix(as.matrix(tmp))
BufferedMatrix object
Matrix size:  5 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  800  bytes.
> 
> 
> 
> subBufferedMatrix(tmp,1:5,1:5)
BufferedMatrix object
Matrix size:  5 5 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  652  bytes.
Disk usage :  200  bytes.
> subBufferedMatrix(tmp,,5:8)
BufferedMatrix object
Matrix size:  5 4 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  566  bytes.
Disk usage :  160  bytes.
> subBufferedMatrix(tmp,1:3,)
BufferedMatrix object
Matrix size:  3 20 
Buffer size:  1 1 
Directory:    /home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests 
Prefix:       BM 
Mode: Col mode
Read Only: FALSE
Memory usage :  1.9  Kilobytes.
Disk usage :  480  bytes.
> 
> 
> rm(tmp)
> 
> 
> ###
> ### Testing colnames and rownames
> ###
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> 
> 
> colnames(tmp)
NULL
> rownames(tmp)
NULL
> 
> 
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> colnames(tmp)
 [1] "col1"  "col2"  "col3"  "col4"  "col5"  "col6"  "col7"  "col8"  "col9" 
[10] "col10" "col11" "col12" "col13" "col14" "col15" "col16" "col17" "col18"
[19] "col19" "col20"
> rownames(tmp)
[1] "row1" "row2" "row3" "row4" "row5"
> 
> 
> tmp["row1",]
           col1      col2       col3     col4       col5       col6      col7
row1 0.03403992 0.5998293 0.07021654 1.565429 -0.1296728 -0.5013215 -0.275512
            col8      col9      col10      col11      col12     col13
row1 -0.03143954 0.1150232 -0.2373856 -0.7597366 0.03376059 -2.536479
          col14     col15     col16      col17      col18      col19      col20
row1 -0.5204466 0.5683105 -3.140363 -0.9213595 -0.5054061 -0.8994129 -0.7285582
> tmp[,"col10"]
          col10
row1 -0.2373856
row2 -0.2374194
row3 -0.4123044
row4 -0.7525275
row5  0.1428915
> tmp[c("row1","row5"),]
           col1       col2        col3       col4       col5       col6
row1 0.03403992  0.5998293  0.07021654  1.5654288 -0.1296728 -0.5013215
row5 0.11604821 -0.3307741 -0.24702262 -0.1006433  0.5342055  0.2789323
          col7        col8        col9      col10      col11      col12
row1 -0.275512 -0.03143954  0.11502320 -0.2373856 -0.7597366 0.03376059
row5  0.262918  0.30989584 -0.06216696  0.1428915 -0.6108300 0.21201933
          col13      col14      col15      col16      col17      col18
row1 -2.5364790 -0.5204466  0.5683105 -3.1403631 -0.9213595 -0.5054061
row5  0.1999013 -0.7751341 -3.2962632  0.1919388  0.1491918  0.1638224
          col19       col20
row1 -0.8994129 -0.72855817
row5  2.1793563 -0.05062435
> tmp[,c("col6","col20")]
           col6       col20
row1 -0.5013215 -0.72855817
row2 -0.6222240 -0.90982927
row3  0.3434378  1.02197015
row4  0.4727103 -0.95827576
row5  0.2789323 -0.05062435
> tmp[c("row1","row5"),c("col6","col20")]
           col6       col20
row1 -0.5013215 -0.72855817
row5  0.2789323 -0.05062435
> 
> 
> 
> 
> tmp["row1",] <- rnorm(20,mean=10)
> tmp[,"col10"] <- rnorm(5,mean=30)
> tmp[c("row1","row5"),] <- rnorm(40,mean=50)
> tmp[,c("col6","col20")] <- rnorm(10,mean=75)
> tmp[c("row1","row5"),c("col6","col20")]  <- rnorm(4,mean=105)
> 
> tmp["row1",]
         col1     col2     col3     col4    col5     col6     col7     col8
row1 50.74032 50.44474 50.67906 50.08009 51.0756 103.8878 50.61643 49.90482
         col9    col10    col11   col12    col13    col14    col15    col16
row1 49.21658 49.06021 50.80097 48.7495 50.19381 49.29112 48.86139 49.33153
        col17    col18    col19    col20
row1 49.28574 49.97542 48.73368 104.7191
> tmp[,"col10"]
        col10
row1 49.06021
row2 31.98689
row3 28.82875
row4 29.20063
row5 50.27596
> tmp[c("row1","row5"),]
         col1     col2     col3     col4     col5     col6     col7     col8
row1 50.74032 50.44474 50.67906 50.08009 51.07560 103.8878 50.61643 49.90482
row5 50.15871 49.83733 49.78087 49.30063 48.64774 106.3940 49.15934 50.86738
         col9    col10    col11   col12    col13    col14    col15    col16
row1 49.21658 49.06021 50.80097 48.7495 50.19381 49.29112 48.86139 49.33153
row5 51.61187 50.27596 50.66103 49.5192 50.86487 50.05908 50.72564 48.83384
        col17    col18    col19    col20
row1 49.28574 49.97542 48.73368 104.7191
row5 49.80996 50.49158 48.13743 105.0176
> tmp[,c("col6","col20")]
          col6     col20
row1 103.88779 104.71911
row2  75.08834  73.60370
row3  73.88136  74.16440
row4  74.89865  74.91691
row5 106.39399 105.01762
> tmp[c("row1","row5"),c("col6","col20")]
         col6    col20
row1 103.8878 104.7191
row5 106.3940 105.0176
> 
> 
> subBufferedMatrix(tmp,c("row1","row5"),c("col6","col20"))[1:2,1:2]
         col6    col20
row1 103.8878 104.7191
row5 106.3940 105.0176
> 
> 
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> colnames(tmp) <- colnames(tmp,do.NULL=FALSE)
> 
> tmp[,"col13"]
          col13
[1,]  0.2522084
[2,]  0.5985040
[3,] -2.3256576
[4,] -1.5566506
[5,] -0.2113681
> tmp[,c("col17","col7")]
          col17       col7
[1,] -0.2344723 -0.6710813
[2,] -1.4561903 -2.6984436
[3,]  0.5371328  0.3138406
[4,]  0.2840325  0.6395346
[5,]  0.6949361  0.2434568
> 
> subBufferedMatrix(tmp,,c("col6","col20"))[,1:2]
           col6      col20
[1,] -0.3020467  0.5051151
[2,]  0.3807164 -1.2643969
[3,]  1.0672755  0.3802294
[4,]  2.3121314  1.3275274
[5,]  0.1459566 -1.4005814
> subBufferedMatrix(tmp,1,c("col6"))[,1]
           col1
[1,] -0.3020467
> subBufferedMatrix(tmp,1:2,c("col6"))[,1]
           col6
[1,] -0.3020467
[2,]  0.3807164
> 
> 
> 
> tmp <- createBufferedMatrix(5,20)
> tmp[1:5,1:20] <- rnorm(100)
> rownames(tmp) <- rownames(tmp,do.NULL=FALSE)
> 
> 
> 
> 
> subBufferedMatrix(tmp,c("row3","row1"),)[,1:20]
           [,1]       [,2]      [,3]     [,4]       [,5]      [,6]      [,7]
row3 -0.4266113  0.8871508 1.7914004 1.421271 -0.3410404  0.983416 -2.162014
row1  0.5518242 -0.5105342 0.3978156 0.517860  0.1279846 -1.240347  1.450374
           [,8]       [,9]      [,10]     [,11]     [,12]     [,13]      [,14]
row3 -0.4914388  0.4321313 -0.1004073 0.5715309 0.1896826 0.7884433 -0.8967671
row1  0.5557369 -0.4444988  1.7029391 1.8406338 0.9723500 0.4033071  1.2064365
          [,15]      [,16]      [,17]      [,18]     [,19]     [,20]
row3  0.5750743 -0.6724636 0.53165521 -0.7638709 0.8447884 0.4734609
row1 -0.3138201 -0.2483075 0.02284584 -0.8349960 0.7408355 0.7778577
> subBufferedMatrix(tmp,c("row2"),1:10)[,1:10]
           [,1]     [,2]       [,3]      [,4]      [,5]      [,6]       [,7]
row2 -0.3267938 2.748752 -0.1108153 -0.725768 -1.811537 -2.149372 -0.9280441
           [,8]      [,9]    [,10]
row2 -0.9085918 0.2272336 1.274358
> subBufferedMatrix(tmp,c("row5"),1:20)[,1:20]
          [,1]      [,2]     [,3]       [,4]      [,5]     [,6]      [,7]
row5 -2.478699 -1.128592 1.325416 -0.2175655 0.5607792 1.308845 0.3825645
           [,8]         [,9]      [,10]     [,11]     [,12]    [,13]    [,14]
row5 -0.1731538 0.0006784796 -0.4967558 0.7949922 -1.488366 0.817518 1.608117
          [,15]      [,16]      [,17]     [,18]      [,19]      [,20]
row5 -0.5788077 -0.5284256 -0.1014883 0.3380305 -0.8207585 -0.2695544
> 
> 
> 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: 0xaaaae26f8a50>
> is.ReadOnlyMode(tmp)
[1] TRUE
> 
> filenames(tmp)
 [1] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a31b6c5b12"
 [2] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a369d009d7"
 [3] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a35f950e22"
 [4] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a323ddbf53"
 [5] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a310b39269"
 [6] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a36830d1a" 
 [7] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a331c8dcaa"
 [8] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a3714944d3"
 [9] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a36ddd4950"
[10] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a3112b045c"
[11] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a31d9ecd56"
[12] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a319cdc517"
[13] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a3470d376d"
[14] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a3462fde1" 
[15] "/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests/BM2094a31cee75ed"
> 
> 
> ### 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: 0xaaaae57d28a0>
> MoveStorageDirectory(tmp,getwd(),full.path=TRUE)
<pointer: 0xaaaae57d28a0>
Warning message:
In dir.create(new.directory) :
  '/home/biocbuild/bbs-3.17-bioc/meat/BufferedMatrix.Rcheck/tests' already exists
> 
> 
> RowMode(tmp)
<pointer: 0xaaaae57d28a0>
> rowMedians(tmp)
  [1]  0.416374193 -0.302563532  0.222710132 -0.147747678  0.485512327
  [6]  0.076243067  0.086297015 -0.006274884 -0.220556759 -0.410861611
 [11]  0.132328122  0.219434667 -0.278366565 -0.550199324  0.520968844
 [16] -0.156845694  0.553490910  1.010709448 -0.383774860 -0.046737120
 [21]  0.213299358 -0.196126148  0.035192198  0.005855340 -0.225745990
 [26] -0.144123443 -0.376250781 -0.576639321 -0.264835446  0.040941583
 [31] -0.062530687  0.009779540 -0.075994111 -0.099084864 -0.156001269
 [36] -0.069296018 -0.049215361  0.019926483 -0.015228537  0.175125436
 [41] -0.095526782 -0.259738146 -0.722810420 -0.797344531  0.166816212
 [46]  0.478518495  0.624911204  0.186302782  0.223144670  0.460284666
 [51] -0.021687980  0.062523968  0.013339641  0.023615924 -0.029842992
 [56]  0.183414354  0.183126332  0.021866340  0.234486534  0.203031031
 [61] -0.239534011  0.351305722  0.100227611 -0.189991648 -0.261956438
 [66]  0.403038537 -0.067724648 -0.251116542 -0.221256856 -0.124865070
 [71] -0.065717933  0.223750548  0.109849806 -0.325691248 -0.466392292
 [76]  0.268560520 -0.325687282  0.490666945  0.033989356  0.652192036
 [81] -0.667762823  0.402146584  0.295026781 -0.623138799 -0.619308619
 [86] -0.620425852 -0.325610081 -0.148773982 -0.479533949  0.091322746
 [91] -0.321480587 -0.565669224  0.481434208  0.599483415 -0.489343306
 [96] -0.332552963  0.016130482  0.247023873 -0.426264563 -0.279770634
[101]  0.050792986 -0.054052473 -0.397870741 -0.471573127 -0.131126299
[106]  0.079619562  0.154918428  0.621939373  0.075505344  0.182480253
[111]  0.065785495  0.107567271  0.079003993  0.164708575  0.275863259
[116]  0.391093040  0.292631511 -0.029689627 -0.394732986  0.188179622
[121]  0.088910547 -0.627362633  0.328380812 -0.095912308 -0.104308126
[126] -0.196388154  0.218293802 -0.276469180 -0.558289850 -0.367393683
[131] -0.179248874 -0.029194864  0.169861580  0.111494858 -0.121670933
[136]  0.701971753  0.517480388 -0.375912330  0.137690697 -0.145985036
[141]  0.002857506 -0.274371614 -0.209510334 -0.501673243 -0.417982760
[146] -0.130808275 -0.308482656  0.054574602 -0.008193403  0.185335600
[151] -0.110056104  0.306818920  0.364976283 -0.235450143 -0.104122395
[156]  0.051678611  0.284475936  0.403721709  0.420513007  0.550055672
[161] -0.094074478 -0.262213534  0.345052334  0.348576280  0.284623705
[166]  0.338726847 -0.218669463 -0.519050866  0.105359447  0.468752839
[171]  0.163971885 -0.437694401 -0.428969817  0.203273252  0.020236063
[176] -0.192366503  0.148195364  0.143689426  0.406464642 -0.082892020
[181] -0.271379358  0.119317216  0.310983798 -0.233073886 -0.217128318
[186]  0.008751524  0.150953002 -0.430859292 -0.281110247  0.399785396
[191] -0.588495836  0.038436808  0.253568370 -0.136255530  0.452732474
[196]  0.265507563 -0.278625361  0.346757698 -0.002949260 -0.634949204
[201] -0.216501555 -0.088037118 -0.051004654  0.005518887  0.421813710
[206]  0.497754254  0.222578300 -0.190690652  0.259461119 -0.823784621
[211] -0.250375738 -0.401919105 -0.344070526  0.072332136 -0.021711573
[216]  0.038720392  0.142575385 -0.225713925  0.284378808  0.042453829
[221]  0.431948241  0.083758838 -0.099577234 -0.554370916  0.576892862
[226] -0.026804244  0.133539797  0.111303276 -0.191148508 -0.516261949
> 
> proc.time()
   user  system elapsed 
  2.000   1.294   3.306 

BufferedMatrix.Rcheck/tests/rawCalltesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

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

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

<pointer: 0xaaab12f919b0>
> .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: 0xaaab12f919b0>
> .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: 0xaaab12f919b0>
> .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: 0xaaab12f919b0>
> 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: 0xaaab114ff270>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab114ff270>
> .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: 0xaaab114ff270>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab114ff270>
> .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: 0xaaab114ff270>
> 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: 0xaaab11dc1750>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab11dc1750>
> .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: 0xaaab11dc1750>
> 
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaab11dc1750>
> .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: 0xaaab11dc1750>
> 
> .Call("R_bm_RowMode",P)
<pointer: 0xaaab11dc1750>
> .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: 0xaaab11dc1750>
> 
> .Call("R_bm_ColMode",P)
<pointer: 0xaaab11dc1750>
> .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: 0xaaab11dc1750>
> 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: 0xaaab13035300>
> .Call("R_bm_SetPrefix",P,"BufferedMatrixFile")
<pointer: 0xaaab13035300>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab13035300>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab13035300>
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2094ba61d47ff1" "BufferedMatrixFile2094ba6b1f2fe8"
> rm(P)
> dir(pattern="BufferedMatrixFile")
[1] "BufferedMatrixFile2094ba61d47ff1" "BufferedMatrixFile2094ba6b1f2fe8"
> 
> 
> P <- .Call("R_bm_Create",prefix,directory,1,1)
> .Call("R_bm_setRows",P,10)
[1] TRUE
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab138bcea0>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab138bcea0>
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaab138bcea0>
> .Call("R_bm_isReadOnlyMode",P)
[1] TRUE
> .Call("R_bm_ReadOnlyModeToggle",P)
<pointer: 0xaaab138bcea0>
> .Call("R_bm_isReadOnlyMode",P)
[1] FALSE
> .Call("R_bm_isRowMode",P)
[1] FALSE
> .Call("R_bm_RowMode",P)
<pointer: 0xaaab138bcea0>
> .Call("R_bm_isRowMode",P)
[1] TRUE
> .Call("R_bm_ColMode",P)
<pointer: 0xaaab138bcea0>
> .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: 0xaaab12027150>
> .Call("R_bm_AddColumn",P)
<pointer: 0xaaab12027150>
> 
> .Call("R_bm_getSize",P)
[1] 10  2
> .Call("R_bm_getBufferSize",P)
[1] 1 1
> .Call("R_bm_ResizeBuffer",P,5,5)
<pointer: 0xaaab12027150>
> 
> .Call("R_bm_getBufferSize",P)
[1] 5 5
> .Call("R_bm_ResizeBuffer",P,-1,5)
<pointer: 0xaaab12027150>
> 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: 0xaaab137f3c70>
> .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: 0xaaab137f3c70>
> rm(P)
> 
> proc.time()
   user  system elapsed 
  0.315   0.068   0.362 

BufferedMatrix.Rcheck/tests/Rcodetesting.Rout


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

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

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

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

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

Attaching package: 'BufferedMatrix'

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

    colMeans, colSums, rowMeans, rowSums

> 
> Temp <- createBufferedMatrix(100)
> dim(Temp)
[1] 100   0
> buffer.dim(Temp)
[1] 1 1
> 
> 
> proc.time()
   user  system elapsed 
  0.321   0.057   0.358 

Example timings