convert.numeric: Convert units.

View source: R/oop.R

convertR Documentation

Convert units.

Description

Convert units.

Usage

convert(x, ...)

## S3 method for class 'numeric'
convert(x, from = c("mm", "cm", "in"), to = c("mm", "cm", "in"), ...)

## S3 method for class 'figure'
convert(x, to = c("mm", "cm", "in"), ...)

Arguments

x

a numeric vector or a figure object.

...

extra arguments passed to methods.

from

the input unit.

to

the target unit.

Details

'convert()' is a S3 generic function with methods defined for numeric vectors and the 'figure' class.

Value

a numeric vector after the unit conversion or a 'figure' class object with the unit information altered.

Examples

convert(10, 'mm', 'cm')
convert(180, 'mm', 'in')
convert(7.086614, 'in', 'mm')

PiotrTymoszuk/figur documentation built on July 16, 2024, 1:15 a.m.