R: memuse Constructor

Constructor {memuse} | R Documentation

## memuse Constructor

### Description

Constructor for objects of class `memuse`.

### Usage

    mu(size, unit = .UNIT, unit.prefix = .PREFIX, unit.names = .NAMES)

    ## S4 method for signature 'ANY'
    mu(size = 0, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    ## S4 method for signature ''NULL''
    mu(size = 0, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    ## S4 method for signature 'numeric'
    mu(size = 0, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    ## S4 method for signature 'object_size'
    mu(size, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    ## S4 method for signature 'missing'
    mu(size = 0, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    memuse(size, unit = .UNIT, unit.prefix = .PREFIX, unit.names = .NAMES)

    ## S4 method for signature 'ANY'
    memuse(size = 0, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    ## S4 method for signature ''NULL''
    memuse(size = 0, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    ## S4 method for signature 'missing'
    memuse(size = 0, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    ## S4 method for signature 'numeric'
    memuse(size = 0, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

    ## S4 method for signature 'object_size'
    memuse(size, unit = .UNIT, unit.prefix = .PREFIX,
      unit.names = .NAMES)

### Arguments

`size` | `numeric`; indicates the unit-multiple number of bytes used by the object.
`unit` | `string`; the unit of storage, such as "MiB" or "MB", depending on prefix. Case is ignored.
`unit.prefix` | `string`; the unit prefix, namely IEC or SI. Case is ignored.
`unit.names` | `string`; control for whether the unit names should be printed out or their abbreviation should be used. Options are "long" and "short", respectively. Case is ignored.

### Details

For numeric objects, if the length is 1, then its value is used as the number of bytes. Otherwise, the object's memory usage in R is taken for the size parameter.

### Value

Returns a `memuse` class object.

### See Also

`memuse-class Accessors Converters`

### Examples

    ## Not run:
    ### The value passed as 'size' is the number of bytes
    x <- memuse(100, unit="kb")
    x

    y <- memuse(100, unit="kb", unit.prefix="SI")
    y

    ### Use the memory usage of object 'size'
    memuse(rnorm(1e4))

    ## End(Not run)

[Package memuse version 3.0-1 Index]