4 Filter & combine surveys
You may soon encounter the need to filter a processed cruz
object to only certain years, regions, or cruise numbers. You may also need to combine one processed cruz
object with another. The function below assist with these tasks.
Here we will continue with the cruz
object we created on the previous page. As a reminder, here is the data structure of that object:
cruz_structure(cruz)
"cruz" list structure ========================
$settings
$strata --- with 11 polygon coordinate sets
$survey --- with 15 input arguments
$cohorts --- with 3 cohorts specified, each with 19 input arguments
$strata
... containing a summary dataframe of 11 geostrata and their spatial areas
... geostratum names:
HI_EEZ, OtherCNP, MHI, WHICEAS, Spotted_OU, Spotted_FI, Spotted_BI, Bottlenose_KaNi, Bottlenose_OUFI, Bottlenose_BI, NWHI
$cohorts
$all
geostrata: WHICEAS, HI_EEZ, OtherCNP
$segments --- with 1457 segments (median = 149.5 km)
$das --- with 329638 data rows
$sightings --- with 3934 detections
$subgroups --- with 255 subgroups, 61 sightings, and 389 events
$bottlenose
geostrata: WHICEAS, HI_EEZ, OtherCNP, Bottlenose_BI, Bottlenose_OUFI, Bottlenose_KaNi
$segments --- with 1538 segments (median = 149.2 km)
$das --- with 329638 data rows
$sightings --- with 523 detections
$spotted
geostrata: WHICEAS, HI_EEZ, OtherCNP, Spotted_OU, Spotted_FI, Spotted_BI
$segments --- with 1540 segments (median = 149.1 km)
$das --- with 329638 data rows
$sightings --- with 527 detections
Filter
LTabundR
lets you filter a cruz
object using the function filter_cruz()
.
For example, in our WHICEAS case study, we processed surveys from 1986 - 2020, which we needed to do to model our detection functions, but our interest for mapping is specifically valid effort in 2017 and 2020 only, and only within the "WHICEAS"
geostratum.
We will use this filtered cruz
object for mapping & sightings summaries downstream.
Note that filter_cruz()
has many other filter options. See ?filter_cruz()
for details.
Combine
Say you have two processed cruz
objects: one containing survey effort from the Hawaiian EEZ (HI_EEZ
) geostratum area only, and one containing survey effort from everywhere else that does not include HI_EEZ
effort.
Let’s make those fake datasets right now, using filter_cruz()
:
Hawaiian EEZ-only data:
Outside Hawaiian EEZ-only data:
Say you want to combine these datasets together in order to reconstruct the equivalent of our original cruz
object. You can do this with the LTabundR
function, cruz_combine()
.
# Make a list of cruz objects
cruzes <- list(cruz_hi, cruz_other)
# Now combine
cruz_demo <- cruz_combine(cruzes)
Re-constituted data structure:
cruz_structure(cruz_demo)
"cruz" list structure ========================
$settings
$strata --- with 11 polygon coordinate sets
$survey --- with 15 input arguments
$cohorts --- with 3 cohorts specified, each with 19 input arguments
$strata
... containing a summary dataframe of 11 geostrata and their spatial areas
... geostratum names:
HI_EEZ, OtherCNP, MHI, WHICEAS, Spotted_OU, Spotted_FI, Spotted_BI, Bottlenose_KaNi, Bottlenose_OUFI, Bottlenose_BI, NWHI
$cohorts
$all
geostrata: WHICEAS, HI_EEZ, OtherCNP
$segments --- with 1429 segments (median = 149.6 km)
$das --- with 233421 data rows
$sightings --- with 3097 detections
$subgroups --- with 250 subgroups, 60 sightings, and 381 events
$bottlenose
geostrata: WHICEAS, HI_EEZ, OtherCNP, Bottlenose_BI, Bottlenose_OUFI, Bottlenose_KaNi
$segments --- with 1512 segments (median = 149.3 km)
$das --- with 233421 data rows
$sightings --- with 504 detections
$spotted
geostrata: WHICEAS, HI_EEZ, OtherCNP, Spotted_OU, Spotted_FI, Spotted_BI
$segments --- with 1513 segments (median = 149.2 km)
$das --- with 233423 data rows
$sightings --- with 512 detections