Learn R Programming

houba (version 0.1.0)

descriptor.file: Descriptor file

Description

Descriptor file

Usage

descriptor.file(object)

# S4 method for mmatrix descriptor.file(object)

# S4 method for mvector descriptor.file(object)

# S4 method for marray descriptor.file(object)

Value

None.

Arguments

object

a memory mapped object

Details

Creates a descriptor file, similar to the descriptor files of the package 'bigmemomry'. This descriptor allows to map the object with the package bigmemory, or the read.descriptor function in this package. Its name is obtained by appending ".desc' to the name of the file mapped by 'object'.

A method is available for marrays as well, but the resulting descriptor can't be read by 'bigmemory' as this package doesn't handle arrays. The function 'read.descriptor' in houba can read it.

See Also

read.descriptor

Examples

Run this code
A <- mmatrix("short", 10, 20)
A[] <- sample.int(200)

# create descriptor file 
dsc <- descriptor.file(A)

# linking file to other object
B <- read.descriptor(dsc, readonly = FALSE)
all(as.matrix(A) == as.matrix(B)) # TRUE

B[1:10] <- 0
all(A[1:10] == 0) # TRUE

Run the code above in your browser using DataLab