| dbDownload {monitoR} | R Documentation |
Retrieve Card-Recorder ID Values or Survey Names from a Database
Description
Convenience functions to execute a prewritten SQL query. Wrappers for RODBC::sqlQuery with no additional processing.
Usage
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 |
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 |
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
## 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)