dbDownload: Retrieve Card-Recorder ID Values or Survey Names from a...

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

Description

Convenience functions to execute a prewritten SQL query. Wrappers for RODBC::sqlQuery with no additional processing.

Usage

1
2
3
4
5
6
dbDownloadCardRecorderID(db.name = "acoustics", uid, pwd, 
                         date.deployed, date.collected, 
			 loc.prefix, ...)

dbDownloadSurvey(db.name = "acoustics", uid, pwd, start.date, 
                 end.date, loc.prefix, samp.rate, ext, ...)

Arguments

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.

date.deployed, date.collected, start.date, end.date

Dates to filter results, as a character string formatted to your database storage; in the example we use YYYY/MM/DD, but be aware that you may need to include a full timestamp: YYYY/MM/DD 00:00:00.

loc.prefix

Location prefix or vector of six-character prefixes by which to filter results.

samp.rate

Numerical sampling rate of surveys (Hz).

ext

Character file extension "wav" or "mp3".

...

Additional arguments to RODBC::odbcConnect.

Details

These functions assume a database structure identical to that provided in the acoustics schema. dbDownloadCardRecorderID may be used to look up CardRecorderID values before uploading survey metadata; dbDownloadSurvey may be used to generate a table of survey names to work through for batch detection with either corMatch or binMatch. 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.

Value

dbDownloadCardRecorderID returns a data frame with fields pkCardRecorderID, fldLocationNameAbbreviation, fldSerialNumber, and pkCardID. dbDownloadSurvey returns a data frame with a single field: fldSurveyName.

Note

These are convenience functions for users who are unfamiliar with SQL syntax and/or have not established an alternative front-end for their acoustics database. Users capable of doing so may find more utility and flexibility writing custom queries directly either with an alternative front-end or RODBC::sqlQuery. No processing is performed; data from the database is returned as it exists in the database.

Author(s)

Jon Katz

See Also

sqlQuery, dbDownloadTemplate, dbUploadSurvey

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
## Not run: 
#If using the 'acoustics' schema verbatim:
CRs <- dbDownloadCardRecorderID(
        date.deployed = "2012/05/22", 
        date.collected = "2012/05/29", 
        loc.prefix = "MABI01")
        
surveys <- dbDownloadSurvey(
        start.date = "2012/05/22", 
        end.date = "2012/05/29", 
        loc.prefix = "MABI01", 
        samp.rate = 24000, 
        ext = "wav")
        
#'acoustics' schema, different database name:
CRs <- dbDownloadCardRecorderID(
        db.name = "LocalSQLdb", 
        uid = "EntryOnly", 
        pwd = "07H23BBM", 
        date.deployed = "2012/05/22", 
        date.collected = "2012/05/29", 
        loc.prefix = "MABI01")
        
surveys <- dbDownloadSurvey(
        db.name = "LocalSQLdb", 
        uid = "EntryOnly", 
        pwd = "07H23BBM", 
        start.date = "2012/05/22", 
        end.date = "2012/05/29", 
        loc.prefix = "MABI01", 
        samp.rate = 24000, 
        ext = "wav")

## End(Not run)

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