wrap: Wraps data on a given range.

View source: R/activity_code.r

wrapR Documentation

Wraps data on a given range.

Description

Input data outside the given bounds (default radian [0, 2*pi]) are wrapped to appear within the range.

Usage

wrap(x, bounds = c(0, 2 * pi))

Arguments

x

A vector of numeric data.

bounds

The range within which to wrap x values

Details

As an example of wrapping, on bounds [0, 1], a value of 1.2 will be converted to 0.2, while a value of -0.2 will be converted to 0.8.

Value

A vector of numeric values within the limits defined by bounds

Examples

data(BCItime)
adjtime <- BCItime$time + 1/24
summary(adjtime)
adjtime <- wrap(adjtime, c(0,1))
summary(adjtime)

activity documentation built on Sept. 27, 2023, 9:08 a.m.

Related to wrap in activity...