Filter odkc_data to a given area_name.

filter_odkc_turtledata(
  data,
  area_name = NULL,
  username = NULL,
  verbose = wastdr::get_wastdr_verbose()
)

Arguments

data

(list) The output of data("odkc_data"), a list of tibbles and sf

area_name

(chr) The name of the area to filter the data by. Options:

  • NULL (default): do not filter data, return unfiltered data.

  • "All turtle programs": do not filter data, return unfiltered data.

  • "Other": Filter data to area_name NA.

  • Any name in unique(odkc_data$areas$area_name): return data filtered to this area_name.

username

(chr) The ODK Collect username to filter the data by. This is handy to investigate where and when a particular name was used. Default: NULL

verbose

Whether to show debug messages. Default: wastdr::get_wastdr_verbose()

Value

(list) The input data, optionally filtered to a subset of records.

Examples

data(odkc_data)

# All data
data_all <- filter_odkc_turtledata(odkc_data)
nrow(data_all$tracks)
#> [1] 100

# One area
area_names <- unique(odkc_data$areas$area_name)
area_names
#>  [1] "Scott Reef"            "Troughton Island"      "Browse Island"        
#>  [4] "Cape Domett"           "Smokey Bay Area"       "Lacepede Islands"     
#>  [7] "Cable Beach Broome"    "Roebuck Bay"           "Eco Beach"            
#> [10] "Eighty Mile Beach"     "Bedout Island"         "Mundabullangana"      
#> [13] "Port Hedland"          "Delambre Island"       "Montebello Islands"   
#> [16] "Rosemary Island"       "Conzinc Bay"           "Cape Lambert"         
#> [19] "Caravan Park"          "Barrow Island"         "Thevenard Island"     
#> [22] "Ningaloo"              "Onslow"                "Dirk Hartog Island"   
#> [25] "Perth Metro"           "Pendoley Headquarters"
data_area_1 <- filter_odkc_turtledata(odkc_data, area_name = "Cape Dommett")
nrow(data_area_1$tracks)
#> [1] 0
data_area_2 <- filter_odkc_turtledata(odkc_data, area_name = area_names[[2]])
nrow(data_area_2$tracks)
#> [1] 0


# Orphans
data_orphans <- filter_odkc_turtledata(odkc_data, area_name = "Other")
nrow(data_orphans)
#> NULL