Learn R Programming

monitoR (version 1.0.7)

combineTemplates: Combine Acoustic Template Lists

Description

Use these functions to combine any number of templates together into a larger template list. They can combine template lists that themselves contain any number of templates.

Usage

combineCorTemplates(...)

combineBinTemplates(...)

Arguments

Correlation or binary template lists (class '>corTemplateList or '>binTemplateList).

Value

A '>TemplateList object that contains all the templates submitted to the function.

Details

These functions are the only way to create template lists containing more than one template, and so should be used often. Only binTemplateList objects should be used with combineBinTemplates, and only corTemplateList objects should be used with combineCorTemplates. If you combine templates that use the same name, a suffix (.2) will be added to the later name.

See Also

makeCorTemplate, makeBinTemplate, templateNames

Examples

Run this code
# NOT RUN {
# First need to make some template lists to combine
# Load data
data(btnw)
data(oven)
data(survey)

# 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

# Binary templates are similar
# Create four templates
wbt1 <- makeBinTemplate(btnw.fp, amp.cutoff = -40, name = "w1")

wbt2 <- makeBinTemplate(btnw.fp, amp.cutoff = -30, t.lim = c(1.5, 2.1), 
                        frq.lim = c(4.2, 5.6), buffer = 2, name = "w2")

obt1 <- makeBinTemplate(oven.fp, amp.cutoff = -20, t.lim = c(1, 4), 
                        frq.lim = c(1, 11), name = "o1")

obt2 <- makeBinTemplate(oven.fp, amp.cutoff = -17, t.lim = c(1, 4), 
                        frq.lim = c(1, 11), buffer = 2, name = "o2")

# Combine all of them
btemps <- combineBinTemplates(wbt1, wbt2, obt1, obt2)
btemps

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

file.remove(oven.fp)
# }

Run the code above in your browser using DataLab