Skip to contents

Wraps periodic data from one specified range to the other in one line.

Usage

qwrap(object, ..., .group = NULL)

Arguments

object,

the object to wrap

...,

named formulas with the form from ~ to (see examples)

.group

optional group column (see wrap)

Details

qwrap is a shortcut to wrap(periodic(obejct, x = range_from), x = range_to)

Examples

x <- seq(0, 360 - 20, by = 20)
df <- data.frame(x = x, y = cos(x*pi/180))
qwrap(df, x = c(0, 360) ~ c(-180, 180))
#>         x          y
#> 10   -180 -1.0000000
#> 11   -160 -0.9396926
#> 12   -140 -0.7660444
#> 13   -120 -0.5000000
#> 14   -100 -0.1736482
#> 15    -80  0.1736482
#> 16    -60  0.5000000
#> 17    -40  0.7660444
#> 18    -20  0.9396926
#> 1       0  1.0000000
#> 2      20  0.9396926
#> 3      40  0.7660444
#> 4      60  0.5000000
#> 5      80  0.1736482
#> 6     100 -0.1736482
#> 7     120 -0.5000000
#> 8     140 -0.7660444
#> 9     160 -0.9396926
#> 10.1  180 -1.0000000