matter_str-class {matter} | R Documentation

## Strings Stored on Disk

### Description

The `matter_str` class implements on-disk strings.

### Usage

    ## Instance creation
    matter_str(data, datamode = "uchar", paths = NULL,
                filemode = ifelse(all(file.exists(paths)), "rb", "rb+"),
                offset = c(0, cumsum(sizeof("uchar") * extent)[-length(extent)]),
                extent = nchar, nchar = 0, names = NULL,
                encoding = "unknown", ...)

    ## Additional methods documented below

### Arguments

`data` | An optional character vector which will be initially written to the data on disk if provided.
`datamode` | Must be "uchar" (or "raw") for strings.
`paths` | A 'character' vector of the paths to the files where the data are stored. If 'NULL', then a temporary file is created using `tempfile`.
`filemode` | The read/write mode of the files where the data are stored. This should be 'rb' for read-only access, or 'rb+' for read/write access.
`offset` | A vector giving the offsets in number of bytes from the beginning of each file in 'paths', specifying the start of the data to be accessed for each file.
`extent` | A vector giving the length of the data for each file in 'paths', specifying the number of elements of size 'datamode' to be accessed from each file.
`nchar` | A vector giving the length of each element of the character vector.
`names` | The names of the data elements.
`encoding` | The character encoding to use (if known).
`...` | Additional arguments to be passed to constructor.

### Value

An object of class `matter_str`.

### Slots

`data`:

  This slot stores the information about locations of the data on disk and within the files.

`datamode`:

  The storage mode of the accessed data when read into R. This is a 'character' vector of length one with value 'integer' or 'numeric'.

`paths`:

  A 'character' vector of the paths to the files where the data are stored.

`filemode`:

  The read/write mode of the files where the data are stored. This should be 'rb' for read-only access, or 'rb+' for read/write access.

`chunksize`:

  The maximum number of elements which should be loaded into memory at once. Used by methods implementing summary statistics and linear algebra. Ignored when explicitly subsetting the dataset.

`length`:

  The length of the data.

`dim`:

  Either 'NULL' for vectors, or an integer vector of length one of more giving the maximal indices in each dimension for matrices and arrays.

`names`:

  The names of the data elements for vectors.

`dimnames`:

  Either 'NULL' or the names for the dimensions. If not 'NULL', then this should be a list of character vectors of the length given by 'dim' for each dimension. This is always 'NULL' for vectors.

`ops`:

  Delayed operations to be applied on atoms.

`encoding`:

  The character encoding of the strings.

### Extends

`matter`

### Creating Objects

`matter_str` instances can be created through `matter_str()` or `matter()`.

### Methods

Standard generic methods:

`x[[i]], x[[i]] <- value`:

  Get or set the string elements of the vector.

`x[i, j], x[i, j] <- value`:

  Get or set `j` characters the `i`th string element of the vector.

`lengths(x)`:

  Get the number of characters (in bytes) of all string elements in the vector.

### Author(s)

Kylie A. Bemis

### See Also

`matter`

### Examples

    x <- matter_str(c("hello", "world!"))
    x[]

[Package matter version 1.6.0 Index]