Version: 0.10.1
Depends: R (≥ 2.10.0)
Imports: R.methodsS3 (≥ 1.7.0), R.oo (≥ 1.23.0), R.utils (≥ 1.34.0)
Title: Methods for Accessing Huge Amounts of Data [deprecated]
Author: Henrik Bengtsson [aut, cre, cph]
Maintainer: Henrik Bengtsson <henrikb@braju.com>
Description: DEPRECATED. Do not start building new projects based on this package. Cross-platform alternatives are the following packages: bigmemory (CRAN), ff (CRAN), BufferedMatrix (Bioconductor). The main usage of it was inside the aroma.affymetrix package. (The package currently provides a class representing a matrix where the actual data is stored in a binary format on the local file system. This way the size limit of the data is set by the file system and not the memory.)
License: LGPL-2.1 | LGPL-3 [expanded from: LGPL (≥ 2.1)]
LazyLoad: TRUE
URL: https://github.com/HenrikBengtsson/R.huge
BugReports: https://github.com/HenrikBengtsson/R.huge/issues
NeedsCompilation: no
Packaged: 2024-01-24 05:44:26 UTC; henrik
Repository: CRAN
Date/Publication: 2024-01-24 06:22:45 UTC

Package R.huge

Description

This package has been deprecated. Do not start building new projects based on it.

DEPRECATED. Do not start building new projects based on this package. Cross-platform alternatives are the following packages: bigmemory (CRAN), ff (CRAN), BufferedMatrix (Bioconductor). The main usage of it was inside the aroma.affymetrix package. (The package currently provides a class representing a matrix where the actual data is stored in a binary format on the local file system. This way the size limit of the data is set by the file system and not the memory.)

Requirements

This package requires the following CRAN packages: R.methodsS3, R.oo and R.utils.

Installation and updates

To install this package, use install.packages("R.huge").

To get started

To get started, see:

  1. FileVector.

  2. FileMatrix.

How to cite this package

Please cite [1] below.

License

The releases of this package is licensed under LGPL version 2.1 or newer.

The development code of the packages is under a private licence (where applicable) and patches sent to the author fall under the latter license, but will be, if incorporated, released under the "release" license above.

References

[1] H. Bengtsson, The R.oo package - Object-Oriented Programming with References Using Standard R Code, In Kurt Hornik, Friedrich Leisch and Achim Zeileis, editors, Proceedings of the 3rd International Workshop on Distributed Statistical Computing (DSC 2003), March 20-22, Vienna, Austria. https://www.r-project.org/conferences/DSC-2003/Proceedings/

Author(s)

Henrik Bengtsson


Class representing a persistent array stored in a file

Description

Package: R.huge
Class AbstractFileArray

Object
~~|
~~+--AbstractFileArray

Directly known subclasses:
FileByteMatrix, FileByteVector, FileDoubleMatrix, FileDoubleVector, FileFloatMatrix, FileFloatVector, FileIntegerMatrix, FileIntegerVector, FileMatrix, FileShortMatrix, FileShortVector, FileVector

public static class AbstractFileArray
extends Object

Note that this is an abstract class, i.e. it is not possible to create an object of this class but only from one of its subclasses. For a vector data type, see FileVector. For a matrix data type, see FileMatrix.

Usage

AbstractFileArray(filename=NULL, path=NULL, storageMode=c("integer", "double"),
  bytesPerCell=1, dim=NULL, dimnames=NULL, dimOrder=NULL, comments=NULL,
  nbrOfFreeBytes=4096)

Arguments

filename

The name of the file storing the data.

path

An optional path where data should be stored.

storageMode

The storage mode() of the data elements.

bytesPerCell

The number of bytes each element (cell) takes up on the file system. If NULL, it is inferred from the storageMode argument.

dim

A numeric vector specifying the dimensions of the array.

dimnames

An optional list of dimension names.

dimOrder

The order of the dimensions.

comments

An optional character string of arbitrary length.

nbrOfFreeBytes

The number of "spare" bytes after the comments before the data section begins.

Details

The purpose of this class is to be able to work with large arrays in R without being limited by the amount of memory available. Data is kept on the file system and elements are read and written whenever queried.

Fields and Methods

Methods:

as.character Returns a short string describing the file array.
as.vector Returns the elements of a file array as an R vector.
clone Clones a file array.
close Closes a connection to the data file of the file array.
delete Deletes the file array from the file system.
dim Gets the dimension of the file array.
dimnames Gets the dimension names of a file array.
finalize Internal: Clean up when file array is deallocated from memory.
flush Internal: Flushes the write buffer.
getBasename Gets the basename (filename) of the data file.
getBytesPerCell Gets the number of bytes per element in a file array.
getCloneNumber Gets the clone number of the file array.
getComments Gets the comments for this file array.
getDataOffset Gets file position of the data section in a file array.
getDimensionOrder Gets the order of dimension.
getExtension Gets the filename extension of the file array.
getFileSize Gets the size of the file array.
getName Gets the name of the file array.
getPath Gets the path (directory) where the data file lives.
getPathname Gets the full pathname to the data file.
getSizeOfComments Gets the number of bytes the comments occupies.
getSizeOfData Gets the size of the data section in bytes.
getStorageMode Gets the storage mode of the file array.
isOpen Checks whether the data file of the file array is open or not.
length Gets the number of elements in a file array.
open Opens a connection to the data file of the file array.
readAllValues Reads all values in the file array.
readContiguousValues Reads sets of contiguous values in the file array.
readHeader Read the header of a file array data file.
readValues Reads individual values in the file array.
setComments Sets the comments for this file array.
writeAllValues Writes all values to a file array.
writeEmptyData Writes an empty data section to the data file of a file array.
writeHeader Writes the header of a file array to file.
writeHeaderComments -
writeValues Writes values to a file array.

Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

Maximum number of elements

It is only the header that is kept in memory, not the data, and therefore the maximum length of a array that can be allocate, is limited by the amount of available space on the file system. Since element names (optional) are stored in the header, these may also be a limiting factor.

Element names

The element names are stored in the header and are currently read and written to file one by one. This may slow down the performance substantially if the dimensions are large. For optimal opening performance, avoid names.

For now, do not change names after file has been allocated.

File format

The file format consist of a header section and a data section. The header contains information about the file format, the length and element names of the array, as well as data type (storage mode()), the size of each element. The data section, which follows immediately after the header section, consists of all data elements with non-assigned elements being pre-allocated with zeros.

For more details, see the source code.

Limitations

The size of the array in bytes is limited by the maximum file size of the file system. For instance, the maximum file size on a Windows FAT32 system is 4GB (2GB?). On Windows NTFS the limit is in practice ~16TB.

Author(s)

Henrik Bengtsson

References

[1] New Technology File System (NTFS), Wikipedia, 2006 https://en.wikipedia.org/wiki/NTFS.


Class representing a persistent matrix stored in a file

Description

Package: R.huge
Class FileMatrix

Object
~~|
~~+--AbstractFileArray
~~~~~~~|
~~~~~~~+--FileMatrix

Directly known subclasses:
FileByteMatrix, FileDoubleMatrix, FileFloatMatrix, FileIntegerMatrix, FileShortMatrix

public static class FileMatrix
extends AbstractFileArray

Usage

FileMatrix(..., nrow=NULL, ncol=NULL, rownames=NULL, colnames=NULL, byrow=FALSE)

Arguments

...

Arguments passed to AbstractFileArray.

nrow, ncol

The number of rows and columns of the matrix.

rownames, colnames

Optional row and column names.

byrow

If TRUE, data are stored row by row, otherwise column by column.

Details

The purpose of this class is to be able to work with large matrices in R without being limited by the amount of memory available. Matrices are kept on the file system and elements are read and written whenever queried. The purpose of the class is not to provide methods for full matrix operations, but instead to be able to work with subsets of the matrix at each time.

For more details, AbstractFileArray.

Fields and Methods

Methods:

[ -
[<- -
as.character Returns a short string describing the file matrix.
as.matrix Returns the elements of a file matrix as an R matrix.
colnames Gets the column names of a file matrix.
getByRow Checks if elements are stored row by row or not.
getColumnOffset -
getMatrixIndicies -
getOffset -
getRowOffset -
ncol Gets the number of columns of the matrix.
nrow Gets the number of rows of the matrix.
readFullMatrix -
readValues -
rowMeans Calculates the means for each row.
rowSums Calculates the sum for each row.
rownames Gets the row names of a file matrix.
writeValues -

Methods inherited from AbstractFileArray:
as.character, as.vector, clone, close, delete, dim, dimnames, finalize, flush, getBasename, getBytesPerCell, getCloneNumber, getComments, getDataOffset, getDimensionOrder, getExtension, getFileSize, getName, getPath, getPathname, getSizeOfComments, getSizeOfData, getStorageMode, isOpen, length, open, readAllValues, readContiguousValues, readHeader, readValues, setComments, writeAllValues, writeEmptyData, writeHeader, writeHeaderComments, writeValues

Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

Column by column or row by row?

If the matrix elements are to be accessed more often along rows, store data row by row, otherwise column by column.

Supported data types

The following subclasses implement support for various data types:

Author(s)

Henrik Bengtsson

Examples

library("R.utils")
verbose <- Arguments$getVerbose(TRUE)

pathname <- "example.Rmatrix"
if (isFile(pathname)) {
  file.remove(pathname)
  if (isFile(pathname)) {
    stop("File not deleted: ", pathname)
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create a new file matrix
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
verbose && enter(verbose, "Creating new matrix")
# The dimensions of the matrix
nrow <- 20
ncol <- 5
X <- FileByteMatrix(pathname, nrow=nrow, ncol=ncol, byrow=TRUE)
verbose && exit(verbose)

verbose && enter(verbose, "Filling it with data")
rows <- c(1:4,7:10)
cols <- c(1)
x <- 1:length(rows)
writeValues(X, rows=rows, cols=cols, values=x)
verbose && exit(verbose)

verbose && enter(verbose, "Getting data again")
y <- readValues(X, rows=rows, cols=cols)
verbose && exit(verbose)
stopifnot(all.equal(x,y))

verbose && enter(verbose, "Setting data using [i,j]")
i <- c(20:18, 13:15)
j <- c(3:2, 4:5)
n <- length(i) * length(j)
values <- 1:n
X[i,j] <- values
verbose && enter(verbose, "Validating")
print(X)
print(X[])
print(X[i,j])
stopifnot(all.equal(as.vector(X[i,j]), values))
verbose && exit(verbose)
verbose && exit(verbose)


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Open an already existing file matrix
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
verbose && enter(verbose, "Getting existing matrix")
Y <- FileByteMatrix(pathname)
verbose && exit(verbose)

print(Y[])
Y[5,1] <- 55
print(Y[])
print(X[])  # Note, X and Y refers to the same instance


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Clone a matrix
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Z <- clone(X)
Z[5,1] <- 66
print(Z[])
print(Y[])

# Remove clone again
delete(Z)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Close all matrices
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
close(X)
close(Y)

# Remove original matrix too
delete(X)

Class representing a persistent vector stored on file

Description

Package: R.huge
Class FileVector

Object
~~|
~~+--AbstractFileArray
~~~~~~~|
~~~~~~~+--FileVector

Directly known subclasses:
FileByteVector, FileDoubleVector, FileFloatVector, FileIntegerVector, FileShortVector

public static class FileVector
extends AbstractFileArray

Usage

FileVector(..., length=NULL, names=NULL)

Arguments

...

Arguments passed to AbstractFileArray.

length

The number of elements in the vector.

names

Optional element names.

Details

The purpose of this class is to be able to work with large vectors in R without being limited by the amount of memory available. Data is kept on the file system and elements are read and written whenever queried.

For more details, AbstractFileArray.

Fields and Methods

Methods:

[ -
[<- -
names Gets the element names of a file vector.

Methods inherited from AbstractFileArray:
as.character, as.vector, clone, close, delete, dim, dimnames, finalize, flush, getBasename, getBytesPerCell, getCloneNumber, getComments, getDataOffset, getDimensionOrder, getExtension, getFileSize, getName, getPath, getPathname, getSizeOfComments, getSizeOfData, getStorageMode, isOpen, length, open, readAllValues, readContiguousValues, readHeader, readValues, setComments, writeAllValues, writeEmptyData, writeHeader, writeHeaderComments, writeValues

Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

Supported data types

The following subclasses implement support for various data types:

Author(s)

Henrik Bengtsson

Examples

library("R.utils")
verbose <- Arguments$getVerbose(TRUE)

pathname <- "example.Rvector"
if (isFile(pathname)) {
  file.remove(pathname)
  if (isFile(pathname)) {
    stop("File not deleted: ", pathname)
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create a new file vector
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
verbose && enter(verbose, "Creating new vector")
# The length of the vector
length <- 1e6
X <- FileDoubleVector(pathname, length=length)
verbose && exit(verbose)
print(X)

verbose && enter(verbose, "Filling it with data")
idxs <- c(1:4,7:10)
x <- 1:length(idxs)
writeValues(X, indices=idxs, values=x)
verbose && exit(verbose)

verbose && enter(verbose, "Getting data again")
y <- readValues(X, indices=idxs)
verbose && exit(verbose)
stopifnot(all.equal(x,y))

verbose && enter(verbose, "Getting and setting data using [i,j]")
print(X[1:20])
i <- 13:15
X[i] <- 99:98
print(X[1:20])
verbose && exit(verbose)

delete(X)

rm(X)

Non-documented objects

Description

This page contains aliases for all "non-documented" objects that R CMD check detects in this package.

Almost all of them are generic functions that have specific document for the corresponding method coupled to a specific class. Other functions are re-defined by setMethodS3() to default methods. Neither of these two classes are non-documented in reality. The rest are deprecated methods.

Author(s)

Henrik Bengtsson


Assigns values to a subset of elements of a file matrix

Description

Assigns values to a subset of elements of a file matrix.

Usage

## S3 replacement method for class 'FileMatrix'
this[i, j] <- value

Arguments

i

A numeric vector or row indices.

j

A numeric vector or column indices.

value

Values to be assigned to the selected elements.

Value

Returns itself.

Author(s)

Henrik Bengtsson

See Also

*[(). For more information see FileMatrix.


Assigns values to a subset of elements of a file vector

Description

Assigns values to a subset of elements of a file vector.

Usage

## S3 replacement method for class 'FileVector'
this[i=NULL] <- value

Arguments

i

A numeric vector or element indices.

value

Values to be assigned to the selected elements.

Value

Returns itself.

Author(s)

Henrik Bengtsson

See Also

*[(). For more information see FileVector.


Gets a subset of elements of a file matrix

Description

Gets a subset of elements of a file matrix.

Usage

## S3 method for class 'FileMatrix'
this[i, j, drop=FALSE]

Arguments

i

A numeric vector or row indices.

j

A numeric vector or column indices.

drop

If TRUE, if only a single row or column is retrived, it is returned as a vector.

Value

Returns a matrix (or possibly a vector).

Author(s)

Henrik Bengtsson

See Also

*[<-(). For more information see FileMatrix.


Gets a subset of elements of a file vector

Description

Gets a subset of elements of a file vector.

Usage

## S3 method for class 'FileVector'
this[i=NULL]

Arguments

i

A numeric vector or element indices.

Value

Returns a vector.

Author(s)

Henrik Bengtsson

See Also

*[<-(). For more information see FileVector.


Returns a short string describing the file array

Description

Returns a short string describing the file array.

Usage

## S3 method for class 'AbstractFileArray'
as.character(x, ...)

Arguments

...

Not used.

Value

Returns a character string.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Returns a short string describing the file matrix

Description

Returns a short string describing the file matrix.

Usage

## S3 method for class 'FileMatrix'
as.character(x, ...)

Arguments

...

Not used.

Value

Returns a character string.

Author(s)

Henrik Bengtsson

See Also

For more information see FileMatrix.


Returns the elements of a file matrix as an R matrix

Description

Returns the elements of a file matrix as an R matrix, that is, imported into memory (if possible).

Usage

## S3 method for class 'FileMatrix'
as.matrix(x, ...)

Arguments

...

Not used.

Value

Returns a matrix.

Author(s)

Henrik Bengtsson

See Also

For more information see FileMatrix.


Returns the elements of a file array as an R vector

Description

Returns the elements of a file array as an R vector, that is, imported into memory (if possible).

Usage

## S3 method for class 'AbstractFileArray'
as.vector(x, mode="any")

Arguments

mode

Not used.

Value

Returns a vector.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Clones a file array

Description

Clones a file array including the file on the file system.

Usage

## S3 method for class 'AbstractFileArray'
clone(con, copyData=TRUE, ...)

Arguments

copyData

If TRUE, also the data file is copied, otherwise not.

...

Not used.

Value

Returns the new AbstractFileArray object.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Closes a connection to the data file of the file array

Description

Closes a connection to the data file of the file array.

Usage

## S3 method for class 'AbstractFileArray'
close(con, ...)

Arguments

...

Not used.

Value

Returns TRUE if the file was closed. If the file is not opened, an exception is thrown.

Author(s)

Henrik Bengtsson

See Also

*isOpen(). *open(). For more information see AbstractFileArray.


Gets the column names of a file matrix

Description

Gets the column names of a file matrix.

Usage

## S3 method for class 'FileMatrix'
colnames(this, ...)

Arguments

...

Not used.

Value

Returns a character vector, or NULL.

Author(s)

Henrik Bengtsson

See Also

*rownames(). For more information see FileMatrix.


Deletes the file array from the file system

Description

Deletes the file array from the file system. If the file array is open, it is first closed.

Usage

## S3 method for class 'AbstractFileArray'
delete(this, ...)

Arguments

...

Not used.

Value

Returns (invisibly) TRUE if the file was successfully deleted (or did not exist in the first place), otherwise FALSE.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the dimension of the file array

Description

Gets the dimension of the file array.

Usage

## S3 method for class 'AbstractFileArray'
dim(x)

Value

Returns a double vector of length two.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the dimension names of a file array

Description

Gets the dimension names of a file array.

Usage

## S3 method for class 'AbstractFileArray'
dimnames(x)

Value

Returns a character vector.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Internal: Clean up when file array is deallocated from memory

Description

Internal: Clean up when file array is deallocated from memory.

Usage

## S3 method for class 'AbstractFileArray'
finalize(this, ...)

Arguments

...

Not used.

Details

The finalizer of a file array makes sure to close the file connection, if it is open.

Value

Returns nothing.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Internal: Flushes the write buffer

Description

Internal: Flushes the write buffer.

Usage

## S3 method for class 'AbstractFileArray'
flush(con, ...)

Arguments

...

Not used.

Value

Returns nothing.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the basename (filename) of the data file

Description

Gets the basename (filename) of the data file.

Usage

## S3 method for class 'AbstractFileArray'
getBasename(this, ...)

Arguments

...

Not used.

Value

Returns a character string.

Author(s)

Henrik Bengtsson

See Also

*getPathname(). *getBasename(). For more information see AbstractFileArray.


Checks if elements are stored row by row or not

Description

Checks if elements are stored row by row or not.

Usage

## S3 method for class 'FileMatrix'
getByRow(this, ...)

Arguments

...

Not used.

Value

Returns TRUE if the elements are stored row by row, otherwise FALSE.

Author(s)

Henrik Bengtsson

See Also

For more information see FileMatrix.


Gets the number of bytes per element in a file array

Description

Gets the number of bytes per element in a file array.

Usage

## S3 method for class 'AbstractFileArray'
getBytesPerCell(this, ...)

Arguments

...

Not used.

Details

In R, an integer

Value

Returns an integer.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the clone number of the file array

Description

Gets the clone number of the file array.

Usage

## S3 method for class 'AbstractFileArray'
getCloneNumber(this, ...)

Arguments

...

Not used.

Value

Returns an integer.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the comments for this file array

Description

Gets the comments for this file array.

Usage

## S3 method for class 'AbstractFileArray'
getComments(this, ...)

Arguments

...

Not used.

Value

Returns a character vector.

Author(s)

Henrik Bengtsson

See Also

*setComments(). For more information see AbstractFileArray.


Gets file position of the data section in a file array

Description

Gets file position of the data section in a file array.

Usage

## S3 method for class 'AbstractFileArray'
getDataOffset(this, ...)

Arguments

...

Not used.

Value

Returns a double (since the largest integer is only 2147483648-1).

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the order of dimension

Description

Gets the order of dimension.

Usage

## S3 method for class 'AbstractFileArray'
getDimensionOrder(this, ...)

Arguments

...

Not used.

Value

Returns an numeric vector.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the filename extension of the file array

Description

Gets the filename extension of the file array.

Usage

## S3 method for class 'AbstractFileArray'
getExtension(this, ...)

Arguments

...

Not used.

Value

Returns a character string.

Author(s)

Henrik Bengtsson

See Also

*getName(). For more information see AbstractFileArray.


Gets the size of the file array

Description

Gets the size of the file array (in bytes).

Usage

## S3 method for class 'AbstractFileArray'
getFileSize(this, ...)

Arguments

...

Not used.

Value

Returns the number of bytes as a @number.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the name of the file array

Description

Gets the name of the file array from the filename of the data file.

Usage

## S3 method for class 'AbstractFileArray'
getName(this, ...)

Arguments

...

Not used.

Value

Returns a character string.

Author(s)

Henrik Bengtsson

See Also

*getBasename(). For more information see AbstractFileArray.


Gets the path (directory) where the data file lives

Description

Gets the path (directory) where the data file lives.

Usage

## S3 method for class 'AbstractFileArray'
getPath(this, ...)

Arguments

...

Not used.

Value

Returns a character string.

Author(s)

Henrik Bengtsson

See Also

*getPathname(). *getBasename(). For more information see AbstractFileArray.


Gets the full pathname to the data file

Description

Gets the full pathname to the data file.

Usage

## S3 method for class 'AbstractFileArray'
getPathname(this, ...)

Arguments

...

Not used.

Value

Returns a character string.

Author(s)

Henrik Bengtsson

See Also

*getPath(). *getBasename(). For more information see AbstractFileArray.


Gets the number of bytes the comments occupies

Description

Gets the number of bytes the comments occupies.

Usage

## S3 method for class 'AbstractFileArray'
getSizeOfComments(this, comments=this$header$comments, ...)

Arguments

comments

The comments to be measured.

...

Not used.

Value

Returns an integer.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Gets the size of the data section in bytes

Description

Gets the size of the data section in bytes.

Usage

## S3 method for class 'AbstractFileArray'
getSizeOfData(this, ...)

Arguments

...

Not used.

Value

Returns a double (since the largest integer is only 2147483648-1).

Author(s)

Henrik Bengtsson

See Also

*getBytesPerCell(). *length(). For more information see AbstractFileArray.


Gets the storage mode of the file array

Description

Gets the storage mode of the file array.

Usage

## S3 method for class 'AbstractFileArray'
getStorageMode(this, ...)

Arguments

...

Not used.

Value

Returns a character string.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Checks whether the data file of the file array is open or not

Description

Checks whether the data file of the file array is open or not.

Usage

## S3 method for class 'AbstractFileArray'
isOpen(this, ...)

Arguments

...

Not used.

Value

Returns nothing.

Author(s)

Henrik Bengtsson

See Also

*open(). *close(). For more information see AbstractFileArray.


Gets the number of elements in a file array

Description

Gets the number of elements in a file array.

Usage

## S3 method for class 'AbstractFileArray'
length(x)

Value

Returns a double (since the largest integer is only 2147483648-1).

Author(s)

Henrik Bengtsson

See Also

*dim(). For more information see AbstractFileArray.


Gets the element names of a file vector

Description

Gets the element names of a file vector.

Usage

## S3 method for class 'FileVector'
names(x, ...)

Arguments

...

Not used.

Value

Returns a character vector.

Author(s)

Henrik Bengtsson

See Also

For more information see FileVector.


Gets the number of columns of the matrix

Description

Gets the number of columns of the matrix.

Usage

## S3 method for class 'FileMatrix'
ncol(this, ...)

Arguments

...

Not used.

Value

Returns a double.

Author(s)

Henrik Bengtsson

See Also

For more information see FileMatrix.


Gets the number of rows of the matrix

Description

Gets the number of rows of the matrix.

Usage

## S3 method for class 'FileMatrix'
nrow(this, ...)

Arguments

...

Not used.

Value

Returns a double.

Author(s)

Henrik Bengtsson

See Also

For more information see FileMatrix.


Opens a connection to the data file of the file array

Description

Opens a connection to the data file of the file array.

Usage

## S3 method for class 'AbstractFileArray'
open(con, ...)

Arguments

...

Not used.

Value

Returns (invisibly) itself.

Author(s)

Henrik Bengtsson

See Also

*isOpen(). *close(). For more information see AbstractFileArray.


Reads all values in the file array

Description

Reads all values in the file array.

Usage

## S3 method for class 'AbstractFileArray'
readAllValues(this, mode=getStorageMode(this), size=getBytesPerCell(this),
  offset=getDataOffset(this), ..., .checkArgs=FALSE)

Arguments

mode

The storage mode to read.

size

The number of bytes each values allocates on file.

offset

The file offset to the first value on file.

...

Not used.

.checkArgs

If TRUE, arguments are validated, otherwise not.

Value

Returns a numeric vector.

Author(s)

Henrik Bengtsson

See Also

readValues(). For more information see AbstractFileArray.


Reads sets of contiguous values in the file array

Description

Reads sets of contiguous values in the file array. A set of contiguous values are values that are connecting without a break. It is much faster to read contiguous sequences at once than read each value separately.

Usage

## S3 method for class 'AbstractFileArray'
readContiguousValues(this, indices, lengths=1, mode=getStorageMode(this),
  size=getBytesPerCell(this), offset=getDataOffset(this), ..., .checkArgs=TRUE)

Arguments

indices

A numeric vector of start (first) indices in each of the contiguous sets.

lengths

A numeric vector specifying the length of each of the contiguous sets.

mode

The storage mode to read.

size

The number of bytes each values allocates on file.

offset

The file offset to the first value on file.

...

Not used.

.checkArgs

If TRUE, arguments are validated, otherwise not.

Value

Returns a numeric vector.

Author(s)

Henrik Bengtsson

See Also

*readAllValues() and readValues(). For more information see AbstractFileArray.


Read the header of a file array data file

Description

Read the header of a file array data file.

Usage

## S3 method for class 'AbstractFileArray'
readHeader(this, ...)

Arguments

...

Not used.

Value

Returns list structure.

Author(s)

Henrik Bengtsson

See Also

*writeHeader(). For more information see AbstractFileArray.


Reads individual values in the file array

Description

Reads individual values in the file array.

Usage

## S3 method for class 'AbstractFileArray'
readValues(this, indices=NULL, mode=getStorageMode(this), size=getBytesPerCell(this),
  offset=getDataOffset(this), order=FALSE, ..., .checkArgs=TRUE)

Arguments

indices

A numeric vector of indices.

mode

The storage mode to read.

size

The number of bytes each values allocates on file.

offset

The file offset to the first value on file.

...

Not used.

.checkArgs

If TRUE, arguments are validated, otherwise not.

Value

Returns a numeric vector.

Author(s)

Henrik Bengtsson

See Also

*readContiguousValues() and readValues(). For more information see AbstractFileArray.


Calculates the means for each row

Description

Calculates the means for each row.

Usage

## S3 method for class 'FileMatrix'
rowMeans(x, ..., doCount=FALSE)

Arguments

...

Arguments passed to *rowSums().

doCount

If TRUE, the number of included values are counted and returned as an attribute.

Value

Returns a numeric vector.

Author(s)

Henrik Bengtsson

See Also

*rowSums(). For more information see FileMatrix.


Calculates the sum for each row

Description

Calculates the sum for each row.

Usage

## S3 method for class 'FileMatrix'
rowSums(x, na.rm=FALSE, doCount=FALSE, rows=NULL, columns=NULL, ...)

Arguments

na.rm

If TRUE, NA values are excluded.

doCount

If TRUE, the number of included values are counted and returned as an attribute.

rows

An integer vector of rows for which the sum should be calculated. If NULL, all rows are considered.

columns

An integer vector of columns for which the sum should be calculated. If NULL, all columns are considered.

...

Not used.

Value

Returns a numeric vector.

Author(s)

Henrik Bengtsson

See Also

*rowMeans(). For more information see FileMatrix.


Gets the row names of a file matrix

Description

Gets the row names of a file matrix.

Usage

## S3 method for class 'FileMatrix'
rownames(this, ...)

Arguments

...

Not used.

Value

Returns a character vector, or NULL.

Author(s)

Henrik Bengtsson

See Also

*colnames(). For more information see FileMatrix.


Sets the comments for this file array

Description

Sets the comments for this file array.

Usage

## S3 method for class 'AbstractFileArray'
setComments(this, comments=NULL, ...)

Arguments

comments

A character vector of new comments.

...

Not used.

Value

Returns (invisibly) the old comments.

Author(s)

Henrik Bengtsson

See Also

*getComments(). For more information see AbstractFileArray.


Writes all values to a file array

Description

Writes all values to a file array.

Usage

## S3 method for class 'AbstractFileArray'
writeAllValues(this, values, mode=getStorageMode(this), size=getBytesPerCell(this),
  offset=getDataOffset(this), ...)

Arguments

values

A numeric vector of values to be assigned.

mode

The storage mode to be used.

size

A integer specifying the number of bytes per cell.

offset

A integer specifying the file offset of the data section.

...

Not used.

Value

Returns nothing.

Author(s)

Henrik Bengtsson

See Also

*writeValues(). For more information see AbstractFileArray.


Writes an empty data section to the data file of a file array

Description

Writes an empty data section to the data file of a file array.

Usage

## S3 method for class 'AbstractFileArray'
writeEmptyData(this, ...)

Arguments

...

Not used.

Value

Returns nothing.

Author(s)

Henrik Bengtsson

See Also

For more information see AbstractFileArray.


Writes the header of a file array to file

Description

Writes the header of a file array to file.

Usage

## S3 method for class 'AbstractFileArray'
writeHeader(this, ...)

Arguments

...

Not used.

Value

Returns nothing.

Author(s)

Henrik Bengtsson

See Also

*writeHeader(). For more information see AbstractFileArray.


Writes values to a file array

Description

Writes values to a file array.

Usage

## S3 method for class 'AbstractFileArray'
writeValues(this, indices=NULL, values, mode=getStorageMode(this),
  size=getBytesPerCell(this), offset=getDataOffset(this), order=FALSE, ...)

Arguments

indices

An integer vector of indices to be updated. If NULL, all cells are considered.

values

A numeric vector of values to be assigned.

mode

The storage mode to be used.

size

A integer specifying the number of bytes per cell.

offset

A integer specifying the file offset of the data section.

order

If TRUE, the data is reordered before being written.

...

Additional arguments passed to *writeAllValues().

Value

Returns nothing.

Author(s)

Henrik Bengtsson

See Also

*writeAllValues(). For more information see AbstractFileArray.