codstom.RdStomach content data for Atlantic cod (Gadus morhua) in the Gulf of St.Lawrence, Eastern Canada. Note: many prey items were of no interest for this analysis and were regrouped into the "Other" category.
codstomA data frame with 10000 observations on the following 10 variables.
regiona factor with levels SGSL NGSL
representing the southern and northern Gulf of St. Lawrence, respectively
ship.typea factor with levels 2 3 31
34 90 99
ship.ida factor with levels 11558 11712
136148 136885
136902 137325 151225 151935 99433
tripa factor with levels 10 11
12 179 1999
2 2001 20020808 3 4 5
6 7 8
88 9 95
seta numeric vector
fish.ida numeric vector
fish.lengtha numeric vector, length in mm
prey.massa numeric vector, mass of item in stomach, in g
prey.typea factor with levels Ammodytes_sp
Argis_dent
Chion_opil Detritus Empty Eualus_fab
Eualus_mac Gadus_mor Hyas_aran
Hyas_coar
Lebbeus_gro Lebbeus_pol Leptocl_mac
Mallot_vil
Megan_norv Ophiuroidea Other Paguridae
Pandal_bor Pandal_mon Pasiph_mult
Sabin_sept
Sebastes_sp Them_abys Them_comp Them_lib
Small subset from a larger dataset (more stomachs, more variables,
more prey.types) collected by D. Chabot and M. Hanson, Fisheries &
Oceans Canada chabotd@dfo-mpo.gc.ca.
Cod are collected either by contracted commerical fishing vessels
(ship.type 90 or 99) or by research vessels. Commercial vessels are
identified by a unique ship.id.
Either one research vessel or several commercial vessels conduct a survey
(trip), during which a trawl, gillnets or hooked lines are set
several times. Most trips are random stratified surveys (depth-based
stratification).
Each trip takes place within one of the regions. The trip
label is only guaranteed to be unique within a region and the set
label is only guaranteed to be unique within a trip.
For each fish caught, the fish.length is recorded and the fish is
allocated a fish.id, but the fish.id is only guaranteed to be
unique within a set. A subset of the fish caught are selected for
stomach analysis (stratified random selection according to fish length; unit
of stratification is the set for research surveys, the combination ship.id
and stratum for surveys conducted by commercial vessels, although strata are
not shown in codstom).
The basic experimental unit in this data set is a cod stomach (one stomach
per fish). Each stomach is uniquely identified by a combination of
region, ship.type, ship.id, trip, set,
and fish.id.
For each prey item found in a stomach, the species and mass of the prey item
are recorded, so there can be multiple observations per stomach. There may
also be several prey items with the same prey.type in the one stomach
(for example many prey.types have been recoded Other, which
produced many instances of Other in the same stomach).
If a stomach is empty, a single observation is recorded with
prey.type Empty and a prey.mass of zero.
data(codstom)
str(codstom)
#> 'data.frame': 10000 obs. of 9 variables:
#> $ region : Factor w/ 2 levels "SGSL","NGSL": 1 1 1 1 1 1 1 1 1 1 ...
#> $ ship.type : Factor w/ 6 levels "2","3","31","34",..: 1 1 1 1 1 1 1 1 1 1 ...
#> $ ship.id : Factor w/ 9 levels "11558","11712",..: NA NA NA NA NA NA NA NA NA NA ...
#> $ trip : Factor w/ 17 levels "10","11","12",..: 17 17 17 17 17 17 17 17 17 17 ...
#> $ set : num 3 3 3 3 3 3 3 3 3 3 ...
#> $ fish.id : int 30 30 30 31 31 31 32 32 32 33 ...
#> $ fish.length: num 530 530 530 490 490 490 470 470 470 480 ...
#> $ prey.mass : num 27.06 1.47 4.77 34.11 0.17 ...
#> $ prey.type : Factor w/ 26 levels "Ammodytes_sp",..: 17 17 17 17 17 17 17 17 17 17 ...
# removes multiple occurences of same prey.type in stomachs
codstom1 <- summaryBy(prey.mass ~
region + ship.type + ship.id + trip + set + fish.id + prey.type,
data = codstom,
FUN = sum)
# keeps a single line per stomach with the total mass of stomach content
codstom2 <- summaryBy(prey.mass ~ region + ship.type + ship.id + trip + set + fish.id,
data = codstom,
FUN = sum)
# mean prey mass per stomach for each trip
codstom3 <- summaryBy(prey.mass.sum ~ region + ship.type + ship.id + trip,
data = codstom2, FUN = mean)
if (FALSE) {
# wide version, one line per stomach, one column per prey type
library(reshape)
codstom4 <- melt(codstom, id = c(1:7, 9))
codstom5 <- cast(codstom4,
region + ship.type + ship.id + trip + set + fish.id + fish.length ~
prey.type, sum)
k <- length(names(codstom5))
prey_col <- 8:k
out <- codstom5[,prey_col]
out[is.na(out)] <- 0
codstom5[,prey_col] <- out
codstom5$total.content <- rowSums(codstom5[, prey_col])
}