Learn R Programming

memuse (version 1.1)

Accessors: Accessors

Description

Accessor methods for slots of objects of class memuse.

Usage

## S3 method for class 'memuse':
size(x, as.is=TRUE)
  ## S3 method for class 'memuse':
as.numeric(x, ...)
  ## S3 method for class 'memuse':
unit(x)
  ## S3 method for class 'memuse':
unit.prefix(x)
  ## S3 method for class 'memuse':
unit.names(x)

Arguments

x
memuse object
as.is
logical; should the size be "as-is", or converted to bytes first.
...
Additional arguments; in this case, they are ignored.

Value

  • Returns a numeric value in the case of size(), and as.numeric(), otherwise a string is returned.

Details

These methods are mostly just syntactic sugar for ordinary S4 slot accessing. So for example, size(x) is no different semantically from calling x@size. There are two differences, however. The size() method has a parameter as.is which controls whether the return should be the raw value or the raw value converted to bytes first. For the latter, you should really use as.numeric instead, which is equivalent to calling size(x, as.is=FALSE).

See Also

memuse-class Replacers

Examples

Run this code
x <- mu(1e6)

size(x)
as.numeric(x)
unit(x)
unit.prefix(x)
unit.names(x)

Run the code above in your browser using DataLab