cueWindow {edl}R Documentation

Create a 'cue window', for overlapping or continuous cues.

Description

Create a 'cue window', for overlapping or continuous cues.

Usage

cueWindow(
  x,
  n = 1,
  step = 1,
  weights = NULL,
  min = 1,
  max = 100,
  round.values = TRUE,
  split = "_",
  premark = "",
  postmark = "",
  as.numeric = FALSE,
  dec = NULL
)

Arguments

x

A vector with numeric cues.

n

Numeric value specifying the window size. If n has two values, the first value indicates the left window size, and the second value the size of the right window.

step

Numeric value, indicating the difference between adjacent cues values. Set to 1 by default.

weights

A vector with weights (round numbers) for multiplying the elements within the window. Defaults to NULL (which will give all cues the same weight).

min

Numeric value specifying the lowest value on the scale. Defaults to 1.

max

Numeric value specifying the maximum value on the scale. Defaults to 100.

round.values

Logical, whether or not to round the values of x to multiples of step on the continuum between min and max. Defaults to TRUE.

split

String, specifying the cue separator. Default value is "_".

premark

String, specifying a character to add before each cue.

postmark

String, specifying a character to add after each cue.

as.numeric

Logical, whether or not to return the numeric values of the window as a list. Default is FALSE (return cue sets as a vector of strings).

dec

Number of decimals for rounding. Defaults to NULL (automatically determined).

Value

A vector of strings (default), or a list with vectors of numbers.

Author(s)

Jacolien van Rij

Examples

# generate random sample of cues on continuum of 1-10,
# with sep=1:
set.seed(123)
cues <- round(runif(20, min=0.5, max=10.5),1)

# Note that cues will be converted to rounded numbers
# as round.values=TRUE. With cue window of 3:
cueWindow(cues, n=3, max=10)
# step of 0.5 increases number of neighboring cues:
cueWindow(cues, n=3, max=10, step=.5)
# cue window of 5:
cueWindow(cues, n=5, max=10)
# asymmetrical window:
cueWindow(cues, n=c(2,1), max=10, step=.5)

# non-uniform weights:
cueWindow(cues, n=5, max=10, weights=c(1,2,3,2,1)) 
cueWindow(cues, n=2.5, max=10, step=.5, weights=c(1,2,3,2,1)) 
# left cues have stronger weights:
cueWindow(cues, n=5, max=10, weights=c(3,3,2,1,1))
# adjust weights, so that cue itself is not included:
cueWindow(cues, n=c(2,1), max=10, weights=c(1,1,0,1))
# premarking:
cueWindow(cues, n=2, max=10, weights=c(1,1,1), premark="stimulus")
# numeric output:
cueWindow(cues, n=2, max=10, weights=c(1,2,1), as.numeric=TRUE)


[Package edl version 1.1 Index]