
Internal (private) routes and intervals class creation functions
Source:R/Routes-internal.R
Routes-internal.RdInternal (private) functions to create and validate
Routes, BirdFlowRoutes, and BirdFlowIntervals objects.
These functions ensure input data meets the required structure and standard for use within BirdFlow models.
Usage
new_routes(data, species, source)
new_birdflow_routes(
data,
species,
metadata,
geom,
dates,
source = NULL,
sort_id_and_dates = TRUE,
reset_index = FALSE,
stay_calculate_col = "date"
)
new_birdflow_intervals(data, species, metadata, geom, dates, source = NULL)Arguments
- data
A data frame containing route/interval data for
Routes,BirdFlowRoutesorBirdFlowIntervals.- species
Either a single character that will be passed to
ebirdst::get_species()to lookup species information or a list with species metadata which must includecommon_nameand can optionally also includescientific_nameandspecies_codeor any other standard BirdFlow species metadata. Seespecies_info()for a description of the full list.- source
A character string indicating the source of the data.
- metadata
A list with additional metadata.
- geom
A list describing spatial geometry, such as
nrow,ncol,crs, andmask.- dates
A data frame with date-related information, including
date,start,end, andtimestep.- sort_id_and_dates
Logical. Should the data be sorted by
route_idanddates?- reset_index
Logical. Should the index of the data frame be reset after sorting?
- stay_calculate_col
The column name for calculating the
stay_idandstay_leninBirdFlowRoutesobject. Defaults todate.
Value
Each function returns an S3 object of the corresponding class
(Routes, BirdFlowRoutes, or BirdFlowIntervals).
Details
new_routes(): Creates aRoutesobject from a data frame.new_birdflow_routes(): Creates aBirdFlowRoutesobject, extendingRouteswith additional BirdFlow-specific spatial and temporal information.new_birdflow_intervals(): Creates aBirdFlowIntervalsobject, representing intervals between timesteps in BirdFlow data.
All objects are internally validated during creation, ensuring required columns, valid data types, and proper formats.
See also
as_routes()Create aRoutesobjectas_birdflow_routes()ConvertRoutestoBirdFlowRoutesas_birdflow_intervals()Extract movement between pairs of locations fromBirdFlowRoutesfor use with model evaluation.Object Validators Private functions for validating routes and intervals.