Description Usage Arguments Details Value Author(s) See Also Examples
Read single templates stored on a local disk, or read in entire directories of templates.
1 2 |
files |
Optional named vector of file names. See details. |
dir |
Name of directory to read files from. Default is working directory. |
ext |
Extension of files that should be read in. Files in |
parallel |
Logical. |
These functions can be used in three different ways, in both cases combing all templates read in into a single template list.
By specifying a character vector of file names for files
, they will read in the named files, and assign names based on file names.
If files
is a named vector, the vector names will be used in the resulting template list.
Finally, if files
is not provided, the functions will read in all saved templates with the extension ext
.
An object of class TemplateList
containing either binary point templates or spectrogram cross-correlation templates.
Sasha D. Hafner
writeBinTemplates
,
writeCorTemplates
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 35 36 37 38 | # 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)
# Correlation example
# Create one 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)
## Not run:
# Write ctemps to a directory "templates"
writeCorTemplates(ctemps, dir = "templates")
# Read in all correlation templates in a directory "templates"
ctemps <- readCorTemplates(dir = "templates")
# Read in two specific files
ctemps <- readCorTemplates(files = c("o1.ct", "o2.ct"), dir = "templates")
# Read in two specific files, and give them names
ctemps <- readCorTemplates(files = c(oven1 = "o1.ct", oven2 = "o2.ct"), dir = "templates")
## End(Not run)
# Clean up (only because these files were created in these examples)
file.remove(btnw.fp)
file.remove(oven.fp)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.