scaleTemplate: Pattern Templates Scaling

Description Usage Arguments Value Examples

View source: R/scaleTemplate.R

Description

Compute a list of scaled versions of pattern templates via linear interpolation.

Usage

1
scaleTemplate(template, template.vl)

Arguments

template

A list of numeric vectors. Each vector represents a distinct pattern template.

template.vl

A numeric vector. A grid of vector lengths that each element of template is to be linearly interpolated into.

Value

A list of lists of numeric vectors. Each element of the returned list is a list of pattern templates scaled according to a particular vector length. The number of elements in the returned list equals the length of template.vl.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## List of two distinct pattern templates
template <- list(sin(seq(0, 2 * pi, length.out = 100)),
                 cos(seq(0, 2 * pi, length.out = 100)))
## Vector which defines a grid of vector lengths to which each of
## the distinct pattern templates is scaled into
template.vl <- c(50, 100, 200)
## Compute list of rescaled versions of pattern templates
out <- scaleTemplate(template, template.vl)

## Plot 1st distinct pattern template, rescaled to different vector lengths
par(mfrow = c(2, 1))
plot(out[[3]][[1]], type = "l",
     main = "pattern: sin([0,2*pi]); different scales considered",
     ylab = "pattern", xlab = "output vector index")
lines(out[[2]][[1]], col = "red")
lines(out[[1]][[1]], col = "blue")

## Plot 2nd distinct pattern template, rescaled to different vector lengths
plot(out[[3]][[2]], type = "l",
     main = "pattern: cos([0,2*pi]); different scales considered",
     ylab = "pattern", xlab = "output vector index")
lines(out[[2]][[2]], col = "red")
lines(out[[1]][[2]], col = "blue")

neuroconductor-devel/adept documentation built on May 5, 2019, 9:19 a.m.