head(production)
# Analyze production measured in tonnes
prod <- production[production$measure == "Q_tlw" & production$value > 0,]
prod <- merge(prod, species[c("species", "yearbook")])
# Select SOFIA species, excluding mammals, reptiles, and plants
prod <- prod[prod$yearbook ==
"Aquatic animals (Fish, crustaceans and molluscs, etc.)",]
# Determine origin
prod <- merge(prod, area[c("area", "inlandmarine")])
prod$origin <- ifelse(prod$source == "CAPTURE", "Capture", "Aquaculture")
prod$w <- ifelse(prod$inlandmarine == "Marine areas", "marine", "inland")
prod$origin <- paste0(prod$origin, " (", prod$w, ")")
cbind(sort(unique(prod$origin)))
# World capture fisheries and aquaculture production
x <- xtabs(value~year+origin, aggregate(value~year+origin, prod, sum))
x <- x[,c(2,1,4,3)] / 1e6
library(areaplot)
areaplot(x, legend=TRUE, args.legend=list(x="topleft"), ylab="million tonnes")
Run the code above in your browser using DataLab