Packages and Data
production <- readxl::read_xlsx("qry_production.xlsx") %>%
dplyr::mutate(Gear = ifelse(GearType %in% c("Trap Net","Pound Net"), "Entrapment Net",
ifelse(GearType %in% c('4 1/2" Gill Net - Bottom'), "Large-Mesh Gillnet", "Small-Mesh Gillnet")),
Unit = ifelse(Unit == "WI-1", "WI-1 (Western Arm)", "WI-2 (Apostle Islands)")) %>%
dplyr::filter(!(Species %in% c("LT Tags", "Burbot", "Sucker spp."))) %>%
dplyr::select(Year,Species,Unit,Gear,Dressed_wt)
prod_AL <- dplyr::group_by(production, Year, Species, Unit) %>%
dplyr::summarise(Total = sum(Dressed_wt)) %>%
dplyr::mutate(Gear = "All Gears")
prod_GE <- dplyr::group_by(production, Year, Species, Gear, Unit) %>%
dplyr::summarise(Total = sum(Dressed_wt))
prod_Final <- rbind(prod_AL,prod_GE)
head(prod_Final)
#R> # A tibble: 6 x 5
#R> # Groups: Year, Species [3]
#R> Year Species Unit Total Gear
#R> <dbl> <chr> <chr> <dbl> <chr>
#R> 1 2010 Chub spp. WI-1 (Western Arm) 54565 All Gears
#R> 2 2010 Chub spp. WI-2 (Apostle Islands) 51 All Gears
#R> 3 2010 Cisco WI-1 (Western Arm) 142410. All Gears
#R> 4 2010 Cisco WI-2 (Apostle Islands) 593128. All Gears
#R> 5 2010 Cisco Eggs WI-1 (Western Arm) 1172 All Gears
#R> 6 2010 Cisco Eggs WI-2 (Apostle Islands) 1595 All Gears