Skip to contents

Get data for animals, with options to filter results. Associated tag information is available in columns starting with tag and acoustic_tag_id. If multiple tags are associated with a single animal, the information is comma-separated.

Usage

get_animals(
  connection = con,
  animal_id = NULL,
  tag_serial_number = NULL,
  animal_project_code = NULL,
  scientific_name = NULL
)

Arguments

connection

A connection to the ETN database. Defaults to con.

animal_id

Integer (vector). One or more animal identifiers.

tag_serial_number

Character (vector). One or more tag serial numbers.

animal_project_code

Character (vector). One or more animal project codes. Case-insensitive.

scientific_name

Character (vector). One or more scientific names.

Value

A tibble with animals data, sorted by animal_project_code, release_date_time and tag_serial_number. See also field definitions.

Examples

# Set default connection variable
con <- connect_to_etn()
#> Error: nanodbc/nanodbc.cpp:1135: 00000: [unixODBC][Driver Manager]Data source name not found and no default driver specified 

# Get all animals
get_animals(con)
#> Error in methods::is(connection, "PostgreSQL"): object 'con' not found

# Get specific animals
get_animals(con, animal_id = 305) # Or string value "305"
#> Error in methods::is(connection, "PostgreSQL"): object 'con' not found
get_animals(con, animal_id = c(304, 305, 2827))
#> Error in methods::is(connection, "PostgreSQL"): object 'con' not found

# Get animals from specific animal project(s)
get_animals(con, animal_project_code = "2014_demer")
#> Error in methods::is(connection, "PostgreSQL"): object 'con' not found
get_animals(con, animal_project_code = c("2014_demer", "2015_dijle"))
#> Error in methods::is(connection, "PostgreSQL"): object 'con' not found

# Get animals associated with a specific tag_serial_number
get_animals(con, tag_serial_number = "1187450")
#> Error in methods::is(connection, "PostgreSQL"): object 'con' not found

# Get animals of specific species (across all projects)
get_animals(con, scientific_name = c("Rutilus rutilus", "Silurus glanis"))
#> Error in methods::is(connection, "PostgreSQL"): object 'con' not found

# Get animals of a specific species from a specific project
get_animals(con, animal_project_code = "2014_demer", scientific_name = "Rutilus rutilus")
#> Error in methods::is(connection, "PostgreSQL"): object 'con' not found