Learn R Programming

monitoR (version 1.2)

dbUploadAnno: Upload Spectrogram Annotations to an Acoustics Database

Description

Spectrogram annotations from viewSpec can be uploaded to tblAnnotations in an acoustics database. Annotations can be specified as either a file path to a csv document or as a data frame. The name of the survey to associate with the annotations must be identical to tblSurvey.fldSurveyName to properly link the annotations to the survey.

Usage

dbUploadAnno(annotations, survey, db.name = "acoustics", uid, 
             pwd, analyst = "", ...)

Value

Invoked for its side effect. Successful upload is marked by a report of the upload time; unsuccessful upload will report any errors encountered.

Arguments

annotations

Either a file path to a csv file or a data frame of annotations.

survey

Name of survey annotations belong to. Must match tblSurvey.fldSurveyName

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.

analyst

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

...

Additional arguments to RODBC::odbcConnect.

Author

Jon Katz

Details

dbUploadAnno 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. Annotations are expected to be formatted by (or as if by) viewSpec, so if another piece of software is recording the annotations the field order must be altered to match output of viewSpec.

See Also

viewSpec

Examples

Run this code
# Assumes 'MABI01_2010-05-22_054400_0_000.wav' is a survey in tblSurvey.fldSurveyName
# Assumes 'MABI01_2010-05-22_054400.csv' is a file of annotations belonging to the above survey

if (FALSE) {
#If using the 'acoustics' schema verbatim:
dbUploadAnno(
    annotations = "MABI01_2010-05-22_054400.csv", 
    survey = "MABI01_2010-05-22_054400_0_000.wav", 
    analyst = 1)

#'acoustics' schema, different database name:
dbUploadAnno(
    annotations = "MABI01_2010-05-22_054400.csv", 
    survey = "MABI01_2010-05-22_054400_0_000.wav", 
    db.name = "LocalSQLdb", 
    uid = "EntryOnly", 
    pwd = "07H23BBM", 
    analyst = 1)}

Run the code above in your browser using DataLab