Learn R Programming

memuse (version 4.2-3)

Converters: Converters

Description

Converter methods between memuse and base R objects.

Usage

as.memuse(x, ...)

# S4 method for numeric as.memuse(x, unit = "best", prefix = "IEC", names = "short")

# S4 method for object_size as.memuse(x, unit = "best", prefix = "IEC", names = "short")

# S4 method for character as.memuse(x, unit = "best", prefix = "IEC", names = "short")

# S4 method for memuse as.character(x, ...)

# S4 method for memuse as.numeric(x, ...)

Value

Returns a character, numeric, or memuse object, depending on the call.

Arguments

x

Numeric value, object_size data, or appropriate string (see details section for more information).

...

Additional arguments.

unit

string; the unit of storage, such as "MiB" or "MB", depending on prefix. Case is ignored.

prefix

string; the unit prefix, namely IEC or SI. Case is ignored.

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

These methods convert numeric, object_size, and string (character) objects to/from memuse objects.

as.numeric(x) for a memuse object x is just sugar for mu.size(x, as.is=FALSE)

Strings must be of the same form as the printed output of a a memuse object. For example, "100 KiB" is valid, but "100 (KiB)" is not. As always, case of the unit is ignored, and so "100 kib" would be valid as well.

See Also

memuse-class Accessors

Examples

Run this code
if (FALSE) {
as.memuse(10)
}

Run the code above in your browser using DataLab