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

Description Usage Arguments Details Value See Also Examples

View source: R/calc_effort.R

Description

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

Usage

1
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.

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.

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.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)

Example output

[1] "Running check on data before calculating effort"
[1] "==========================="
[1] " STECF Transversal2 checks on formats"
[1] "==========================="
[1] "Checking column names..."
[1] "Checking eunr_id..."
[1] "Checking loa..."
[1] "Checking gt..."
[1] "Checking kw..."
[1] "Checking depdate..."
[1] "Checking retdate..."
[1] "Checking fishdate..."
[1] "Checking deptime..."
[1] "Checking rettime..."
[1] "Checking gear..."
[1] "Checking gear_mesh_size..."
[1] "Checking fishing_area..."
[1] "Checking economic_zone..."
[1] "Checking rectangle..."
[1] "Checking trip_id"
[1] "Checking uniqueness of trip_id..."
[1] "Checking duplicates..."
[1] "==========================="
[1] "The returned data passes the check."
[1] "==========================="
[1] "Data looks OK. Continuing"

fecR documentation built on Sept. 9, 2017, 5:03 p.m.