dbUploadResult: Upload Detection Results to an Acoustics Database

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

View source: R/dbUploadResult.R

Description

Upload detection results (peaks or detections) from findPeaks directly to tblResult in an acoustics database.

Usage

1
2
dbUploadResult(detection.obj, which.one, what = "detections", db.name = "acoustics", 
               uid, pwd, analysis.type, analyst = "", ...)

Arguments

detection.obj

Object of class detectionList containing results from findPeaks.

which.one

Results from a single template can be selected for upload, or leave blank to upload results from all templates.

what

Character value of either "detections" (the default; peaks above the score cutoff) or "peaks" (all peaks regardless of score cutoff).

db.name

Name of the ODBC connector data source corresponding to the acoustics database.

uid

User ID to allow ODBC connector to connect to database, if not present in ODBC connector.

pwd

Password to allow ODBC connector to connect to database, if not present in ODBC connector.

analysis.type

Character value identifying analysis type, in c("BIN", "COR"). Some partial matching is performed.

analyst

Numerical key value corresponding to the user's tblPerson.pkPersonID value in the acoustics database.

...

Additional arguments to RODBC::odbcConnect.

Details

dbUploadResult assumes a database structure identical to that provided in the acoustics schema. If the username and password are present in the ODBC datasource they do not need to be provided. It is possible to store only the username in the datasource and enter a password, but the reverse will not work.

The value for analyst must be present in tblPeople.pkPeopleID for upload to succeed.

Value

Invoked for its side effect, which is to insert the detection results into tblResult in an acoustics database. Successful upload is marked by a report of the upload time; unsuccessful upload will report any errors encountered.

Author(s)

Jon Katz

See Also

findPeaks, getPeaks, getDetections

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
35
36
37
38
39
40
41
42
43
44
45
## Not run: 
## Not run, as it requires a database to receive the upload
# Load data
data(btnw)
data(survey)

# Write Wave objects to file (temporary directory used here)
btnw.fp <- file.path(tempdir(), "btnw.wav")
survey.fp <- file.path(tempdir(), "survey2010-12-31_120000_EST.wav")
writeWave(btnw, btnw.fp)
writeWave(survey, survey.fp)

# Template construction
b4 <- makeBinTemplate(
    btnw.fp, 
    frq.lim = c(2, 8), 
    select = "auto", 
    name = "b4", 
    buffer = 4, 
    amp.cutoff = -31, 
    binary = TRUE)

# Binary point matching
scores <- binMatch(survey = survey.fp, templates = b4, time.source = 'fileinfo')

# Isolate peaks
pks <- findPeaks(scores)

#If using the 'acoustics' schema verbatim:
dbUploadResult(detection.obj = pks, analysis.type = "BIN", analyst = 1)

#'acoustics' schema, different database name:
dbUploadResult(
    detection.obj = pks, 
    which.one = "b4", 
    what = "peaks", 
    db.name = "LocalSQLdb", 
    uid = "EntryOnly" , 
    pwd = "07H23BBM", 
    analysis.type = "BIN", 
    analyst = 1)
## End(Not run)
    
    
    

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