Learn R Programming

metabodecon (version 1.6.2)

convert_pos: Convert from unit A to unit B

Description

Converts positions/widths from unit A to unit B. If the direction of units A and B is reversed, the width's sign will be reversed as well. To keep widths strictly positive, wrap the result with abs().

Usage

convert_pos(xa, ya, yb)

convert_width(xa, ya, yb)

Value

A numeric vector of values converted from unit A to unit B.

Arguments

xa

A numeric vector specifying widths/positions in unit A.

ya, yb

A numeric vector specifying the positions of at least two points in unit A / unit B.

Author

2024-2025 Tobias Schmidt: initial version.

Examples

Run this code
ya <- c(244, 246, 248, 250, 252)
yb <- c(15, 10, 5, 0, -5)
convert_width(c(2, 4, 8), ya, yb)
convert_pos(c(247, 249), ya, yb)

Run the code above in your browser using DataLab