get.big.matrix: Retrieve a big.matrix object

Description Usage Arguments Value Examples

View source: R/bigpca.R

Description

This function can load a big.matrix object using a big.matrix.descriptor object, the name of a description file, the name of a binary file containing a big.matrix.descriptor or if passed a big.matrix object, it will just return that object. Only the object or file name plus the directory containing the backing file are required.

Usage

1
get.big.matrix(fn, dir = "", verbose = FALSE)

Arguments

fn

the name of a description file, the name of a binary file containing a big.matrix.descriptor, a big.matrix object or a big.matrix.descriptor object.

dir

directory containing the backing file (if not the working directory)

verbose

whether to display information on method being used, or minor warnings

Value

Returns a big.matrix object, regardless of what method was used as reference/input

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# set up a toy example of a big.matrix 
orig.dir <- getwd(); setwd(tempdir()); # move to temporary dir
if(file.exists("test.bck")) { unlink(c("test.bck","test.dsc")) }
bM <- filebacked.big.matrix(20, 50,
       dimnames = list(paste("r",1:20,sep=""), paste("c",1:50,sep="")),
       backingfile = "test.bck",  backingpath = getwd(), descriptorfile = "test.dsc")
bM[1:20,] <- replicate(50,rnorm(20))
# Now have a big matrix which can be retrieved using this function in 4 ways:
d.bM <- describe(bM)
save(d.bM,file="fn.RData")
bM1 <- get.big.matrix("test.dsc")
bM2 <- get.big.matrix(d.bM)
bM3 <- get.big.matrix("fn.RData")
bM4 <- get.big.matrix(bM)
prv.big.matrix(bM)
prv.big.matrix(bM1)
prv.big.matrix(bM2)
prv.big.matrix(bM3)
prv.big.matrix(bM4)
rm(bM) 
unlink(c("fn.RData","test.bck","test.dsc"))
setwd(orig.dir)

bigpca documentation built on Nov. 22, 2017, 1:02 a.m.