cyclx: Generate Power Function, Stepped, and Cyclic Sequences

Description Usage Arguments Value Examples

View source: R/cyclx.R

Description

Generate Power Function, Stepped, and Cyclic Sequences

Usage

1
2
3
4
5
6
7
cyclx(from = 0, to = 1, n = 2, step.n = 1, exponent = 1,
  cyc.from = NULL, cyc.to = NULL, cyc.n = n, cyc.exponent = 1,
  operator = "*")

rampx(from = 0, to = 1, n = 2, exponent = 1)

stepx(from = 0, to = 1, n = 2, step.n = 1, exponent = 1)

Arguments

from

Numeric. Number to interpolate from. For cyclx(), first number in the trend.

to

Numeric. Number to interpolate to. For cyclx(), last number in the trend.

n

Numeric. Length of sequence. Equvalent of length.out in base::seq().

step.n

Numeric. Step length, in same units as n.

exponent

Numeric. Exponent of power function used to interpolate betwwen from and to.

cyc.from

Numeric. Number to interpolate from, for each cycle to be imposed on trend.

cyc.to

Numeric. Number to interpolate to, for each cycle to be imposed on trend.

cyc.n

Numeric. Length of cycle, in same units as n.

cyc.exponent

Numeric. Exponent of power function used to interpolate betwwen cyc.from and cyc.to.

operator

Character. "*" or "+". Operator used to impose cycles on trend. By default, cycles and trend are multiplied ("*").

Value

Numeric vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
s <- rampx(0,1,101)
stepped_s <- stepx(0,1,101,step.n = 10)
plot(s,type="l")
points(stepped_s,type="p",pch=20)

s <- rampx(0,1,101,exp=2)
stepped_s <- stepx(0,1,101,step.n = 20,exp=2)
plot(s,type="l")
points(stepped_s,type="p",pch=20)

s <- stepx(0,1,101,step.n=20)
cycled_s <- cyclx(0,1,101,step.n = 20,cyc.from=0.5,cyc.to=1,cyc.n=20,cyc.exponent = 1)
plot(cycled_s,type="p",pch=19,col="red",ylim=c(0,1))
points(s,type="p",pch=20)

stepped_s <- stepx(0,1,101,step.n = 20,exp=.5)
cycled_s <- cyclx(0,1,101,step.n = 20,exp=.5,cyc.from=0,cyc.to=1,cyc.n=20,cyc.exponent=1)
plot(cycled_s,type="p",pch=19,col="red")
points(stepped_s,type="p",pch=20)

stepped_s <- stepx(0,1,101,step.n=10,exp=2)
cycled_s <- cyclx(0,1,101,step.n=10,exp=2,cyc.from=0,cyc.to=1,cyc.n=10,cyc.exponent=2,operator="+")
plot(cycled_s,type="p",pch=19,col="red")
points(stepped_s,type="p",pch=20)

allopole/datacolor documentation built on May 4, 2019, 6:39 p.m.