View source: R/smoothContours.R
reformatAnchors | R Documentation |
Internal soundgen function.
reformatAnchors(anchors, normalizeTime = TRUE)
anchors |
a numeric vector of values or a list/dataframe with one column (value) or two columns (time and value) |
normalizeTime |
if TRUE, normalizes anchors$time values to range from 0 to 1 |
Checks that the anchors are formatted in a valid way and expands them to a standard dataframe with two columns: time and value. NB: works for all anchors except "noise", whose anchors have to be scaled by sylLen and are therefore processed directly in soundgen()
soundgen:::reformatAnchors(150)
soundgen:::reformatAnchors(c(150, 200, 220))
soundgen:::reformatAnchors(anchors = list(value=c(150, 200, 220)))
soundgen:::reformatAnchors(anchors = list(time = c(0, 10, 100),
value = c(150, 200, 220)))
# returns NA
soundgen:::reformatAnchors('aha')
## Not run:
# returns NA with a warning
soundgen:::reformatAnchors(anchors = list(time = c(0, .1, 1),
freq = c(150, 200, 220)))
# throws a warning and rearranges in order of time stamps
soundgen:::reformatAnchors(anchors = list(time = c(0, .8, .7, 1),
value = c(150, 200, 150, 220)))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.