as_rave_unit: Convert numeric number into print-friendly format

View source: R/units.R

as_rave_unitR Documentation

Convert numeric number into print-friendly format

Description

Convert numeric number into print-friendly format

Usage

as_rave_unit(x, unit, label = "")

Arguments

x

numeric or numeric vector

unit

the unit of x

label

prefix when printing x

Value

Still numeric, but print-friendly class

Examples


sp <- as_rave_unit(1024, 'GB', 'Hard-disk space is ')
print(sp, digits = 0)

sp - 12

as.character(sp)

as.numeric(sp)

# Vectorize
sp <- as_rave_unit(c(500,200), 'MB/s', c('Writing: ', 'Reading: '))
print(sp, digits = 0, collapse = '\n')


raveio documentation built on July 26, 2023, 5:29 p.m.