Skip to content

Instantly share code, notes, and snippets.

@PietrH
Created January 23, 2026 09:11
Show Gist options
  • Select an option

  • Save PietrH/3170e2bc565d7c1b8e35b07090da3e75 to your computer and use it in GitHub Desktop.

Select an option

Save PietrH/3170e2bc565d7c1b8e35b07090da3e75 to your computer and use it in GitHub Desktop.
Example of etn without connection argument
library(etn)
# Creating a connection object will result in a warning and not result in a
# connection object
my_con <- connect_to_etn()
#> Warning: `connect_to_etn()` was deprecated in etn 2.3.0.
#> ℹ You will be prompted for credentials instead.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
class(my_con)
#> [1] "NULL"
get_animals(connection = my_con)
#> Error in get_animals(connection = my_con): unused argument (connection = my_con)
get_animals(my_con)
#> # A tibble: 29,170 × 66
#> animal_id animal_project_code tag_serial_number tag_type tag_subtype
#> <int> <chr> <chr> <chr> <chr>
#> 1 5923 2004_Gudena 1208 acoustic animal
#> 2 5924 2004_Gudena 1209 acoustic animal
#> 3 5915 2004_Gudena 7416 acoustic animal
#> 4 5916 2004_Gudena 7417 acoustic animal
#> 5 5917 2004_Gudena 7418 acoustic animal
#> 6 5918 2004_Gudena 7419 acoustic animal
#> 7 5919 2004_Gudena 7420 acoustic animal
#> 8 5920 2004_Gudena 7421 acoustic animal
#> 9 5921 2004_Gudena 7422 acoustic animal
#> 10 5922 2004_Gudena 7423 acoustic animal
#> # ℹ 29,160 more rows
#> # ℹ 61 more variables: acoustic_tag_id <chr>,
#> # acoustic_tag_id_alternative <chr>, scientific_name <chr>,
#> # common_name <chr>, aphia_id <int>, animal_label <chr>,
#> # animal_nickname <chr>, tagger <chr>, capture_date_time <dttm>,
#> # capture_location <chr>, capture_latitude <dbl>, capture_longitude <dbl>,
#> # capture_method <chr>, capture_depth <chr>, …
# Unnamed arguments will work
get_animals(5923,1208)
#> # A tibble: 1 × 66
#> animal_id animal_project_code tag_serial_number tag_type tag_subtype
#> <int> <chr> <chr> <chr> <chr>
#> 1 5923 2004_Gudena 1208 acoustic animal
#> # ℹ 61 more variables: acoustic_tag_id <chr>,
#> # acoustic_tag_id_alternative <chr>, scientific_name <chr>,
#> # common_name <chr>, aphia_id <int>, animal_label <chr>,
#> # animal_nickname <chr>, tagger <chr>, capture_date_time <dttm>,
#> # capture_location <chr>, capture_latitude <dbl>, capture_longitude <dbl>,
#> # capture_method <chr>, capture_depth <chr>,
#> # capture_temperature_change <chr>, release_date_time <dttm>, …
get_animals(animal_id = 5923, 1208)
#> # A tibble: 1 × 66
#> animal_id animal_project_code tag_serial_number tag_type tag_subtype
#> <int> <chr> <chr> <chr> <chr>
#> 1 5923 2004_Gudena 1208 acoustic animal
#> # ℹ 61 more variables: acoustic_tag_id <chr>,
#> # acoustic_tag_id_alternative <chr>, scientific_name <chr>,
#> # common_name <chr>, aphia_id <int>, animal_label <chr>,
#> # animal_nickname <chr>, tagger <chr>, capture_date_time <dttm>,
#> # capture_location <chr>, capture_latitude <dbl>, capture_longitude <dbl>,
#> # capture_method <chr>, capture_depth <chr>,
#> # capture_temperature_change <chr>, release_date_time <dttm>, …
# Named arguments will work
get_animals(animal_id = 5923, animal_project_code = "2004_Gudena")
#> # A tibble: 1 × 66
#> animal_id animal_project_code tag_serial_number tag_type tag_subtype
#> <int> <chr> <chr> <chr> <chr>
#> 1 5923 2004_Gudena 1208 acoustic animal
#> # ℹ 61 more variables: acoustic_tag_id <chr>,
#> # acoustic_tag_id_alternative <chr>, scientific_name <chr>,
#> # common_name <chr>, aphia_id <int>, animal_label <chr>,
#> # animal_nickname <chr>, tagger <chr>, capture_date_time <dttm>,
#> # capture_location <chr>, capture_latitude <dbl>, capture_longitude <dbl>,
#> # capture_method <chr>, capture_depth <chr>,
#> # capture_temperature_change <chr>, release_date_time <dttm>, …
# Running functions without arguments will work
list_acoustic_project_codes() |> length()
#> [1] 299
get_animals()
#> # A tibble: 29,170 × 66
#> animal_id animal_project_code tag_serial_number tag_type tag_subtype
#> <int> <chr> <chr> <chr> <chr>
#> 1 5923 2004_Gudena 1208 acoustic animal
#> 2 5924 2004_Gudena 1209 acoustic animal
#> 3 5915 2004_Gudena 7416 acoustic animal
#> 4 5916 2004_Gudena 7417 acoustic animal
#> 5 5917 2004_Gudena 7418 acoustic animal
#> 6 5918 2004_Gudena 7419 acoustic animal
#> 7 5919 2004_Gudena 7420 acoustic animal
#> 8 5920 2004_Gudena 7421 acoustic animal
#> 9 5921 2004_Gudena 7422 acoustic animal
#> 10 5922 2004_Gudena 7423 acoustic animal
#> # ℹ 29,160 more rows
#> # ℹ 61 more variables: acoustic_tag_id <chr>,
#> # acoustic_tag_id_alternative <chr>, scientific_name <chr>,
#> # common_name <chr>, aphia_id <int>, animal_label <chr>,
#> # animal_nickname <chr>, tagger <chr>, capture_date_time <dttm>,
#> # capture_location <chr>, capture_latitude <dbl>, capture_longitude <dbl>,
#> # capture_method <chr>, capture_depth <chr>, …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment