-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Milestone
Description
Suggested in camtraptor July 2023 coding sprint
get_n_obs()
returns the number of observations per deployment and species (unless species = NULL
)
library(camtraptor)
get_n_obs(mica, species = "Anas platyrhynchos")
#> There are 3 deployments without observations: 577b543a-2cf1-4b23-b6d2-cda7e2eac372, 62c200a9-0e03-4495-bcd8-032944f6f5a1 and 7ca633fa-64f8-4cfc-a628-6b0c419056d7
#> # A tibble: 4 × 3
#> deploymentID scientificName n
#> <chr> <chr> <int>
#> 1 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Anas platyrhynchos 4
#> 2 577b543a-2cf1-4b23-b6d2-cda7e2eac372 Anas platyrhynchos 0
#> 3 62c200a9-0e03-4495-bcd8-032944f6f5a1 Anas platyrhynchos 0
#> 4 7ca633fa-64f8-4cfc-a628-6b0c419056d7 Anas platyrhynchos 0
Created on 2023-07-13 with reprex v2.0.2
get_n_individuals()
returns the number of individuals (count sum) per deployment and species (unless species = NULL
)
library(camtraptor)
get_n_individuals(mica, species = "Anas platyrhynchos")
#> There are 3 deployments without observations: 577b543a-2cf1-4b23-b6d2-cda7e2eac372, 62c200a9-0e03-4495-bcd8-032944f6f5a1 and 7ca633fa-64f8-4cfc-a628-6b0c419056d7
#> # A tibble: 4 × 3
#> deploymentID scientificName n
#> <chr> <chr> <int>
#> 1 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Anas platyrhynchos 13
#> 2 577b543a-2cf1-4b23-b6d2-cda7e2eac372 Anas platyrhynchos 0
#> 3 62c200a9-0e03-4495-bcd8-032944f6f5a1 Anas platyrhynchos 0
#> 4 7ca633fa-64f8-4cfc-a628-6b0c419056d7 Anas platyrhynchos 0
Created on 2023-07-13 with reprex v2.0.2
We suggest to combine this behaviour into a single function n_observations()
that returns count characteristics per deployment and species. Filters are removed from the function, but supported by filters_
functions
n_observations(
package = NULL,
group_by = c("deploymentID", "scientificName") # this is the default, but can be changed by the user.
# The options should probably be limited to this default and "deploymentID",
# because the function needs to know what table to chose the column from
# ... removed, see filters
# species = "all" removed, see filters
# sex = NULL removed, see filters
# life_stage = NULL removed, see filters
# datapkg removed
)
The returned information would be:
deploymentID
scientificName (if part of group_by)
n_events # also useful, number of sequences/events of within the deployment (for this species)
n_observations # same as n of get_n_obs
n_individuals # same as n of get_n_individuals
Metadata
Metadata
Assignees
Labels
No labels