BigMatrixFactor-class: Class '"BigMatrixFactor"'

Description Extends Methods Fields Class-Based Methods Author(s) See Also Examples

Description

The BigMatrixFactor class extends the BigMatrix class to add factor functionality. Data are stored as 32-bit or 8-bit integers on-disk depending on the number of levels. Reference Class methods are also provided in S4 style to give the familiar matrix and factor API (please see the examples below). Subsetting returns a integer matrix with the S3 class "factor" and an appropriate levels attribute.

Extends

Class "BigMatrix", directly.

All reference classes extend and inherit methods from "envRefClass".

Methods

S4-style methods supplement ReferenceClass methods to provide a standard factor API.

nlevels

signature(x = "BigMatrixFactor"): Query the number of levels, as in a typical factor.

levels

signature(x = "BigMatrixFactor"): Access the levels, as in a typical factor.

levels<-

signature(x = "BigMatrixFactor"): Set the levels, as in a typical factor. Disallowed for now.

Fields

bigmat:

Object of class activeBindingFunction Public access to the big.matrix object.

datapath:

Object of class activeBindingFunction Full file path to the big.matrix backing file.

descpath:

Object of class character Full file path to the big.matrix metadata file.

.bm:

Object of class big.matrix Private storage of the big.matrix object.

levels:

Object of class activeBindingFunction Public access to the levels.

.levels:

Object of class character Levels as in a typical factor.

Class-Based Methods

nlevels():

Check number of levels, as in a typical factor.

getValues(i, j, drop):

Getter for on-disk data. Returns a factor with the appropriate number of dimensions.

setValues(i, j, value):

Setter for on-disk data. Data converted to integer, matching to levels for character input.

The following methods are inherited (from the corresponding class): setValues ("BigMatrix"), getValues ("BigMatrix"), attach ("BigMatrix"), save ("BigMatrix")

Author(s)

Peter M. Haverty

See Also

See Also ReferenceClasses, BigMatrix, factor, BigMatrix, makeActiveBinding,filebacked.big.matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
showClass("BigMatrixFactor")
back.file = tempfile()
x = matrix( sample( 1:3, 9, replace=TRUE), ncol=3, dimnames=list(letters[1:3],LETTERS[1:3]))
ds = BigMatrixFactor(x,back.file,levels=c("AA","AB","BB"))
ds[1,3]
ds[3,3] = "AB"
ds[,]
nlevels(ds)
ds$nlevels()
levels(ds)
ds$levels

bigmemoryExtras documentation built on Nov. 8, 2020, 5:17 p.m.