add_variables {Tivy} | R Documentation |
Add variables for juveniles, sample length, distance to coast, and distance category
Description
Adds new variables to a dataset, including the proportion of juveniles, the total number of individuals in the sample, the distance to the coast, and the distance category.
Usage
add_variables(
data,
JuvLim = 12,
distance_type = "haversine",
window = 0.5,
unit = "nm",
coastline = NULL,
suppress_warnings = TRUE
)
Arguments
data |
Data frame that must contain latitude ( |
JuvLim |
Length threshold to consider juveniles. |
distance_type |
Type of distance calculation to the coast. |
window |
Window parameter to smooth the coastline. |
unit |
Distance unit used in the calculation ("nm", "km", etc.). |
coastline |
Data frame with coastline coordinates. Must have columns named |
suppress_warnings |
Logical. If TRUE, warnings are suppressed. |
Value
Data frame with new variables: juv
(proportion of juveniles), sample
(total individuals),
dc
(distance to coast), and dc_cat
(categorical distance).
Examples
## Not run:
data_hauls <- process_hauls(data_hauls = calas_bitacora)
data_fishing_trips <- process_fishing_trips(data_fishing_trips = faenas_bitacora)
hauls_length <- process_length(data_length = tallas_bitacora)
data_length_trips <- merge(
x = data_fishing_trips,
y = hauls_length,
by = 'fishing_trip_code'
)
data_total <- merge_length_fishing_trips_hauls(
data_hauls = data_hauls,
data_length_fishing_trips = data_length_trips
)
results <- add_variables(data = data_total)
## End(Not run)