Learn R Programming

fecR (version 0.0.2)

calc_fishing_effort: Calculate days at sea and fishing days for a full trip data set.

Description

Calculates the days at sea and the fishing days for each trip in a data set.

Usage

calc_fishing_effort(dat, check_data = TRUE)

Arguments

dat

data.frame with the details of all the fishing trips.

check_data

Should the check_format function be called on the data first (default is TRUE). It is not possible to run check_format with automatic corrections here. Do this yourself first.

Value

A list with two data.frames: one with the fishing days by gear, fishing area, economic zone and rectangle, the other with the days at sea by gear, fishing area and economic zone.

Details

The input is a data.frame that contains details of fishing trips. The format of the data should be checked by check_format before calling this function (see the package vignette checking_data for more details on the data format). See the documentation of calc_fishing_days_trip and calc_days_at_sea_trip and the vignette calculating_fishing_effort for more details of how the different effort measures are calculated. This function has the additional option of calling check_format before the calculations are performed.

See Also

See check_format. See the package vignette checking_data for data preparation and the vignette calculating_fishing_effort for the calculation details.

Examples

Run this code
# NOT RUN {
trip1 <- data.frame(
    eunr_id = "my_boat", loa = 2000, gt = 70, kw = 400,
    trip_id = "trip1",
    # 4 day trip
    depdate = "20140718", deptime = "0615", retdate = "20140721", rettime = "1615",
    # Only fish on 2 of those
    fishdate = c("20140719", "20140719", "20140719", "20140719", "20140720",
       "20140720", "20140720"), 
    gear = c("OTB","OTB","OTB","GN","OTB","GN","FPO"), gear_mesh_size = c(80,80,80,50,80,50,0),
    fishing_area = "27.4.B",
    economic_zone = "EU",
    rectangle = c("39F0","40F0","41F0","41F0","41F0","41F0","41F0"),
    stringsAsFactors = FALSE
)
trip2 <- data.frame(
    eunr_id = "my_boat", loa = 2000, gt = 70, kw = 400,
    trip_id = "trip2",
    # 2 day trip
    depdate = "20140718", deptime = "0615", retdate = "20140719", rettime = "0600",
    # Only fish on 2 of those
    fishdate = c("20140718", "20140719", "20140719", "20140719"), 
    gear = c("OTB","OTB","GN","FPO"), gear_mesh_size = c(80,80,50,0),
    fishing_area = "27.4.B",
    economic_zone = "EU",
    rectangle = c("39F0","39F0"),
    stringsAsFactors = FALSE
)
dat <- rbind(trip1, trip2)
effort <- calc_fishing_effort(dat)
# }

Run the code above in your browser using DataLab