templateComment: Query or Set Template Cutoffs

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/templateComment.R

Description

Use this function to add or check comments to templates within template lists (corTemplateList or binTemplateList objects), scores (templateScores objects), or detection list (detectionList objects).

Usage

1
2
templateComment(object)
templateComment(object) <- value

Arguments

object

A binary or correlation template list (class binTemplateList or corTemplateList).

value

A character vector with the new comment.

Details

templateComment is an accessor function and templateComment <- is a replacement function.
For replacement, the value object should be as long as the number of templates in object (or the number selecting via indexing) unless it is a named vector (see Examples).

Value

For extraction, a numeric vector of the same length as object with comments. For replacement, the updated object.

Author(s)

Sasha D. Hafner

See Also

templateNames, templateCutoff, getTemplates

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
25
26
27
28
29
30
31
32
33
34
# Load data
data(btnw)
data(oven)

# Write Wave objects to file (temporary directory used here)
btnw.fp <- file.path(tempdir(), "btnw.wav")
oven.fp <- file.path(tempdir(), "oven.wav")
writeWave(btnw, btnw.fp)
writeWave(oven, oven.fp)

# Create four correlation templates
wct1 <- makeCorTemplate(btnw.fp, name = "w1")
wct2 <- makeCorTemplate(btnw.fp, t.lim = c(1.5, 2.1), frq.lim = c(4.2, 5.6), name = "w2")
oct1 <- makeCorTemplate(oven.fp, t.lim = c(1, 4), frq.lim = c(1, 11), name = "o1")
oct2 <- makeCorTemplate(oven.fp, t.lim = c(1, 4), frq.lim = c(1, 11), dens = 0.1, name = "o2")

# Combine all of them
ctemps <- combineCorTemplates(wct1, wct2, oct1, oct2)
ctemps

# Add a comment for two templates
templateComment(ctemps) <- c(w1 = "This is the best template so far.", 
                           o1 = "Should we drop the lowest syllable?")

# Add a default comment also
templateComment(ctemps) <- c(w1 = "This is the best template so far.", 
                           o1 = "Should we drop the lowest syllable?", 
                           default = "These templates have not been tested.")
# View comments
templateComment(ctemps)

# Clean up (only because these files were created in these examples)
file.remove(btnw.fp)
file.remove(oven.fp)

monitoR documentation built on May 1, 2019, 6:28 p.m.