queryFiles: Paths to recordings or images

Description Usage Arguments Value Examples

Description

queryFiles returns paths to recordings, images or videos. For this function to work you need to be connected to madmex folder, this is because the function searches for existing files in the madmex directories.

Usage

1
2
3
queryFiles(database, file_type, state = "all", organization = "all",
  cgl_id = "all", year_visit = 2010:2016, month_visit = 1:12,
  photo = TRUE, video = TRUE, ultrasonic = FALSE, original = FALSE)

Arguments

database

Connection to an existing postgresql or sqlite database (as returned by src_postgres or src_sqlite.

file_type

String specifing which file paths should be retrieved, value should be "recordings" or "images" (includes images and videos from the camera trap).

organization

Character vector of organizations to include in the search (CONAFOR, CONANP, FMCN), defaults to "all".

cgl_id

Character vector of conglomerate ids to include in the searh, defaults to "all".

year_visit

Numeric vector indicating the year(s) to include in the search, defaults to 2014:2016.

month_visit

Numeric vector indicating the month(s) to include in the search, defaults to 1:12.

photo, video, ultrasonic

Binary variables, if file_type = "images", photo = FALSE, video = TRUE indicates to only search for videos, similarly video = FALSE, photo = TRUE excludes videos from results, defult sets both to TRUE. In case of recordings it is only possible to download one type of file (acoustic OR ultrasonic), defaults to download acoustic, this is ultrasonic = FALSE.

original

Indicates if a column with the original file name should be included in the results.

Value

A data.frame containing the following columns: file_type, state, institucion (organization), cgl_id (conglomerate id), date (date of visit), lat, lon (coordinates of the conglomerate), and archivo_nombre_original (if original = TRUE, the original file name).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# connect to sqlite database (snmb)
database <- dplyr::src_sqlite(system.file("extdata", "snmb.sqlite",
  package = "querysnmb"))
files_images_videos <- queryFiles(database, file_type = "images",
  cgl_id = "405", year_visit = 2014)
files_videos <- queryFiles(database, file_type = "images", cgl_id = "2286",
  year_visit = 2014, photo = FALSE)
files_acoustic <- queryFiles(database, file_type = "recordings",
  ultrasonic = FALSE, year_visit = 2014)
## Not run: 
# connect to postgreSQL database (snmb)
PASS_SNMB = Sys.getenv("PASS_SNMB")
database <- dplyr::src_postgres(dbname = "snmb", host = "dbms", user =
  "snmb", password = PASS_SNMB)
files_acoustic_name <- queryFiles(database, file_type = "recordings",
  ultrasonic = FALSE, year_visit = 2014, original = TRUE)

## End(Not run)

tereom/querysnmb documentation built on May 31, 2019, 8:39 a.m.